blob: 5ba5138ac4c477677d70382d24d74d0f964cfc00 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
/*******************************************************************************
* Copyright (c) 2007, 2016 Symbian Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunction;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPComputableFunction;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPExecution;
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction, ICPPComputableFunction {
public CompositeCPPFunction(ICompositesFactory cf, ICPPFunction rbinding) {
super(cf, rbinding);
}
@Override
public boolean isExternC() {
return ((ICPPFunction) rbinding).isExternC();
}
@Override
public boolean isInline() {
return ((ICPPFunction) rbinding).isInline();
}
@Override
public boolean isMutable() {
return ((ICPPFunction) rbinding).isMutable();
}
@Override
public boolean isConstexpr() {
return ((ICPPFunction) rbinding).isConstexpr();
}
@Override
public IScope getFunctionScope() {
return null;
}
@Override
public ICPPParameter[] getParameters() {
ICPPParameter[] result = ((ICPPFunction) rbinding).getParameters();
for (int i= 0; i < result.length; i++) {
result[i] = (ICPPParameter) cf.getCompositeBinding((IIndexFragmentBinding) result[i]);
}
return result;
}
@Override
public ICPPFunctionType getType() {
IType rtype = ((ICPPFunction) rbinding).getType();
return (ICPPFunctionType) cf.getCompositeType(rtype);
}
@Override
public ICPPFunctionType getDeclaredType() {
IType rtype = ((ICPPFunction) rbinding).getDeclaredType();
return (ICPPFunctionType) cf.getCompositeType(rtype);
}
@Override
public boolean isDeleted() {
return ((ICPPFunction) rbinding).isDeleted();
}
@Override
public boolean isAuto() {
return ((ICPPFunction) rbinding).isAuto();
}
@Override
public boolean isExtern() {
return ((ICPPFunction) rbinding).isExtern();
}
@Override
public boolean isRegister() {
return ((ICPPFunction) rbinding).isRegister();
}
@Override
public boolean isStatic() {
return ((ICPPFunction) rbinding).isStatic();
}
@Override
public boolean takesVarArgs() {
return ((ICPPFunction) rbinding).takesVarArgs();
}
@Override
public boolean isNoReturn() {
return ((ICPPFunction) rbinding).isNoReturn();
}
@Override
public int getRequiredArgumentCount() {
return ((ICPPFunction) rbinding).getRequiredArgumentCount();
}
@Override
public boolean hasParameterPack() {
return ((ICPPFunction) rbinding).hasParameterPack();
}
@Override
public Object clone() {
fail(); return null;
}
@Override
public String toString() {
return getName() + " " + ASTTypeUtil.getParameterTypeString(getType()); //$NON-NLS-1$
}
@Override
public IType[] getExceptionSpecification() {
IType[] es= ((ICPPFunction) rbinding).getExceptionSpecification();
if (es == null || es.length == 0)
return es;
IType[] result= new IType[es.length];
for (int i = 0; i < result.length; i++) {
result[i]= cf.getCompositeType(es[i]);
}
return result;
}
@Override
public ICPPExecution getFunctionBodyExecution() {
return CPPFunction.getFunctionBodyExecution((ICPPFunction) rbinding);
}
}
|