Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2017-06-11 19:06:25 +0000
committerNathan Ridge2017-09-25 16:51:22 +0000
commit64709c980ddb83dde1ecef0794b976b89cdf7550 (patch)
tree22e06bd4953dc40089f6e90f837d16f4a2ea3e33 /core
parent9869cbc9bacf716995a616434f9d635928dcca01 (diff)
downloadorg.eclipse.cdt-64709c980ddb83dde1ecef0794b976b89cdf7550.tar.gz
org.eclipse.cdt-64709c980ddb83dde1ecef0794b976b89cdf7550.tar.xz
org.eclipse.cdt-64709c980ddb83dde1ecef0794b976b89cdf7550.zip
Bug 513105 - Store the current lookup point in a thread-local static stack rather than passing it around everywhere
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java27
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java8
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java12
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java86
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/FunctionTests.java2
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java8
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java98
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java12
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java26
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java49
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPConstructor.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java49
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java46
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ValueFactory.java96
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java100
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java56
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java44
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java58
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java23
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java113
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorSpecialization.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplate.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplateSpecialization.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredConstructor.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerationSpecialization.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPField.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScopeMapper.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownTypeScope.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java177
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPClassSpecializationScope.java26
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPComputableFunction.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java27
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ImplicitsAnalysis.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/InstantiationContext.java28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java25
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPEvaluation.java49
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java33
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java849
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java285
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVariableReadWriteFlags.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java64
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java171
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Cost.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java38
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinary.java106
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinaryTypeId.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalComma.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java27
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompoundStatementExpression.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConditional.java62
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java46
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFixed.java29
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java74
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalInitList.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java33
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalParameterPack.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPointer.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalReference.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java51
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java86
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUtil.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java60
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecRangeBasedFor.java45
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecSwitch.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionCost.java24
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionSetType.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/HeuristicResolver.java92
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java107
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java135
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java155
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java140
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecializationScope.java42
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructor.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorInstance.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorSpecialization.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplate.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplateSpecialization.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPFunction.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/TypeMarshalBuffer.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java119
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java13
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerationSpecialization.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeratorSpecialization.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java209
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java10
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplate.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java22
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java40
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java16
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexViewSearchQuery.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java711
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMethodProcessor.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchElementQuery.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java10
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTextSelectionQuery.java40
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java29
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java46
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java15
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java18
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuesser.java20
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java10
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java6
195 files changed, 3258 insertions, 3066 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 34e96c70daa..39b0507b528 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -141,7 +141,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.SemanticQueries;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
-import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
@@ -6469,20 +6468,20 @@ public class AST2CPPTests extends AST2CPPTestBase {
assertFalse(ClassTypeHelper.isOverrider(m5, m2));
assertTrue(ClassTypeHelper.isOverrider(m4, m2));
- ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0, null);
+ ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m1, null);
+ ors= ClassTypeHelper.findOverridden(m1);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m2, null);
+ ors= ClassTypeHelper.findOverridden(m2);
assertEquals(1, ors.length);
assertEquals(ors[0], m1);
- ors= ClassTypeHelper.findOverridden(m3, null);
+ ors= ClassTypeHelper.findOverridden(m3);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m4, null);
+ ors= ClassTypeHelper.findOverridden(m4);
assertEquals(2, ors.length);
assertEquals(ors[0], m2);
assertEquals(ors[1], m1);
- ors= ClassTypeHelper.findOverridden(m5, null);
+ ors= ClassTypeHelper.findOverridden(m5);
assertEquals(1, ors.length);
assertEquals(ors[0], m1);
}
@@ -9254,8 +9253,8 @@ public class AST2CPPTests extends AST2CPPTestBase {
IASTName namep = bh.findName("p");
ICPPClassType B = (ICPPClassType) nameB.resolveBinding();
IPointerType ptrToA = (IPointerType) ((ICPPVariable) namep.resolveBinding()).getType();
- long pointerSize = SizeofCalculator.getSizeAndAlignment(ptrToA, namep).size;
- long BSize = SizeofCalculator.getSizeAndAlignment(B, nameB).size;
+ long pointerSize = getSizeAndAlignment(ptrToA, namep).size;
+ long BSize = getSizeAndAlignment(B, nameB).size;
assertEquals(pointerSize, BSize);
}
@@ -9264,7 +9263,7 @@ public class AST2CPPTests extends AST2CPPTestBase {
BindingAssertionHelper bh = getAssertionHelper();
IASTName nameWaldo = bh.findName("waldo");
ICPPClassType waldo = (ICPPClassType) nameWaldo.resolveBinding();
- long waldoSize = SizeofCalculator.getSizeAndAlignment(waldo, nameWaldo).size;
+ long waldoSize = getSizeAndAlignment(waldo, nameWaldo).size;
assertNotEquals(0, waldoSize);
}
@@ -9389,14 +9388,14 @@ public class AST2CPPTests extends AST2CPPTestBase {
assertFalse(ClassTypeHelper.isOverrider(m3, m0));
assertFalse(ClassTypeHelper.isOverrider(m3, m1));
- ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0, null);
+ ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m1, null);
+ ors= ClassTypeHelper.findOverridden(m1);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m2, null);
+ ors= ClassTypeHelper.findOverridden(m2);
assertEquals(1, ors.length);
assertSame(ors[0], m0);
- ors= ClassTypeHelper.findOverridden(m3, null);
+ ors= ClassTypeHelper.findOverridden(m3);
assertEquals(0, ors.length);
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index 4afd79421b6..f93deae62e2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -353,7 +353,7 @@ public class AST2TemplateTests extends AST2CPPTestBase {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType B = helper.assertNonProblem("A<B>", 4);
// Check that this line does not cause a StackOverflowError.
- ClassTypeHelper.getBases(B, null);
+ B.getBases();
}
// template < class T > class A {
@@ -1897,7 +1897,7 @@ public class AST2TemplateTests extends AST2CPPTestBase {
ICPPClassType B = (ICPPClassType) col.getName(3).resolveBinding();
ICPPClassType A = (ICPPClassType) col.getName(6).resolveBinding();
- ICPPBase[] bases = ClassTypeHelper.getBases(A, tu);
+ ICPPBase[] bases = A.getBases();
assertEquals(bases.length, 1);
assertSame(bases[0].getBaseClass(), B);
}
@@ -4918,7 +4918,7 @@ public class AST2TemplateTests extends AST2CPPTestBase {
BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP);
ICPPClassType type= bh.assertNonProblem("X<int&>", 7);
- ICPPMethod[] ms= ClassTypeHelper.getMethods(type, null);
+ ICPPMethod[] ms= ClassTypeHelper.getMethods(type);
int i= ms[0].getName().equals("f") ? 0 : 1;
ICPPMethod m= ms[i];
assertEquals("int &", ASTTypeUtil.getType(m.getType().getParameterTypes()[0]));
@@ -4926,7 +4926,7 @@ public class AST2TemplateTests extends AST2CPPTestBase {
assertEquals("int &", ASTTypeUtil.getType(m.getType().getParameterTypes()[0]));
type= bh.assertNonProblem("X<const int&&>", 14);
- ms= ClassTypeHelper.getMethods(type, null);
+ ms= ClassTypeHelper.getMethods(type);
i= ms[0].getName().equals("f") ? 0 : 1;
m= ms[i];
assertEquals("const int &", ASTTypeUtil.getType(m.getType().getParameterTypes()[0]));
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java
index b33723d6f6a..737bbc8a1ae 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java
@@ -25,6 +25,8 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
+import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType;
import org.eclipse.cdt.internal.core.dom.parser.c.CPointerType;
import org.eclipse.cdt.internal.core.dom.parser.c.CQualifierType;
@@ -32,6 +34,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Common base class for AST2 and index tests.
@@ -104,6 +107,15 @@ public class SemanticTestBase extends BaseTestCase {
ASTTypeUtil.getType(expected, false) + "' and '" + ASTTypeUtil.getType(actual, false) + "'",
expected.isSameType(actual));
}
+
+ protected static SizeAndAlignment getSizeAndAlignment(IType type, IASTNode lookupPoint) {
+ try {
+ CPPSemantics.pushLookupPoint(lookupPoint);
+ return SizeofCalculator.getSizeAndAlignment(type);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
protected class BindingAssertionHelper {
protected String contents;
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java
index 48365cf1ef8..d781781ad2b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java
@@ -90,7 +90,7 @@ public class SemanticsTests extends AST2TestBase {
// Test getDeclaredConversionOperators()
BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true);
ICPPClassType c= ba.assertNonProblem("X {", 1, ICPPClassType.class);
- ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c, null);
+ ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c);
assertEquals(2, cops.length);
Set actual= new HashSet();
actual.add(cops[0].getName()); actual.add(cops[1].getName());
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java
index 843be3a3ed7..a3f731012d9 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java
@@ -61,11 +61,11 @@ public class TypeTraitsTests extends AST2TestBase {
public void testHasTrivialCopyCtor() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertFalse(TypeTraits.hasTrivialCopyCtor(classA, null));
+ assertFalse(TypeTraits.hasTrivialCopyCtor(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B {");
- assertTrue(TypeTraits.hasTrivialCopyCtor(classB, null));
+ assertTrue(TypeTraits.hasTrivialCopyCtor(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C {");
- assertFalse(TypeTraits.hasTrivialCopyCtor(classC, null));
+ assertFalse(TypeTraits.hasTrivialCopyCtor(classC));
}
// struct A {
@@ -89,11 +89,11 @@ public class TypeTraitsTests extends AST2TestBase {
public void testHasTrivialDestructor() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertFalse(TypeTraits.hasTrivialDestructor(classA, null));
+ assertFalse(TypeTraits.hasTrivialDestructor(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B {");
- assertTrue(TypeTraits.hasTrivialDestructor(classB, null));
+ assertTrue(TypeTraits.hasTrivialDestructor(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C {");
- assertFalse(TypeTraits.hasTrivialDestructor(classC, null));
+ assertFalse(TypeTraits.hasTrivialDestructor(classC));
}
// struct A {
@@ -130,25 +130,25 @@ public class TypeTraitsTests extends AST2TestBase {
public void testIsEmpty() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertTrue(TypeTraits.isEmpty(classA, null));
+ assertTrue(TypeTraits.isEmpty(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B :");
- assertTrue(TypeTraits.isEmpty(classB, null));
+ assertTrue(TypeTraits.isEmpty(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C {");
- assertFalse(TypeTraits.isEmpty(classC, null));
+ assertFalse(TypeTraits.isEmpty(classC));
ICPPClassType classD = helper.assertNonProblemOnFirstIdentifier("D :");
- assertFalse(TypeTraits.isEmpty(classD, null));
+ assertFalse(TypeTraits.isEmpty(classD));
ICPPClassType classE = helper.assertNonProblemOnFirstIdentifier("E {");
- assertFalse(TypeTraits.isEmpty(classE, null));
+ assertFalse(TypeTraits.isEmpty(classE));
ICPPClassType classF = helper.assertNonProblemOnFirstIdentifier("F {");
- assertFalse(TypeTraits.isEmpty(classF, null));
+ assertFalse(TypeTraits.isEmpty(classF));
ICPPClassType classG = helper.assertNonProblemOnFirstIdentifier("G :");
- assertFalse(TypeTraits.isEmpty(classG, null));
+ assertFalse(TypeTraits.isEmpty(classG));
IType typeH = helper.assertNonProblemOnFirstIdentifier("H;");
- assertTrue(TypeTraits.isEmpty(typeH, null));
+ assertTrue(TypeTraits.isEmpty(typeH));
IType typeI = helper.assertNonProblemOnFirstIdentifier("I;");
- assertFalse(TypeTraits.isEmpty(typeI, null));
+ assertFalse(TypeTraits.isEmpty(typeI));
IType typeJ = helper.assertNonProblemOnFirstIdentifier("J[");
- assertFalse(TypeTraits.isEmpty(typeJ, null));
+ assertFalse(TypeTraits.isEmpty(typeJ));
}
// struct A {
@@ -170,11 +170,11 @@ public class TypeTraitsTests extends AST2TestBase {
public void testIsPolymorphic() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertTrue(TypeTraits.isPolymorphic(classA, null));
+ assertTrue(TypeTraits.isPolymorphic(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B {");
- assertFalse(TypeTraits.isPolymorphic(classB, null));
+ assertFalse(TypeTraits.isPolymorphic(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C");
- assertTrue(TypeTraits.isPolymorphic(classC, null));
+ assertTrue(TypeTraits.isPolymorphic(classC));
}
// struct A {
@@ -217,21 +217,21 @@ public class TypeTraitsTests extends AST2TestBase {
public void testIsStandardLayout() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertTrue(TypeTraits.isStandardLayout(classA, null));
+ assertTrue(TypeTraits.isStandardLayout(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B {");
- assertTrue(TypeTraits.isStandardLayout(classB, null));
+ assertTrue(TypeTraits.isStandardLayout(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C :");
- assertFalse(TypeTraits.isStandardLayout(classC, null));
+ assertFalse(TypeTraits.isStandardLayout(classC));
ICPPClassType classD = helper.assertNonProblemOnFirstIdentifier("D {");
- assertFalse(TypeTraits.isStandardLayout(classD, null));
+ assertFalse(TypeTraits.isStandardLayout(classD));
ICPPClassType classE = helper.assertNonProblemOnFirstIdentifier("E :");
- assertFalse(TypeTraits.isStandardLayout(classE, null));
+ assertFalse(TypeTraits.isStandardLayout(classE));
ICPPClassType classF = helper.assertNonProblemOnFirstIdentifier("F :");
- assertFalse(TypeTraits.isStandardLayout(classF, null));
+ assertFalse(TypeTraits.isStandardLayout(classF));
ICPPClassType classG = helper.assertNonProblemOnFirstIdentifier("G {");
- assertFalse(TypeTraits.isStandardLayout(classG, null));
+ assertFalse(TypeTraits.isStandardLayout(classG));
ICPPClassType classH = helper.assertNonProblemOnFirstIdentifier("H {");
- assertFalse(TypeTraits.isStandardLayout(classH, null));
+ assertFalse(TypeTraits.isStandardLayout(classH));
}
// struct A {
@@ -275,23 +275,23 @@ public class TypeTraitsTests extends AST2TestBase {
public void testIsTrivial() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ICPPClassType classA = helper.assertNonProblemOnFirstIdentifier("A {");
- assertTrue(TypeTraits.isTrivial(classA, null));
+ assertTrue(TypeTraits.isTrivial(classA));
ICPPClassType classB = helper.assertNonProblemOnFirstIdentifier("B :");
- assertTrue(TypeTraits.isTrivial(classB, null));
+ assertTrue(TypeTraits.isTrivial(classB));
ICPPClassType classC = helper.assertNonProblemOnFirstIdentifier("C {");
- assertFalse(TypeTraits.isTrivial(classC, null));
+ assertFalse(TypeTraits.isTrivial(classC));
ICPPClassType classD = helper.assertNonProblemOnFirstIdentifier("D {");
- assertFalse(TypeTraits.isTrivial(classD, null));
+ assertFalse(TypeTraits.isTrivial(classD));
ICPPClassType classE = helper.assertNonProblemOnFirstIdentifier("E {");
- assertFalse(TypeTraits.isTrivial(classE, null));
+ assertFalse(TypeTraits.isTrivial(classE));
ICPPClassType classF = helper.assertNonProblemOnFirstIdentifier("F {");
- assertFalse(TypeTraits.isTrivial(classF, null));
+ assertFalse(TypeTraits.isTrivial(classF));
ICPPClassType classG = helper.assertNonProblemOnFirstIdentifier("G {");
- assertFalse(TypeTraits.isTrivial(classG, null));
+ assertFalse(TypeTraits.isTrivial(classG));
ICPPClassType classH = helper.assertNonProblemOnFirstIdentifier("H :");
- assertFalse(TypeTraits.isTrivial(classH, null));
+ assertFalse(TypeTraits.isTrivial(classH));
ICPPClassType classI = helper.assertNonProblemOnFirstIdentifier("I {");
- assertFalse(TypeTraits.isTrivial(classI, null));
+ assertFalse(TypeTraits.isTrivial(classI));
}
// int a;
@@ -311,18 +311,18 @@ public class TypeTraitsTests extends AST2TestBase {
public void testIsTriviallyCopyable() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
IVariable a = helper.assertNonProblemOnFirstIdentifier("a;");
- assertTrue(TypeTraits.isTriviallyCopyable(a.getType(), null));
+ assertTrue(TypeTraits.isTriviallyCopyable(a.getType()));
IVariable b = helper.assertNonProblemOnFirstIdentifier("b;");
- assertTrue(TypeTraits.isTriviallyCopyable(b.getType(), null));
+ assertTrue(TypeTraits.isTriviallyCopyable(b.getType()));
IVariable c = helper.assertNonProblemOnFirstIdentifier("c;");
- assertFalse(TypeTraits.isTriviallyCopyable(c.getType(), null));
+ assertFalse(TypeTraits.isTriviallyCopyable(c.getType()));
IVariable d = helper.assertNonProblemOnFirstIdentifier("d[");
- assertTrue(TypeTraits.isTriviallyCopyable(d.getType(), null));
+ assertTrue(TypeTraits.isTriviallyCopyable(d.getType()));
IVariable e = helper.assertNonProblemOnFirstIdentifier("e;");
- assertTrue(TypeTraits.isTriviallyCopyable(e.getType(), null));
+ assertTrue(TypeTraits.isTriviallyCopyable(e.getType()));
IVariable f = helper.assertNonProblemOnFirstIdentifier("f;");
- assertTrue(TypeTraits.isTriviallyCopyable(f.getType(), null));
+ assertTrue(TypeTraits.isTriviallyCopyable(f.getType()));
IVariable g = helper.assertNonProblemOnFirstIdentifier("g;");
- assertFalse(TypeTraits.isTriviallyCopyable(g.getType(), null));
+ assertFalse(TypeTraits.isTriviallyCopyable(g.getType()));
}
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/FunctionTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/FunctionTests.java
index cc0f6722beb..c50afb4f878 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/FunctionTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/FunctionTests.java
@@ -242,7 +242,7 @@ public class FunctionTests extends TestBase {
IASTFunctionCallExpression funcExpr = (IASTFunctionCallExpression)clause;
IASTIdExpression idExpr = (IASTIdExpression)funcExpr.getFunctionNameExpression();
ICPPFunction function = (ICPPFunction)idExpr.getName().resolveBinding();
- ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, clause);
+ ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function);
assertNull(bodyExec);
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
index b8275756fe3..577f524eb8b 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/constexpr/TestBase.java
@@ -40,6 +40,7 @@ import org.eclipse.cdt.internal.core.dom.parser.CStringValue;
import org.eclipse.cdt.internal.core.dom.parser.FloatingPointValue;
import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.parser.ParserException;
import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
@@ -102,7 +103,12 @@ public class TestBase extends IndexBindingResolutionTestBase {
private IValue getValue() throws Exception {
ICPPASTInitializerClause point = getLastDeclarationInitializer();
ICPPEvaluation evaluation = point.getEvaluation();
- return evaluation.getValue(point);
+ try {
+ CPPSemantics.pushLookupPoint(point);
+ return evaluation.getValue();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
protected ICPPASTInitializerClause getLastDeclarationInitializer() throws Exception {
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java
index 1428dd43eab..784e3a39c58 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java
@@ -227,7 +227,7 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
ICPPSpecialization inst= ct.getInstance(new ICPPTemplateArgument[]{new CPPTemplateTypeArgument((IType)b0)});
assertInstance(inst, ICPPClassType.class);
ICPPClassType c2t= (ICPPClassType) inst;
- ICPPBase[] bases= ClassTypeHelper.getBases(c2t, null);
+ ICPPBase[] bases= c2t.getBases();
assertEquals(1, bases.length);
assertInstance(bases[0].getBaseClass(), ICPPClassType.class);
}
@@ -973,74 +973,74 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
// class template instance
ct= getBindingFromASTName("CT<int>", 7);
assertInstance(ct, ICPPTemplateInstance.class);
- assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"n", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"B"}, ct.getBases());
+ assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"CT", "CT"}, ct.getConstructors());
+ assertBindings(new String[] {"g"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"n", "CT"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"O"}, ct.getNestedClasses());
// explicit class template instance
ct= getBindingFromASTName("CT<char>", 8);
assertInstance(ct, ICPPTemplateInstance.class);
- assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"CT", "CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"o", "CT", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"A"}, ct.getBases());
+ assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"CT", "CT", "CT"}, ct.getConstructors());
+ assertBindings(new String[] {"h"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"o", "CT", "CT"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"P"}, ct.getNestedClasses());
// class specialization
ct= getBindingFromASTName("C spec", 1);
assertInstance(ct, ICPPClassSpecialization.class);
- assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"n", "m", "B", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"C", "C"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"n", "C"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"m", "n", "C", "C", "~C", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"B"}, ct.getBases());
+ assertBindings(new String[] {"n", "m", "B", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"C", "C"}, ct.getConstructors());
+ assertBindings(new String[] {"g"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"n", "C"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"m", "n", "C", "C", "~C", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"O"}, ct.getNestedClasses());
// class template specialization
ct= getBindingFromASTName("CT<int> spect", 2);
assertInstance(ct, ICPPClassTemplate.class, ICPPClassSpecialization.class);
- assertBindings(new String[] {"B"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"g"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"n", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"O"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"B"}, ct.getBases());
+ assertBindings(new String[] {"n", "m", "B", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"CT", "CT"}, ct.getConstructors());
+ assertBindings(new String[] {"g"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"n", "CT"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"f", "g"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"m", "n", "CT", "CT", "~CT", "B", "B", "~B", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"O"}, ct.getNestedClasses());
// explicit class specialization
ct= getBindingFromASTName("C espec", 1);
assertInstance(ct, ICPPClassSpecialization.class);
- assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"o", "l", "A", "C", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"C", "C", "C"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"o", "C", "C"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"l", "o", "C", "C", "C", "~C", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"A"}, ct.getBases());
+ assertBindings(new String[] {"o", "l", "A", "C", "C"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"C", "C", "C"}, ct.getConstructors());
+ assertBindings(new String[] {"h"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"o", "C", "C"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"l", "o", "C", "C", "C", "~C", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"P"}, ct.getNestedClasses());
// explicit class template specialization
ct= getBindingFromASTName("CT<int> espect", 7);
assertInstance(ct, ICPPTemplateInstance.class);
- assertBindings(new String[] {"A"}, ClassTypeHelper.getBases(ct, null));
- assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct, null));
- assertBindings(new String[] {"CT", "CT", "CT"}, ClassTypeHelper.getConstructors(ct, null));
- assertBindings(new String[] {"h"}, ClassTypeHelper.getDeclaredFields(ct, null));
- assertBindings(new String[] {"o", "CT", "CT"}, ClassTypeHelper.getDeclaredMethods(ct, null));
- assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct, null));
- assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct, null));
- assertBindings(new String[] {"P"}, ClassTypeHelper.getNestedClasses(ct, null));
+ assertBindings(new String[] {"A"}, ct.getBases());
+ assertBindings(new String[] {"o", "l", "A", "CT", "CT"}, ClassTypeHelper.getAllDeclaredMethods(ct));
+ assertBindings(new String[] {"CT", "CT", "CT"}, ct.getConstructors());
+ assertBindings(new String[] {"h"}, ct.getDeclaredFields());
+ assertBindings(new String[] {"o", "CT", "CT"}, ct.getDeclaredMethods());
+ assertBindings(new String[] {"e", "h"}, ClassTypeHelper.getFields(ct));
+ assertBindings(new String[] {"l", "o", "CT", "CT", "CT", "~CT", "A", "A", "~A", "operator =", "operator ="}, ClassTypeHelper.getMethods(ct));
+ assertBindings(new String[] {"P"}, ct.getNestedClasses());
}
// void func(const int* x) {}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
index b5c61238202..c83115f0738 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
@@ -2071,20 +2071,20 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
assertFalse(ClassTypeHelper.isOverrider(m5, m2));
assertTrue(ClassTypeHelper.isOverrider(m4, m2));
- ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0, null);
+ ICPPMethod[] ors= ClassTypeHelper.findOverridden(m0);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m1, null);
+ ors= ClassTypeHelper.findOverridden(m1);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m2, null);
+ ors= ClassTypeHelper.findOverridden(m2);
assertEquals(1, ors.length);
assertEquals(ors[0], m1);
- ors= ClassTypeHelper.findOverridden(m3, null);
+ ors= ClassTypeHelper.findOverridden(m3);
assertEquals(0, ors.length);
- ors= ClassTypeHelper.findOverridden(m4, null);
+ ors= ClassTypeHelper.findOverridden(m4);
assertEquals(2, ors.length);
assertEquals(ors[0], m2);
assertEquals(ors[1], m1);
- ors= ClassTypeHelper.findOverridden(m5, null);
+ ors= ClassTypeHelper.findOverridden(m5);
assertEquals(1, ors.length);
assertEquals(ors[0], m1);
}
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
index 70289ca4118..d3631045cdf 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
@@ -691,7 +691,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
assertInstance(b2, ICPPClassType.class);
assertInstance(b2, ICPPTemplateInstance.class);
ICPPClassType ct2= (ICPPClassType) b2;
- ICPPBase[] bss2= ClassTypeHelper.getBases(ct2, null);
+ ICPPBase[] bss2= ct2.getBases();
assertEquals(1, bss2.length);
assertInstance(bss2[0].getBaseClass(), ICPPClassType.class);
ICPPClassType ct2b= (ICPPClassType) bss2[0].getBaseClass();
@@ -700,14 +700,14 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
IBinding b0= getBindingFromASTName("B<int>", 6);
assertInstance(b0, ICPPClassType.class);
ICPPClassType ct= (ICPPClassType) b0;
- ICPPBase[] bss= ClassTypeHelper.getBases(ct, null);
+ ICPPBase[] bss= ct.getBases();
assertEquals(1, bss.length);
assertInstance(bss[0].getBaseClass(), ICPPClassType.class);
IBinding b1= getBindingFromASTName("B<long>", 7);
assertInstance(b1, ICPPClassType.class);
ICPPClassType ct1= (ICPPClassType) b1;
- ICPPBase[] bss1= ClassTypeHelper.getBases(ct1, null);
+ ICPPBase[] bss1= ct1.getBases();
assertEquals(1, bss1.length);
assertInstance(bss1[0].getBaseClass(), ICPPClassType.class);
}
@@ -736,11 +736,11 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
assertInstance(b0, ICPPSpecialization.class);
ICPPClassType ct= (ICPPClassType) b0;
- ICPPMethod[] dms= ClassTypeHelper.getDeclaredMethods(ct, null);
+ ICPPMethod[] dms= ct.getDeclaredMethods();
assertEquals(2, dms.length);
// if the specialization was used, we have 2 fields.
- ICPPField[] fs= ClassTypeHelper.getDeclaredFields(ct, null);
+ ICPPField[] fs= ct.getDeclaredFields();
assertEquals(2, fs.length);
ICPPMethod foo= dms[0].getName().equals("foo") ? dms[0] : dms[1];
@@ -1702,11 +1702,11 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
ICPPTemplateInstance inst= (ICPPTemplateInstance) t1;
final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition();
- IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), name);
+ IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments());
assertSame(inst, inst2);
- IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name);
- IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))}, name);
+ IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))});
+ IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateTypeArgument(new CPPBasicType(Kind.eChar, 0))});
assertSame(charInst1, charInst2);
}
@@ -1723,7 +1723,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
assertInstance(m, ICPPSpecialization.class);
ICPPClassType ct= m.getClassOwner();
assertInstance(ct, ICPPTemplateInstance.class);
- ICPPMethod[] ms= ClassTypeHelper.getDeclaredMethods(ct, null);
+ ICPPMethod[] ms= ct.getDeclaredMethods();
assertEquals(1, ms.length);
assertEquals(m, ms[0]);
}
@@ -1997,16 +1997,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
methods= ct.getMethods();
assertEquals(14, methods.length);
- ICPPBase[] bases = ClassTypeHelper.getBases(ct, null);
+ ICPPBase[] bases = ct.getBases();
assertEquals(1, bases.length);
IField field = ct.findField("bfield");
assertNotNull(field);
- IField[] fields = ClassTypeHelper.getFields(ct, null);
+ IField[] fields = ClassTypeHelper.getFields(ct);
assertEquals(2, fields.length);
- IBinding[] friends = ClassTypeHelper.getFriends(ct, null);
+ IBinding[] friends = ct.getFriends();
assertEquals(0, friends.length); // not yet supported
}
@@ -3036,7 +3036,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
IType derivedInt = waldo.getType();
assertInstance(derivedInt, ICPPClassSpecialization.class);
ICPPClassType derived = ((ICPPClassSpecialization) derivedInt).getSpecializedBinding();
- ICPPMethod constructor = ClassTypeHelper.getMethodInClass(derived, MethodKind.DEFAULT_CTOR, null);
+ ICPPMethod constructor = ClassTypeHelper.getMethodInClass(derived, MethodKind.DEFAULT_CTOR);
assertInstance(constructor, ICPPConstructor.class);
// Trigger deserialization of constructor chain execution
((ICPPConstructor) constructor).getConstructorChainExecution(waldoName);
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java
index a055de08b4d..0d5070a89c4 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/CPPClassTemplateTests.java
@@ -209,7 +209,7 @@ public class CPPClassTemplateTests extends PDOMInlineCodeTestBase {
ICPPVariable var= (ICPPVariable) bs[0];
assertInstance(var.getType(), ICPPClassType.class);
ICPPClassType ct= (ICPPClassType) var.getType();
- IField[] fields = ClassTypeHelper.getFields(ct, null);
+ IField[] fields = ClassTypeHelper.getFields(ct);
assertEquals(1, fields.length);
assertInstance(fields[0].getType(), IPointerType.class);
IPointerType pt= (IPointerType) fields[0].getType();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java
index 8b315a0db6d..f6f34ff379c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java
@@ -27,86 +27,85 @@ public interface ICPPClassSpecialization extends ICPPTypeSpecialization, ICPPCla
ICPPClassType getSpecializedBinding();
/**
- * @deprecated Specializing a member may require a point of instantiation.
- * @noreference This method is not intended to be referenced by clients.
+ * Creates a specialized binding for a member of the original class. The result is
+ * a member of this class specialization.
*/
- @Deprecated
IBinding specializeMember(IBinding binding);
/**
- * Creates a specialized binding for a member of the original class. The result is
- * a member of this class specialization.
* @since 5.5
+ * @deprecated Use {@link ICPPClassSpecialization#specializeMember(IBinding)} instead.
*/
+ @Deprecated
IBinding specializeMember(IBinding binding, IASTNode point);
/**
- * Similar to {@link ICPPClassType#getBases()} but a accepts a starting point for template
- * instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getBases()} instead.
*/
+ @Deprecated
ICPPBase[] getBases(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getConstructors()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getConstructors()} instead.
*/
+ @Deprecated
ICPPConstructor[] getConstructors(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getDeclaredFields()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getDeclaredFields()} instead.
*/
+ @Deprecated
ICPPField[] getDeclaredFields(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getMethods()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getMethods()} instead.
*/
+ @Deprecated
ICPPMethod[] getMethods(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getAllDeclaredMethods()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getAllDeclaredMethods()} instead.
*/
+ @Deprecated
ICPPMethod[] getAllDeclaredMethods(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getDeclaredMethods()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getDeclaredMethods()} instead.
*/
+ @Deprecated
ICPPMethod[] getDeclaredMethods(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getFriends()} instead.
*/
+ @Deprecated
IBinding[] getFriends(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getFields()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getFields()} instead.
*/
+ @Deprecated
IField[] getFields(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getNestedClasses()} but a accepts a starting point
- * for template instantiation.
* @since 5.5
+ * @deprecated Use {@link ICPPClassType#getNestedClasses()} instead.
*/
+ @Deprecated
ICPPClassType[] getNestedClasses(IASTNode point);
/**
- * Similar to {@link ICPPClassType#getUsingDeclarations()} but accepts a starting point
- * for template instantiation.
* @since 6.3
+ * @deprecated Use {@link ICPPClassType#getUsingDeclarations()} instead.
*/
+ @Deprecated
ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPConstructor.java
index 89f75606322..490e61590c5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPConstructor.java
@@ -21,11 +21,18 @@ public interface ICPPConstructor extends ICPPMethod {
public static final ICPPConstructor[] EMPTY_CONSTRUCTOR_ARRAY = {};
/**
- * For a constexpr constructor returns the ICPPExecution for its constructor chain. Otherwise returns
- * {@code null}.
- * @param point The point of instantiation for name lookups.
* @since 6.0
* @noreference This method is not intended to be referenced by clients.
+ * @deprecated use {@link ICPPConstructor#getConstructorChainExecution()} instead.
*/
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point);
+
+ /**
+ * For a constexpr constructor returns the ICPPExecution for its constructor chain. Otherwise returns
+ * {@code null}.
+ * @since 6.3
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public ICPPExecution getConstructorChainExecution();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java
index 1066543e477..7382740f77a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java
@@ -22,8 +22,8 @@ import org.eclipse.cdt.core.dom.ast.IType;
*/
public interface ICPPMethodSpecialization extends ICPPSpecialization, ICPPMethod {
/**
- * Similar to {@link ICPPFunction#getExceptionSpecification()} but a accepts a starting point
- * for template instantiation.
+ * @deprecated Use {@link ICPPFunction#getExceptionSpecification()} instead.
*/
+ @Deprecated
IType[] getExceptionSpecification(IASTNode point);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
index fb1336aac3f..a4895bdda0a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/SemanticQueries.java
@@ -92,12 +92,11 @@ public class SemanticQueries {
* template parameters.
*
* @param classType the class whose pure virtual methods should be returned
- * @param point the point of template instantiation, if applicable
* @return an array containing all pure virtual methods of the class
- * @since 5.6
+ * @since 6.3
*/
- public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType, IASTNode point) {
- FinalOverriderMap finalOverriderMap = CPPInheritance.getFinalOverriderMap(classType, point);
+ public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType) {
+ FinalOverriderMap finalOverriderMap = CPPInheritance.getFinalOverriderMap(classType);
List<ICPPMethod> pureVirtualMethods = new ArrayList<>();
for (ICPPMethod method : finalOverriderMap.getMap().keySet()) {
if (method.isPureVirtual()) {
@@ -114,6 +113,15 @@ public class SemanticQueries {
}
/**
+ * @deprecated Use {@link SemanticQueries}{@link #getPureVirtualMethods(ICPPClassType)} instead.
+ * @since 5.6
+ */
+ @Deprecated
+ public static ICPPMethod[] getPureVirtualMethods(ICPPClassType classType, IASTNode point) {
+ return getPureVirtualMethods(classType);
+ }
+
+ /**
* Returns whether a problem binding represents a name resolution error due to an unknown built-in.
* Importantly, this will not return true for a misuse of a known builtin, which we want to diagnose.
* @param binding The problem binding to test.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java
index 02911156117..3217a472459 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/TypeHelper.java
@@ -20,6 +20,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator;
import org.eclipse.cdt.internal.core.dom.parser.SizeofCalculator.SizeAndAlignment;
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
@@ -46,19 +47,24 @@ public class TypeHelper {
public static boolean shouldBePassedByReference(IType type, IASTTranslationUnit ast) {
type = SemanticUtil.getNestedType(type, SemanticUtil.CVTYPE | SemanticUtil.TDEF);
if (type instanceof ICompositeType) {
- if (type instanceof ICPPClassType) {
- ICPPClassType classType = ((ICPPClassType) type);
- if (!TypeTraits.hasTrivialCopyCtor(classType, ast) ||
- !TypeTraits.hasTrivialDestructor(classType, ast)) {
- return true;
+ try {
+ CPPSemantics.pushLookupPoint(ast);
+ if (type instanceof ICPPClassType) {
+ ICPPClassType classType = ((ICPPClassType) type);
+ if (!TypeTraits.hasTrivialCopyCtor(classType) ||
+ !TypeTraits.hasTrivialDestructor(classType)) {
+ return true;
+ }
}
+ SizeofCalculator calc = ((ASTTranslationUnit) ast).getSizeofCalculator();
+ SizeAndAlignment sizeofPointer = calc.sizeAndAlignmentOfPointer();
+ long maxSize = sizeofPointer != null ? sizeofPointer.size : 4;
+ SizeAndAlignment sizeofType = calc.sizeAndAlignment(type);
+ if (sizeofType == null || sizeofType.size > maxSize)
+ return true;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- SizeofCalculator calc = ((ASTTranslationUnit) ast).getSizeofCalculator();
- SizeAndAlignment sizeofPointer = calc.sizeAndAlignmentOfPointer();
- long maxSize = sizeofPointer != null ? sizeofPointer.size : 4;
- SizeAndAlignment sizeofType = calc.sizeAndAlignment(type);
- if (sizeofType == null || sizeofType.size > maxSize)
- return true;
}
return false;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java
index 0c9937daa5b..b658799031a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.dom.parser;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@@ -421,10 +420,9 @@ public abstract class ArithmeticConversion {
*
* @param target the target integral type
* @param source the source integral type
- * @param point point for sizeof lookup
* @return whether the target integral type can represent all values of the source integral type
*/
- public static boolean fitsIntoType(IBasicType target, IBasicType source, IASTNode point) {
+ public static boolean fitsIntoType(IBasicType target, IBasicType source) {
// A boolean cannot represent any other type.
if (target.getKind() == Kind.eBoolean && source.getKind() != Kind.eBoolean)
return false;
@@ -437,8 +435,8 @@ public abstract class ArithmeticConversion {
return false;
// Otherwise, go by the size and signedness of the type.
- SizeAndAlignment sourceSizeAndAlignment = SizeofCalculator.getSizeAndAlignment(source, point);
- SizeAndAlignment targetSizeAndAlignment = SizeofCalculator.getSizeAndAlignment(target, point);
+ SizeAndAlignment sourceSizeAndAlignment = SizeofCalculator.getSizeAndAlignment(source);
+ SizeAndAlignment targetSizeAndAlignment = SizeofCalculator.getSizeAndAlignment(target);
long sizeofSource = sourceSizeAndAlignment == null ? getApproximateSize(source) : sourceSizeAndAlignment.size;
long sizeofTarget = targetSizeAndAlignment == null ? getApproximateSize(target) : targetSizeAndAlignment.size;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
index 1de71a16274..8a282422d1f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/CompositeValue.java
@@ -13,7 +13,6 @@ import java.util.TreeSet;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
@@ -80,12 +79,12 @@ public final class CompositeValue implements IValue {
return 0 <= index && index < values.length;
}
- public static IValue create(EvalInitList initList, IASTNode point) {
+ public static IValue create(EvalInitList initList) {
ICPPEvaluation[] clauses = initList.getClauses();
ICPPEvaluation[] values = new ICPPEvaluation[clauses.length];
for (int i = 0; i < clauses.length; i++) {
ICPPEvaluation eval = clauses[i];
- values[i] = new EvalFixed(eval.getType(point), eval.getValueCategory(point), eval.getValue(point));
+ values[i] = new EvalFixed(eval.getType(), eval.getValueCategory(), eval.getValue());
}
return new CompositeValue(initList, values);
}
@@ -94,7 +93,7 @@ public final class CompositeValue implements IValue {
* Creates a value representing an instance of the given array type initialized with
* the elements of the given initializer list.
*/
- public static IValue create(EvalInitList initList, IArrayType type, IASTNode point) {
+ public static IValue create(EvalInitList initList, IArrayType type) {
Number arraySize = type.getSize().numberValue();
if (arraySize == null) {
// Array size is dependent. TODO: Handle this?
@@ -108,8 +107,8 @@ public final class CompositeValue implements IValue {
ICPPEvaluation[] values = new ICPPEvaluation[arraySize.intValue()];
for (int i = 0; i < initList.getClauses().length; i++) {
ICPPEvaluation eval = initList.getClauses()[i];
- IValue value = getValue(elementType, eval, point);
- values[i] = new EvalFixed(elementType, eval.getValueCategory(point), value);
+ IValue value = getValue(elementType, eval);
+ values[i] = new EvalFixed(elementType, eval.getValueCategory(), value);
}
return new CompositeValue(initList, values);
}
@@ -117,16 +116,16 @@ public final class CompositeValue implements IValue {
/**
* Gets the value of an evaluation, interpreted as a value of the given type.
*/
- private static IValue getValue(IType type, ICPPEvaluation eval, IASTNode point) {
+ private static IValue getValue(IType type, ICPPEvaluation eval) {
IValue value;
if (type instanceof IArrayType && eval instanceof EvalInitList) {
- value = CompositeValue.create((EvalInitList) eval, (IArrayType) type, point);
+ value = CompositeValue.create((EvalInitList) eval, (IArrayType) type);
} else if (type instanceof ICompositeType && eval instanceof EvalInitList) {
- value = CompositeValue.create((EvalInitList) eval, (ICompositeType) type, point);
+ value = CompositeValue.create((EvalInitList) eval, (ICompositeType) type);
} else if (eval instanceof EvalInitList) {
value = IntegralValue.UNKNOWN;
} else {
- value = eval.getValue(null);
+ value = eval.getValue();
}
return value;
}
@@ -135,10 +134,10 @@ public final class CompositeValue implements IValue {
* Creates a value representing an instance of the given composite type initialized with
* the elements of the given initializer list.
*/
- public static IValue create(EvalInitList initList, ICompositeType type, IASTNode point) {
+ public static IValue create(EvalInitList initList, ICompositeType type) {
IField[] fields;
if (type instanceof ICPPClassType) {
- fields = ClassTypeHelper.getFields((ICPPClassType) type, point);
+ fields = ClassTypeHelper.getFields((ICPPClassType) type);
} else {
fields = type.getFields();
}
@@ -150,8 +149,8 @@ public final class CompositeValue implements IValue {
IField field = fields[i];
ICPPEvaluation eval = clauses[i];
IType fieldType = field.getType();
- IValue value = getValue(fieldType, eval, point);
- values[i] = new EvalFixed(fieldType, eval.getValueCategory(null), value);
+ IValue value = getValue(fieldType, eval);
+ values[i] = new EvalFixed(fieldType, eval.getValueCategory(), value);
}
return new CompositeValue(initList, values);
}
@@ -175,8 +174,8 @@ public final class CompositeValue implements IValue {
* determined by the default member initializers only. Constructors are not considered
* when determining the values of the fields.
*/
- public static CompositeValue create(ICPPClassType classType, IASTNode point) {
- return create(classType, point, 0);
+ public static CompositeValue create(ICPPClassType classType) {
+ return create(classType, 0);
}
/**
@@ -184,7 +183,7 @@ public final class CompositeValue implements IValue {
* determined by the default member initializers only. Constructors are not considered
* when determining the values of the fields.
*/
- public static CompositeValue create(ICPPClassType classType, IASTNode point, int nestingLevel) {
+ public static CompositeValue create(ICPPClassType classType, int nestingLevel) {
Set<ICPPClassType> recursionProtectionSet = fCreateInProgress.get();
if (!recursionProtectionSet.add(classType)) {
return new CompositeValue(null, ICPPEvaluation.EMPTY_ARRAY);
@@ -195,16 +194,16 @@ public final class CompositeValue implements IValue {
System.out.flush();
}
ActivationRecord record = new ActivationRecord();
- ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType, point).length];
+ ICPPEvaluation[] values = new ICPPEvaluation[ClassTypeHelper.getFields(classType).length];
// Recursively create all the base class member variables.
- ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
+ ICPPBase[] bases = classType.getBases();
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
ICPPClassType baseClassType = (ICPPClassType) baseClass;
- ICPPField[] baseFields = ClassTypeHelper.getDeclaredFields(baseClassType, point);
- IValue compValue = CompositeValue.create(baseClassType, point, nestingLevel + 1);
+ ICPPField[] baseFields = baseClassType.getDeclaredFields();
+ IValue compValue = CompositeValue.create(baseClassType, nestingLevel + 1);
for (ICPPField baseField : baseFields) {
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
if (fieldPos == -1) {
@@ -219,11 +218,11 @@ public final class CompositeValue implements IValue {
}
}
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (field.isStatic())
continue;
- final ICPPEvaluation value = EvalUtil.getVariableValue(field, record, point);
+ final ICPPEvaluation value = EvalUtil.getVariableValue(field, record);
int fieldPos = CPPASTFieldReference.getFieldPosition(field);
if (fieldPos == -1) {
continue;
@@ -274,8 +273,8 @@ public final class CompositeValue implements IValue {
if (eval == EvalFixed.INCOMPLETE) {
newValues[i] = eval;
} else {
- IValue newValue = eval.getValue(null).clone();
- newValues[i] = new EvalFixed(eval.getType(null), eval.getValueCategory(null), newValue);
+ IValue newValue = eval.getValue().clone();
+ newValues[i] = new EvalFixed(eval.getType(), eval.getValueCategory(), newValue);
}
}
return new CompositeValue(evaluation, newValues);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
index 5877d020985..394325854c5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
@@ -33,7 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
@@ -86,11 +86,10 @@ public class SizeofCalculator {
* Calculates size and alignment for the given type.
*
* @param type the type to get size and alignment for.
- * @param point a node belonging to the AST of the translation unit defining context for
- * the size calculation.
* @return size and alignment, or {@code null} if could not be calculated.
*/
- public static SizeAndAlignment getSizeAndAlignment(IType type, IASTNode point) {
+ public static SizeAndAlignment getSizeAndAlignment(IType type) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
SizeofCalculator calc = point == null ?
getDefault() : ((ASTTranslationUnit) point.getTranslationUnit()).getSizeofCalculator();
return calc.sizeAndAlignment(type);
@@ -292,27 +291,32 @@ public class SizeofCalculator {
int maxAlignment = 1;
IField[] fields;
if (type instanceof ICPPClassType) {
- ICPPClassType classType = (ICPPClassType) type;
- for (ICPPBase base : ClassTypeHelper.getBases(classType, ast)) {
- if (base.isVirtual())
- return null; // Don't know how to calculate size when there are virtual bases.
- IBinding baseClass = base.getBaseClass();
- if (!(baseClass instanceof IType))
- return null;
- SizeAndAlignment info = sizeAndAlignment((IType) baseClass);
- if (info == null)
- return null;
- size += info.alignment - (size - 1) % info.alignment - 1 + info.size;
- if (maxAlignment < info.alignment)
- maxAlignment = info.alignment;
- for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, ast)) {
- if (method.isVirtual()) {
- // Don't know how to calculate size when there are virtual functions.
+ CPPSemantics.pushLookupPoint(ast);
+ try {
+ ICPPClassType classType = (ICPPClassType) type;
+ for (ICPPBase base : classType.getBases()) {
+ if (base.isVirtual())
+ return null; // Don't know how to calculate size when there are virtual bases.
+ IBinding baseClass = base.getBaseClass();
+ if (!(baseClass instanceof IType))
return null;
+ SizeAndAlignment info = sizeAndAlignment((IType) baseClass);
+ if (info == null)
+ return null;
+ size += info.alignment - (size - 1) % info.alignment - 1 + info.size;
+ if (maxAlignment < info.alignment)
+ maxAlignment = info.alignment;
+ for (ICPPMethod method : classType.getDeclaredMethods()) {
+ if (method.isVirtual()) {
+ // Don't know how to calculate size when there are virtual functions.
+ return null;
+ }
}
}
+ fields = classType.getDeclaredFields();
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- fields = ClassTypeHelper.getDeclaredFields(classType, ast);
} else {
fields = type.getFields();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ValueFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ValueFactory.java
index 646f12b356c..471ac5915a5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ValueFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ValueFactory.java
@@ -45,7 +45,6 @@ import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IBinding;
@@ -67,6 +66,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
@@ -78,16 +78,21 @@ public class ValueFactory {
* Creates the value for an expression.
*/
public static IValue create(IASTExpression expr) {
- IValue val= evaluate(expr);
- if (val != null) {
- return val;
- }
-
- if (expr instanceof ICPPASTInitializerClause) {
- ICPPEvaluation evaluation = ((ICPPASTInitializerClause) expr).getEvaluation();
- return evaluation.getValue(expr);
+ try {
+ CPPSemantics.pushLookupPoint(expr);
+ IValue val= evaluate(expr);
+ if (val != null) {
+ return val;
+ }
+
+ if (expr instanceof ICPPASTInitializerClause) {
+ ICPPEvaluation evaluation = ((ICPPASTInitializerClause) expr).getEvaluation();
+ return evaluation.getValue();
+ }
+ return IntegralValue.UNKNOWN;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- return IntegralValue.UNKNOWN;
}
public static IValue evaluateUnaryExpression(final int unaryOp, final IValue value) {
@@ -248,16 +253,16 @@ public class ValueFactory {
}
}
- public static IValue evaluateUnaryTypeIdExpression(int operator, IType type, IASTNode point) {
- IValue val = applyUnaryTypeIdOperator(operator, type, point);
+ public static IValue evaluateUnaryTypeIdExpression(int operator, IType type) {
+ IValue val = applyUnaryTypeIdOperator(operator, type);
if (isInvalidValue(val))
return IntegralValue.UNKNOWN;
return val;
}
public static IValue evaluateBinaryTypeIdExpression(IASTBinaryTypeIdExpression.Operator operator,
- IType type1, IType type2, IASTNode point) {
- IValue val = applyBinaryTypeIdOperator(operator, type1, type2, point);
+ IType type1, IType type2) {
+ IValue val = applyBinaryTypeIdOperator(operator, type1, type2);
if (isInvalidValue(val))
return IntegralValue.UNKNOWN;
return val;
@@ -348,7 +353,7 @@ public class ValueFactory {
final IType type = ast.createType(typeIdExp.getTypeId());
if (type instanceof ICPPUnknownType)
return null;
- return applyUnaryTypeIdOperator(typeIdExp.getOperator(), type, exp);
+ return applyUnaryTypeIdOperator(typeIdExp.getOperator(), type);
}
if (exp instanceof IASTBinaryTypeIdExpression) {
IASTBinaryTypeIdExpression typeIdExp = (IASTBinaryTypeIdExpression) exp;
@@ -357,7 +362,7 @@ public class ValueFactory {
IType t2= ast.createType(typeIdExp.getOperand2());
if (CPPTemplates.isDependentType(t1) || CPPTemplates.isDependentType(t2))
return null;
- return applyBinaryTypeIdOperator(typeIdExp.getOperator(), t1, t2, exp);
+ return applyBinaryTypeIdOperator(typeIdExp.getOperator(), t1, t2);
}
return IntegralValue.UNKNOWN;
}
@@ -389,14 +394,14 @@ public class ValueFactory {
return value;
}
- private static IValue applyUnaryTypeIdOperator(int operator, IType type, IASTNode point) {
+ private static IValue applyUnaryTypeIdOperator(int operator, IType type) {
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE);
switch (operator) {
case op_sizeof:
- return getSize(type, point);
+ return getSize(type);
case op_alignof:
- return getAlignment(type, point);
+ return getAlignment(type);
case op_typeid:
break;
case op_has_nothrow_copy:
@@ -409,19 +414,19 @@ public class ValueFactory {
break; // TODO(sprigogin): Implement
case op_has_trivial_copy:
return IntegralValue.create(!(type instanceof ICPPClassType) ||
- TypeTraits.hasTrivialCopyCtor((ICPPClassType) type, point) ? 1 : 0);
+ TypeTraits.hasTrivialCopyCtor((ICPPClassType) type) ? 1 : 0);
case op_has_trivial_destructor:
break; // TODO(sprigogin): Implement
case op_has_virtual_destructor:
break; // TODO(sprigogin): Implement
case op_is_abstract:
return IntegralValue.create(type instanceof ICPPClassType &&
- TypeTraits.isAbstract((ICPPClassType) type, point) ? 1 : 0);
+ TypeTraits.isAbstract((ICPPClassType) type) ? 1 : 0);
case op_is_class:
return IntegralValue.create(type instanceof ICompositeType &&
((ICompositeType) type).getKey() != ICompositeType.k_union ? 1 : 0);
case op_is_empty:
- return IntegralValue.create(TypeTraits.isEmpty(type, point) ? 1 : 0);
+ return IntegralValue.create(TypeTraits.isEmpty(type) ? 1 : 0);
case op_is_enum:
return IntegralValue.create(type instanceof IEnumeration ? 1 : 0);
case op_is_final:
@@ -429,17 +434,17 @@ public class ValueFactory {
case op_is_literal_type:
break; // TODO(sprigogin): Implement
case op_is_pod:
- return IntegralValue.create(TypeTraits.isPOD(type, point) ? 1 : 0);
+ return IntegralValue.create(TypeTraits.isPOD(type) ? 1 : 0);
case op_is_polymorphic:
return IntegralValue.create(type instanceof ICPPClassType &&
- TypeTraits.isPolymorphic((ICPPClassType) type, point) ? 1 : 0);
+ TypeTraits.isPolymorphic((ICPPClassType) type) ? 1 : 0);
case op_is_standard_layout:
- return IntegralValue.create(TypeTraits.isStandardLayout(type, point) ? 1 : 0);
+ return IntegralValue.create(TypeTraits.isStandardLayout(type) ? 1 : 0);
case op_is_trivial:
return IntegralValue.create(type instanceof ICPPClassType &&
- TypeTraits.isTrivial((ICPPClassType) type, point) ? 1 : 0);
+ TypeTraits.isTrivial((ICPPClassType) type) ? 1 : 0);
case op_is_trivially_copyable:
- return IntegralValue.create(TypeTraits.isTriviallyCopyable(type, point) ? 1 : 0);
+ return IntegralValue.create(TypeTraits.isTriviallyCopyable(type) ? 1 : 0);
case op_is_union:
return IntegralValue.create(type instanceof ICompositeType &&
((ICompositeType) type).getKey() == ICompositeType.k_union ? 1 : 0);
@@ -449,15 +454,15 @@ public class ValueFactory {
return IntegralValue.UNKNOWN;
}
- private static IValue getAlignment(IType type, IASTNode point) {
- SizeAndAlignment sizeAndAlignment = SizeofCalculator.getSizeAndAlignment(type, point);
+ private static IValue getAlignment(IType type) {
+ SizeAndAlignment sizeAndAlignment = SizeofCalculator.getSizeAndAlignment(type);
if (sizeAndAlignment == null)
return IntegralValue.UNKNOWN;
return IntegralValue.create(sizeAndAlignment.alignment);
}
- private static IValue getSize(IType type, IASTNode point) {
- SizeAndAlignment sizeAndAlignment = SizeofCalculator.getSizeAndAlignment(type, point);
+ private static IValue getSize(IType type) {
+ SizeAndAlignment sizeAndAlignment = SizeofCalculator.getSizeAndAlignment(type);
if (sizeAndAlignment == null)
return IntegralValue.UNKNOWN;
return IntegralValue.create(sizeAndAlignment.size);
@@ -574,14 +579,14 @@ public class ValueFactory {
}
private static IValue applyBinaryTypeIdOperator(IASTBinaryTypeIdExpression.Operator operator,
- IType type1, IType type2, IASTNode point) {
+ IType type1, IType type2) {
switch (operator) {
case __is_base_of:
type1 = SemanticUtil.getNestedType(type1, TDEF);
type2 = SemanticUtil.getNestedType(type2, TDEF);
if (type1 instanceof ICPPClassType && type2 instanceof ICPPClassType &&
(type1.isSameType(type2) ||
- ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1, point))) {
+ ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1))) {
return IntegralValue.create(1);
}
return IntegralValue.create(0);
@@ -609,16 +614,21 @@ public class ValueFactory {
* to a constant
*/
public static Number getConstantNumericalValue(IASTExpression expr) {
- IValue val = evaluate(expr);
- if (val != null) {
- return val.numberValue();
- }
-
- if (expr instanceof ICPPASTInitializerClause) {
- ICPPEvaluation eval = ((ICPPASTInitializerClause) expr).getEvaluation();
- if (eval.isConstantExpression(expr) && !eval.isValueDependent())
- return eval.getValue(expr).numberValue();
+ try {
+ CPPSemantics.pushLookupPoint(expr);
+ IValue val = evaluate(expr);
+ if (val != null) {
+ return val.numberValue();
+ }
+
+ if (expr instanceof ICPPASTInitializerClause) {
+ ICPPEvaluation eval = ((ICPPASTInitializerClause) expr).getEvaluation();
+ if (eval.isConstantExpression() && !eval.isValueDependent())
+ return eval.getValue().numberValue();
+ }
+ return null;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- return null;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java
index a8802c0c806..7d5de09e792 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/VariableReadWriteFlags.java
@@ -213,7 +213,7 @@ public abstract class VariableReadWriteFlags {
private IType getArgumentType(IASTInitializerClause argument) {
if (argument instanceof ICPPASTInitializerClause) {
- return ((ICPPASTInitializerClause) argument).getEvaluation().getType(argument);
+ return ((ICPPASTInitializerClause) argument).getEvaluation().getType();
} else if (argument instanceof IASTExpression) {
return ((IASTExpression) argument).getExpressionType();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
index f470b9b1529..750798b09ac 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/AbstractCPPClassSpecializationScope.java
@@ -14,12 +14,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IName;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
@@ -97,8 +95,13 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
return null;
IBinding[] specs = IBinding.EMPTY_BINDING_ARRAY;
- for (IBinding binding : bindings) {
- specs = ArrayUtil.append(specs, specialClass.specializeMember(binding, name));
+ CPPSemantics.pushLookupPoint(name);
+ try {
+ for (IBinding binding : bindings) {
+ specs = ArrayUtil.append(specs, specialClass.specializeMember(binding));
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
specs = ArrayUtil.trim(specs);
return CPPSemantics.resolveAmbiguities(name, specs);
@@ -129,7 +132,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
(binding instanceof ICPPClassType && areSameTypesModuloPartialSpecialization(specialized, (IType) binding))) {
binding= specialClass;
} else {
- binding= specialClass.specializeMember(binding, lookup.getLookupPoint());
+ binding= specialClass.specializeMember(binding);
}
if (binding != null)
result = ArrayUtil.appendAt(result, n++, binding);
@@ -153,7 +156,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
}
@Override
- public ICPPBase[] getBases(IASTNode point) {
+ public ICPPBase[] getBases() {
if (fBases == null) {
if (fComputingBases.get()) {
return ICPPBase.EMPTY_BASE_ARRAY; // avoid recursion
@@ -161,7 +164,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
fComputingBases.set(true);
try {
ICPPBase[] result = ICPPBase.EMPTY_BASE_ARRAY;
- ICPPBase[] bases = ClassTypeHelper.getBases(specialClass.getSpecializedBinding(), point);
+ ICPPBase[] bases = specialClass.getSpecializedBinding().getBases();
if (bases.length == 0) {
fBases= bases;
} else {
@@ -170,7 +173,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
IType baseType = base.getBaseClassType();
if (baseType instanceof ICPPParameterPackType) {
IType[] specClasses= CPPTemplates.instantiateTypes(new IType[] { baseType },
- new InstantiationContext(tpmap, specialClass, point));
+ new InstantiationContext(tpmap, specialClass));
if (specClasses.length == 1 && specClasses[0] instanceof ICPPParameterPackType) {
result= ArrayUtil.append(result, base);
} else {
@@ -192,7 +195,7 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
specializationContext = (ICPPClassSpecialization) owner;
}
IType specClass= CPPTemplates.instantiateType(baseType,
- new InstantiationContext(tpmap, specializationContext, point));
+ new InstantiationContext(tpmap, specializationContext));
specClass = SemanticUtil.getUltimateType(specClass, false);
if (specClass instanceof IBinding && !(specClass instanceof IProblemBinding)) {
specBase.setBaseClass((IBinding) specClass);
@@ -212,37 +215,31 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
}
@SuppressWarnings("unchecked")
- private <T extends IBinding> T[] specializeMembers(T[] array, IASTNode point) {
+ private <T extends IBinding> T[] specializeMembers(T[] array) {
if (array == null || array.length == 0)
return array;
T[] newArray= array.clone();
for (int i = 0; i < newArray.length; i++) {
- IBinding specializedMember = specialClass.specializeMember(array[i], point);
+ IBinding specializedMember = specialClass.specializeMember(array[i]);
newArray[i]= (T) specializedMember;
}
return newArray;
}
@Override
- public ICPPField[] getDeclaredFields(IASTNode point) {
- ICPPField[] fields= ClassTypeHelper.getDeclaredFields(specialClass.getSpecializedBinding(), point);
- return specializeMembers(fields, point);
+ public ICPPField[] getDeclaredFields() {
+ ICPPField[] fields= specialClass.getSpecializedBinding().getDeclaredFields();
+ return specializeMembers(fields);
}
@Override
public ICPPMethod[] getImplicitMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getImplicitMethods(null);
- }
-
- @Override
- public ICPPMethod[] getImplicitMethods(IASTNode point) {
ICPPClassType origClass = specialClass.getSpecializedBinding();
- ICPPMethod[] methods= ClassTypeHelper.getImplicitMethods(origClass, point);
- ICPPMethod[] specializedMembers = specializeMembers(methods, point);
+ ICPPMethod[] methods= ClassTypeHelper.getImplicitMethods(origClass);
+ ICPPMethod[] specializedMembers = specializeMembers(methods);
// Add inherited constructors.
- ICPPMethod[] inheritedConstructors = getOwnInheritedConstructors(point);
+ ICPPMethod[] inheritedConstructors = getOwnInheritedConstructors();
return ArrayUtil.addAll(specializedMembers, inheritedConstructors);
}
@@ -255,16 +252,10 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
@Override
public ICPPConstructor[] getConstructors() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getConstructors(null);
- }
-
- @Override
- public ICPPConstructor[] getConstructors(IASTNode point) {
- ICPPConstructor[] ctors= ClassTypeHelper.getConstructors(specialClass.getSpecializedBinding(), point);
- ICPPConstructor[] specializedCtors = specializeMembers(ctors, point);
+ ICPPConstructor[] ctors= specialClass.getSpecializedBinding().getConstructors();
+ ICPPConstructor[] specializedCtors = specializeMembers(ctors);
// Add inherited constructors.
- ICPPMethod[] inheritedConstructors = getOwnInheritedConstructors(specializedCtors, point);
+ ICPPMethod[] inheritedConstructors = getOwnInheritedConstructors(specializedCtors);
return ArrayUtil.addAll(specializedCtors, inheritedConstructors);
}
@@ -272,10 +263,9 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
* Returns the inherited constructors that are not specializations of the inherited constructors
* of the specialized class.
*/
- private ICPPMethod[] getOwnInheritedConstructors(ICPPConstructor[] existingConstructors,
- IASTNode point) {
+ private ICPPMethod[] getOwnInheritedConstructors(ICPPConstructor[] existingConstructors) {
if (ownInheritedConstructors == null) {
- if (!hasInheritedConstructorsSources(point))
+ if (!hasInheritedConstructorsSources())
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
IType[][] existingConstructorParamTypes = new IType[existingConstructors.length][];
@@ -287,23 +277,23 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
}
existingConstructorParamTypes[i] = types;
}
- ICPPMethod[] constructors = ClassTypeHelper.getInheritedConstructors(this, getBases(point),
- existingConstructorParamTypes, point);
+ ICPPMethod[] constructors = ClassTypeHelper.getInheritedConstructors(this, getBases(),
+ existingConstructorParamTypes);
ownInheritedConstructors = constructors;
}
return ownInheritedConstructors;
}
- private ICPPMethod[] getOwnInheritedConstructors(IASTNode point) {
+ private ICPPMethod[] getOwnInheritedConstructors() {
if (ownInheritedConstructors != null)
return ownInheritedConstructors;
- ICPPConstructor[] ctors= ClassTypeHelper.getConstructors(specialClass.getSpecializedBinding(), point);
- ICPPConstructor[] specializedCtors = specializeMembers(ctors, point);
- return getOwnInheritedConstructors(specializedCtors, point);
+ ICPPConstructor[] ctors= specialClass.getSpecializedBinding().getConstructors();
+ ICPPConstructor[] specializedCtors = specializeMembers(ctors);
+ return getOwnInheritedConstructors(specializedCtors);
}
- private boolean hasInheritedConstructorsSources(IASTNode point) {
- for (ICPPBase base : getBases(point)) {
+ private boolean hasInheritedConstructorsSources() {
+ for (ICPPBase base : getBases()) {
if (base.isInheritedConstructorsSource())
return true;
}
@@ -311,27 +301,27 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
}
@Override
- public ICPPMethod[] getDeclaredMethods(IASTNode point) {
- ICPPMethod[] bindings = ClassTypeHelper.getDeclaredMethods(specialClass.getSpecializedBinding(), point);
- return specializeMembers(bindings, point);
+ public ICPPMethod[] getDeclaredMethods() {
+ ICPPMethod[] bindings = specialClass.getSpecializedBinding().getDeclaredMethods();
+ return specializeMembers(bindings);
}
@Override
- public ICPPClassType[] getNestedClasses(IASTNode point) {
- ICPPClassType[] bindings = ClassTypeHelper.getNestedClasses(specialClass.getSpecializedBinding(), point);
- return specializeMembers(bindings, point);
+ public ICPPClassType[] getNestedClasses() {
+ ICPPClassType[] bindings = specialClass.getSpecializedBinding().getNestedClasses();
+ return specializeMembers(bindings);
}
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
- ICPPUsingDeclaration[] bindings = ClassTypeHelper.getUsingDeclarations(specialClass.getSpecializedBinding(), point);
- return specializeMembers(bindings, point);
+ public ICPPUsingDeclaration[] getUsingDeclarations() {
+ ICPPUsingDeclaration[] bindings = specialClass.getSpecializedBinding().getUsingDeclarations();
+ return specializeMembers(bindings);
}
@Override
- public IBinding[] getFriends(IASTNode point) {
- IBinding[] friends = ClassTypeHelper.getFriends(specialClass.getSpecializedBinding(), point);
- return specializeMembers(friends, point);
+ public IBinding[] getFriends() {
+ IBinding[] friends = specialClass.getSpecializedBinding().getFriends();
+ return specializeMembers(friends);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
index bc772050473..d3d3d05a34d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTArraySubscriptExpression.java
@@ -28,6 +28,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -132,8 +134,14 @@ public class CPPASTArraySubscriptExpression extends ASTNode
private ICPPFunction getOverload() {
ICPPEvaluation eval = getEvaluation();
- if (eval instanceof EvalBinary)
- return ((EvalBinary) eval).getOverload(this);
+ if (eval instanceof EvalBinary) {
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ return ((EvalBinary) eval).getOverload();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
return null;
}
@@ -203,12 +211,12 @@ public class CPPASTArraySubscriptExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
index 3be6826d0dd..1fc3b627e4c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java
@@ -31,6 +31,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -263,8 +265,14 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public ICPPFunction getOverload() {
ICPPEvaluation eval = getEvaluation();
- if (eval instanceof EvalBinary)
- return ((EvalBinary) eval).getOverload(this);
+ if (eval instanceof EvalBinary) {
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ return ((EvalBinary) eval).getOverload();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
return null;
}
@@ -287,12 +295,12 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
index b6c8c27870e..0f9b3c479ec 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryTypeIdExpression.java
@@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinaryTypeId;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -135,7 +136,7 @@ public class CPPASTBinaryTypeIdExpression extends ASTNode implements ICPPASTExpr
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
index d45aa93248e..213ed19ed4a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCastExpression.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -172,12 +173,12 @@ public class CPPASTCastExpression extends ASTNode implements ICPPASTCastExpressi
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
index d5736394464..aee8d2b3292 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompoundStatementExpression.java
@@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalCompoundStatementExpression;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -127,7 +128,7 @@ public class CPPASTCompoundStatementExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
index bae2da97ddc..ec9c73935c1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConditionalExpression.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConditional;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -191,12 +192,12 @@ public class CPPASTConditionalExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
index 05051b01652..6fb81501816 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTConstructorChainInitializer.java
@@ -177,7 +177,7 @@ public class CPPASTConstructorChainInitializer extends ASTNode implements
IBinding method= fdef.getDeclarator().getName().resolveBinding();
if (method instanceof ICPPMethod) {
ICPPClassType cls= ((ICPPMethod) method).getClassOwner();
- for (ICPPBase base : ClassTypeHelper.getBases(cls, fdef)) {
+ for (ICPPBase base : cls.getBases()) {
IType baseType= base.getBaseClassType();
if (baseType instanceof IBinding)
result.put(((IBinding) baseType).getNameCharArray());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
index 7c708d0aede..a89b023c7b4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTExpressionList.java
@@ -27,6 +27,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalComma;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -156,7 +158,12 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
private ICPPFunction[] getOverloads() {
ICPPEvaluation eval = getEvaluation();
if (eval instanceof EvalComma) {
- return ((EvalComma) eval).getOverloads(this);
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ return ((EvalComma) eval).getOverloads();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
return null;
}
@@ -195,12 +202,12 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
index e73c603216c..e650c341d89 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java
@@ -46,6 +46,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPFunctionSet;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
@@ -146,25 +147,30 @@ public class CPPASTFieldReference extends ASTNode
if (!fIsDeref)
return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
- // Collect the function bindings
- List<ICPPFunction> functionBindings = new ArrayList<>();
- EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, functionBindings, false);
- if (functionBindings.isEmpty())
- return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
-
- // Create a name to wrap each binding
- fImplicitNames = new IASTImplicitName[functionBindings.size()];
- int i = -1;
- for (ICPPFunction op : functionBindings) {
- if (op != null && !(op instanceof CPPImplicitFunction)) {
- CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.ARROW,
- this);
- operatorName.setBinding(op);
- operatorName.computeOperatorOffsets(fOwner, true);
- fImplicitNames[++i] = operatorName;
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ // Collect the function bindings
+ List<ICPPFunction> functionBindings = new ArrayList<>();
+ EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, functionBindings, false);
+ if (functionBindings.isEmpty())
+ return fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
+
+ // Create a name to wrap each binding
+ fImplicitNames = new IASTImplicitName[functionBindings.size()];
+ int i = -1;
+ for (ICPPFunction op : functionBindings) {
+ if (op != null && !(op instanceof CPPImplicitFunction)) {
+ CPPASTImplicitName operatorName = new CPPASTImplicitName(OverloadableOperator.ARROW,
+ this);
+ operatorName.setBinding(op);
+ operatorName.computeOperatorOffsets(fOwner, true);
+ fImplicitNames[++i] = operatorName;
+ }
}
- }
- fImplicitNames = ArrayUtil.trimAt(IASTImplicitName.class, fImplicitNames, i);
+ fImplicitNames = ArrayUtil.trimAt(IASTImplicitName.class, fImplicitNames, i);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
return fImplicitNames;
@@ -269,7 +275,7 @@ public class CPPASTFieldReference extends ASTNode
*/
@Override
public IType getFieldOwnerType() {
- return EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, this, null, true);
+ return EvalMemberAccess.getFieldOwnerType(fOwner.getExpressionType(), fIsDeref, null, true);
}
@Override
@@ -283,7 +289,7 @@ public class CPPASTFieldReference extends ASTNode
private ICPPEvaluation createEvaluation() {
ICPPEvaluation ownerEval = fOwner.getEvaluation();
if (!ownerEval.isTypeDependent()) {
- IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getType(this), fIsDeref, this, null, false);
+ IType ownerType= EvalMemberAccess.getFieldOwnerType(ownerEval.getType(), fIsDeref, null, false);
if (ownerType != null) {
IBinding binding = fName.resolvePreBinding();
if (binding instanceof CPPFunctionSet)
@@ -293,7 +299,7 @@ public class CPPASTFieldReference extends ASTNode
return EvalFixed.INCOMPLETE;
}
- return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(this), binding, ownerEval, fIsDeref, this);
+ return new EvalMemberAccess(ownerType, ownerEval.getValueCategory(), binding, ownerEval, fIsDeref, this);
}
}
@@ -325,10 +331,10 @@ public class CPPASTFieldReference extends ASTNode
if (ownerType == null) {
return -1;
}
- final ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(ownerType, null);
+ final ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(ownerType);
int baseFields = 0;
for (ICPPClassType baseClass : baseClasses) {
- baseFields += ClassTypeHelper.getDeclaredFields(baseClass, null).length;
+ baseFields += baseClass.getDeclaredFields().length;
}
return baseFields + field.getFieldPosition();
}
@@ -344,7 +350,7 @@ public class CPPASTFieldReference extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
@@ -354,6 +360,6 @@ public class CPPASTFieldReference extends ASTNode
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java
index a17a162ee95..a6a88ac4d6f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionCallExpression.java
@@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -242,27 +243,32 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public ICPPFunction getOverload() {
- ICPPEvaluation eval = getEvaluation();
- if (eval instanceof EvalFunctionCall)
- return ((EvalFunctionCall) eval).getOverload(this);
-
- if (eval instanceof EvalTypeId) {
- if (!eval.isTypeDependent()) {
- IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF);
- if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) {
- ICPPClassType cls= (ICPPClassType) t;
- LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) fFunctionName).getName());
- try {
- ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(cls, data.getLookupPoint());
- IBinding b= CPPSemantics.resolveFunction(data, constructors, true, false);
- if (b instanceof ICPPFunction)
- return (ICPPFunction) b;
- } catch (DOMException e) {
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ ICPPEvaluation eval = getEvaluation();
+ if (eval instanceof EvalFunctionCall)
+ return ((EvalFunctionCall) eval).getOverload();
+
+ if (eval instanceof EvalTypeId) {
+ if (!eval.isTypeDependent()) {
+ IType t= getNestedType(((EvalTypeId) eval).getInputType(), TDEF | CVTYPE | REF);
+ if (t instanceof ICPPClassType && !(t instanceof ICPPUnknownBinding)) {
+ ICPPClassType cls= (ICPPClassType) t;
+ LookupData data= CPPSemantics.createLookupData(((IASTIdExpression) fFunctionName).getName());
+ try {
+ ICPPConstructor[] constructors = cls.getConstructors();
+ IBinding b= CPPSemantics.resolveFunction(data, constructors, true, false);
+ if (b instanceof ICPPFunction)
+ return (ICPPFunction) b;
+ } catch (DOMException e) {
+ }
}
}
}
+ return null;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- return null;
}
@Override
@@ -313,12 +319,12 @@ public class CPPASTFunctionCallExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
index 6e477f9bdf2..9c66d1e9dc7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFunctionDefinition.java
@@ -36,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Models a function definition without a try-block. If used for a constructor definition
@@ -255,36 +256,41 @@ public class CPPASTFunctionDefinition extends CPPASTAttributeOwner
IASTName functionName = ASTQueries.findInnermostDeclarator(declarator).getName();
IBinding function = functionName.resolveBinding();
if (function instanceof ICPPConstructor) {
- ICPPClassType classOwner = ((ICPPConstructor) function).getClassOwner();
-
- // Determine the bases of 'classOwner' that need to be initialized by this constructor.
- Set<ICPPClassType> basesThatNeedInitialization = new HashSet<>();
- for (ICPPBase base : ClassTypeHelper.getBases(classOwner, this)) {
- IType baseType = base.getBaseClassType();
- if (baseType instanceof ICPPClassType) {
- basesThatNeedInitialization.add((ICPPClassType) baseType);
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ ICPPClassType classOwner = ((ICPPConstructor) function).getClassOwner();
+
+ // Determine the bases of 'classOwner' that need to be initialized by this constructor.
+ Set<ICPPClassType> basesThatNeedInitialization = new HashSet<>();
+ for (ICPPBase base : classOwner.getBases()) {
+ IType baseType = base.getBaseClassType();
+ if (baseType instanceof ICPPClassType) {
+ basesThatNeedInitialization.add((ICPPClassType) baseType);
+ }
}
- }
- for (ICPPClassType virtualBase : ClassTypeHelper.getVirtualBases(classOwner, this)) {
- basesThatNeedInitialization.add(virtualBase);
- }
-
- // Go through the bases determined above, and see which ones aren't initialized
- // explicitly in the mem-initializer list.
- for (ICPPClassType base : basesThatNeedInitialization) {
- if (!isInitializedExplicitly(base)) {
- // Try to find a default constructor to create an implicit name for.
- for (ICPPConstructor constructor : ClassTypeHelper.getConstructors(base, this)) {
- if (constructor.getRequiredArgumentCount() == 0) { // default constructor
- CPPASTImplicitName ctorName = new CPPASTImplicitName(
- constructor.getNameCharArray(), this);
- ctorName.setBinding(constructor);
- ctorName.setOffsetAndLength((ASTNode) functionName);
- implicitNames = ArrayUtil.append(implicitNames, ctorName);
- break;
+ for (ICPPClassType virtualBase : ClassTypeHelper.getVirtualBases(classOwner)) {
+ basesThatNeedInitialization.add(virtualBase);
+ }
+
+ // Go through the bases determined above, and see which ones aren't initialized
+ // explicitly in the mem-initializer list.
+ for (ICPPClassType base : basesThatNeedInitialization) {
+ if (!isInitializedExplicitly(base)) {
+ // Try to find a default constructor to create an implicit name for.
+ for (ICPPConstructor constructor : base.getConstructors()) {
+ if (constructor.getRequiredArgumentCount() == 0) { // default constructor
+ CPPASTImplicitName ctorName = new CPPASTImplicitName(
+ constructor.getNameCharArray(), this);
+ ctorName.setBinding(constructor);
+ ctorName.setOffsetAndLength((ASTNode) functionName);
+ implicitNames = ArrayUtil.append(implicitNames, ctorName);
+ break;
+ }
}
}
}
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
implicitNames = ArrayUtil.trim(implicitNames);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java
index 6ecbf14c067..584d70e8e6b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalID;
@@ -137,15 +138,20 @@ public class CPPASTIdExpression extends ASTNode
@Override
public IType getExpressionType() {
- IType type= getEvaluation().getType(this);
- if (type instanceof FunctionSetType) {
- IBinding binding= fName.resolveBinding();
- if (binding instanceof IFunction) {
- return SemanticUtil.mapToAST(((IFunction) binding).getType(), this);
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ IType type= getEvaluation().getType();
+ if (type instanceof FunctionSetType) {
+ IBinding binding= fName.resolveBinding();
+ if (binding instanceof IFunction) {
+ return SemanticUtil.mapToAST(((IFunction) binding).getType());
+ }
+ return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
- return ProblemType.UNKNOWN_FOR_EXPRESSION;
+ return type;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- return type;
}
@Override
@@ -155,6 +161,6 @@ public class CPPASTIdExpression extends ASTNode
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
index 3d33c1ee8a1..c860b1807ca 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLambdaExpression.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IntegralValue;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
/**
@@ -243,7 +244,7 @@ public class CPPASTLambdaExpression extends ASTNode implements ICPPASTLambdaExpr
@Override
public CPPClosureType getExpressionType() {
- return (CPPClosureType) getEvaluation().getType(this);
+ return (CPPClosureType) CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
index b77475fdc09..a59e9c25659 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTLiteralExpression.java
@@ -38,6 +38,7 @@ import org.eclipse.cdt.internal.core.dom.parser.FloatingPointValue;
import org.eclipse.cdt.internal.core.dom.parser.IntegralValue;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinding;
@@ -749,7 +750,7 @@ public class CPPASTLiteralExpression extends ASTNode implements ICPPASTLiteralEx
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
index dddd6915c8d..3daa3f7e7a4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java
@@ -59,7 +59,12 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
@Override
protected IBinding createIntermediateBinding() {
- return CPPVisitor.createBinding(this);
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ return CPPVisitor.createBinding(this);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
index 5c0b906445c..21adf6a2dbc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNewExpression.java
@@ -40,6 +40,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
import org.eclipse.cdt.internal.core.dom.parser.c.CASTExpressionList;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
@@ -304,7 +305,7 @@ public class CPPASTNewExpression extends ASTNode implements ICPPASTNewExpression
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
index edf8335b47b..8609867b65e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTPackExpansionExpression.java
@@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPackExpansionExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalParameterPack;
/**
@@ -71,7 +72,7 @@ public class CPPASTPackExpansionExpression extends ASTNode implements ICPPASTPac
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java
index f4b2277b87a..7409aa100b9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTProblemExpression.java
@@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTProblemExpression, ICPPASTExpression {
@@ -75,7 +76,7 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
@@ -85,6 +86,6 @@ public class CPPASTProblemExpression extends CPPASTProblemOwner implements IASTP
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
index 333b01a49de..3e75365fb3f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
@@ -323,7 +323,7 @@ public class CPPASTQualifiedName extends CPPASTNameBase
List<IBinding> filtered = filterClassScopeBindings(classQualifier, bindings, isDeclaration);
if ((isDeclaration || isUsingDecl) && nameMatches(classQualifier.getNameCharArray(),
n.getLookupKey(), isPrefix)) {
- ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classQualifier, n);
+ ICPPConstructor[] constructors = classQualifier.getConstructors();
for (int i = 0; i < constructors.length; i++) {
if (!constructors[i].isImplicit()) {
filtered.add(constructors[i]);
@@ -359,7 +359,7 @@ public class CPPASTQualifiedName extends CPPASTNameBase
while (scope != null) {
if (scope instanceof ICPPClassScope) {
ICPPClassType classType = ((ICPPClassScope) scope).getClassType();
- if (SemanticUtil.calculateInheritanceDepth(classType, baseClass, this) >= 0) {
+ if (SemanticUtil.calculateInheritanceDepth(classType, baseClass) >= 0) {
return true;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
index 45294a31c4f..493d4c9a046 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeConstructorExpression.java
@@ -27,6 +27,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalConstructor;
@@ -109,12 +111,12 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
@@ -277,12 +279,17 @@ public class CPPASTSimpleTypeConstructorExpression extends ASTNode
fImplicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
ICPPEvaluation eval = getEvaluation();
if (eval instanceof EvalTypeId) {
- ICPPFunction constructor = ((EvalTypeId) eval).getConstructor(this);
- if (constructor != null && constructor != EvalTypeId.AGGREGATE_INITIALIZATION) {
- CPPASTImplicitName name = new CPPASTImplicitName(constructor.getNameCharArray(), this);
- name.setOffsetAndLength((ASTNode) fDeclSpec);
- name.setBinding(constructor);
- fImplicitNames = new IASTImplicitName[] { name };
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ ICPPFunction constructor = ((EvalTypeId) eval).getConstructor();
+ if (constructor != null && constructor != EvalTypeId.AGGREGATE_INITIALIZATION) {
+ CPPASTImplicitName name = new CPPASTImplicitName(constructor.getNameCharArray(), this);
+ name.setOffsetAndLength((ASTNode) fDeclSpec);
+ name.setBinding(constructor);
+ fImplicitNames = new IASTImplicitName[] { name };
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
index 8f01e8ba5a2..81199682052 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTranslationUnit.java
@@ -191,12 +191,11 @@ public class CPPASTTranslationUnit extends ASTTranslationUnit implements ICPPAST
* Maps a class type to the AST.
*
* @param binding a class type, possibly from index
- * @param point a lookup point in the AST
* @return the corresponding class in the AST, or the original class type if it doesn't have
* a counterpart in the AST.
*/
- public ICPPClassType mapToAST(ICPPClassType binding, IASTNode point) {
- return fScopeMapper.mapToAST(binding, point);
+ public ICPPClassType mapToAST(ICPPClassType binding) {
+ return fScopeMapper.mapToAST(binding);
}
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java
index 2804c76442c..de5bf934160 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdExpression.java
@@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnaryTypeID;
@@ -117,12 +118,12 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java
index 9260028b71a..72f03abc1f4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTypeIdInitializerExpression.java
@@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTInitializerClause;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
@@ -151,11 +152,11 @@ public class CPPASTTypeIdInitializerExpression extends ASTNode
@Override
public IType getExpressionType() {
- return getEvaluation().getType(this);
+ return CPPEvaluation.getType(this);
}
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
index 4c3f1ac30b5..e687c0ed4c6 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUnaryExpression.java
@@ -33,6 +33,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPEvaluation;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.DestructorCallCollector;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalFixed;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalUnary;
@@ -179,8 +181,14 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
@Override
public ICPPFunction getOverload() {
ICPPEvaluation eval = getEvaluation();
- if (eval instanceof EvalUnary)
- return ((EvalUnary) eval).getOverload(this);
+ if (eval instanceof EvalUnary) {
+ CPPSemantics.pushLookupPoint(this);
+ try {
+ return ((EvalUnary) eval).getOverload();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
return null;
}
@@ -218,7 +226,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
@Override
public IType getExpressionType() {
- IType type= getEvaluation().getType(this);
+ IType type= CPPEvaluation.getType(this);
if (type instanceof FunctionSetType) {
type= fOperand.getExpressionType();
if (fOperator == op_amper) {
@@ -243,7 +251,7 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
@Override
public ValueCategory getValueCategory() {
- return getEvaluation().getValueCategory(this);
+ return CPPEvaluation.getValueCategory(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
index 4b5ec6d6fa5..573d645a556 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
@@ -151,7 +151,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
* Marks bases that serve as sources of inherited constructors.
*/
private void markInheritedConstructorsSourceBases(ICPPASTCompositeTypeSpecifier compositeTypeSpec) {
- ICPPBase[] bases = ClassTypeHelper.getBases(getClassType(), compositeTypeSpec);
+ ICPPBase[] bases = getClassType().getBases();
if (bases.length == 0)
return;
IASTDeclaration[] members = compositeTypeSpec.getMembers();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java
index 5b5bcbd38c9..932d74a2510 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java
@@ -17,7 +17,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
@@ -49,6 +48,7 @@ import org.eclipse.cdt.core.parser.util.ObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.IRecursionResolvingBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemFunctionType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
import org.eclipse.core.runtime.Assert;
@@ -59,7 +59,8 @@ public class CPPClassSpecialization extends CPPSpecialization
implements ICPPClassSpecialization, ICPPInternalClassTypeMixinHost {
public static class RecursionResolvingBinding extends ProblemBinding implements ICPPMember, IRecursionResolvingBinding {
- public static RecursionResolvingBinding createFor(IBinding original, IASTNode point) {
+ public static RecursionResolvingBinding createFor(IBinding original) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (original instanceof ICPPMethod)
return new RecursionResolvingMethod(point, original.getNameCharArray());
if (original instanceof ICPPField)
@@ -177,11 +178,6 @@ public class CPPClassSpecialization extends CPPSpecialization
@Override
public IBinding specializeMember(IBinding original) {
- return specializeMember(original, null);
- }
-
- @Override
- public IBinding specializeMember(IBinding original, IASTNode point) {
synchronized (this) {
IBinding result= (IBinding) specializationMap.get(original);
if (result != null)
@@ -191,10 +187,10 @@ public class CPPClassSpecialization extends CPPSpecialization
IBinding result;
Set<IBinding> recursionProtectionSet= fInProgress.get();
if (!recursionProtectionSet.add(original))
- return RecursionResolvingBinding.createFor(original, point);
+ return RecursionResolvingBinding.createFor(original);
try {
- result= CPPTemplates.createSpecialization(this, original, point);
+ result= CPPTemplates.createSpecialization(this, original);
} finally {
recursionProtectionSet.remove(original);
}
@@ -211,6 +207,11 @@ public class CPPClassSpecialization extends CPPSpecialization
}
@Override
+ public IBinding specializeMember(IBinding original, IASTNode point) {
+ return specializeMember(original);
+ }
+
+ @Override
public void checkForDefinition() {
// Ambiguity resolution ensures that declarations and definitions are resolved.
}
@@ -230,12 +231,6 @@ public class CPPClassSpecialization extends CPPSpecialization
@Override
public ICPPBase[] getBases() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getBases(null);
- }
-
- @Override
- public ICPPBase[] getBases(IASTNode point) {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null) {
if (bases == null) {
@@ -244,108 +239,114 @@ public class CPPClassSpecialization extends CPPSpecialization
return bases;
}
- return scope.getBases(point);
+ return scope.getBases();
}
@Override
- public ICPPField[] getDeclaredFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredFields(null);
+ @Deprecated
+ public ICPPBase[] getBases(IASTNode point) {
+ return getBases();
}
@Override
- public ICPPField[] getDeclaredFields(IASTNode point) {
+ public ICPPField[] getDeclaredFields() {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getDeclaredFields(this);
- return scope.getDeclaredFields(point);
+ return scope.getDeclaredFields();
}
@Override
- public ICPPMethod[] getDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredMethods(null);
+ @Deprecated
+ public ICPPField[] getDeclaredFields(IASTNode point) {
+ return getDeclaredFields();
}
@Override
- public ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ public ICPPMethod[] getDeclaredMethods() {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getDeclaredMethods(this);
- return scope.getDeclaredMethods(point);
+ return scope.getDeclaredMethods();
}
@Override
- public ICPPConstructor[] getConstructors() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getConstructors(null);
+ @Deprecated
+ public ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ return getDeclaredMethods();
}
@Override
- public ICPPConstructor[] getConstructors(IASTNode point) {
+ public ICPPConstructor[] getConstructors() {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getConstructors(this);
- return scope.getConstructors(point);
+ return scope.getConstructors();
}
@Override
- public IBinding[] getFriends() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFriends(null);
+ @Deprecated
+ public ICPPConstructor[] getConstructors(IASTNode point) {
+ return getConstructors();
}
@Override
- public IBinding[] getFriends(IASTNode point) {
+ public IBinding[] getFriends() {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getFriends(this);
- return scope.getFriends(point);
+ return scope.getFriends();
}
@Override
- public ICPPClassType[] getNestedClasses() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getNestedClasses(null);
+ @Deprecated
+ public IBinding[] getFriends(IASTNode point) {
+ return getFriends();
}
@Override
- public ICPPClassType[] getNestedClasses(IASTNode point) {
+ public ICPPClassType[] getNestedClasses() {
ICPPClassSpecializationScope scope= getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getNestedClasses(this);
- return scope.getNestedClasses(point);
+ return scope.getNestedClasses();
}
-
+
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getUsingDeclarations(null);
+ @Deprecated
+ public ICPPClassType[] getNestedClasses(IASTNode point) {
+ return getNestedClasses();
}
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ public ICPPUsingDeclaration[] getUsingDeclarations() {
ICPPClassSpecializationScope scope = getSpecializationScope();
if (scope == null)
return ClassTypeHelper.getUsingDeclarations(this);
- return scope.getUsingDeclarations(point);
+ return scope.getUsingDeclarations();
+ }
+
+ @Override
+ @Deprecated
+ public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ return getUsingDeclarations();
}
@Override
public IField[] getFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFields(null);
+ return ClassTypeHelper.getFields(this);
}
@Override
+ @Deprecated
public IField[] getFields(IASTNode point) {
- return ClassTypeHelper.getFields(this, point);
+ return getFields();
}
@Override
@@ -355,24 +356,24 @@ public class CPPClassSpecialization extends CPPSpecialization
@Override
public ICPPMethod[] getMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getMethods(null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
+ @Deprecated
public ICPPMethod[] getMethods(IASTNode point) {
- return ClassTypeHelper.getMethods(this, point);
+ return getMethods();
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getAllDeclaredMethods(null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
+ @Deprecated
public ICPPMethod[] getAllDeclaredMethods(IASTNode point) {
- return ClassTypeHelper.getAllDeclaredMethods(this, point);
+ return getAllDeclaredMethods();
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
index 8628fc46eea..2495e588bd3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java
@@ -165,7 +165,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
@Override
public IField[] getFields() {
- return ClassTypeHelper.getFields(this, null);
+ return ClassTypeHelper.getFields(this);
}
@Override
@@ -175,12 +175,12 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
@Override
public ICPPMethod[] getMethods() {
- return ClassTypeHelper.getMethods(this, null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- return ClassTypeHelper.getAllDeclaredMethods(this, null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
index e2b7204f758..cf2a0db9771 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplateSpecialization.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
@@ -49,13 +48,12 @@ public class CPPClassTemplateSpecialization extends CPPClassSpecialization
@Override
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
if (fPartialSpecs == null) {
- IASTNode point= null; // Instantiation of dependent expressions may not work.
ICPPClassTemplate origTemplate= getSpecializedBinding();
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
ICPPClassSpecialization owner = getOwner();
for (int i = 0; i < orig.length; i++) {
- spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i], point);
+ spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i]);
}
fPartialSpecs = spec;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java
index 519858a03ed..7f398ec028c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java
@@ -336,7 +336,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
@Override
public IField[] getFields() {
- return ClassTypeHelper.getFields(this, null);
+ return ClassTypeHelper.getFields(this);
}
@Override
@@ -346,12 +346,12 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
@Override
public ICPPMethod[] getMethods() {
- return ClassTypeHelper.getMethods(this, null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- return ClassTypeHelper.getAllDeclaredMethods(this, null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java
index 551b3cf570d..de136d06218 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructor.java
@@ -34,16 +34,20 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalTypeId;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExecConstructorChain;
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
-
public CPPConstructor(ICPPASTFunctionDeclarator declarator) {
super(declarator);
}
@Override
- public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ public ICPPExecution getConstructorChainExecution() {
return getConstructorChainExecution(this);
}
+ @Override
+ public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
private static ICPPEvaluation getMemberEvaluation(ICPPField member, ICPPASTConstructorChainInitializer chainInitializer, IASTNode point) {
final IASTInitializer initializer = chainInitializer.getInitializer();
if (initializer instanceof ICPPASTInitializerClause) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java
index bc7a99bfdf0..fb937dab590 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorInstance.java
@@ -24,14 +24,18 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
* Instantiation of a constructor template
*/
public class CPPConstructorInstance extends CPPMethodInstance implements ICPPConstructorSpecialization {
-
public CPPConstructorInstance(ICPPConstructor orig, ICPPClassType owner, ICPPTemplateParameterMap tpmap,
ICPPTemplateArgument[] args, ICPPFunctionType type, IType[] exceptionSpec) {
super(orig, owner, tpmap, args, type, exceptionSpec);
}
@Override
+ public ICPPExecution getConstructorChainExecution() {
+ return CPPConstructorSpecialization.getConstructorChainExecution(this);
+ }
+
+ @Override
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return CPPConstructorSpecialization.getConstructorChainExecution(this, point);
+ return getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorSpecialization.java
index 3fda1d48113..f9b12306882 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorSpecialization.java
@@ -31,7 +31,7 @@ public class CPPConstructorSpecialization extends CPPMethodSpecialization
super(orig, owner, argMap, type, exceptionSpecs);
}
static <T extends ICPPConstructorSpecialization & ICPPInternalBinding> ICPPExecution
- getConstructorChainExecution(T functionSpec, IASTNode point) {
+ getConstructorChainExecution(T functionSpec) {
if (!functionSpec.isConstexpr()) {
return null;
}
@@ -40,11 +40,16 @@ public class CPPConstructorSpecialization extends CPPMethodSpecialization
if (def != null) {
return CPPConstructor.computeConstructorChainExecution(def);
}
- return CPPTemplates.instantiateConstructorChain(functionSpec, point);
+ return CPPTemplates.instantiateConstructorChain(functionSpec);
}
@Override
+ public ICPPExecution getConstructorChainExecution() {
+ return getConstructorChainExecution(this);
+ }
+
+ @Override
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return getConstructorChainExecution(this, point);
+ return getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplate.java
index 8b8f5187979..74cf28b34dd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplate.java
@@ -15,16 +15,20 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
public class CPPConstructorTemplate extends CPPMethodTemplate implements ICPPConstructor {
-
public CPPConstructorTemplate(IASTName name) {
super(name);
}
@Override
- public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr()) {
return null;
}
return CPPConstructor.computeConstructorChainExecution(getDefinition());
}
+
+ @Override
+ public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplateSpecialization.java
index 65eee9544c1..017e9d8a110 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPConstructorTemplateSpecialization.java
@@ -31,7 +31,12 @@ public class CPPConstructorTemplateSpecialization extends CPPMethodTemplateSpeci
}
@Override
+ public ICPPExecution getConstructorChainExecution() {
+ return CPPConstructorSpecialization.getConstructorChainExecution(this);
+ }
+
+ @Override
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return CPPConstructorSpecialization.getConstructorChainExecution(this, point);
+ return getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredConstructor.java
index 695e3a71ef5..7822ed8896a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredConstructor.java
@@ -77,7 +77,12 @@ public class CPPDeferredConstructor extends CPPDeferredFunction implements ICPPC
}
@Override
- public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ public ICPPExecution getConstructorChainExecution() {
return null;
}
+
+ @Override
+ public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java
index 59c01799955..e7ff3db2bdd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPDeferredFunction.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -173,7 +172,7 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPDeferr
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
return null;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerationSpecialization.java
index 484ee955d2f..23e42cc6ca9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerationSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPEnumerationSpecialization.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -39,16 +38,16 @@ public class CPPEnumerationSpecialization extends CPPSpecialization implements I
private boolean fInitializationComplete;
public static IBinding createInstance(ICPPEnumeration enumeration,
- ICPPClassSpecialization owner, ICPPTemplateParameterMap tpMap, IASTNode point) {
+ ICPPClassSpecialization owner, ICPPTemplateParameterMap tpMap) {
IType fixedType = enumeration.getFixedType();
if (fixedType != null) {
ICPPClassSpecialization within = CPPTemplates.getSpecializationContext(owner);
- InstantiationContext context = new InstantiationContext(tpMap, within, point);
+ InstantiationContext context = new InstantiationContext(tpMap, within);
fixedType = CPPTemplates.instantiateType(fixedType, context);
}
CPPEnumerationSpecialization specializedEnumeration =
new CPPEnumerationSpecialization(enumeration, owner, tpMap, fixedType);
- specializedEnumeration.initialize(point);
+ specializedEnumeration.initialize();
return specializedEnumeration;
}
@@ -59,13 +58,13 @@ public class CPPEnumerationSpecialization extends CPPSpecialization implements I
fEnumerators = new IEnumerator[specialized.getEnumerators().length];
}
- private void initialize(IASTNode point) {
+ private void initialize() {
ICPPTemplateParameterMap tpMap = getTemplateParameterMap();
IEnumerator[] enumerators = getSpecializedBinding().getEnumerators();
IType previousInternalType = CPPBasicType.INT;
for (int i = 0; i < enumerators.length; ++i) {
IEnumerator enumerator = enumerators[i];
- InstantiationContext context = new InstantiationContext(tpMap, this, point);
+ InstantiationContext context = new InstantiationContext(tpMap, this);
IValue specializedValue =
CPPTemplates.instantiateValue(enumerator.getValue(), context, IntegralValue.MAX_RECURSION_DEPTH);
IType internalType = null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPField.java
index 771218c58e2..c7b5f51af38 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPField.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPField.java
@@ -105,7 +105,7 @@ public class CPPField extends CPPVariable implements ICPPField {
}
public static int getFieldPosition(String fieldName, ICPPClassType classOwner) {
- IField[] fields = ClassTypeHelper.getDeclaredFields(classOwner, null);
+ IField[] fields = classOwner.getDeclaredFields();
for (int fieldPos = 0; fieldPos < fields.length; fieldPos++) {
if (fields[fieldPos].getName().equals(fieldName)) {
return fieldPos;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java
index 034e501b699..50741b31868 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunction.java
@@ -703,15 +703,15 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
return false;
}
- public static ICPPExecution getFunctionBodyExecution(ICPPFunction function, IASTNode point) {
+ public static ICPPExecution getFunctionBodyExecution(ICPPFunction function) {
if (function instanceof ICPPComputableFunction) {
- return ((ICPPComputableFunction) function).getFunctionBodyExecution(point);
+ return ((ICPPComputableFunction) function).getFunctionBodyExecution();
}
return null;
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
if (!isConstexpr())
return null;
if (getDefinition() == null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
index 347465a9b5b..23aad277867 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionSpecialization.java
@@ -327,7 +327,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
if (!isConstexpr()) {
return null;
}
@@ -336,6 +336,6 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
if (def != null) {
return CPPFunction.computeFunctionBodyExecution(def);
}
- return CPPTemplates.instantiateFunctionBody(this, point);
+ return CPPTemplates.instantiateFunctionBody(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java
index 2f6bc36efe4..cbc14890684 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionTemplate.java
@@ -442,7 +442,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
if (!isConstexpr()) {
return null;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
index 2218f6fa1cd..4b5e16035cd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitConstructor.java
@@ -27,14 +27,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeTraits;
* Binding for implicit constructors (default and copy constructor).
*/
public class CPPImplicitConstructor extends CPPImplicitMethod implements ICPPConstructor {
-
- IASTNode fPoint; // point of instantiation, if applicable
-
public CPPImplicitConstructor(ICPPClassScope scope, char[] name, ICPPParameter[] params, IASTNode point) {
// Note: the value passed for the 'isConstexpr' parameter of the CPPImplicitMethod constructor
// is irrelevant, as CPPImplicitConstructor overrides isConstexpr().
super(scope, name, createFunctionType(params), params, false);
- fPoint = point;
}
private static ICPPFunctionType createFunctionType(IParameter[] params) {
@@ -53,11 +49,16 @@ public class CPPImplicitConstructor extends CPPImplicitMethod implements ICPPCon
*/
@Override
public boolean isConstexpr() {
- return TypeTraits.isLiteralClass(getClassOwner(), fPoint);
+ return TypeTraits.isLiteralClass(getClassOwner());
}
@Override
- public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ public ICPPExecution getConstructorChainExecution() {
return CPPConstructor.getConstructorChainExecution(this);
}
+
+ @Override
+ public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
index 09a5842dc5b..8b96da20c3b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java
@@ -209,6 +209,6 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod
@Override
public IType[] getExceptionSpecification() {
- return ClassTypeHelper.getInheritedExceptionSpecification(this, null);
+ return ClassTypeHelper.getInheritedExceptionSpecification(this);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
index 80ac021215a..852de922d3b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethodSpecialization.java
@@ -117,10 +117,15 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization implement
}
@Override
- public IType[] getExceptionSpecification(IASTNode point) {
+ public IType[] getExceptionSpecification() {
if (isImplicit()) {
- return ClassTypeHelper.getInheritedExceptionSpecification(this, point);
+ return ClassTypeHelper.getInheritedExceptionSpecification(this);
}
return super.getExceptionSpecification();
}
+
+ @Override
+ public IType[] getExceptionSpecification(IASTNode point) {
+ return getExceptionSpecification();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScopeMapper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScopeMapper.java
index 8551d7bce10..db11c09d383 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScopeMapper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScopeMapper.java
@@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
@@ -398,14 +397,14 @@ public class CPPScopeMapper {
return scope;
}
- public ICPPClassType mapToAST(ICPPClassType type, IASTNode point) {
+ public ICPPClassType mapToAST(ICPPClassType type) {
if (type instanceof ICPPTemplateInstance) {
ICPPTemplateInstance inst= (ICPPTemplateInstance) type;
ICPPTemplateDefinition template= inst.getTemplateDefinition();
if (template instanceof IIndexBinding && template instanceof ICPPClassType) {
- IBinding mapped= mapToAST((ICPPClassType) template, point);
+ IBinding mapped= mapToAST((ICPPClassType) template);
if (mapped != template && mapped instanceof ICPPClassType) {
- mapped= CPPTemplates.instantiate((ICPPClassTemplate) mapped, inst.getTemplateArguments(), point);
+ mapped= CPPTemplates.instantiate((ICPPClassTemplate) mapped, inst.getTemplateArguments());
if (mapped instanceof ICPPClassType)
return (ICPPClassType) mapped;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
index a0d72588d36..aea11911c05 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateNonTypeArgument.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
@@ -30,18 +29,18 @@ import org.eclipse.core.runtime.Assert;
public final class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
private final ICPPEvaluation fEvaluation;
- public CPPTemplateNonTypeArgument(ICPPEvaluation evaluation, IASTNode point) {
+ public CPPTemplateNonTypeArgument(ICPPEvaluation evaluation) {
Assert.isNotNull(evaluation);
- if (evaluation instanceof EvalFixed || point == null ||
+ if (evaluation instanceof EvalFixed ||
evaluation.isTypeDependent() || evaluation.isValueDependent()) {
fEvaluation= evaluation;
} else {
- IValue value = evaluation.getValue(point);
+ IValue value = evaluation.getValue();
if (value == IntegralValue.ERROR) {
fEvaluation = EvalFixed.INCOMPLETE;
} else {
- fEvaluation= new EvalFixed(evaluation.getType(point),
- evaluation.getValueCategory(point), value);
+ fEvaluation= new EvalFixed(evaluation.getType(),
+ evaluation.getValueCategory(), value);
}
}
}
@@ -77,22 +76,22 @@ public final class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
@Override
public IValue getNonTypeValue() {
- return fEvaluation.getValue(null);
+ return fEvaluation.getValue();
}
@Override
public IType getTypeOfNonTypeValue() {
- return fEvaluation.getType(null);
+ return fEvaluation.getType();
}
@Override
public boolean isPackExpansion() {
- return fEvaluation.getType(null) instanceof ICPPParameterPackType;
+ return fEvaluation.getType() instanceof ICPPParameterPackType;
}
@Override
public ICPPTemplateArgument getExpansionPattern() {
- IType type = fEvaluation.getType(null);
+ IType type = fEvaluation.getType();
if (type instanceof ICPPParameterPackType) {
IType t= ((ICPPParameterPackType) type).getType();
if (t != null) {
@@ -102,7 +101,7 @@ public final class CPPTemplateNonTypeArgument implements ICPPTemplateArgument {
} else {
evaluation = new EvalTypeId(t, fEvaluation.getTemplateDefinition(), false, false, fEvaluation);
}
- return new CPPTemplateNonTypeArgument(evaluation, null);
+ return new CPPTemplateNonTypeArgument(evaluation);
}
}
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownTypeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownTypeScope.java
index e308094f3df..7415cdf13b0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownTypeScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownTypeScope.java
@@ -156,8 +156,7 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
if (lookup.isPrefixLookup()) {
// If name lookup is performed for the purpose of code completion in a dependent context,
// try to give some useful results heuristically.
- IScope scope = HeuristicResolver.findConcreteScopeForType(fScopeType,
- lookup.getLookupPoint());
+ IScope scope = HeuristicResolver.findConcreteScopeForType(fScopeType);
if (scope != null) {
return scope.getBindings(lookup);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
index 2dcd6ebfa22..ba153cf6c15 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVariable.java
@@ -262,7 +262,12 @@ public class CPPVariable extends PlatformObject implements ICPPInternalDeclaredV
}
if (!initEval.isValueDependent() ) {
IASTNode point = fDefinition != null ? fDefinition : fDeclarations[0];
- return initEval.getValue(point);
+ CPPSemantics.pushLookupPoint(point);
+ try {
+ return initEval.getValue();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
return DependentValue.create(initEval);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
index a7046ae2233..cff9faf585d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java
@@ -153,7 +153,7 @@ public class ClassTypeHelper {
if (type.isSameType(classType)) {
return true;
}
- for (IBinding friend : getFriends(classType, null)) {
+ for (IBinding friend : classType.getFriends()) {
if (friend instanceof ICPPClassType && type.isSameType((IType) friend)) {
return true;
}
@@ -161,7 +161,7 @@ public class ClassTypeHelper {
} else if (binding instanceof ICPPFunction) {
type = ((ICPPFunction) binding).getType();
char[] name = binding.getNameCharArray();
- for (IBinding friend : getFriends(classType, null)) {
+ for (IBinding friend : classType.getFriends()) {
if (friend instanceof ICPPFunction &&
CharArrayUtils.equals(name, friend.getNameCharArray()) &&
SemanticUtil.haveSameOwner(binding, friend) &&
@@ -251,70 +251,28 @@ public class ClassTypeHelper {
return ArrayUtil.trim(result, resultSize);
}
- public static ICPPBase[] getBases(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getBases(point);
- return classType.getBases();
- }
-
- public static ICPPConstructor[] getConstructors(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getConstructors(point);
- return classType.getConstructors();
- }
-
- public static ICPPField[] getDeclaredFields(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getDeclaredFields(point);
- return classType.getDeclaredFields();
- }
-
- public static ICPPMethod[] getDeclaredMethods(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getDeclaredMethods(point);
- return classType.getDeclaredMethods();
- }
-
- public static IBinding[] getFriends(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getFriends(point);
- return classType.getFriends();
- }
-
- public static ICPPClassType[] getNestedClasses(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getNestedClasses(point);
- return classType.getNestedClasses();
- }
-
- public static ICPPUsingDeclaration[] getUsingDeclarations(ICPPClassType classType, IASTNode point) {
- if (classType instanceof ICPPClassSpecialization)
- return ((ICPPClassSpecialization) classType).getUsingDeclarations(point);
- return classType.getUsingDeclarations();
- }
-
/**
* Returns all direct and indirect base classes.
*
* @param classType a class
* @return An array of base classes in arbitrary order.
*/
- public static ICPPClassType[] getAllBases(ICPPClassType classType, IASTNode point) {
+ public static ICPPClassType[] getAllBases(ICPPClassType classType) {
Set<ICPPClassType> result= new HashSet<>();
result.add(classType);
- getAllBases(classType, result, point);
+ getAllBases(classType, result);
result.remove(classType);
return result.toArray(new ICPPClassType[result.size()]);
}
- private static void getAllBases(ICPPClassType classType, Set<ICPPClassType> result, IASTNode point) {
- ICPPBase[] bases= getBases(classType, point);
+ private static void getAllBases(ICPPClassType classType, Set<ICPPClassType> result) {
+ ICPPBase[] bases= classType.getBases();
for (ICPPBase base : bases) {
IBinding b= base.getBaseClass();
if (b instanceof ICPPClassType) {
final ICPPClassType baseClass = (ICPPClassType) b;
if (result.add(baseClass)) {
- getAllBases(baseClass, result, point);
+ getAllBases(baseClass, result);
}
}
}
@@ -322,35 +280,33 @@ public class ClassTypeHelper {
/**
* Returns all (direct or indirect) virtual base classes of {@code classType}.
- *
- * @param point the point of instantiation for name lookups
*/
- public static ICPPClassType[] getVirtualBases(ICPPClassType classType, IASTNode point) {
+ public static ICPPClassType[] getVirtualBases(ICPPClassType classType) {
Set<ICPPClassType> virtualBases = new HashSet<>();
Set<ICPPClassType> nonvirtualBases = new HashSet<>();
nonvirtualBases.add(classType);
- getVirtualBases(classType, virtualBases, nonvirtualBases, point);
+ getVirtualBases(classType, virtualBases, nonvirtualBases);
return virtualBases.toArray(new ICPPClassType[virtualBases.size()]);
}
/**
- * Helper function for {@link #getVirtualBases(ICPPClassType, IASTNode)}.
+ * Helper function for {@link #getVirtualBases(ICPPClassType)}.
*/
private static void getVirtualBases(ICPPClassType classType, Set<ICPPClassType> virtualBases,
- Set<ICPPClassType> nonvirtualBases, IASTNode point) {
- ICPPBase[] bases = getBases(classType, point);
+ Set<ICPPClassType> nonvirtualBases) {
+ ICPPBase[] bases = classType.getBases();
for (ICPPBase base : bases) {
IBinding b = base.getBaseClass();
if (b instanceof ICPPClassType) {
final ICPPClassType baseClass = (ICPPClassType) b;
if (base.isVirtual()) {
if (virtualBases.add(baseClass)) {
- getVirtualBases(baseClass, virtualBases, nonvirtualBases, point);
+ getVirtualBases(baseClass, virtualBases, nonvirtualBases);
}
} else {
// A non-virtual base could have virtual bases in its hierarchy.
if (nonvirtualBases.add(baseClass)) {
- getVirtualBases(baseClass, virtualBases, nonvirtualBases, point);
+ getVirtualBases(baseClass, virtualBases, nonvirtualBases);
}
}
}
@@ -362,8 +318,8 @@ public class ClassTypeHelper {
*
* @return {@code true} if {@code subclass} is a subclass of {@code superclass}.
*/
- public static boolean isSubclass(ICPPClassType subclass, ICPPClassType superclass, IASTNode point) {
- ICPPBase[] bases= getBases(subclass, point);
+ public static boolean isSubclass(ICPPClassType subclass, ICPPClassType superclass) {
+ ICPPBase[] bases= subclass.getBases();
for (ICPPBase base : bases) {
IBinding b= base.getBaseClass();
if (b instanceof ICPPClassType) {
@@ -371,7 +327,7 @@ public class ClassTypeHelper {
if (baseClass.isSameType(superclass)) {
return true;
}
- if (isSubclass(baseClass, superclass, point)) {
+ if (isSubclass(baseClass, superclass)) {
return true;
}
}
@@ -379,22 +335,22 @@ public class ClassTypeHelper {
return false;
}
- public static ICPPMethod[] getAllDeclaredMethods(ICPPClassType ct, IASTNode point) {
- ICPPMethod[] methods= getDeclaredMethods(ct, point);
- ICPPClassType[] bases= getAllBases(ct, point);
+ public static ICPPMethod[] getAllDeclaredMethods(ICPPClassType ct) {
+ ICPPMethod[] methods= ct.getDeclaredMethods();
+ ICPPClassType[] bases= getAllBases(ct);
for (ICPPClassType base : bases) {
- methods = ArrayUtil.addAll(ICPPMethod.class, methods, getDeclaredMethods(base, point));
+ methods = ArrayUtil.addAll(ICPPMethod.class, methods, base.getDeclaredMethods());
}
return ArrayUtil.trim(ICPPMethod.class, methods);
}
- public static ICPPMethod[] getMethods(ICPPClassType ct, IASTNode point) {
- ObjectSet<ICPPMethod> set = getOwnMethods(ct, point);
+ public static ICPPMethod[] getMethods(ICPPClassType ct) {
+ ObjectSet<ICPPMethod> set = getOwnMethods(ct);
- ICPPClassType[] bases= getAllBases(ct, point);
+ ICPPClassType[] bases= getAllBases(ct);
for (ICPPClassType base : bases) {
- set.addAll(getDeclaredMethods(base, point));
- set.addAll(getImplicitMethods(base, point));
+ set.addAll(base.getDeclaredMethods());
+ set.addAll(getImplicitMethods(base));
}
return set.keyArray(ICPPMethod.class);
}
@@ -403,21 +359,19 @@ public class ClassTypeHelper {
* Returns methods either declared by the given class or generated by the compiler. Does not
* include methods declared in base classes.
*/
- public static ObjectSet<ICPPMethod> getOwnMethods(ICPPClassType classType, IASTNode point) {
+ public static ObjectSet<ICPPMethod> getOwnMethods(ICPPClassType classType) {
ObjectSet<ICPPMethod> set= new ObjectSet<>(4);
- set.addAll(ClassTypeHelper.getDeclaredMethods(classType, point));
- set.addAll(getImplicitMethods(classType, point));
+ set.addAll(classType.getDeclaredMethods());
+ set.addAll(getImplicitMethods(classType));
return set;
}
- public static ICPPMethod[] getImplicitMethods(ICPPClassType classType, IASTNode point) {
- return getImplicitMethods(classType.getCompositeScope(), point);
+ public static ICPPMethod[] getImplicitMethods(ICPPClassType classType) {
+ return getImplicitMethods(classType.getCompositeScope());
}
- public static ICPPMethod[] getImplicitMethods(IScope scope, IASTNode point) {
- if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getImplicitMethods(point);
- } else if (scope instanceof ICPPClassScope) {
+ public static ICPPMethod[] getImplicitMethods(IScope scope) {
+ if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope) scope).getImplicitMethods();
}
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
@@ -488,7 +442,7 @@ public class ClassTypeHelper {
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
}
ICPPConstructor[] constructors = scope.getConstructors();
- return getAllConstructors(host, constructors, null);
+ return getAllConstructors(host, constructors);
}
/**
@@ -497,18 +451,17 @@ public class ClassTypeHelper {
*
* @param classType the class to get the constructors for
* @param declaredAndImplicitConstructors the declared and implicit constructors of the class
- * @param point the point of template instantiation, if applicable
* @return an array of all class constructors
*/
public static ICPPConstructor[] getAllConstructors(ICPPClassType classType,
- ICPPConstructor[] declaredAndImplicitConstructors, IASTNode point) {
+ ICPPConstructor[] declaredAndImplicitConstructors) {
IType[][] paramTypes = new IType[declaredAndImplicitConstructors.length][];
for (int i = 0; i < declaredAndImplicitConstructors.length; i++) {
ICPPConstructor ctor = declaredAndImplicitConstructors[i];
paramTypes[i] = ctor.getType().getParameterTypes();
}
ICPPConstructor[] inheritedConstructors = getInheritedConstructors(
- (ICPPClassScope) classType.getCompositeScope(), getBases(classType, point), paramTypes, point);
+ (ICPPClassScope) classType.getCompositeScope(), classType.getBases(), paramTypes);
return ArrayUtil.addAll(declaredAndImplicitConstructors, inheritedConstructors);
}
@@ -518,11 +471,10 @@ public class ClassTypeHelper {
* @param scope the composite scope of the class to get the constructors for
* @param bases the base class relationships of the class
* @param existingConstructorParamTypes parameter types of the declared and the implicit constructors
- * @param point the point of template instantiation, if applicable
* @return an array of all inherited constructors
*/
public static ICPPConstructor[] getInheritedConstructors(ICPPClassScope scope, ICPPBase[] bases,
- IType[][] existingConstructorParamTypes, IASTNode point) {
+ IType[][] existingConstructorParamTypes) {
ICPPConstructor[] inheritedConstructors = ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
int n = 0;
for (ICPPBase base : bases) {
@@ -532,7 +484,7 @@ public class ClassTypeHelper {
if (!(baseType instanceof ICPPClassType))
continue;
ICPPClassType baseClass = (ICPPClassType) baseType;
- ICPPConstructor[] ctors = getConstructors(baseClass, point);
+ ICPPConstructor[] ctors = baseClass.getConstructors();
for (ICPPConstructor ctor : ctors) {
if (canBeInherited(ctor, baseClass, existingConstructorParamTypes))
inheritedConstructors = appendAt(inheritedConstructors, n++, ctor);
@@ -650,11 +602,11 @@ public class ClassTypeHelper {
}
- public static ICPPField[] getFields(ICPPClassType ct, IASTNode point) {
- ICPPField[] fields = getDeclaredFields(ct, point);
- ICPPClassType[] bases = getAllBases(ct, point);
+ public static ICPPField[] getFields(ICPPClassType ct) {
+ ICPPField[] fields = ct.getDeclaredFields();
+ ICPPClassType[] bases = getAllBases(ct);
for (ICPPClassType base : bases) {
- fields = ArrayUtil.addAll(ICPPField.class, fields, getDeclaredFields(base, point));
+ fields = ArrayUtil.addAll(ICPPField.class, fields, base.getDeclaredFields());
}
return ArrayUtil.trim(ICPPField.class, fields);
}
@@ -690,8 +642,7 @@ public class ClassTypeHelper {
final ICPPClassType mcl= m.getClassOwner();
if (mcl != null) {
final ICPPFunctionType mft= m.getType();
- IASTNode point = null; // Instantiation of dependent expressions may not work
- ICPPMethod[] allMethods= ClassTypeHelper.getMethods(mcl, point);
+ ICPPMethod[] allMethods= ClassTypeHelper.getMethods(mcl);
for (ICPPMethod method : allMethods) {
if (CharArrayUtils.equals(mname, method.getNameCharArray()) && functionTypesAllowOverride(mft, method.getType())) {
if (method.isVirtual()) {
@@ -747,7 +698,7 @@ public class ClassTypeHelper {
if (sourceClass == null || targetClass == null)
return false;
- ICPPClassType[] bases= getAllBases(sourceClass, null);
+ ICPPClassType[] bases= getAllBases(sourceClass);
for (ICPPClassType base : bases) {
if (base.isSameType(targetClass))
return true;
@@ -759,7 +710,7 @@ public class ClassTypeHelper {
/**
* Returns all methods that are overridden by the given {@code method}.
*/
- public static ICPPMethod[] findOverridden(ICPPMethod method, IASTNode point) {
+ public static ICPPMethod[] findOverridden(ICPPMethod method) {
if (method instanceof ICPPConstructor)
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
@@ -773,11 +724,11 @@ public class ClassTypeHelper {
final ICPPFunctionType methodType= method.getType();
virtualInClass.put(mcl, method.isVirtual());
- ICPPBase[] bases= getBases(mcl, point);
+ ICPPBase[] bases= mcl.getBases();
for (ICPPBase base : bases) {
IBinding b= base.getBaseClass();
if (b instanceof ICPPClassType) {
- findOverridden((ICPPClassType) b, point, mname, methodType, virtualInClass,
+ findOverridden((ICPPClassType) b, mname, methodType, virtualInClass,
result, CPPSemantics.MAX_INHERITANCE_DEPTH);
}
}
@@ -794,7 +745,7 @@ public class ClassTypeHelper {
*
* @return whether {@code classType} contains an overridden method.
*/
- private static boolean findOverridden(ICPPClassType classType, IASTNode point, char[] methodName,
+ private static boolean findOverridden(ICPPClassType classType, char[] methodName,
ICPPFunctionType methodType, Map<ICPPClassType, Boolean> virtualInClass,
List<ICPPMethod> result, int maxdepth) {
// Prevent recursion due to a hierarchy of unbounded depth, e.g. A<I> deriving from A<I - 1>.
@@ -805,7 +756,7 @@ public class ClassTypeHelper {
if (visitedBefore != null)
return visitedBefore;
- ICPPMethod[] methods= ClassTypeHelper.getDeclaredMethods(classType, point);
+ ICPPMethod[] methods= classType.getDeclaredMethods();
ICPPMethod candidate= null;
boolean hasOverridden= false;
for (ICPPMethod method : methods) {
@@ -820,11 +771,11 @@ public class ClassTypeHelper {
// Prevent recursion due to a class inheriting (directly or indirectly) from itself.
virtualInClass.put(classType, hasOverridden);
- ICPPBase[] bases= getBases(classType, point);
+ ICPPBase[] bases= classType.getBases();
for (ICPPBase base : bases) {
IBinding b= base.getBaseClass();
if (b instanceof ICPPClassType) {
- if (findOverridden((ICPPClassType) b, point, methodName, methodType, virtualInClass,
+ if (findOverridden((ICPPClassType) b, methodName, methodType, virtualInClass,
result, maxdepth - 1)) {
hasOverridden= true;
}
@@ -842,7 +793,7 @@ public class ClassTypeHelper {
/**
* Returns all methods found in the index, that override the given {@code method}.
*/
- public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method, IASTNode point)
+ public static ICPPMethod[] findOverriders(IIndex index, ICPPMethod method)
throws CoreException {
if (!isVirtual(method))
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
@@ -852,18 +803,18 @@ public class ClassTypeHelper {
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
ICPPClassType[] subclasses= getSubClasses(index, mcl);
- return findOverriders(subclasses, method, point);
+ return findOverriders(subclasses, method);
}
/**
* Returns all methods belonging to the given set of classes that override the given {@code method}.
*/
- public static ICPPMethod[] findOverriders(ICPPClassType[] subclasses, ICPPMethod method, IASTNode point) {
+ public static ICPPMethod[] findOverriders(ICPPClassType[] subclasses, ICPPMethod method) {
final char[] mname= method.getNameCharArray();
final ICPPFunctionType mft= method.getType();
final ArrayList<ICPPMethod> result= new ArrayList<>();
for (ICPPClassType subClass : subclasses) {
- ICPPMethod[] methods= ClassTypeHelper.getDeclaredMethods(subClass, point);
+ ICPPMethod[] methods= subClass.getDeclaredMethods();
for (ICPPMethod candidate : methods) {
if (CharArrayUtils.equals(mname, candidate.getNameCharArray()) &&
functionTypesAllowOverride(mft, candidate.getType())) {
@@ -972,10 +923,10 @@ public class ClassTypeHelper {
/**
* For implicit methods the exception specification is inherited, search it.
*/
- public static IType[] getInheritedExceptionSpecification(ICPPMethod implicitMethod, IASTNode point) {
+ public static IType[] getInheritedExceptionSpecification(ICPPMethod implicitMethod) {
// See 15.4.13
ICPPClassType owner= implicitMethod.getClassOwner();
- if (owner == null || ClassTypeHelper.getBases(owner, point).length == 0)
+ if (owner == null || owner.getBases().length == 0)
return null;
// We use a list as types aren't comparable, and can have duplicates (15.4.6)
@@ -984,10 +935,10 @@ public class ClassTypeHelper {
return null;
List<IType> inheritedTypeids = new ArrayList<>();
- ICPPClassType[] bases= getAllBases(owner, point);
+ ICPPClassType[] bases= getAllBases(owner);
for (ICPPClassType base : bases) {
if (!(base instanceof ICPPDeferredClassInstance)) {
- ICPPMethod baseMethod= getMethodInClass(base, kind, point);
+ ICPPMethod baseMethod= getMethodInClass(base, kind);
if (baseMethod != null) {
IType[] baseExceptionSpec= baseMethod.getExceptionSpecification();
if (baseExceptionSpec == null)
@@ -1025,19 +976,19 @@ public class ClassTypeHelper {
return null;
}
- public static ICPPMethod getMethodInClass(ICPPClassType ct, MethodKind kind, IASTNode point) {
+ public static ICPPMethod getMethodInClass(ICPPClassType ct, MethodKind kind) {
switch (kind) {
case DEFAULT_CTOR:
case COPY_CTOR:
case MOVE_CTOR:
- for (ICPPConstructor ctor : getConstructors(ct, point)) {
+ for (ICPPConstructor ctor : ct.getConstructors()) {
if (!ctor.isImplicit() && getMethodKind(ct, ctor) == kind)
return ctor;
}
return null;
case COPY_ASSIGNMENT_OP:
case MOVE_ASSIGNMENT_OP:
- for (ICPPMethod method : getDeclaredMethods(ct, point)) {
+ for (ICPPMethod method : ct.getDeclaredMethods()) {
if (method instanceof ICPPConstructor)
continue;
if (getMethodKind(ct, method) == kind)
@@ -1045,7 +996,7 @@ public class ClassTypeHelper {
}
return null;
case DTOR:
- for (ICPPMethod method : getDeclaredMethods(ct, point)) {
+ for (ICPPMethod method : ct.getDeclaredMethods()) {
if (method.isDestructor())
return method;
}
@@ -1098,7 +1049,7 @@ public class ClassTypeHelper {
if (visibility >= 0)
return visibility;
- ICPPMethod[] implicitMethods = getImplicitMethods(classType, null);
+ ICPPMethod[] implicitMethods = getImplicitMethods(classType);
for (ICPPMethod implicitMethod : implicitMethods) {
if (member.equals(implicitMethod)) {
return ICPPClassType.v_public;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPClassSpecializationScope.java
index a6386ebde6e..b6df9e9556e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPClassSpecializationScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPClassSpecializationScope.java
@@ -11,13 +11,11 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
@@ -43,42 +41,30 @@ public interface ICPPClassSpecializationScope extends ICPPClassScope {
/**
* Computes the bases via the original class.
*/
- ICPPBase[] getBases(IASTNode point);
-
- /**
- * Similar to {@link ICPPClassScope#getConstructors()} but a accepts a starting point
- * for template instantiation.
- */
- ICPPConstructor[] getConstructors(IASTNode point);
-
- /**
- * Similar to {@link ICPPClassScope#getImplicitMethods()} but a accepts a starting point
- * for template instantiation.
- */
- ICPPMethod[] getImplicitMethods(IASTNode point);
+ ICPPBase[] getBases();
/**
* Computes the methods via the original class.
*/
- ICPPMethod[] getDeclaredMethods(IASTNode point);
+ ICPPMethod[] getDeclaredMethods();
/**
* Computes the fields via the original class.
*/
- ICPPField[] getDeclaredFields(IASTNode point);
+ ICPPField[] getDeclaredFields();
/**
* Computes the friends via the original class.
*/
- IBinding[] getFriends(IASTNode point);
+ IBinding[] getFriends();
/**
* Computes the nested classes via the original class.
*/
- ICPPClassType[] getNestedClasses(IASTNode point);
+ ICPPClassType[] getNestedClasses();
/**
* Computes the using declarations via the original class.
*/
- ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point);
+ ICPPUsingDeclaration[] getUsingDeclarations();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPComputableFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPComputableFunction.java
index e1d2d4800b3..3cea4d8959e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPComputableFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPComputableFunction.java
@@ -10,16 +10,13 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
-
/**
* Represents a function whose executing may be simulated at parsing time.
*/
public interface ICPPComputableFunction {
/**
- * For a constexpr function returns the ICPPExecution for its body. Otherwise returns
* {@code null}.
- * @param point the point of instantiation for name lookups
+ * For a constexpr function returns the ICPPExecution for its body. Otherwise returns
*/
- public ICPPExecution getFunctionBodyExecution(IASTNode point);
+ public ICPPExecution getFunctionBodyExecution();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java
index 78bead1b726..df14da0224c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ICPPEvaluation.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -46,31 +45,25 @@ public interface ICPPEvaluation {
*
* @param point the point of instantiation, determines the scope for name lookups
*/
- boolean isConstantExpression(IASTNode point);
+ boolean isConstantExpression();
/**
* Returns the type of the expression.
*
* If the expression evaluates to a function set, a {@code FunctionSetType} is returned.
- *
- * @param point the point of instantiation, determines the scope for name lookups
*/
- IType getType(IASTNode point);
+ IType getType();
/**
* Returns the value of the expression.
- *
- * @param point the point of instantiation, determines the scope for name lookups
*/
- IValue getValue(IASTNode point);
+ IValue getValue();
/**
* Returns the category of the expression value.
* @see ValueCategory
- *
- * @param point the point of instantiation, determines the scope for name lookups
*/
- ValueCategory getValueCategory(IASTNode point);
+ ValueCategory getValueCategory();
/**
* Returns a signature uniquely identifying the evaluation. Two evaluations with identical
@@ -98,15 +91,12 @@ public interface ICPPEvaluation {
public static final int MAX_CONSTEXPR_EVALUATION_STEPS = 1024;
private int fStepsPerformed;
- private IASTNode fPoint;
/**
* Constructs a ConstexprEvaluationContext for a new constexpr evaluation.
- * @param point the point of instantiation, determines the scope for name lookups
*/
- public ConstexprEvaluationContext(IASTNode point) {
+ public ConstexprEvaluationContext() {
fStepsPerformed = 0;
- fPoint = point;
}
/**
@@ -125,13 +115,6 @@ public interface ICPPEvaluation {
public int getStepsPerformed() {
return fStepsPerformed;
}
-
- /**
- * Returns the point of instantiation.
- */
- public IASTNode getPoint() {
- return fPoint;
- }
}
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ImplicitsAnalysis.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ImplicitsAnalysis.java
index f485adbe428..d552a84d2da 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ImplicitsAnalysis.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ImplicitsAnalysis.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
@@ -45,7 +44,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
*/
final class ImplicitsAnalysis {
private final ICPPClassType classType;
- private final ICPPASTCompositeTypeSpecifier compositeTypeSpecifier;
private boolean hasConstructor;
private boolean hasCopyConstructor;
private boolean hasCopyAssignmentOperator;
@@ -54,7 +52,6 @@ final class ImplicitsAnalysis {
ImplicitsAnalysis(ICPPASTCompositeTypeSpecifier compositeTypeSpecifier, ICPPClassType classType) {
this.classType = classType;
- this.compositeTypeSpecifier = compositeTypeSpecifier;
analyzeMembers(compositeTypeSpecifier);
}
@@ -162,15 +159,15 @@ final class ImplicitsAnalysis {
if (hasNonStaticFields)
return false;
- ICPPBase[] bases = ClassTypeHelper.getBases(classType, compositeTypeSpecifier);
+ ICPPBase[] bases = classType.getBases();
for (ICPPBase base : bases) {
if (base.isVirtual())
return false;
}
- ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, compositeTypeSpecifier);
+ ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType);
for (ICPPClassType baseClass : baseClasses) {
- ICPPConstructor ctor = getDefaultConstructor(baseClass, compositeTypeSpecifier);
+ ICPPConstructor ctor = getDefaultConstructor(baseClass);
if (ctor == null || !ctor.isConstexpr())
return false;
}
@@ -180,8 +177,8 @@ final class ImplicitsAnalysis {
/**
* Returns a user-defined or implicit default constructor for the given class.
*/
- private static ICPPConstructor getDefaultConstructor(ICPPClassType classType, IASTNode point) {
- for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
+ private static ICPPConstructor getDefaultConstructor(ICPPClassType classType) {
+ for (ICPPConstructor ctor : classType.getConstructors()) {
if (ClassTypeHelper.getMethodKind(classType, ctor) == ClassTypeHelper.MethodKind.DEFAULT_CTOR)
return ctor;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/InstantiationContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/InstantiationContext.java
index b9871dba33c..78d607ea9e4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/InstantiationContext.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/InstantiationContext.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumerationSpecialization;
@@ -30,7 +29,6 @@ public final class InstantiationContext {
private CPPTemplateParameterMap parameterMap;
private int packOffset;
private final ICPPSpecialization contextSpecialization;
- private final IASTNode point;
private boolean expandPack;
private boolean packExpanded;
@@ -45,42 +43,37 @@ public final class InstantiationContext {
* @param packOffset parameter pack offset, or -1 if expansion of a parameter pack is not desired pack.
* @param contextSpecialization the specialization if instantiation happens inside a specialized
* type or function, otherwise {@code null}.
- * @param point the point of instantiation
*/
public InstantiationContext(ICPPTemplateParameterMap parameterMap, int packOffset,
- ICPPSpecialization contextSpecialization, IASTNode point) {
+ ICPPSpecialization contextSpecialization) {
this.parameterMap = (CPPTemplateParameterMap) parameterMap;
this.packOffset = packOffset;
this.contextSpecialization = contextSpecialization;
- this.point = point;
}
/**
* @param parameterMap mapping of template parameters to arguments, may be {@code null}.
* @param contextSpecialization the specialization if instantiation happens inside a specialized
* type or function, otherwise {@code null}.
- * @param point the point of instantiation
*/
public InstantiationContext(ICPPTemplateParameterMap parameterMap,
- ICPPSpecialization contextSpecialization, IASTNode point) {
- this(parameterMap, -1, contextSpecialization, point);
+ ICPPSpecialization contextSpecialization) {
+ this(parameterMap, -1, contextSpecialization);
}
/**
* @param parameterMap mapping of template parameters to arguments, may be {@code null}.
* @param packOffset parameter pack offset, or -1 if not known
- * @param point the point of instantiation
*/
- public InstantiationContext(ICPPTemplateParameterMap parameterMap, int packOffset, IASTNode point) {
- this(parameterMap, packOffset, null, point);
+ public InstantiationContext(ICPPTemplateParameterMap parameterMap, int packOffset) {
+ this(parameterMap, packOffset, null);
}
/**
* @param parameterMap mapping of template parameters to arguments, may be {@code null}.
- * @param point the point of instantiation
*/
- public InstantiationContext(ICPPTemplateParameterMap parameterMap, IASTNode point) {
- this(parameterMap, -1, null, point);
+ public InstantiationContext(ICPPTemplateParameterMap parameterMap) {
+ this(parameterMap, -1, null);
}
/**
@@ -147,13 +140,6 @@ public final class InstantiationContext {
}
/**
- * Returns the point of instantiation
- */
- public final IASTNode getPoint() {
- return point;
- }
-
- /**
* Returns {@code true} if the pack offset is specified.
*/
public boolean hasPackOffset() {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java
index aca2126bdbc..e28e29bfa56 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AccessContext.java
@@ -54,7 +54,12 @@ public class AccessContext {
* @return {@code true} if the binding is accessible.
*/
public static boolean isAccessible(IBinding binding, IASTName from) {
- return new AccessContext(from).isAccessible(binding);
+ CPPSemantics.pushLookupPoint(from);
+ try {
+ return new AccessContext(from).isAccessible(binding);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
/**
@@ -67,7 +72,12 @@ public class AccessContext {
* @return {@code true} if the binding is accessible.
*/
public static boolean isAccessible(IBinding binding, int bindingVisibility, IASTName from) {
- return new AccessContext(from).isAccessible(binding, bindingVisibility);
+ CPPSemantics.pushLookupPoint(from);
+ try {
+ return new AccessContext(from).isAccessible(binding, bindingVisibility);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
private final IASTName name;
@@ -210,7 +220,7 @@ public class AccessContext {
return isAccessible(bindingVisibility, accessLevel);
}
- ICPPUsingDeclaration[] usingDecls = ClassTypeHelper.getUsingDeclarations(derivedClass, name);
+ ICPPUsingDeclaration[] usingDecls = derivedClass.getUsingDeclarations();
for (ICPPUsingDeclaration decl : usingDecls) {
for (IBinding delegate : decl.getDelegates()) {
if (delegate.equals(binding)) {
@@ -220,7 +230,7 @@ public class AccessContext {
}
}
- ICPPBase[] bases = ClassTypeHelper.getBases(derivedClass, name);
+ ICPPBase[] bases = derivedClass.getBases();
if (bases != null) {
for (ICPPBase base : bases) {
IBinding baseBinding = base.getBaseClass();
@@ -273,7 +283,7 @@ public class AccessContext {
if (derived.isSameType(classType))
return true;
- ICPPBase[] bases = ClassTypeHelper.getBases(derived, name);
+ ICPPBase[] bases = derived.getBases();
if (bases != null) {
for (ICPPBase base : bases) {
IBinding baseClass = base.getBaseClass();
@@ -303,8 +313,7 @@ public class AccessContext {
if (scope instanceof ICPPInternalUnknownScope) {
IType scopeType = ((ICPPInternalUnknownScope) scope).getScopeType();
if (scopeType instanceof ICPPUnknownType && isPrefixLookup) {
- scopeType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) scopeType,
- name.getParent());
+ scopeType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) scopeType);
if (scopeType instanceof ICPPClassType) {
return (ICPPClassType) scopeType;
}
@@ -341,7 +350,7 @@ public class AccessContext {
return true;
}
if (maxdepth > 0) {
- for (ICPPBase cppBase : ClassTypeHelper.getBases(derived, point)) {
+ for (ICPPBase cppBase : derived.getBases()) {
IBinding base = cppBase.getBaseClass();
if (!(target instanceof ICPPSpecialization)) {
while (base instanceof ICPPSpecialization) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java
index 73761a20eaf..9e97a2a1ff4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BaseClassLookup.java
@@ -38,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
@@ -215,7 +214,7 @@ class BaseClassLookup {
// its base classes.
ICPPClassType baseClass= result.getClassType();
if (baseClass != null) {
- ICPPBase[] grandBases= ClassTypeHelper.getBases(baseClass, data.getLookupPoint());
+ ICPPBase[] grandBases= baseClass.getBases();
if (grandBases != null && grandBases.length > 0) {
HashSet<IBinding> grandBaseBindings= null;
BitSet selectedBases= null;
@@ -318,7 +317,7 @@ class BaseClassLookup {
if (fClassType != null) {
ICPPBase[] bases= null;
- bases= ClassTypeHelper.getBases(fClassType, fLookupPoint);
+ bases= fClassType.getBases();
if (bases != null && bases.length > 0) {
for (ICPPBase base : bases) {
IBinding baseBinding = base.getBaseClass();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
index 95152a50792..c5678eb8782 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
@@ -63,16 +63,15 @@ class BuiltinOperators {
private static final IType PTR_DIFF = new CPPBasicType(Kind.eInt, 0);
public static ICPPFunction[] create(OverloadableOperator operator, ICPPEvaluation[] args,
- IASTNode point, Object[] globCandidates) {
+ Object[] globCandidates) {
if (operator == null || args == null || args.length == 0)
return EMPTY;
- return new BuiltinOperators(operator, args, point, globCandidates).create();
+ return new BuiltinOperators(operator, args, globCandidates).create();
}
private final OverloadableOperator fOperator;
private final boolean fUnary;
- private final IASTNode fPoint;
private IType fType1;
private IType fType2;
private IType[][] fClassConversionTypes= { null, null };
@@ -82,22 +81,22 @@ class BuiltinOperators {
private Set<String> fSignatures;
private Object[] fGlobalCandidates;
- BuiltinOperators(OverloadableOperator operator, ICPPEvaluation[] args, IASTNode point,
+ BuiltinOperators(OverloadableOperator operator, ICPPEvaluation[] args,
Object[] globCandidates) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
fFileScope= point == null ?
new CPPScope.CPPScopeProblem(null, IProblemBinding.SEMANTIC_BAD_SCOPE) :
point.getTranslationUnit().getScope();
fOperator= operator;
- fPoint = point;
fUnary= args.length < 2;
fGlobalCandidates= globCandidates;
if (args.length > 0) {
- IType type= args[0].getType(point);
+ IType type= args[0].getType();
if (!(type instanceof ISemanticProblem))
fType1= type;
}
if (args.length > 1) {
- IType type= args[1].getType(point);
+ IType type= args[1].getType();
if (!(type instanceof ISemanticProblem))
fType2= type;
}
@@ -360,7 +359,7 @@ class BuiltinOperators {
IType t2= SemanticUtil.getNestedType(memPtr.getMemberOfClass(), TDEF);
if (t2 instanceof ICPPClassType) {
ICPPClassType c2= (ICPPClassType) t2;
- if (SemanticUtil.calculateInheritanceDepth(c1, c2, fPoint) >= 0) {
+ if (SemanticUtil.calculateInheritanceDepth(c1, c2) >= 0) {
IType cvt= SemanticUtil.getNestedType(memPtr.getType(), TDEF);
IType rt= new CPPReferenceType(
SemanticUtil.addQualifiers(cvt, cv1.isConst(), cv1.isVolatile(), cv1.isRestrict()), false);
@@ -684,7 +683,7 @@ class BuiltinOperators {
if (type instanceof ICPPClassType) {
fIsClass[idx]= true;
try {
- ICPPMethod[] ops = SemanticUtil.getConversionOperators((ICPPClassType) type, fPoint);
+ ICPPMethod[] ops = SemanticUtil.getConversionOperators((ICPPClassType) type);
result= new IType[ops.length];
int j= -1;
for (ICPPMethod op : ops) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPEvaluation.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPEvaluation.java
index e5c824426e5..d9144c8f84a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPEvaluation.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPEvaluation.java
@@ -18,10 +18,10 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
@@ -54,6 +54,24 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
}
return buf.getSignature();
}
+
+ public static IType getType(ICPPASTExpression expr) {
+ CPPSemantics.pushLookupPoint(expr);
+ try {
+ return expr.getEvaluation().getType();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
+
+ public static ValueCategory getValueCategory(ICPPASTExpression expr) {
+ CPPSemantics.pushLookupPoint(expr);
+ try {
+ return expr.getEvaluation().getValueCategory();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
+ }
protected static IBinding resolveUnknown(ICPPUnknownBinding unknown, InstantiationContext context) {
try {
@@ -103,10 +121,9 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
* Checks if all evaluations contained in the given array are constant expressions.
*
* @param evaluations the evaluations to check
- * @param point the point of instantiation
*/
- protected static boolean areAllConstantExpressions(ICPPEvaluation[] evaluations, IASTNode point) {
- return areAllConstantExpressions(evaluations, 0, evaluations.length, point);
+ protected static boolean areAllConstantExpressions(ICPPEvaluation[] evaluations) {
+ return areAllConstantExpressions(evaluations, 0, evaluations.length);
}
/**
@@ -115,19 +132,17 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
* @param evaluations the evaluations to check
* @param from the initial index of the range to be checked, inclusive
* @param to the final index of the range to be checked, exclusive
- * @param point the point of instantiation
*/
- protected static boolean areAllConstantExpressions(ICPPEvaluation[] evaluations, int from, int to,
- IASTNode point) {
+ protected static boolean areAllConstantExpressions(ICPPEvaluation[] evaluations, int from, int to) {
for (int i = from; i < to; i++) {
- if (!evaluations[i].isConstantExpression(point)) {
+ if (!evaluations[i].isConstantExpression()) {
return false;
}
}
return true;
}
- protected static boolean isConstexprValue(IValue value, IASTNode point) {
+ protected static boolean isConstexprValue(IValue value) {
if (value == null) {
return false;
}
@@ -139,7 +154,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
return true;
}
}
- return innerEval.isConstantExpression(point);
+ return innerEval.isConstantExpression();
}
protected static boolean isNullOrConstexprFunc(ICPPFunction function) {
@@ -153,12 +168,11 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
*
* @param argument the evaluation to convert
* @param targetType the type to convert to
- * @param point point of instantiation for name lookups
* @param allowContextualConversion enable/disable explicit contextual conversion
*/
protected static ICPPEvaluation maybeApplyConversion(ICPPEvaluation argument, IType targetType,
- IASTNode point, boolean allowContextualConversion) {
- IType type = argument.getType(point);
+ boolean allowContextualConversion) {
+ IType type = argument.getType();
// Types match - don't bother to check for conversions.
if (targetType.isSameType(type)) {
@@ -168,16 +182,17 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
try {
// Source type is class type - check for conversion operator.
IType uqType= SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
- ValueCategory valueCategory = argument.getValueCategory(point);
+ ValueCategory valueCategory = argument.getValueCategory();
if (uqType instanceof ICPPClassType) {
Cost cost = Conversions.initializationByConversion(valueCategory, type, (ICPPClassType) uqType,
- targetType, false, point, allowContextualConversion);
+ targetType, false, allowContextualConversion);
ICPPFunction conversion = cost.getUserDefinedConversion();
if (conversion != null) {
if (!conversion.isConstexpr()) {
return EvalFixed.INCOMPLETE;
}
- ICPPEvaluation eval = new EvalMemberAccess(uqType, valueCategory, conversion, argument, false, point);
+ ICPPEvaluation eval = new EvalMemberAccess(uqType, valueCategory, conversion, argument,
+ false, CPPSemantics.getCurrentLookupPoint());
return new EvalFunctionCall(new ICPPEvaluation[] { eval }, null, (IBinding) null);
}
}
@@ -185,7 +200,7 @@ public abstract class CPPEvaluation implements ICPPEvaluation {
// Source type is not a class type, or is but a conversion operator wasn't used.
// Check for standard conversions.
if (!Conversions.checkImplicitConversionSequence(targetType, type, valueCategory, UDCMode.FORBIDDEN,
- Context.ORDINARY, point).converts()) {
+ Context.ORDINARY).converts()) {
return EvalFixed.INCOMPLETE;
}
} catch (DOMException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java
index 9a56091d362..d401f8fd1a4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPInheritance.java
@@ -121,12 +121,11 @@ public class CPPInheritance {
* Final overrider maps are cached in the AST.
*
* @param classType the root of the class hierarchy
- * @param point The point of template instantiation, if applicable.
- * Also used to access the cache in the AST.
* @return the computed final overrider map
*/
- public static FinalOverriderMap getFinalOverriderMap(ICPPClassType classType, IASTNode point) {
+ public static FinalOverriderMap getFinalOverriderMap(ICPPClassType classType) {
Map<ICPPClassType, FinalOverriderMap> cache = null;
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (point != null && point.getTranslationUnit() instanceof CPPASTTranslationUnit) {
cache = ((CPPASTTranslationUnit) point.getTranslationUnit()).getFinalOverriderMapCache();
}
@@ -135,7 +134,7 @@ public class CPPInheritance {
result = cache.get(classType);
}
if (result == null) {
- result = FinalOverriderAnalysis.computeFinalOverriderMap(classType, point);
+ result = FinalOverriderAnalysis.computeFinalOverriderMap(classType);
}
if (cache != null) {
cache.put(classType, result);
@@ -146,13 +145,9 @@ public class CPPInheritance {
/**
* If a given virtual method has a unique final overrider in the class hierarchy rooted at the
* given class, returns that final overrider. Otherwise, returns null.
-
- * @param point The point of template instantiation, if applicable.
- * Also used to access the final overrider map cache in the AST.
*/
- public static ICPPMethod getFinalOverrider(ICPPMethod method, ICPPClassType hierarchyRoot,
- IASTNode point) {
- FinalOverriderMap map = getFinalOverriderMap(hierarchyRoot, point);
+ public static ICPPMethod getFinalOverrider(ICPPMethod method, ICPPClassType hierarchyRoot) {
+ FinalOverriderMap map = getFinalOverriderMap(hierarchyRoot);
Map<Integer, List<ICPPMethod>> finalOverriders = map.getMap().get(method);
if (finalOverriders != null && finalOverriders.size() == 1) {
for (Integer subobjectNumber : finalOverriders.keySet()) {
@@ -170,12 +165,11 @@ public class CPPInheritance {
* Computes the final overrider map for a class hierarchy.
*
* @param classType the root of the class hierarchy
- * @param point the point of template instantiation, if applicable
* @return the computed final overrider map
*/
- public static FinalOverriderMap computeFinalOverriderMap(ICPPClassType classType, IASTNode point) {
+ public static FinalOverriderMap computeFinalOverriderMap(ICPPClassType classType) {
return new FinalOverriderAnalysis().collectFinalOverriders(classType, false,
- new HashSet<ICPPClassType>(), CPPSemantics.MAX_INHERITANCE_DEPTH, point);
+ new HashSet<ICPPClassType>(), CPPSemantics.MAX_INHERITANCE_DEPTH);
}
// The last subobject number used for each type in the hierarchy. This is used to
@@ -196,11 +190,10 @@ public class CPPInheritance {
* @param isVirtualBase whether 'classType' is inherited virtually
* @param inheritanceChain the chain of classes from the entire hierarchy's root to 'classType'.
* This is used to guard against circular inheritance.
- * @param point the point of template instantiation, if applicable
* @return the computed final overrider map for the subtree
*/
private FinalOverriderMap collectFinalOverriders(ICPPClassType classType, boolean isVirtualBase,
- Set<ICPPClassType> inheritanceChain, int maxdepth, IASTNode point) {
+ Set<ICPPClassType> inheritanceChain, int maxdepth) {
FinalOverriderMap result = new FinalOverriderMap();
inheritanceChain.add(classType);
@@ -214,7 +207,7 @@ public class CPPInheritance {
}
// Go through our base classes.
- for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
+ for (ICPPBase base : classType.getBases()) {
IBinding baseClass = base.getBaseClass();
if (!(baseClass instanceof ICPPClassType))
continue;
@@ -237,11 +230,11 @@ public class CPPInheritance {
if (base.isVirtual()) {
baseOverriderMap = virtualBaseCache.get(baseType);
if (baseOverriderMap == null) {
- baseOverriderMap = collectFinalOverriders(baseType, true, inheritanceChain, maxdepth - 1, point);
+ baseOverriderMap = collectFinalOverriders(baseType, true, inheritanceChain, maxdepth - 1);
virtualBaseCache.put(baseType, baseOverriderMap);
}
} else {
- baseOverriderMap = collectFinalOverriders(baseType, false, inheritanceChain, maxdepth - 1, point);
+ baseOverriderMap = collectFinalOverriders(baseType, false, inheritanceChain, maxdepth - 1);
}
// Merge final overrider information from base class into this class.
@@ -249,7 +242,7 @@ public class CPPInheritance {
}
// Go through our own methods.
- for (ICPPMethod method : ClassTypeHelper.getOwnMethods(classType, point)) {
+ for (ICPPMethod method : ClassTypeHelper.getOwnMethods(classType)) {
// Skip methods that don't actually belong to us, such as methods brought
// into scope via a using-declaration.
if (!(method.getOwner() instanceof ICPPClassType &&
@@ -263,7 +256,7 @@ public class CPPInheritance {
// Find all methods overridden by this method, and set their final overrider
// to be this method.
- ICPPMethod[] overriddenMethods = ClassTypeHelper.findOverridden(method, point);
+ ICPPMethod[] overriddenMethods = ClassTypeHelper.findOverridden(method);
for (ICPPMethod overriddenMethod : overriddenMethods)
result.replaceForAllSubobjects(overriddenMethod, method);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index f1960630e02..103391b60c8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -32,10 +32,12 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.isConversionOperator;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -229,7 +231,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUnknownMethod;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUsingDirective;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPClassSpecializationScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
@@ -268,7 +269,7 @@ public class CPPSemantics {
public static int traceIndent= 0;
// special return value for costForFunctionCall
- private static final FunctionCost CONTAINS_DEPENDENT_TYPES = new FunctionCost(null, 0, null);
+ private static final FunctionCost CONTAINS_DEPENDENT_TYPES = new FunctionCost(null, 0);
// A regular expression for matching qualified names. This allows for optional global qualification
// (leading ::) and then separates the first part of the name from the rest (if present). There are
@@ -296,6 +297,23 @@ public class CPPSemantics {
return false;
}
};
+
+ private static final ThreadLocal<Deque<IASTNode>> fLookupPoints = new ThreadLocal<Deque<IASTNode>>() {
+ @Override
+ protected Deque<IASTNode> initialValue() {
+ return new ArrayDeque<>();
+ }
+ };
+ public static void pushLookupPoint(IASTNode point) {
+ fLookupPoints.get().push(point);
+ }
+ public static void popLookupPoint() {
+ fLookupPoints.get().pop();
+ }
+ public static IASTNode getCurrentLookupPoint() {
+ Deque<IASTNode> lookupPoints = fLookupPoints.get();
+ return lookupPoints.isEmpty() ? null : lookupPoints.peek();
+ }
static protected IBinding resolveBinding(IASTName name) {
if (traceBindingResolution) {
@@ -312,29 +330,34 @@ public class CPPSemantics {
// 1: Get some context info off of the name to figure out what kind of lookup we want.
LookupData data = createLookupData(name);
- try {
- // 2: Lookup
- lookup(data, null);
-
- // Perform argument dependent lookup
- if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionOrVariableResult()) {
- doArgumentDependentLookup(data);
- }
- } catch (DOMException e) {
- data.problem = (ProblemBinding) e.getProblem();
- }
- if (data.problem != null)
- return data.problem;
-
- // 3: Resolve ambiguities
IBinding binding;
+ pushLookupPoint(name);
try {
- binding = resolveAmbiguities(data);
- } catch (DOMException e) {
- binding = e.getProblem();
+ try {
+ // 2: Lookup
+ lookup(data, null);
+
+ // Perform argument dependent lookup
+ if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionOrVariableResult()) {
+ doArgumentDependentLookup(data);
+ }
+ } catch (DOMException e) {
+ data.problem = (ProblemBinding) e.getProblem();
+ }
+ if (data.problem != null)
+ return data.problem;
+
+ // 3: Resolve ambiguities
+ try {
+ binding = resolveAmbiguities(data);
+ } catch (DOMException e) {
+ binding = e.getProblem();
+ }
+ // 4: Post processing
+ binding = postResolution(binding, data);
+ } finally {
+ popLookupPoint();
}
- // 4: Post processing
- binding = postResolution(binding, data);
if (traceBindingResolution) {
traceIndent--;
for (int i = 0; i < traceIndent; i++) {
@@ -462,14 +485,14 @@ public class CPPSemantics {
if (t instanceof ICPPClassType && convertClassToConstructor(lookupName)) {
ICPPClassType cls= (ICPPClassType) t;
if (cls instanceof IIndexBinding) {
- cls= data.getTranslationUnit().mapToAST(cls, lookupName);
+ cls= data.getTranslationUnit().mapToAST(cls);
}
try {
if (lookupName instanceof ICPPASTTemplateId && cls instanceof ICPPClassTemplate) {
if (data.getTranslationUnit() != null) {
ICPPASTTemplateId id = (ICPPASTTemplateId) lookupName;
ICPPTemplateArgument[] args = CPPTemplates.createTemplateArgumentArray(id);
- IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args, lookupPoint);
+ IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args);
if (inst instanceof ICPPClassType) {
cls= (ICPPClassType) inst;
}
@@ -481,7 +504,7 @@ public class CPPSemantics {
// Do not interpret template arguments to a template class as being
// explicit template arguments to its templated constructor.
data.setTemplateArguments(null);
- binding= resolveFunction(data, ClassTypeHelper.getConstructors(cls, lookupPoint), true, false);
+ binding= resolveFunction(data, cls.getConstructors(), true, false);
}
} catch (DOMException e) {
return e.getProblem();
@@ -588,7 +611,7 @@ public class CPPSemantics {
IType impliedObjectType = data.getImpliedObjectType();
if (impliedObjectType instanceof ICPPClassType) {
ICPPMethod finalOverrider = CPPInheritance.getFinalOverrider((ICPPMethod) binding,
- (ICPPClassType) impliedObjectType, lookupName);
+ (ICPPClassType) impliedObjectType);
if (finalOverrider != null) {
binding = finalOverrider;
}
@@ -826,7 +849,7 @@ public class CPPSemantics {
if (t instanceof ICPPClassType && !(t instanceof ICPPClassTemplate)) {
ICPPClassType ct= (ICPPClassType) t;
if (lookInBaseClasses) {
- ICPPBase[] bases = ClassTypeHelper.getBases(ct, tu);
+ ICPPBase[] bases = ct.getBases();
for (ICPPBase base : bases) {
IBinding b = base.getBaseClass();
if (b instanceof IType)
@@ -838,7 +861,7 @@ public class CPPSemantics {
// (excluding template template parameters);
// * ... owners of which any template template arguments are members;
if (ct instanceof ICPPSpecialization) {
- for (IBinding friend : ClassTypeHelper.getFriends(ct, tu)) {
+ for (IBinding friend : ct.getFriends()) {
if (friend instanceof ICPPFunction) {
friendFns.add((ICPPFunction) friend);
}
@@ -1215,7 +1238,7 @@ public class CPPSemantics {
IType type = (IType) candidate;
if (templateArgs != null && type instanceof ICPPAliasTemplate) {
IBinding instantiated = CPPTemplates.instantiateAliasTemplate((ICPPAliasTemplate) type,
- templateArgs, data.getLookupPoint());
+ templateArgs);
if (instantiated instanceof IType) {
type = (IType) instantiated;
}
@@ -1299,7 +1322,7 @@ public class CPPSemantics {
if (expression instanceof ICPPASTLiteralExpression) {
final ICPPASTLiteralExpression litExpr = (ICPPASTLiteralExpression) expression;
if (litExpr.getKind() == IASTLiteralExpression.lk_this) {
- final IType thisType = SemanticUtil.getNestedType(litExpr.getEvaluation().getType(litExpr), TDEF | ALLCVQ | PTR | ARRAY | MPTR | REF);
+ final IType thisType = SemanticUtil.getNestedType(litExpr.getEvaluation().getType(), TDEF | ALLCVQ | PTR | ARRAY | MPTR | REF);
if (thisType instanceof ICPPUnknownBinding || thisType instanceof ICPPTemplateDefinition) {
result[0]= true;
return PROCESS_ABORT;
@@ -2597,7 +2620,7 @@ public class CPPSemantics {
// No arguments to resolve function
final IASTNode lookupPoint = data.getLookupPoint();
if (!data.hasFunctionArguments()) {
- return createFunctionSet(fns, data.getTemplateArguments(), lookupPoint, lookupName);
+ return createFunctionSet(fns, data.getTemplateArguments(), lookupName);
}
// Reduce our set of candidate functions to only those who have the right number of parameters.
@@ -2608,7 +2631,7 @@ public class CPPSemantics {
tmp= CPPTemplates.instantiateForFunctionCall(tmp, data.getTemplateArguments(),
Arrays.asList(argTypes),
Arrays.asList(data.getFunctionArgumentValueCategories()),
- data.argsContainImpliedObject, lookupPoint);
+ data.argsContainImpliedObject);
if (tmp.length == 0 || tmp[0] == null)
return new ProblemBinding(lookupName, lookupPoint, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, fns);
@@ -2673,7 +2696,7 @@ public class CPPSemantics {
if (potentialCosts != null) {
for (FunctionCost fnCost : potentialCosts) {
- if (!fnCost.mustBeWorse(bestFnCost) && fnCost.performUDC(lookupPoint)) {
+ if (!fnCost.mustBeWorse(bestFnCost) && fnCost.performUDC()) {
int cmp= fnCost.compareTo(tu, bestFnCost);
if (cmp < 0) {
bestFnCost= fnCost;
@@ -2729,7 +2752,7 @@ public class CPPSemantics {
* @return the resolved type, or the given {@type} if the type didn't contain a FunctionSetType
* or the targeted function resolution failed
*/
- private static IType resolveTargetedFunctionSetType(IType type, IType targetType, IASTNode point) {
+ private static IType resolveTargetedFunctionSetType(IType type, IType targetType) {
IType t = type;
if (type instanceof IPointerType) {
t = ((IPointerType) type).getType();
@@ -2737,7 +2760,7 @@ public class CPPSemantics {
if (t instanceof FunctionSetType) {
ICPPFunction function =
- resolveTargetedFunction(targetType, ((FunctionSetType) t).getFunctionSet(), point);
+ resolveTargetedFunction(targetType, ((FunctionSetType) t).getFunctionSet());
if (function != null && !(function instanceof IProblemBinding)) {
type = function.getType();
if (targetType instanceof ITypeContainer) {
@@ -2750,17 +2773,16 @@ public class CPPSemantics {
return type;
}
- private static IBinding createFunctionSet(ICPPFunction[] fns, ICPPTemplateArgument[] args, IASTNode point, IASTName name) {
+ private static IBinding createFunctionSet(ICPPFunction[] fns, ICPPTemplateArgument[] args, IASTName name) {
// First try to find a unique function
if (name != null && name.getPropertyInParent() == ICPPASTTemplateId.TEMPLATE_NAME) {
name= (IASTName) name.getParent();
}
- ICPPFunction f= getUniqueFunctionForSet(fns, args, point);
+ ICPPFunction f= getUniqueFunctionForSet(fns, args);
return f == null ? new CPPFunctionSet(fns, args, name) : f;
}
- private static ICPPFunction getUniqueFunctionForSet(ICPPFunction[] fns,
- ICPPTemplateArgument[] args, IASTNode point) {
+ private static ICPPFunction getUniqueFunctionForSet(ICPPFunction[] fns, ICPPTemplateArgument[] args) {
// First try to find a unique function
ICPPFunction result= null;
boolean haveASTResult= false;
@@ -2779,10 +2801,10 @@ public class CPPSemantics {
ICPPFunctionTemplate funcTemp = (ICPPFunctionTemplate) f;
final ICPPTemplateParameter[] tpars = funcTemp.getTemplateParameters();
final CPPTemplateParameterMap map = new CPPTemplateParameterMap(tpars.length);
- if (!TemplateArgumentDeduction.addExplicitArguments(funcTemp, tpars, args, map, point)) {
+ if (!TemplateArgumentDeduction.addExplicitArguments(funcTemp, tpars, args, map)) {
isCandidate= false;
} else {
- f = CPPTemplates.instantiateForAddressOfFunction(funcTemp, null, args, point);
+ f = CPPTemplates.instantiateForAddressOfFunction(funcTemp, null, args);
isCandidate= f != null;
}
}
@@ -2798,7 +2820,7 @@ public class CPPSemantics {
}
if (result instanceof ICPPFunctionTemplate)
- return CPPTemplates.instantiateForAddressOfFunction((ICPPFunctionTemplate) result, null, args, point);
+ return CPPTemplates.instantiateForAddressOfFunction((ICPPFunctionTemplate) result, null, args);
return result;
}
@@ -2867,9 +2889,9 @@ public class CPPSemantics {
return CPPDeferredFunction.createForCandidates(fns);
}
ICPPFunctionTemplate template= (ICPPFunctionTemplate) fn;
- ICPPFunction inst= CPPTemplates.instantiateForFunctionDeclaration(template, tmplArgs, ft, data.getLookupPoint());
+ ICPPFunction inst= CPPTemplates.instantiateForFunctionDeclaration(template, tmplArgs, ft);
if (inst != null) {
- int cmp= CPPTemplates.orderFunctionTemplates(bestTemplate, template, TypeSelection.PARAMETERS_AND_RETURN_TYPE, data.getLookupPoint());
+ int cmp= CPPTemplates.orderFunctionTemplates(bestTemplate, template, TypeSelection.PARAMETERS_AND_RETURN_TYPE);
if (cmp == 0)
cmp= compareByRelevance(tu, bestTemplate, template);
@@ -2919,7 +2941,7 @@ public class CPPSemantics {
for (int i = 0; i < argTypes.length && i < paramTypes.length; i++) {
IType argType = argTypes[i];
IType paramType = paramTypes[i];
- IType newArgType = resolveTargetedFunctionSetType(argType, paramType, data.getLookupPoint());
+ IType newArgType = resolveTargetedFunctionSetType(argType, paramType);
if (newArgType != argType) {
if (newArgTypes == null) {
newArgTypes = new IType[argTypes.length];
@@ -2952,9 +2974,9 @@ public class CPPSemantics {
final int sourceLen= argTypes.length - skipArg;
final FunctionCost result;
if (implicitParameterType == null) {
- result= new FunctionCost(fn, sourceLen, data.getLookupPoint());
+ result= new FunctionCost(fn, sourceLen);
} else {
- result= new FunctionCost(fn, sourceLen + 1, data.getLookupPoint());
+ result= new FunctionCost(fn, sourceLen + 1);
if (impliedObjectType == null) {
impliedObjectType= data.getImpliedObjectType();
@@ -2980,14 +3002,14 @@ public class CPPSemantics {
Context.IMPLICIT_OBJECT_FOR_METHOD_WITH_REF_QUALIFIER :
Context.IMPLICIT_OBJECT_FOR_METHOD_WITHOUT_REF_QUALIFIER;
cost = Conversions.checkImplicitConversionSequence(implicitParameterType, impliedObjectType,
- impliedObjectValueCategory, UDCMode.FORBIDDEN, context, data.getLookupPoint());
+ impliedObjectValueCategory, UDCMode.FORBIDDEN, context);
if (cost.converts()) {
cost.setImpliedObject();
} else {
if (CPPTemplates.isDependentType(implicitParameterType) || CPPTemplates.isDependentType(impliedObjectType)) {
IType s= getNestedType(impliedObjectType, TDEF|REF|CVTYPE);
IType t= getNestedType(implicitParameterType, TDEF|REF|CVTYPE);
- if (SemanticUtil.calculateInheritanceDepth(s, t, data.getLookupPoint()) >= 0)
+ if (SemanticUtil.calculateInheritanceDepth(s, t) >= 0)
return null;
return CONTAINS_DEPENDENT_TYPES;
@@ -3019,7 +3041,7 @@ public class CPPSemantics {
}
if (argType instanceof FunctionSetType) {
- cost= ((FunctionSetType) argType).costForTarget(paramType, data.getLookupPoint());
+ cost= ((FunctionSetType) argType).costForTarget(paramType);
} else if (argType.isSameType(paramType)) {
cost = new Cost(argType, paramType, Rank.IDENTITY);
} else {
@@ -3036,8 +3058,8 @@ public class CPPSemantics {
}
}
cost = Conversions.checkImplicitConversionSequence(paramType, argType, argValueCategory,
- udc, ctx, data.getLookupPoint());
- if (data.fNoNarrowing && cost.isNarrowingConversion(data.getLookupPoint())) {
+ udc, ctx);
+ if (data.fNoNarrowing && cost.isNarrowingConversion()) {
cost= Cost.NO_CONVERSION;
}
}
@@ -3069,7 +3091,7 @@ public class CPPSemantics {
}
if (data.forDeclaration() == null ||
data.forExplicitFunctionSpecialization() || data.forExplicitFunctionInstantiation()) {
- fns= CPPTemplates.instantiateConversionTemplates(fns, t, data.getLookupPoint());
+ fns= CPPTemplates.instantiateConversionTemplates(fns, t);
}
IFunction unknown= null;
@@ -3094,163 +3116,168 @@ public class CPPSemantics {
* a function.
*/
static IBinding resolveTargetedFunction(IASTName name, CPPFunctionSet functionSet) {
- boolean addressOf= false;
- IASTNode node= name.getParent();
- while (node instanceof IASTName) {
- node= node.getParent();
- }
-
- if (!(node instanceof IASTIdExpression))
- return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD);
-
- ASTNodeProperty prop= node.getPropertyInParent();
- IASTNode parent = node.getParent();
- while (parent instanceof IASTUnaryExpression) {
- final int op= ((IASTUnaryExpression) parent).getOperator();
- if (op == IASTUnaryExpression.op_bracketedPrimary) {
- } else if (!addressOf && op == IASTUnaryExpression.op_amper) {
- addressOf= true;
- } else {
- break;
+ pushLookupPoint(name);
+ try {
+ boolean addressOf= false;
+ IASTNode node= name.getParent();
+ while (node instanceof IASTName) {
+ node= node.getParent();
}
- node= parent;
- prop= node.getPropertyInParent();
- parent= node.getParent();
- }
-
- IType targetType= null;
- if (prop == IASTDeclarator.INITIALIZER) {
- // Target is an object or reference being initialized
- IASTDeclarator dtor = (IASTDeclarator) parent;
- targetType= CPPVisitor.createType(dtor);
- } else if (prop == IASTEqualsInitializer.INITIALIZER) {
- final IASTNode grandpa = parent.getParent();
- if (grandpa instanceof IASTDeclarator) {
- IASTDeclarator dtor = ASTQueries.findInnermostDeclarator((IASTDeclarator) grandpa);
- IBinding var= dtor.getName().resolvePreBinding();
- if (var instanceof IVariable)
- targetType= ((IVariable) var).getType();
- }
- } else if (prop == ICPPASTConstructorInitializer.ARGUMENT) {
- ICPPASTConstructorInitializer init = (ICPPASTConstructorInitializer) parent;
- final IASTNode parentOfInit = init.getParent();
- if (parentOfInit instanceof IASTDeclarator) {
- IASTDeclarator dtor = (IASTDeclarator) parentOfInit;
- targetType= CPPVisitor.createType(dtor);
- } else if (parentOfInit instanceof ICPPASTConstructorChainInitializer) {
- ICPPASTConstructorChainInitializer memInit= (ICPPASTConstructorChainInitializer) parentOfInit;
- IBinding var= memInit.getMemberInitializerId().resolveBinding();
- if (var instanceof IVariable) {
- targetType= ((IVariable) var).getType();
+
+ if (!(node instanceof IASTIdExpression))
+ return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD);
+
+ ASTNodeProperty prop= node.getPropertyInParent();
+ IASTNode parent = node.getParent();
+ while (parent instanceof IASTUnaryExpression) {
+ final int op= ((IASTUnaryExpression) parent).getOperator();
+ if (op == IASTUnaryExpression.op_bracketedPrimary) {
+ } else if (!addressOf && op == IASTUnaryExpression.op_amper) {
+ addressOf= true;
+ } else {
+ break;
}
+ node= parent;
+ prop= node.getPropertyInParent();
+ parent= node.getParent();
}
- targetType= getNestedType(targetType, TDEF | REF | CVTYPE | PTR | MPTR);
- if (init.getArguments().length != 1 || !(targetType instanceof ICPPFunctionType)) {
- if (targetType instanceof ICPPClassType) {
- LookupData data= new LookupData(name);
- data.setFunctionArguments(false, init.getArguments());
- try {
- IBinding ctor = resolveFunction(data,
- ClassTypeHelper.getConstructors((ICPPClassType) targetType, name), true, false);
- if (ctor instanceof ICPPConstructor) {
- int i= 0;
- for (IASTNode arg : init.getArguments()) {
- if (arg == node) {
- IType[] params= ((ICPPConstructor) ctor).getType().getParameterTypes();
- if (params.length > i) {
- targetType= params[i];
+
+ IType targetType= null;
+ if (prop == IASTDeclarator.INITIALIZER) {
+ // Target is an object or reference being initialized
+ IASTDeclarator dtor = (IASTDeclarator) parent;
+ targetType= CPPVisitor.createType(dtor);
+ } else if (prop == IASTEqualsInitializer.INITIALIZER) {
+ final IASTNode grandpa = parent.getParent();
+ if (grandpa instanceof IASTDeclarator) {
+ IASTDeclarator dtor = ASTQueries.findInnermostDeclarator((IASTDeclarator) grandpa);
+ IBinding var= dtor.getName().resolvePreBinding();
+ if (var instanceof IVariable)
+ targetType= ((IVariable) var).getType();
+ }
+ } else if (prop == ICPPASTConstructorInitializer.ARGUMENT) {
+ ICPPASTConstructorInitializer init = (ICPPASTConstructorInitializer) parent;
+ final IASTNode parentOfInit = init.getParent();
+ if (parentOfInit instanceof IASTDeclarator) {
+ IASTDeclarator dtor = (IASTDeclarator) parentOfInit;
+ targetType= CPPVisitor.createType(dtor);
+ } else if (parentOfInit instanceof ICPPASTConstructorChainInitializer) {
+ ICPPASTConstructorChainInitializer memInit= (ICPPASTConstructorChainInitializer) parentOfInit;
+ IBinding var= memInit.getMemberInitializerId().resolveBinding();
+ if (var instanceof IVariable) {
+ targetType= ((IVariable) var).getType();
+ }
+ }
+ targetType= getNestedType(targetType, TDEF | REF | CVTYPE | PTR | MPTR);
+ if (init.getArguments().length != 1 || !(targetType instanceof ICPPFunctionType)) {
+ if (targetType instanceof ICPPClassType) {
+ LookupData data= new LookupData(name);
+ data.setFunctionArguments(false, init.getArguments());
+ try {
+ IBinding ctor = resolveFunction(data,
+ ((ICPPClassType) targetType).getConstructors(), true, false);
+ if (ctor instanceof ICPPConstructor) {
+ int i= 0;
+ for (IASTNode arg : init.getArguments()) {
+ if (arg == node) {
+ IType[] params= ((ICPPConstructor) ctor).getType().getParameterTypes();
+ if (params.length > i) {
+ targetType= params[i];
+ }
+ break;
}
- break;
+ i++;
}
- i++;
}
+ } catch (DOMException e) {
}
- } catch (DOMException e) {
}
}
- }
- } else if (prop == IASTBinaryExpression.OPERAND_TWO) {
- IASTBinaryExpression binaryExp = (IASTBinaryExpression) parent;
- if (binaryExp.getOperator() == IASTBinaryExpression.op_assign) {
- targetType= binaryExp.getOperand1().getExpressionType();
- }
- } else if (prop == IASTFunctionCallExpression.ARGUMENT) {
- // Target is a parameter of a function, need to resolve the function call
- IASTFunctionCallExpression fnCall = (IASTFunctionCallExpression) parent;
- IType t= SemanticUtil.getNestedType(fnCall.getFunctionNameExpression().getExpressionType(), TDEF | REF | CVTYPE);
- if (t instanceof IPointerType) {
- t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
- }
- if (t instanceof IFunctionType) {
- int i= 0;
- for (IASTNode arg : fnCall.getArguments()) {
- if (arg == node) {
- IType[] params= ((IFunctionType) t).getParameterTypes();
- if (params.length > i) {
- targetType= params[i];
+ } else if (prop == IASTBinaryExpression.OPERAND_TWO) {
+ IASTBinaryExpression binaryExp = (IASTBinaryExpression) parent;
+ if (binaryExp.getOperator() == IASTBinaryExpression.op_assign) {
+ targetType= binaryExp.getOperand1().getExpressionType();
+ }
+ } else if (prop == IASTFunctionCallExpression.ARGUMENT) {
+ // Target is a parameter of a function, need to resolve the function call
+ IASTFunctionCallExpression fnCall = (IASTFunctionCallExpression) parent;
+ IType t= SemanticUtil.getNestedType(fnCall.getFunctionNameExpression().getExpressionType(), TDEF | REF | CVTYPE);
+ if (t instanceof IPointerType) {
+ t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
+ }
+ if (t instanceof IFunctionType) {
+ int i= 0;
+ for (IASTNode arg : fnCall.getArguments()) {
+ if (arg == node) {
+ IType[] params= ((IFunctionType) t).getParameterTypes();
+ if (params.length > i) {
+ targetType= params[i];
+ }
+ break;
}
+ i++;
+ }
+ }
+ } else if (prop == IASTCastExpression.OPERAND) {
+ // target is an explicit type conversion
+ IASTCastExpression cast = (IASTCastExpression) parent;
+ targetType= CPPVisitor.createType(cast.getTypeId().getAbstractDeclarator());
+ } else if (prop == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT) {
+ // target is a template non-type parameter (14.3.2-5)
+ ICPPASTTemplateId id = (ICPPASTTemplateId) parent;
+ IASTNode[] args = id.getTemplateArguments();
+ int i = 0;
+ for (; i < args.length; i++) {
+ if (args[i] == node) {
break;
}
- i++;
}
- }
- } else if (prop == IASTCastExpression.OPERAND) {
- // target is an explicit type conversion
- IASTCastExpression cast = (IASTCastExpression) parent;
- targetType= CPPVisitor.createType(cast.getTypeId().getAbstractDeclarator());
- } else if (prop == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT) {
- // target is a template non-type parameter (14.3.2-5)
- ICPPASTTemplateId id = (ICPPASTTemplateId) parent;
- IASTNode[] args = id.getTemplateArguments();
- int i = 0;
- for (; i < args.length; i++) {
- if (args[i] == node) {
- break;
+ IBinding template = id.getTemplateName().resolveBinding();
+ if (template instanceof ICPPTemplateDefinition) {
+ ICPPTemplateParameter[] ps = ((ICPPTemplateDefinition) template).getTemplateParameters();
+ if (i < args.length && i < ps.length && ps[i] instanceof ICPPTemplateNonTypeParameter) {
+ targetType= ((ICPPTemplateNonTypeParameter) ps[i]).getType();
+ }
}
- }
- IBinding template = id.getTemplateName().resolveBinding();
- if (template instanceof ICPPTemplateDefinition) {
- ICPPTemplateParameter[] ps = ((ICPPTemplateDefinition) template).getTemplateParameters();
- if (i < args.length && i < ps.length && ps[i] instanceof ICPPTemplateNonTypeParameter) {
- targetType= ((ICPPTemplateNonTypeParameter) ps[i]).getType();
+ } else if (prop == IASTReturnStatement.RETURNVALUE) {
+ // target is the return value of a function, operator or conversion
+ while (parent != null && !(parent instanceof IASTFunctionDefinition)) {
+ parent = parent.getParent();
}
- }
- } else if (prop == IASTReturnStatement.RETURNVALUE) {
- // target is the return value of a function, operator or conversion
- while (parent != null && !(parent instanceof IASTFunctionDefinition)) {
- parent = parent.getParent();
- }
- if (parent instanceof IASTFunctionDefinition) {
- IASTDeclarator dtor = ((IASTFunctionDefinition) parent).getDeclarator();
- dtor= ASTQueries.findInnermostDeclarator(dtor);
- IBinding binding = dtor.getName().resolveBinding();
- if (binding instanceof IFunction) {
- IFunctionType ft = ((IFunction) binding).getType();
- targetType= ft.getReturnType();
+ if (parent instanceof IASTFunctionDefinition) {
+ IASTDeclarator dtor = ((IASTFunctionDefinition) parent).getDeclarator();
+ dtor= ASTQueries.findInnermostDeclarator(dtor);
+ IBinding binding = dtor.getName().resolveBinding();
+ if (binding instanceof IFunction) {
+ IFunctionType ft = ((IFunction) binding).getType();
+ targetType= ft.getReturnType();
+ }
}
}
- }
- if (targetType == null && parent instanceof ICPPASTExpression
- && parent instanceof IASTImplicitNameOwner) {
- // Trigger resolution of overloaded operator, which may resolve the
- // function set.
- ((IASTImplicitNameOwner) parent).getImplicitNames();
- final IBinding newBinding = name.getPreBinding();
- if (!(newBinding instanceof CPPFunctionSet))
- return newBinding;
-
- // If we're in a dependent context, we don't have enough information
- // to resolve the function set.
- if (((ICPPASTExpression) parent).getEvaluation().isTypeDependent()) {
- return CPPDeferredFunction.createForCandidates(functionSet.getBindings());
+ if (targetType == null && parent instanceof ICPPASTExpression
+ && parent instanceof IASTImplicitNameOwner) {
+ // Trigger resolution of overloaded operator, which may resolve the
+ // function set.
+ ((IASTImplicitNameOwner) parent).getImplicitNames();
+ final IBinding newBinding = name.getPreBinding();
+ if (!(newBinding instanceof CPPFunctionSet))
+ return newBinding;
+
+ // If we're in a dependent context, we don't have enough information
+ // to resolve the function set.
+ if (((ICPPASTExpression) parent).getEvaluation().isTypeDependent()) {
+ return CPPDeferredFunction.createForCandidates(functionSet.getBindings());
+ }
}
+
+ ICPPFunction function = resolveTargetedFunction(targetType, functionSet);
+ if (function == null)
+ return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD);
+
+ return function;
+ } finally {
+ popLookupPoint();
}
-
- ICPPFunction function = resolveTargetedFunction(targetType, functionSet, name);
- if (function == null)
- return new ProblemBinding(name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD);
-
- return function;
}
private static boolean isViableUserDefinedLiteralOperator(IBinding binding, int kind) {
@@ -3281,143 +3308,148 @@ public class CPPSemantics {
* @throws DOMException
*/
public static IBinding findUserDefinedLiteralOperator(IASTLiteralExpression exp) throws DOMException {
+ pushLookupPoint(exp);
IBinding ret = null;
- /*
- * 2.14.8.2
- * Let `IASTLiteralExpression exp` = L
- * Let `exp.getSuffix()` = X
- * Let `bindings` = S
- * A user-defined-literal is treated as a call to a literal operator or
- * literal operator template (13.5.8). To determine the form of this
- * call for a given user-defined-literal L with ud-suffix X, the
- * literal-operator-id whose literal suffix identifier is X is looked up
- * in the context of L using the rules for unqualified name lookup (3.4.1).
- * Let S be the set of declarations found by this lookup.
- * S shall not be empty.
- *
- */
- int kind = exp.getKind();
- IScope lookupScope = CPPVisitor.getContainingScope(exp);
- IBinding[] bindings = findBindings(lookupScope, ((CPPASTLiteralExpression) exp).getOperatorName(), false);
- ICPPFunction[] funcs = new ICPPFunction[bindings.length];
- ICPPFunctionTemplate[] tplFunctions = new ICPPFunctionTemplate[bindings.length];
- LookupData data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp);
-
- int i = 0, j = 0;
- for (IBinding binding : bindings) {
- if (binding instanceof ICPPFunction || binding instanceof ICPPFunctionTemplate) {
- funcs[i++] = (ICPPFunction) binding;
- if (binding instanceof ICPPFunctionTemplate) {
- tplFunctions[j++] = (ICPPFunctionTemplate) binding;
+ try {
+ /*
+ * 2.14.8.2
+ * Let `IASTLiteralExpression exp` = L
+ * Let `exp.getSuffix()` = X
+ * Let `bindings` = S
+ * A user-defined-literal is treated as a call to a literal operator or
+ * literal operator template (13.5.8). To determine the form of this
+ * call for a given user-defined-literal L with ud-suffix X, the
+ * literal-operator-id whose literal suffix identifier is X is looked up
+ * in the context of L using the rules for unqualified name lookup (3.4.1).
+ * Let S be the set of declarations found by this lookup.
+ * S shall not be empty.
+ *
+ */
+ int kind = exp.getKind();
+ IScope lookupScope = CPPVisitor.getContainingScope(exp);
+ IBinding[] bindings = findBindings(lookupScope, ((CPPASTLiteralExpression) exp).getOperatorName(), false);
+ ICPPFunction[] funcs = new ICPPFunction[bindings.length];
+ ICPPFunctionTemplate[] tplFunctions = new ICPPFunctionTemplate[bindings.length];
+ LookupData data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp);
+
+ int i = 0, j = 0;
+ for (IBinding binding : bindings) {
+ if (binding instanceof ICPPFunction || binding instanceof ICPPFunctionTemplate) {
+ funcs[i++] = (ICPPFunction) binding;
+ if (binding instanceof ICPPFunctionTemplate) {
+ tplFunctions[j++] = (ICPPFunctionTemplate) binding;
+ }
}
}
- }
-
- funcs = ArrayUtil.trim(funcs, i);
- tplFunctions = ArrayUtil.trim(tplFunctions, j);
-
- if (funcs.length == 0) {
- // S shall not be empty
- return new ProblemBinding(data.getLookupName(), exp, IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
- }
-
- if (kind == IASTLiteralExpression.lk_integer_constant || kind == IASTLiteralExpression.lk_float_constant) {
- if (kind == IASTLiteralExpression.lk_integer_constant) {
- /*
- * 2.14.8.3
- * Let `exp.getValue()` = n
- * If L is a user-defined-integer-literal, let n be the literal
- * without its ud-suffix. If S contains a literal operator with
- * parameter type unsigned long long, then use operator "" X(n ULL)
- */
- CPPBasicType t = new CPPBasicType(Kind.eInt, IBasicType.IS_UNSIGNED | IBasicType.IS_LONG_LONG, exp);
- data.setFunctionArguments(false, createArgForType(exp, t));
- ret = resolveFunction(data, funcs, true, false);
- if (isViableUserDefinedLiteralOperator(ret, kind)) {
- return ret;
+
+ funcs = ArrayUtil.trim(funcs, i);
+ tplFunctions = ArrayUtil.trim(tplFunctions, j);
+
+ if (funcs.length == 0) {
+ // S shall not be empty
+ return new ProblemBinding(data.getLookupName(), exp, IProblemBinding.SEMANTIC_NAME_NOT_FOUND);
+ }
+
+ if (kind == IASTLiteralExpression.lk_integer_constant || kind == IASTLiteralExpression.lk_float_constant) {
+ if (kind == IASTLiteralExpression.lk_integer_constant) {
+ /*
+ * 2.14.8.3
+ * Let `exp.getValue()` = n
+ * If L is a user-defined-integer-literal, let n be the literal
+ * without its ud-suffix. If S contains a literal operator with
+ * parameter type unsigned long long, then use operator "" X(n ULL)
+ */
+ CPPBasicType t = new CPPBasicType(Kind.eInt, IBasicType.IS_UNSIGNED | IBasicType.IS_LONG_LONG, exp);
+ data.setFunctionArguments(false, createArgForType(exp, t));
+ ret = resolveFunction(data, funcs, true, false);
+ if (isViableUserDefinedLiteralOperator(ret, kind)) {
+ return ret;
+ }
+ } else if (kind == IASTLiteralExpression.lk_float_constant) {
+ /*
+ * 2.14.8.4
+ * Let `exp.getValue()` = f
+ * If L is a user-defined-floating-literal, let f be the literal
+ * without its ud-suffix. If S contains a literal operator with
+ * parameter type long double, then use operator "" X(f L)
+ */
+ CPPBasicType t = new CPPBasicType(Kind.eDouble, IBasicType.IS_LONG, exp);
+ data.setFunctionArguments(false, createArgForType(exp, t));
+ ret = resolveFunction(data, funcs, true, false);
+ if (isViableUserDefinedLiteralOperator(ret, kind)) {
+ return ret;
+ }
}
- } else if (kind == IASTLiteralExpression.lk_float_constant) {
+
/*
- * 2.14.8.4
- * Let `exp.getValue()` = f
- * If L is a user-defined-floating-literal, let f be the literal
- * without its ud-suffix. If S contains a literal operator with
- * parameter type long double, then use operator "" X(f L)
+ * 2.14.8.3 (cont.), 2.14.8.4 (cont.)
+ * Otherwise, S shall contain a raw literal operator or a literal
+ * operator template but not both.
*/
- CPPBasicType t = new CPPBasicType(Kind.eDouble, IBasicType.IS_LONG, exp);
- data.setFunctionArguments(false, createArgForType(exp, t));
+ // Raw literal operator `operator "" _op(const char * c)`
+ CPPPointerType charArray = new CPPPointerType(CPPBasicType.CHAR, true, false, false);
+ data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp);
+ data.setFunctionArguments(false, createArgForType(exp, charArray));
ret = resolveFunction(data, funcs, true, false);
- if (isViableUserDefinedLiteralOperator(ret, kind)) {
- return ret;
+
+ //
+ char[] stringLiteral = exp.getValue(); // The string literal that was passed to the operator
+
+ // The string literal is passed to the operator as chars:
+ // "literal"_op -> operator "" _op<'l', 'i', 't', 'e', 'r', 'a', 'l'>();
+ ICPPTemplateArgument args[] = new ICPPTemplateArgument[stringLiteral.length];
+ for (int k = 0; k < stringLiteral.length; k++) {
+ args[k] = new CPPTemplateNonTypeArgument(new EvalFixed(CPPBasicType.CHAR, PRVALUE, IntegralValue.create(stringLiteral[k])));
}
- }
-
- /*
- * 2.14.8.3 (cont.), 2.14.8.4 (cont.)
- * Otherwise, S shall contain a raw literal operator or a literal
- * operator template but not both.
- */
- // Raw literal operator `operator "" _op(const char * c)`
- CPPPointerType charArray = new CPPPointerType(CPPBasicType.CHAR, true, false, false);
- data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), null, exp);
- data.setFunctionArguments(false, createArgForType(exp, charArray));
- ret = resolveFunction(data, funcs, true, false);
-
- //
- char[] stringLiteral = exp.getValue(); // The string literal that was passed to the operator
-
- // The string literal is passed to the operator as chars:
- // "literal"_op -> operator "" _op<'l', 'i', 't', 'e', 'r', 'a', 'l'>();
- ICPPTemplateArgument args[] = new ICPPTemplateArgument[stringLiteral.length];
- for (int k = 0; k < stringLiteral.length; k++) {
- args[k] = new CPPTemplateNonTypeArgument(new EvalFixed(CPPBasicType.CHAR, PRVALUE, IntegralValue.create(stringLiteral[k])), exp);
- }
-
- data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), args, exp);
- IBinding litTpl = resolveFunction(data, tplFunctions, true, false);
-
- // Do we have valid template and non-template bindings?
- if (ret != null && !(ret instanceof IProblemBinding)) {
+
+ data = new LookupData(((CPPASTLiteralExpression) exp).getOperatorName(), args, exp);
+ IBinding litTpl = resolveFunction(data, tplFunctions, true, false);
+
// Do we have valid template and non-template bindings?
- if (litTpl instanceof ICPPFunctionInstance) {
- // Ambiguity? It has two valid options, and the spec says it shouldn't
- return new ProblemBinding(data.getLookupName(), exp, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, tplFunctions);
- }
- } else {
- if (litTpl instanceof ICPPFunctionInstance) {
- // Only the template binding is valid
- ret = litTpl;
+ if (ret != null && !(ret instanceof IProblemBinding)) {
+ // Do we have valid template and non-template bindings?
+ if (litTpl instanceof ICPPFunctionInstance) {
+ // Ambiguity? It has two valid options, and the spec says it shouldn't
+ return new ProblemBinding(data.getLookupName(), exp, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, tplFunctions);
+ }
} else {
- // Couldn't find a valid operator
- return ret;
+ if (litTpl instanceof ICPPFunctionInstance) {
+ // Only the template binding is valid
+ ret = litTpl;
+ } else {
+ // Couldn't find a valid operator
+ return ret;
+ }
}
+ } else if (kind == IASTLiteralExpression.lk_string_literal) {
+ /*
+ * 2.14.8.5
+ * If L is a user-defined-string-literal, let str be the literal
+ * without its ud-suffix and let len be the number of code units in
+ * str (i.e., its length excluding the terminating null character).
+ * L is treated as operator "" X(str, len)
+ */
+ CPPPointerType strType = new CPPPointerType(new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, null), true, false, false);
+ IASTInitializerClause[] initializer = new IASTInitializerClause[] {
+ createArgForType(exp, strType),
+ createArgForType(null, CPPBasicType.UNSIGNED_INT)
+ };
+ data.setFunctionArguments(false, initializer);
+ ret = resolveFunction(data, funcs, true, false);
+ } else if (kind == IASTLiteralExpression.lk_char_constant) {
+ /*
+ * 2.14.8.6
+ * If L is a user-defined-character-literal, let ch be the literal
+ * without its ud-suffix. S shall contain a literal operator whose
+ * only parameter has the type ch and the literal L is treated as a
+ * call operator "" X(ch)
+ */
+ CPPBasicType t = new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, exp);
+ data.setFunctionArguments(false, createArgForType(exp, t));
+ ret = resolveFunction(data, funcs, true, false);
}
- } else if (kind == IASTLiteralExpression.lk_string_literal) {
- /*
- * 2.14.8.5
- * If L is a user-defined-string-literal, let str be the literal
- * without its ud-suffix and let len be the number of code units in
- * str (i.e., its length excluding the terminating null character).
- * L is treated as operator "" X(str, len)
- */
- CPPPointerType strType = new CPPPointerType(new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, null), true, false, false);
- IASTInitializerClause[] initializer = new IASTInitializerClause[] {
- createArgForType(exp, strType),
- createArgForType(null, CPPBasicType.UNSIGNED_INT)
- };
- data.setFunctionArguments(false, initializer);
- ret = resolveFunction(data, funcs, true, false);
- } else if (kind == IASTLiteralExpression.lk_char_constant) {
- /*
- * 2.14.8.6
- * If L is a user-defined-character-literal, let ch be the literal
- * without its ud-suffix. S shall contain a literal operator whose
- * only parameter has the type ch and the literal L is treated as a
- * call operator "" X(ch)
- */
- CPPBasicType t = new CPPBasicType(((CPPASTLiteralExpression) exp).getBasicCharKind(), 0, exp);
- data.setFunctionArguments(false, createArgForType(exp, t));
- ret = resolveFunction(data, funcs, true, false);
+ } finally {
+ popLookupPoint();
}
return ret;
@@ -3427,7 +3459,7 @@ public class CPPSemantics {
* 13.4-1 A use of an overloaded function without arguments is resolved in certain contexts to
* a function.
*/
- static ICPPFunction resolveTargetedFunction(IType targetType, CPPFunctionSet set, IASTNode point) {
+ static ICPPFunction resolveTargetedFunction(IType targetType, CPPFunctionSet set) {
targetType= getNestedType(targetType, TDEF | REF | CVTYPE | PTR | MPTR);
if (!(targetType instanceof ICPPFunctionType))
return null;
@@ -3445,16 +3477,16 @@ public class CPPSemantics {
ICPPFunction result= null;
ICPPFunctionTemplate resultTemplate= null;
boolean isAmbiguous= false;
- final IASTTranslationUnit tu= point.getTranslationUnit();
+ final IASTTranslationUnit tu= CPPSemantics.getCurrentLookupPoint().getTranslationUnit();
for (IFunction fn : fns) {
try {
if (fn instanceof ICPPFunctionTemplate) {
final ICPPFunctionTemplate template = (ICPPFunctionTemplate) fn;
ICPPFunction inst= CPPTemplates.instantiateForAddressOfFunction(template,
- (ICPPFunctionType) targetType, set.getTemplateArguments(), point);
+ (ICPPFunctionType) targetType, set.getTemplateArguments());
if (inst != null) {
int cmp= CPPTemplates.orderFunctionTemplates(resultTemplate, template,
- TypeSelection.PARAMETERS_AND_RETURN_TYPE, point);
+ TypeSelection.PARAMETERS_AND_RETURN_TYPE);
if (cmp == 0)
cmp= compareByRelevance(tu, resultTemplate, template);
@@ -3477,14 +3509,14 @@ public class CPPSemantics {
return result;
}
- public static ICPPFunction findOverloadedBinaryOperator(IASTNode pointOfInstantiation, IScope pointOfDefinition,
+ public static ICPPFunction findOverloadedBinaryOperator(IScope pointOfDefinition,
OverloadableOperator op, ICPPEvaluation arg1, ICPPEvaluation arg2) {
if (op == null || arg1 == null || arg2 == null)
return null;
- IType op1type = getNestedType(arg1.getType(pointOfInstantiation), TDEF | REF | CVTYPE);
+ IType op1type = getNestedType(arg1.getType(), TDEF | REF | CVTYPE);
if (!isUserDefined(op1type) && !isUserDefined(
- getNestedType(arg2.getType(pointOfInstantiation), TDEF | REF | CVTYPE)))
+ getNestedType(arg2.getType(), TDEF | REF | CVTYPE)))
return null;
final LookupMode lookupNonMember;
@@ -3493,50 +3525,60 @@ public class CPPSemantics {
} else {
lookupNonMember= LookupMode.LIMITED_GLOBALS;
}
- return findOverloadedOperator(pointOfInstantiation, pointOfDefinition, new ICPPEvaluation[] {arg1, arg2},
- op1type, op, lookupNonMember);
+ return findOverloadedOperator(pointOfDefinition, new ICPPEvaluation[] {arg1, arg2}, op1type, op,
+ lookupNonMember);
}
public static ICPPFunction findOverloadedOperator(ICPPASTNewExpression expr) {
- OverloadableOperator op = OverloadableOperator.fromNewExpression(expr);
- final ICPPEvaluation evaluation = expr.getEvaluation();
- if (evaluation.isTypeDependent())
- return null;
-
- final IASTInitializerClause[] placement = expr.getPlacementArguments();
- final ICPPEvaluation arg1= new EvalUnary(IASTUnaryExpression.op_star, evaluation, null, expr);
- final ICPPEvaluation arg2= new EvalUnary(IASTUnaryExpression.op_sizeof, evaluation, null, expr);
-
- ICPPEvaluation[] args;
- if (placement == null) {
- args= new ICPPEvaluation[] { arg1, arg2 };
- } else {
- args= new ICPPEvaluation[2 + placement.length];
- args[0]= arg1;
- args[1]= arg2;
- int i= 2;
- for (IASTInitializerClause p : placement) {
- final ICPPEvaluation a = ((ICPPASTInitializerClause) p).getEvaluation();
- if (a.isTypeDependent())
- return null;
- args[i++]= a;
+ pushLookupPoint(expr);
+ try {
+ OverloadableOperator op = OverloadableOperator.fromNewExpression(expr);
+ final ICPPEvaluation evaluation = expr.getEvaluation();
+ if (evaluation.isTypeDependent())
+ return null;
+
+ final IASTInitializerClause[] placement = expr.getPlacementArguments();
+ final ICPPEvaluation arg1= new EvalUnary(IASTUnaryExpression.op_star, evaluation, null, expr);
+ final ICPPEvaluation arg2= new EvalUnary(IASTUnaryExpression.op_sizeof, evaluation, null, expr);
+
+ ICPPEvaluation[] args;
+ if (placement == null) {
+ args= new ICPPEvaluation[] { arg1, arg2 };
+ } else {
+ args= new ICPPEvaluation[2 + placement.length];
+ args[0]= arg1;
+ args[1]= arg2;
+ int i= 2;
+ for (IASTInitializerClause p : placement) {
+ final ICPPEvaluation a = ((ICPPASTInitializerClause) p).getEvaluation();
+ if (a.isTypeDependent())
+ return null;
+ args[i++]= a;
+ }
}
+ IType type= getNestedType(arg1.getType(), TDEF | REF | CVTYPE);
+ return findOverloadedOperator(null, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
+ } finally {
+ popLookupPoint();
}
- IType type= getNestedType(arg1.getType(expr), TDEF | REF | CVTYPE);
- return findOverloadedOperator(expr, null, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
}
public static ICPPFunction findOverloadedOperator(ICPPASTDeleteExpression expr) {
- OverloadableOperator op = OverloadableOperator.fromDeleteExpression(expr);
- IType type = getTypeOfPointer(expr.getOperand().getExpressionType());
- if (type == null)
- return null;
-
- ICPPEvaluation[] args = {
- new EvalFixed(type, LVALUE, IntegralValue.UNKNOWN),
- ((ICPPASTExpression) expr.getOperand()).getEvaluation()
- };
- return findOverloadedOperator(expr, null, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
+ pushLookupPoint(expr);
+ try {
+ OverloadableOperator op = OverloadableOperator.fromDeleteExpression(expr);
+ IType type = getTypeOfPointer(expr.getOperand().getExpressionType());
+ if (type == null)
+ return null;
+
+ ICPPEvaluation[] args = {
+ new EvalFixed(type, LVALUE, IntegralValue.UNKNOWN),
+ ((ICPPASTExpression) expr.getOperand()).getEvaluation()
+ };
+ return findOverloadedOperator(null, args, type, op, LookupMode.GLOBALS_IF_NO_MEMBERS);
+ } finally {
+ popLookupPoint();
+ }
}
private static IType getTypeOfPointer(IType type) {
@@ -3551,23 +3593,28 @@ public class CPPSemantics {
* Returns constructor called by a declarator, or {@code null} if no constructor is called.
*/
public static IBinding findImplicitlyCalledConstructor(final ICPPASTDeclarator declarator) {
- if (declarator.getNestedDeclarator() != null)
- return null;
- IASTDeclarator dtor= ASTQueries.findOutermostDeclarator(declarator);
- IASTNode parent = dtor.getParent();
- if (parent instanceof IASTSimpleDeclaration) {
- final IASTInitializer initializer = dtor.getInitializer();
- if (initializer == null) {
- IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration) parent).getDeclSpecifier();
- parent = parent.getParent();
- if (parent instanceof IASTCompositeTypeSpecifier ||
- declSpec.getStorageClass() == IASTDeclSpecifier.sc_extern) {
- // No initialization is performed for class members and extern declarations
- // without an initializer.
- return null;
+ pushLookupPoint(declarator);
+ try {
+ if (declarator.getNestedDeclarator() != null)
+ return null;
+ IASTDeclarator dtor= ASTQueries.findOutermostDeclarator(declarator);
+ IASTNode parent = dtor.getParent();
+ if (parent instanceof IASTSimpleDeclaration) {
+ final IASTInitializer initializer = dtor.getInitializer();
+ if (initializer == null) {
+ IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration) parent).getDeclSpecifier();
+ parent = parent.getParent();
+ if (parent instanceof IASTCompositeTypeSpecifier ||
+ declSpec.getStorageClass() == IASTDeclSpecifier.sc_extern) {
+ // No initialization is performed for class members and extern declarations
+ // without an initializer.
+ return null;
+ }
}
+ return findImplicitlyCalledConstructor(declarator.getName(), initializer);
}
- return findImplicitlyCalledConstructor(declarator.getName(), initializer);
+ } finally {
+ popLookupPoint();
}
return null;
}
@@ -3601,7 +3648,7 @@ public class CPPSemantics {
// In such a case, we want the constructors as AST bindings (since as
// index bindings they would fail declaredBefore() filtering), so map
// the class type to its AST representation.
- type = SemanticUtil.mapToAST(type, name);
+ type = SemanticUtil.mapToAST(type);
return findImplicitlyCalledConstructor((ICPPClassType) type, initializer, name);
}
@@ -3624,21 +3671,22 @@ public class CPPSemantics {
private static IBinding findImplicitlyCalledConstructor(ICPPClassType type, IASTInitializer initializer,
IASTNode typeId) {
+ pushLookupPoint(typeId);
try {
if (initializer instanceof IASTEqualsInitializer) {
// Copy initialization.
IASTEqualsInitializer eqInit= (IASTEqualsInitializer) initializer;
ICPPASTInitializerClause evalOwner = (ICPPASTInitializerClause) eqInit.getInitializerClause();
final ICPPEvaluation evaluation = evalOwner.getEvaluation();
- IType sourceType= evaluation.getType(typeId);
- ValueCategory isLValue= evaluation.getValueCategory(typeId);
+ IType sourceType= evaluation.getType();
+ ValueCategory isLValue= evaluation.getValueCategory();
if (sourceType != null) {
Cost c;
- if (calculateInheritanceDepth(sourceType, type, typeId) >= 0) {
- c = Conversions.copyInitializationOfClass(isLValue, sourceType, type, false, typeId);
+ if (calculateInheritanceDepth(sourceType, type) >= 0) {
+ c = Conversions.copyInitializationOfClass(isLValue, sourceType, type, false);
} else {
c = Conversions.checkImplicitConversionSequence(type, sourceType, isLValue,
- UDCMode.ALLOWED, Context.ORDINARY, typeId);
+ UDCMode.ALLOWED, Context.ORDINARY);
}
if (c.converts()) {
ICPPFunction f = c.getUserDefinedConversion();
@@ -3651,7 +3699,7 @@ public class CPPSemantics {
// List initialization.
ICPPEvaluation eval= ((ICPPASTInitializerClause) initializer).getEvaluation();
if (eval instanceof EvalInitList) {
- Cost c= Conversions.listInitializationSequence((EvalInitList) eval, type, UDCMode.ALLOWED, true, typeId);
+ Cost c= Conversions.listInitializationSequence((EvalInitList) eval, type, UDCMode.ALLOWED, true);
if (c.converts()) {
ICPPFunction f = c.getUserDefinedConversion();
if (f instanceof ICPPConstructor)
@@ -3664,7 +3712,7 @@ public class CPPSemantics {
(ICPPASTConstructorInitializer) initializer, typeId);
} else if (initializer == null) {
// Default initialization.
- ICPPConstructor[] ctors = ClassTypeHelper.getConstructors(type, typeId);
+ ICPPConstructor[] ctors = type.getConstructors();
for (ICPPConstructor ctor : ctors) {
if (ctor.getRequiredArgumentCount() == 0)
return ctor;
@@ -3672,6 +3720,8 @@ public class CPPSemantics {
return null;
}
} catch (DOMException e) {
+ } finally {
+ popLookupPoint();
}
return null;
}
@@ -3689,7 +3739,7 @@ public class CPPSemantics {
LookupData data = new LookupData(astName);
data.setFunctionArguments(false, arguments);
data.qualified = true;
- data.foundItems = ClassTypeHelper.getConstructors(classType, typeId);
+ data.foundItems = classType.getConstructors();
try {
return resolveAmbiguities(data);
} catch (DOMException e) {
@@ -3737,10 +3787,10 @@ public class CPPSemantics {
/**
* For simplicity returns an operator of form RT (T, T) rather than RT (boolean, T, T)
*/
- public static ICPPFunction findOverloadedConditionalOperator(IASTNode pointOfInstantiation, IScope pointOfDefinition,
+ public static ICPPFunction findOverloadedConditionalOperator(IScope pointOfDefinition,
ICPPEvaluation positive, ICPPEvaluation negative) {
final ICPPEvaluation[] args = new ICPPEvaluation[] {positive, negative};
- return findOverloadedOperator(pointOfInstantiation, pointOfDefinition, args, null,
+ return findOverloadedOperator(pointOfDefinition, args, null,
OverloadableOperator.CONDITIONAL_OPERATOR, LookupMode.NO_GLOBALS);
}
@@ -3748,22 +3798,23 @@ public class CPPSemantics {
* Returns the operator,() function that would apply to the two given arguments.
* The lookup type of the class where the operator,() might be found must also be provided.
*/
- public static ICPPFunction findOverloadedOperatorComma(IASTNode pointOfInstantiation, IScope pointOfDefinition,
+ public static ICPPFunction findOverloadedOperatorComma(IScope pointOfDefinition,
ICPPEvaluation arg1, ICPPEvaluation arg2) {
- IType op1type = getNestedType(arg1.getType(pointOfInstantiation), TDEF | REF | CVTYPE);
- IType op2type = getNestedType(arg2.getType(pointOfInstantiation), TDEF | REF | CVTYPE);
+ IType op1type = getNestedType(arg1.getType(), TDEF | REF | CVTYPE);
+ IType op2type = getNestedType(arg2.getType(), TDEF | REF | CVTYPE);
if (!isUserDefined(op1type) && !isUserDefined(op2type))
return null;
ICPPEvaluation[] args = { arg1 , arg2 };
- return findOverloadedOperator(pointOfInstantiation, pointOfDefinition, args, op1type,
+ return findOverloadedOperator(pointOfDefinition, args, op1type,
OverloadableOperator.COMMA, LookupMode.LIMITED_GLOBALS);
}
static enum LookupMode {NO_GLOBALS, GLOBALS_IF_NO_MEMBERS, LIMITED_GLOBALS, ALL_GLOBALS}
- static ICPPFunction findOverloadedOperator(IASTNode pointOfInstantiation, IScope pointOfDefinition,
- ICPPEvaluation[] args, IType methodLookupType, OverloadableOperator operator, LookupMode mode) {
+ static ICPPFunction findOverloadedOperator(IScope pointOfDefinition, ICPPEvaluation[] args,
+ IType methodLookupType, OverloadableOperator operator, LookupMode mode) {
+ IASTNode pointOfInstantiation = CPPSemantics.getCurrentLookupPoint();
while (pointOfInstantiation instanceof IASTName) {
pointOfInstantiation= pointOfInstantiation.getParent();
}
@@ -3771,7 +3822,7 @@ public class CPPSemantics {
ICPPClassType callToObjectOfClassType= null;
IType type2= null;
if (args.length >= 2) {
- type2 = args[1].getType(pointOfInstantiation);
+ type2 = args[1].getType();
type2= getNestedType(type2, TDEF | REF | CVTYPE);
}
@@ -3913,7 +3964,7 @@ public class CPPSemantics {
if (callToObjectOfClassType != null) {
try {
// 13.3.1.1.2 call to object of class type
- ICPPMethod[] ops = SemanticUtil.getConversionOperators(callToObjectOfClassType, pointOfInstantiation);
+ ICPPMethod[] ops = SemanticUtil.getConversionOperators(callToObjectOfClassType);
for (ICPPMethod op : ops) {
if (op.isExplicit())
continue;
@@ -3936,7 +3987,7 @@ public class CPPSemantics {
}
if (methodLookupType instanceof ICPPClassType || type2 instanceof ICPPClassType) {
- ICPPFunction[] builtins= BuiltinOperators.create(operator, args, pointOfInstantiation, (Object[]) funcData.foundItems);
+ ICPPFunction[] builtins= BuiltinOperators.create(operator, args, (Object[]) funcData.foundItems);
mergeResults(funcData, builtins, false);
}
@@ -4385,8 +4436,9 @@ public class CPPSemantics {
return false;
}
- protected static IBinding resolveUnknownName(IScope scope, ICPPUnknownBinding unknown, IASTNode point) {
+ protected static IBinding resolveUnknownName(IScope scope, ICPPUnknownBinding unknown) {
final char[] unknownName = unknown.getNameCharArray();
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
LookupData data = new LookupData(unknownName, null, point);
data.setIgnorePointOfDeclaration(true);
data.typesOnly= unknown instanceof IType;
@@ -4435,13 +4487,12 @@ public class CPPSemantics {
* instantiate it.
*
* @param eval the (instantiated) evaluation representing the expression
- * @param point
*/
- public static IType getDeclTypeForEvaluation(ICPPEvaluation eval, IASTNode point) {
- IType expressionType = eval.getType(point);
+ public static IType getDeclTypeForEvaluation(ICPPEvaluation eval) {
+ IType expressionType = eval.getType();
boolean namedEntity = eval instanceof EvalBinding || eval instanceof EvalMemberAccess;
if (!namedEntity && !(expressionType instanceof ICPPReferenceType)) {
- switch (eval.getValueCategory(point)) {
+ switch (eval.getValueCategory()) {
case XVALUE:
return new CPPReferenceType(expressionType, true);
case LVALUE:
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index f556d0ed6ef..932947ae937 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -245,37 +245,37 @@ public class CPPTemplates {
/**
* Instantiates a class or variable template with the given arguments. May return {@code null}.
*/
- public static IBinding instantiate(ICPPPartiallySpecializable template, ICPPTemplateArgument[] args, IASTNode point) {
- return instantiate(template, args, false, false, point);
+ public static IBinding instantiate(ICPPPartiallySpecializable template, ICPPTemplateArgument[] args) {
+ return instantiate(template, args, false, false);
}
/**
* Instantiates a class template with the given arguments. May return {@code null}.
*/
private static IBinding instantiate(ICPPPartiallySpecializable template, ICPPTemplateArgument[] args,
- boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
+ boolean isDefinition, boolean isExplicitSpecialization) {
try {
ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args);
// Add default arguments, if necessary.
- arguments= addDefaultArguments(template, arguments, point);
+ arguments= addDefaultArguments(template, arguments);
if (arguments == null)
- return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
+ return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
if (template instanceof ICPPTemplateTemplateParameter || hasDependentArgument(arguments)) {
- return deferredInstance(template, arguments, point);
+ return deferredInstance(template, arguments);
}
if (template instanceof ICPPClassTemplatePartialSpecialization) {
return instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) template,
- arguments, isDefinition, null, point);
+ arguments, isDefinition, null);
}
if (arguments == args) {
arguments= args.clone(); // The createParameterMap call may modify the arguments array.
}
- CPPTemplateParameterMap map = createParameterMap(template, arguments, point);
+ CPPTemplateParameterMap map = createParameterMap(template, arguments);
if (map == null) {
- return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
+ return createProblem(template, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
}
ICPPTemplateInstance prim= getInstance(template, arguments, isDefinition);
@@ -283,12 +283,12 @@ public class CPPTemplates {
return prim;
if (!isExplicitSpecialization) {
- IBinding result= selectSpecialization(template, arguments, isDefinition, point);
+ IBinding result= selectSpecialization(template, arguments, isDefinition);
if (result != null)
return result;
}
- return instantiatePrimaryTemplate(template, arguments, new InstantiationContext(map, point),
+ return instantiatePrimaryTemplate(template, arguments, new InstantiationContext(map),
isDefinition);
} catch (DOMException e) {
return e.getProblem();
@@ -299,26 +299,26 @@ public class CPPTemplates {
* Instantiates an alias template with the given arguments.
*/
public static IBinding instantiateAliasTemplate(ICPPAliasTemplate aliasTemplate,
- ICPPTemplateArgument[] args, IASTNode point) {
+ ICPPTemplateArgument[] args) {
try {
- args = addDefaultArguments(aliasTemplate, args, point);
+ args = addDefaultArguments(aliasTemplate, args);
if (args == null) {
- return createProblem(aliasTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
+ return createProblem(aliasTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
}
- ICPPTemplateParameterMap parameterMap = createParameterMap(aliasTemplate, args, point);
+ ICPPTemplateParameterMap parameterMap = createParameterMap(aliasTemplate, args);
if (parameterMap == null) {
- return createProblem(aliasTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, point);
+ return createProblem(aliasTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
}
IType aliasedType = aliasTemplate.getType();
IBinding owner = aliasTemplate.getOwner();
- return createAliasTemplaceInstance(aliasTemplate, args, parameterMap, aliasedType, owner, point);
+ return createAliasTemplaceInstance(aliasTemplate, args, parameterMap, aliasedType, owner);
} catch (DOMException e) {
return e.getProblem();
}
}
- private static IBinding createProblem(ICPPTemplateDefinition template, int id, IASTNode point) {
- return new ProblemBinding(point, id, template.getNameCharArray());
+ private static IBinding createProblem(ICPPTemplateDefinition template, int id) {
+ return new ProblemBinding(CPPSemantics.getCurrentLookupPoint(), id, template.getNameCharArray());
}
static IBinding isUsedInClassTemplateScope(ICPPClassTemplate ct, IASTName name) {
@@ -390,7 +390,7 @@ public class CPPTemplates {
}
private static IBinding instantiateFunctionTemplate(ICPPFunctionTemplate template,
- ICPPTemplateArgument[] arguments, CPPTemplateParameterMap tpMap, IASTNode point)
+ ICPPTemplateArgument[] arguments, CPPTemplateParameterMap tpMap)
throws DOMException {
ICPPTemplateInstance instance= getInstance(template, arguments, false);
if (instance != null) {
@@ -398,7 +398,7 @@ public class CPPTemplates {
}
IBinding owner= template.getOwner();
- instance = createInstance(owner, template, tpMap, arguments, point);
+ instance = createInstance(owner, template, tpMap, arguments);
if (instance instanceof ICPPFunction && SemanticUtil.isValidType(((ICPPFunction) instance).getType())) {
addInstance(template, arguments, instance);
}
@@ -409,7 +409,7 @@ public class CPPTemplates {
* Instantiates a partial class template specialization.
*/
private static IBinding instantiatePartialSpecialization(ICPPPartialSpecialization partialSpec,
- ICPPTemplateArgument[] args, boolean isDef, CPPTemplateParameterMap tpMap, IASTNode point)
+ ICPPTemplateArgument[] args, boolean isDef, CPPTemplateParameterMap tpMap)
throws DOMException {
ICPPTemplateInstance instance= getInstance(partialSpec, args, isDef);
if (instance != null)
@@ -418,12 +418,12 @@ public class CPPTemplates {
if (tpMap == null) {
tpMap = new CPPTemplateParameterMap(args.length);
if (!TemplateArgumentDeduction.fromTemplateArguments(partialSpec.getTemplateParameters(),
- partialSpec.getTemplateArguments(), args, tpMap, point)) {
+ partialSpec.getTemplateArguments(), args, tpMap)) {
return null;
}
}
- instance= createInstance(partialSpec.getOwner(), partialSpec, tpMap, args, point);
+ instance= createInstance(partialSpec.getOwner(), partialSpec, tpMap, args);
addInstance(partialSpec, args, instance);
return instance;
}
@@ -441,7 +441,7 @@ public class CPPTemplates {
}
IBinding owner= template.getOwner();
- instance = createInstance(owner, template, context.getParameterMap(), arguments, context.getPoint());
+ instance = createInstance(owner, template, context.getParameterMap(), arguments);
addInstance(template, arguments, instance);
return instance;
}
@@ -481,7 +481,7 @@ public class CPPTemplates {
}
private static IBinding deferredInstance(ICPPPartiallySpecializable template,
- ICPPTemplateArgument[] arguments, IASTNode point) throws DOMException {
+ ICPPTemplateArgument[] arguments) throws DOMException {
ICPPTemplateInstance instance= getInstance(template, arguments, false);
if (instance != null)
return instance;
@@ -498,7 +498,7 @@ public class CPPTemplates {
}
private static ICPPTemplateArgument[] addDefaultArguments(ICPPTemplateDefinition template,
- ICPPTemplateArgument[] arguments, IASTNode point) throws DOMException {
+ ICPPTemplateArgument[] arguments) throws DOMException {
if (template instanceof ICPPClassTemplatePartialSpecialization)
return arguments;
@@ -546,7 +546,7 @@ public class CPPTemplates {
ICPPTemplateArgument[] completeArgs= new ICPPTemplateArgument[tparCount];
CPPTemplateParameterMap map= new CPPTemplateParameterMap(tparCount);
- InstantiationContext context = new InstantiationContext(map, point);
+ InstantiationContext context = new InstantiationContext(map);
for (int i = 0; i < tparCount; i++) {
final ICPPTemplateParameter tpar = tpars[i];
if (tpar.isParameterPack()) {
@@ -753,6 +753,7 @@ public class CPPTemplates {
}
}
}
+ CPPSemantics.pushLookupPoint(id);
try {
IBinding result= null;
IASTName templateName = id.getTemplateName();
@@ -766,7 +767,7 @@ public class CPPTemplates {
if (template instanceof ICPPAliasTemplate) {
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) template;
ICPPTemplateArgument[] args = createTemplateArgumentArray(id);
- return instantiateAliasTemplate(aliasTemplate, args, id);
+ return instantiateAliasTemplate(aliasTemplate, args);
}
// Class or variable template.
@@ -792,7 +793,7 @@ public class CPPTemplates {
if (argsAreTrivial(classTemplate.getTemplateParameters(), args)) {
result= classTemplate;
} else {
- args= addDefaultArguments(classTemplate, args, id);
+ args= addDefaultArguments(classTemplate, args);
if (args == null) {
return new ProblemBinding(id, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, templateName.toCharArray());
}
@@ -832,7 +833,7 @@ public class CPPTemplates {
}
}
if (result == null) {
- result= instantiate(classTemplate, args, isDefinition, isExplicitSpecialization, id);
+ result= instantiate(classTemplate, args, isDefinition, isExplicitSpecialization);
if (result instanceof ICPPInternalBinding) {
if (isDeclaration) {
ASTInternal.addDeclaration(result, id);
@@ -844,13 +845,15 @@ public class CPPTemplates {
return CPPSemantics.postResolution(result, id);
} catch (DOMException e) {
return e.getProblem();
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
private static IBinding createAliasTemplaceInstance(ICPPAliasTemplate aliasTemplate,
ICPPTemplateArgument[] args, ICPPTemplateParameterMap parameterMap, IType aliasedType,
- IBinding owner, IASTNode point) {
- InstantiationContext context = createInstantiationContext(parameterMap, owner, point);
+ IBinding owner) {
+ InstantiationContext context = createInstantiationContext(parameterMap, owner);
IType instantiatedType = instantiateType(aliasedType, context);
return new CPPAliasTemplateInstance(aliasTemplate, instantiatedType, owner, parameterMap, args);
}
@@ -879,7 +882,7 @@ public class CPPTemplates {
}
public static ICPPTemplateInstance createInstance(IBinding owner, ICPPTemplateDefinition template,
- ICPPTemplateParameterMap tpMap, ICPPTemplateArgument[] args, IASTNode point) {
+ ICPPTemplateParameterMap tpMap, ICPPTemplateArgument[] args) {
if (owner instanceof ICPPSpecialization) {
ICPPTemplateParameterMap map= ((ICPPSpecialization) owner).getTemplateParameterMap();
if (map != null) {
@@ -892,7 +895,7 @@ public class CPPTemplates {
instance = new CPPClassInstance((ICPPClassType) template, owner, tpMap, args);
} else if (template instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) template;
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), context);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), context);
CPPFunctionSpecialization spec;
@@ -911,10 +914,11 @@ public class CPPTemplates {
instance = (ICPPTemplateInstance) spec;
} else if (template instanceof ICPPVariable) {
ICPPVariable var = (ICPPVariable) template;
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
IType type = instantiateType(var.getType(), context);
IValue value;
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
ICPPASTDeclarator decl = ASTQueries.findAncestorWithType(point, ICPPASTDeclarator.class);
if (point instanceof IASTName && ((IASTName) point).getRoleOfName(false) == IASTNameOwner.r_definition
&& decl != null && decl.getInitializer() != null) {
@@ -972,7 +976,7 @@ public class CPPTemplates {
return newVariable;
}
- public static IBinding createSpecialization(ICPPSpecialization owner, IBinding decl, IASTNode point) {
+ public static IBinding createSpecialization(ICPPSpecialization owner, IBinding decl) {
IBinding spec = null;
final ICPPTemplateParameterMap tpMap= owner.getTemplateParameterMap();
final ICPPClassSpecialization classOwner = (owner instanceof ICPPClassSpecialization) ? (ICPPClassSpecialization) owner : null;
@@ -980,7 +984,7 @@ public class CPPTemplates {
// Guard against infinite recursion during template instantiation with a depth limit.
int instantiationDepth = fTemplateInstantiationDepth.get();
if (instantiationDepth > TEMPLATE_INSTANTIATION_DEPTH_LIMIT) {
- return RecursionResolvingBinding.createFor(decl, point);
+ return RecursionResolvingBinding.createFor(decl);
}
// Increment the instantiation depth for the duration of this call.
fTemplateInstantiationDepth.set(instantiationDepth + 1);
@@ -992,8 +996,8 @@ public class CPPTemplates {
ICPPClassTemplate template= pspec.getPrimaryClassTemplate();
ICPPTemplateArgument[] args = pspec.getTemplateArguments();
- template= (ICPPClassTemplate) classOwner.specializeMember(template, point);
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ template= (ICPPClassTemplate) classOwner.specializeMember(template);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
args= instantiateArguments(args, context, false);
spec= new CPPClassTemplatePartialSpecializationSpecialization(pspec, tpMap, template, args);
} catch (DOMException e) {
@@ -1002,7 +1006,7 @@ public class CPPTemplates {
ICPPClassTemplate template = (ICPPClassTemplate) decl;
CPPClassTemplateSpecialization classTemplateSpec = new CPPClassTemplateSpecialization(template, classOwner, tpMap);
classTemplateSpec.setTemplateParameters(specializeTemplateParameters(classTemplateSpec,
- (ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), classOwner, point));
+ (ICPPScope) classTemplateSpec.getScope(), template.getTemplateParameters(), classOwner));
spec = classTemplateSpec;
} else if (decl instanceof ICPPClassType && classOwner != null) {
// TODO: Handle local classes
@@ -1014,7 +1018,7 @@ public class CPPTemplates {
}
} else if (decl instanceof ICPPField && classOwner != null) {
ICPPField field= (ICPPField) decl;
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
IType type= instantiateType(field.getType(), context);
IValue value= instantiateValue(field.getInitialValue(), context, IntegralValue.MAX_RECURSION_DEPTH);
if (decl instanceof ICPPFieldTemplate) {
@@ -1022,7 +1026,7 @@ public class CPPTemplates {
classOwner, tpMap, type, value);
ICPPTemplateParameter[] params = specializeTemplateParameters(fieldTempSpec,
(ICPPScope) fieldTempSpec.getScope(),
- ((ICPPFieldTemplate) decl).getTemplateParameters(), classOwner, point);
+ ((ICPPFieldTemplate) decl).getTemplateParameters(), classOwner);
fieldTempSpec.setTemplateParameters(params);
spec = fieldTempSpec;
} else {
@@ -1030,7 +1034,7 @@ public class CPPTemplates {
}
} else if (decl instanceof ICPPFunction) {
ICPPFunction func= (ICPPFunction) decl;
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
ICPPFunctionType type= (ICPPFunctionType) instantiateType(func.getType(), context);
IType[] exceptionSpecs= instantiateTypes(func.getExceptionSpecification(), context);
@@ -1047,7 +1051,7 @@ public class CPPTemplates {
}
methodSpec.setTemplateParameters(specializeTemplateParameters(methodSpec,
(ICPPScope) methodSpec.getScope(),
- ((ICPPFunctionTemplate) decl).getTemplateParameters(), classOwner, point));
+ ((ICPPFunctionTemplate) decl).getTemplateParameters(), classOwner));
functionSpec = methodSpec;
} else {
IBinding oldOwner = decl.getOwner();
@@ -1075,33 +1079,32 @@ public class CPPTemplates {
spec = functionSpec;
}
} else if (decl instanceof ITypedef) {
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
IType type= instantiateType(((ITypedef) decl).getType(), context);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
} else if (decl instanceof ICPPAliasTemplate) {
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
IType type= instantiateType(aliasTemplate.getType(), context);
CPPAliasTemplateSpecialization aliasSpec =
new CPPAliasTemplateSpecialization(aliasTemplate, owner, tpMap, type);
aliasSpec.setTemplateParameters(specializeTemplateParameters(aliasSpec,
- (ICPPScope) aliasSpec.getScope(), aliasTemplate.getTemplateParameters(), classOwner,
- point));
+ (ICPPScope) aliasSpec.getScope(), aliasTemplate.getTemplateParameters(), classOwner));
spec = aliasSpec;
} else if (decl instanceof ICPPEnumeration && classOwner != null) {
// TODO: Handle local enumerations
- spec = CPPEnumerationSpecialization.createInstance((ICPPEnumeration) decl, classOwner, tpMap, point);
+ spec = CPPEnumerationSpecialization.createInstance((ICPPEnumeration) decl, classOwner, tpMap);
} else if (decl instanceof IEnumerator && classOwner != null) {
IEnumerator enumerator = (IEnumerator) decl;
ICPPEnumeration enumeration = (ICPPEnumeration) enumerator.getOwner();
- IBinding enumSpec = classOwner.specializeMember(enumeration, point);
+ IBinding enumSpec = classOwner.specializeMember(enumeration);
if (enumSpec instanceof ICPPEnumerationSpecialization) {
spec = ((ICPPEnumerationSpecialization) enumSpec).specializeEnumerator(enumerator);
}
} else if (decl instanceof ICPPUsingDeclaration) {
IBinding[] delegates= ((ICPPUsingDeclaration) decl).getDelegates();
List<IBinding> result= new ArrayList<>();
- InstantiationContext context = createInstantiationContext(tpMap, owner, point);
+ InstantiationContext context = createInstantiationContext(tpMap, owner);
for (IBinding delegate : delegates) {
try {
if (delegate instanceof ICPPUnknownBinding) {
@@ -1130,8 +1133,8 @@ public class CPPTemplates {
}
private static InstantiationContext createInstantiationContext(ICPPTemplateParameterMap tpMap,
- IBinding owner, IASTNode point) {
- return new InstantiationContext(tpMap, getSpecializationContext(owner), point);
+ IBinding owner) {
+ return new InstantiationContext(tpMap, getSpecializationContext(owner));
}
public static ICPPClassSpecialization getSpecializationContext(IBinding owner) {
@@ -1161,7 +1164,7 @@ public class CPPTemplates {
ICPPEvaluation instantiated = evaluation.instantiate(context, maxDepth);
if (instantiated == evaluation)
return value;
- return instantiated.getValue(context.getPoint());
+ return instantiated.getValue();
}
public static boolean containsParameterPack(IType type) {
@@ -1292,7 +1295,8 @@ public class CPPTemplates {
IType innerType= ((ICPPParameterPackType) origType).getType();
int packSize= determinePackSize(innerType, context.getParameterMap());
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
- newType= new ProblemBinding(context.getPoint(), IProblemBinding.SEMANTIC_INVALID_TYPE,
+ newType= new ProblemBinding(CPPSemantics.getCurrentLookupPoint(),
+ IProblemBinding.SEMANTIC_INVALID_TYPE,
types[i] instanceof IBinding ? ((IBinding) types[i]).getNameCharArray() : null);
} else if (packSize == PACK_SIZE_DEFER) {
newType= origType;
@@ -1332,7 +1336,8 @@ public class CPPTemplates {
* {@code false}, any invalid instantiated arguments are replaced by the corresponding original
* arguments.
*/
- public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args, InstantiationContext context, boolean strict) throws DOMException {
+ public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
+ InstantiationContext context, boolean strict) throws DOMException {
// Don't create a new array until it's really needed.
ICPPTemplateArgument[] result = args;
int resultShift= 0;
@@ -1343,7 +1348,7 @@ public class CPPTemplates {
ICPPTemplateArgument pattern= origArg.getExpansionPattern();
int packSize= determinePackSize(pattern, context.getParameterMap());
if (packSize == PACK_SIZE_FAIL || packSize == PACK_SIZE_NOT_FOUND) {
- throw new DOMException(new ProblemBinding(context.getPoint(),
+ throw new DOMException(new ProblemBinding(CPPSemantics.getCurrentLookupPoint(),
IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, null));
} else if (packSize == PACK_SIZE_DEFER) {
newArg= origArg;
@@ -1414,7 +1419,7 @@ public class CPPTemplates {
final ICPPEvaluation newEval= eval.instantiate(context, IntegralValue.MAX_RECURSION_DEPTH);
if (eval == newEval)
return arg;
- return new CPPTemplateNonTypeArgument(newEval, context.getPoint());
+ return new CPPTemplateNonTypeArgument(newEval);
}
// Which to instantiate, getOriginalTypeValue() or getTypeValue()?
@@ -1523,9 +1528,9 @@ public class CPPTemplates {
ICPPEvaluation instantiated = eval.instantiate(context, IntegralValue.MAX_RECURSION_DEPTH);
if (instantiated != eval) {
if (dependentType.isForDecltype()) {
- return CPPSemantics.getDeclTypeForEvaluation(instantiated, context.getPoint());
+ return CPPSemantics.getDeclTypeForEvaluation(instantiated);
} else {
- return instantiated.getType(context.getPoint());
+ return instantiated.getType();
}
}
} else {
@@ -1572,7 +1577,7 @@ public class CPPTemplates {
}
if (newOwner != owner && newOwner instanceof ICPPClassSpecialization) {
- return (IType) ((ICPPClassSpecialization) newOwner).specializeMember(typeAsBinding, context.getPoint());
+ return (IType) ((ICPPClassSpecialization) newOwner).specializeMember(typeAsBinding);
}
}
}
@@ -1587,7 +1592,7 @@ public class CPPTemplates {
ICPPTemplateArgument[] newArgs = instantiateArguments(args, context, true);
if (newArgs == null) {
return (IType) createProblem(template,
- IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, context.getPoint());
+ IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
}
if (args != newArgs) {
IType target = instantiateType(instance.getType(), context);
@@ -1660,15 +1665,14 @@ public class CPPTemplates {
* @param scope the scope of the nested template specialization
* @param specialized the template parameter to be specialized
* @param within the specialization of the enclosing class
- * @param point the point of template instantiation
* @return the specialized template parameter
*/
public static ICPPTemplateParameter specializeTemplateParameter(ICPPSpecialization owner, ICPPScope scope,
- ICPPTemplateParameter specialized, ICPPClassSpecialization within, IASTNode point) {
+ ICPPTemplateParameter specialized, ICPPClassSpecialization within) {
if (specialized == null)
return null;
ICPPTemplateParameterMap tpMap = owner.getTemplateParameterMap();
- InstantiationContext context = new InstantiationContext(tpMap, 0, within, point);
+ InstantiationContext context = new InstantiationContext(tpMap, 0, within);
ICPPTemplateArgument defaultValue = instantiateArgument(specialized.getDefaultValue(), context);
if (specialized instanceof ICPPTemplateNonTypeParameter) {
ICPPTemplateNonTypeParameter spec = (ICPPTemplateNonTypeParameter) specialized;
@@ -1689,10 +1693,10 @@ public class CPPTemplates {
* See specializeTemplateParameter().
*/
public static ICPPTemplateParameter[] specializeTemplateParameters(ICPPSpecialization owner, ICPPScope scope,
- ICPPTemplateParameter[] specialized, ICPPClassSpecialization within, IASTNode point) {
+ ICPPTemplateParameter[] specialized, ICPPClassSpecialization within) {
ICPPTemplateParameter[] result = new ICPPTemplateParameter[specialized.length];
for (int i = 0; i < specialized.length; ++i)
- result[i] = specializeTemplateParameter(owner, scope, specialized[i], within, point);
+ result[i] = specializeTemplateParameter(owner, scope, specialized[i], within);
return result;
}
@@ -1713,7 +1717,7 @@ public class CPPTemplates {
owner = instantiateBinding(owner, context, maxDepth);
}
if (owner instanceof ICPPClassSpecialization) {
- return ((ICPPClassSpecialization) owner).specializeMember(binding, context.getPoint());
+ return ((ICPPClassSpecialization) owner).specializeMember(binding);
}
} else if (binding instanceof IEnumerator) {
IBinding owner = binding.getOwner();
@@ -1772,8 +1776,8 @@ public class CPPTemplates {
ICPPTemplateArgument[] args = context.getPackExpansion(tpar);
if (args != null) {
if (context.getPackOffset() >= args.length) {
- return new ProblemBinding(context.getPoint(), IProblemBinding.SEMANTIC_INVALID_TYPE,
- tpar.getNameCharArray());
+ return new ProblemBinding(CPPSemantics.getCurrentLookupPoint(),
+ IProblemBinding.SEMANTIC_INVALID_TYPE, tpar.getNameCharArray());
}
arg= args[context.getPackOffset()];
}
@@ -2214,7 +2218,12 @@ public class CPPTemplates {
result[i]= new CPPTemplateTypeArgument(CPPVisitor.createType((IASTTypeId) arg));
} else if (arg instanceof ICPPASTExpression) {
ICPPASTExpression expr= (ICPPASTExpression) arg;
- result[i]= new CPPTemplateNonTypeArgument(expr.getEvaluation(), expr);
+ CPPSemantics.pushLookupPoint(expr);
+ try {
+ result[i]= new CPPTemplateNonTypeArgument(expr.getEvaluation());
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
} else if (arg instanceof ICPPASTAmbiguousTemplateArgument) {
IProblemBinding problem = new ProblemBinding(id, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
throw new DOMException(problem);
@@ -2227,7 +2236,7 @@ public class CPPTemplates {
}
static ICPPFunction[] instantiateForFunctionCall(ICPPFunction[] fns, ICPPTemplateArgument[] tmplArgs,
- List<IType> fnArgs, List<ValueCategory> argCats, boolean withImpliedObjectArg, IASTNode point) {
+ List<IType> fnArgs, List<ValueCategory> argCats, boolean withImpliedObjectArg) {
// Extract template arguments.
boolean requireTemplate= tmplArgs != null;
boolean haveTemplate= false;
@@ -2257,7 +2266,7 @@ public class CPPTemplates {
if (fn instanceof ICPPFunctionTemplate) {
ICPPFunctionTemplate fnTmpl= (ICPPFunctionTemplate) fn;
ICPPFunction inst = instantiateForFunctionCall(fnTmpl, tmplArgs, fnArgs, argCats,
- withImpliedObjectArg, point);
+ withImpliedObjectArg);
if (inst != null)
result.add(inst);
} else if (!requireTemplate || fn instanceof ICPPUnknownBinding) {
@@ -2270,7 +2279,7 @@ public class CPPTemplates {
private static ICPPFunction instantiateForFunctionCall(ICPPFunctionTemplate template,
ICPPTemplateArgument[] tmplArgs, List<IType> fnArgs, List<ValueCategory> argCats,
- boolean withImpliedObjectArg, IASTNode point) {
+ boolean withImpliedObjectArg) {
if (withImpliedObjectArg && template instanceof ICPPMethod) {
fnArgs= fnArgs.subList(1, fnArgs.size());
argCats= argCats.subList(1, argCats.size());
@@ -2279,9 +2288,9 @@ public class CPPTemplates {
CPPTemplateParameterMap map= new CPPTemplateParameterMap(fnArgs.size());
try {
ICPPTemplateArgument[] args=
- TemplateArgumentDeduction.deduceForFunctionCall(template, tmplArgs, fnArgs, argCats, map, point);
+ TemplateArgumentDeduction.deduceForFunctionCall(template, tmplArgs, fnArgs, argCats, map);
if (args != null) {
- IBinding instance= instantiateFunctionTemplate(template, args, map, point);
+ IBinding instance= instantiateFunctionTemplate(template, args, map);
if (instance instanceof ICPPFunction) {
final ICPPFunction f = (ICPPFunction) instance;
if (isValidFunctionType(f.getType())) {
@@ -2322,8 +2331,7 @@ public class CPPTemplates {
* 14.8.2.3 Deducing conversion function template arguments
* @param point
*/
- static ICPPFunction[] instantiateConversionTemplates(ICPPFunction[] functions, IType conversionType,
- IASTNode point) {
+ static ICPPFunction[] instantiateConversionTemplates(ICPPFunction[] functions, IType conversionType) {
boolean checkedForDependentType= false;
ICPPFunction[] result= functions;
int i= 0;
@@ -2345,9 +2353,9 @@ public class CPPTemplates {
CPPTemplateParameterMap map= new CPPTemplateParameterMap(1);
try {
ICPPTemplateArgument[] args=
- TemplateArgumentDeduction.deduceForConversion(template, conversionType, map, point);
+ TemplateArgumentDeduction.deduceForConversion(template, conversionType, map);
if (args != null) {
- IBinding instance= instantiateFunctionTemplate(template, args, map, point);
+ IBinding instance= instantiateFunctionTemplate(template, args, map);
if (instance instanceof ICPPFunction) {
inst= (ICPPFunction) instance;
}
@@ -2375,12 +2383,12 @@ public class CPPTemplates {
* @return
*/
static ICPPFunction instantiateForFunctionDeclaration(ICPPFunctionTemplate template,
- ICPPTemplateArgument[] args, ICPPFunctionType functionType, IASTNode point) {
+ ICPPTemplateArgument[] args, ICPPFunctionType functionType) {
CPPTemplateParameterMap map= new CPPTemplateParameterMap(1);
try {
- args= TemplateArgumentDeduction.deduceForDeclaration(template, args, functionType, map, point);
+ args= TemplateArgumentDeduction.deduceForDeclaration(template, args, functionType, map);
if (args != null) {
- IBinding instance= instantiateFunctionTemplate(template, args, map, point);
+ IBinding instance= instantiateFunctionTemplate(template, args, map);
if (instance instanceof ICPPFunction) {
return (ICPPFunction) instance;
}
@@ -2396,7 +2404,7 @@ public class CPPTemplates {
* 14.8.2.2 Deducing template arguments taking the address of a function template [temp.deduct.funcaddr]
*/
static ICPPFunction instantiateForAddressOfFunction(ICPPFunctionTemplate template, IFunctionType target,
- ICPPTemplateArgument[] args, IASTNode point) {
+ ICPPTemplateArgument[] args) {
try {
if (target != null && isDependentType(target)) {
return CPPDeferredFunction.createForCandidates(template);
@@ -2406,9 +2414,9 @@ public class CPPTemplates {
args= ICPPTemplateArgument.EMPTY_ARGUMENTS;
CPPTemplateParameterMap map= new CPPTemplateParameterMap(4);
- args= TemplateArgumentDeduction.deduceForAddressOf(template, args, target, map, point);
+ args= TemplateArgumentDeduction.deduceForAddressOf(template, args, target, map);
if (args != null) {
- IBinding instance= instantiateFunctionTemplate(template, args, map, point);
+ IBinding instance= instantiateFunctionTemplate(template, args, map);
if (instance instanceof ICPPFunction) {
return (ICPPFunction) instance;
}
@@ -2419,7 +2427,7 @@ public class CPPTemplates {
}
// 14.5.6.2 Partial ordering of function templates
- static int orderFunctionTemplates(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode, IASTNode point)
+ static int orderFunctionTemplates(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode)
throws DOMException {
if (f1 == f2)
return 0;
@@ -2428,8 +2436,8 @@ public class CPPTemplates {
if (f2 == null)
return 1;
- int s1 = compareSpecialization(f1, f2, mode, point);
- int s2 = compareSpecialization(f2, f1, mode, point);
+ int s1 = compareSpecialization(f1, f2, mode);
+ int s2 = compareSpecialization(f2, f1, mode);
if (s1 == s2)
return 0;
@@ -2439,7 +2447,7 @@ public class CPPTemplates {
return 1;
}
- private static ICPPFunction transferFunctionTemplate(ICPPFunctionTemplate f, IASTNode point) throws DOMException {
+ private static ICPPFunction transferFunctionTemplate(ICPPFunctionTemplate f) throws DOMException {
final ICPPTemplateParameter[] tpars = f.getTemplateParameters();
final int argLen = tpars.length;
@@ -2457,7 +2465,7 @@ public class CPPTemplates {
}
}
- IBinding result = instantiateFunctionTemplate(f, args, map, point);
+ IBinding result = instantiateFunctionTemplate(f, args, map);
if (result instanceof ICPPFunction)
return (ICPPFunction) result;
@@ -2494,8 +2502,8 @@ public class CPPTemplates {
originalType.isRValueReference(), originalType.takesVarArgs());
}
- private static int compareSpecialization(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode, IASTNode point) throws DOMException {
- ICPPFunction transF1 = transferFunctionTemplate(f1, point);
+ private static int compareSpecialization(ICPPFunctionTemplate f1, ICPPFunctionTemplate f2, TypeSelection mode) throws DOMException {
+ ICPPFunction transF1 = transferFunctionTemplate(f1);
if (transF1 == null)
return -1;
@@ -2529,7 +2537,7 @@ public class CPPTemplates {
}
break;
}
- return TemplateArgumentDeduction.deduceForPartialOrdering(f2.getTemplateParameters(), pars, args, point);
+ return TemplateArgumentDeduction.deduceForPartialOrdering(f2.getTemplateParameters(), pars, args);
}
private static boolean isNonStaticMember(ICPPFunctionTemplate f) {
@@ -2550,7 +2558,7 @@ public class CPPTemplates {
}
static IBinding selectSpecialization(ICPPPartiallySpecializable template, ICPPTemplateArgument[] args,
- boolean isDef, IASTNode point) throws DOMException {
+ boolean isDef) throws DOMException {
if (template == null) {
return null;
}
@@ -2566,9 +2574,9 @@ public class CPPTemplates {
final CPPTemplateParameterMap map = new CPPTemplateParameterMap(args.length);
ICPPTemplateArgument[] specializationArguments = specialization.getTemplateArguments();
if (TemplateArgumentDeduction.fromTemplateArguments(
- specialization.getTemplateParameters(), specializationArguments, args, map, point) &&
- checkInstantiationOfArguments(specializationArguments, map, point)) {
- int compare = orderSpecializations(bestMatch, specialization, point);
+ specialization.getTemplateParameters(), specializationArguments, args, map) &&
+ checkInstantiationOfArguments(specializationArguments, map)) {
+ int compare = orderSpecializations(bestMatch, specialization);
if (compare == 0) {
bestMatchIsBest = false;
} else if (compare < 0) {
@@ -2583,7 +2591,7 @@ public class CPPTemplates {
// specializations, then the use of the class template is ambiguous and the program is
// ill-formed.
if (!bestMatchIsBest) {
- return new CPPTemplateDefinition.CPPTemplateProblem(point,
+ return new CPPTemplateDefinition.CPPTemplateProblem(CPPSemantics.getCurrentLookupPoint(),
IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, template.getNameCharArray());
}
@@ -2591,15 +2599,15 @@ public class CPPTemplates {
return null;
if (bestMatch instanceof ICPPClassTemplatePartialSpecialization) {
- bestMatch = SemanticUtil.mapToAST((ICPPClassTemplatePartialSpecialization) bestMatch, point);
+ bestMatch = SemanticUtil.mapToAST((ICPPClassTemplatePartialSpecialization) bestMatch);
}
- return instantiatePartialSpecialization(bestMatch, args, isDef, bestMap, point);
+ return instantiatePartialSpecialization(bestMatch, args, isDef, bestMap);
}
private static boolean checkInstantiationOfArguments(ICPPTemplateArgument[] args,
- CPPTemplateParameterMap tpMap, IASTNode point) throws DOMException {
- return instantiateArguments(args, new InstantiationContext(tpMap, point), true) != null;
+ CPPTemplateParameterMap tpMap) throws DOMException {
+ return instantiateArguments(args, new InstantiationContext(tpMap), true) != null;
}
/**
@@ -2611,7 +2619,8 @@ public class CPPTemplates {
* @return
* @throws DOMException
*/
- static private int orderSpecializations(ICPPPartialSpecialization spec1, ICPPPartialSpecialization spec2, IASTNode point) throws DOMException {
+ static private int orderSpecializations(ICPPPartialSpecialization spec1, ICPPPartialSpecialization spec2)
+ throws DOMException {
if (spec1 == null) {
return -1;
}
@@ -2622,8 +2631,8 @@ public class CPPTemplates {
// 14.5.5.2
// A template is more specialized than another if and only if it is at least as specialized as the
// other template and that template is not at least as specialized as the first.
- boolean f1IsAtLeastAsSpecializedAsF2 = isAtLeastAsSpecializedAs(spec1, spec2, point);
- boolean f2IsAtLeastAsSpecializedAsF1 = isAtLeastAsSpecializedAs(spec2, spec1, point);
+ boolean f1IsAtLeastAsSpecializedAsF2 = isAtLeastAsSpecializedAs(spec1, spec2);
+ boolean f2IsAtLeastAsSpecializedAsF1 = isAtLeastAsSpecializedAs(spec2, spec1);
if (f1IsAtLeastAsSpecializedAsF2 == f2IsAtLeastAsSpecializedAsF1)
return 0;
@@ -2634,7 +2643,8 @@ public class CPPTemplates {
return -1;
}
- private static boolean isAtLeastAsSpecializedAs(ICPPPartialSpecialization f1, ICPPPartialSpecialization f2, IASTNode point) throws DOMException {
+ private static boolean isAtLeastAsSpecializedAs(ICPPPartialSpecialization f1, ICPPPartialSpecialization f2)
+ throws DOMException {
// 14.5.5.2
// Using the transformed parameter list, perform argument deduction against the other
// function template
@@ -2660,11 +2670,11 @@ public class CPPTemplates {
}
}
final ICPPTemplateArgument[] transferredArgs1 =
- instantiateArguments(targs1, new InstantiationContext(transferMap, point), false);
+ instantiateArguments(targs1, new InstantiationContext(transferMap), false);
// Deduce arguments for specialization 2
final CPPTemplateParameterMap deductionMap= new CPPTemplateParameterMap(2);
- return TemplateArgumentDeduction.fromTemplateArguments(tpars2, targs2, transferredArgs1, deductionMap, point);
+ return TemplateArgumentDeduction.fromTemplateArguments(tpars2, targs2, transferredArgs1, deductionMap);
}
static boolean isValidArgument(ICPPTemplateArgument arg) {
@@ -2672,7 +2682,7 @@ public class CPPTemplates {
}
static ICPPTemplateArgument matchTemplateParameterAndArgument(ICPPTemplateDefinition template,
- ICPPTemplateParameter param, ICPPTemplateArgument arg, CPPTemplateParameterMap map, IASTNode point) {
+ ICPPTemplateParameter param, ICPPTemplateArgument arg, CPPTemplateParameterMap map) {
if (!isValidArgument(arg)) {
return null;
}
@@ -2719,7 +2729,7 @@ public class CPPTemplates {
pType= ((ICPPParameterPackType) pType).getType();
}
if (map != null && pType != null) {
- pType= instantiateType(pType, new InstantiationContext(map, point));
+ pType= instantiateType(pType, new InstantiationContext(map));
}
if (argType instanceof ICPPParameterPackType) {
@@ -2728,7 +2738,7 @@ public class CPPTemplates {
if (argType instanceof ICPPUnknownType) {
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), pType);
}
- return convertNonTypeTemplateArgument(template, pType, arg, point);
+ return convertNonTypeTemplateArgument(template, pType, arg);
} catch (DOMException e) {
return null;
}
@@ -2797,7 +2807,7 @@ public class CPPTemplates {
* @throws DOMException
*/
private static ICPPTemplateArgument convertNonTypeTemplateArgument(ICPPTemplateDefinition template,
- final IType paramType, ICPPTemplateArgument arg, IASTNode point) throws DOMException {
+ final IType paramType, ICPPTemplateArgument arg) throws DOMException {
// 14.1s8 function to pointer and array to pointer conversions.
IType a= arg.getTypeOfNonTypeValue();
IType p;
@@ -2820,20 +2830,20 @@ public class CPPTemplates {
for (ICPPFunction f : functionSet.getBindings()) {
if (p.isSameType(f.getType())) {
functionSet.applySelectedFunction(f);
- return new CPPTemplateNonTypeArgument(new EvalBinding(f, null, template), point);
+ return new CPPTemplateNonTypeArgument(new EvalBinding(f, null, template));
}
}
}
return null;
}
Cost cost = Conversions.checkImplicitConversionSequence(p, a, LVALUE, UDCMode.FORBIDDEN,
- Context.ORDINARY, point);
+ Context.ORDINARY);
if (cost == null || !cost.converts()) {
ICPPEvaluation eval = arg.getNonTypeEvaluation();
- ICPPEvaluation newEval = CPPEvaluation.maybeApplyConversion(eval, p, point, false);
+ ICPPEvaluation newEval = CPPEvaluation.maybeApplyConversion(eval, p, false);
if (newEval == EvalFixed.INCOMPLETE && newEval != eval)
return null;
- return new CPPTemplateNonTypeArgument(newEval, point);
+ return new CPPTemplateNonTypeArgument(newEval);
}
return new CPPTemplateNonTypeArgument(arg.getNonTypeValue(), paramType);
@@ -3007,23 +3017,22 @@ public class CPPTemplates {
} else if (ot1 instanceof ICPPClassType) {
IScope s = ((ICPPClassType) ot1).getCompositeScope();
if (s != null) {
- result= CPPSemantics.resolveUnknownName(s, unknown, context.getPoint());
+ result= CPPSemantics.resolveUnknownName(s, unknown);
if (unknown instanceof ICPPUnknownMemberClassInstance &&
(result instanceof ICPPTemplateDefinition ||
result instanceof ICPPAliasTemplateInstance)) {
ICPPTemplateArgument[] args1 = instantiateArguments(
((ICPPUnknownMemberClassInstance) unknown).getArguments(), context, false);
if (result instanceof ICPPClassTemplate) {
- result = instantiate((ICPPClassTemplate) result, args1, context.getPoint());
+ result = instantiate((ICPPClassTemplate) result, args1);
} else if (result instanceof ICPPAliasTemplate) {
- result = instantiateAliasTemplate((ICPPAliasTemplate) result, args1,
- context.getPoint());
+ result = instantiateAliasTemplate((ICPPAliasTemplate) result, args1);
}
}
}
} else if (ot1 != ot0) {
- return new ProblemBinding(new CPPASTName(unknown.getNameCharArray()), context.getPoint(),
- IProblemBinding.SEMANTIC_BAD_SCOPE);
+ return new ProblemBinding(new CPPASTName(unknown.getNameCharArray()),
+ CPPSemantics.getCurrentLookupPoint(), IProblemBinding.SEMANTIC_BAD_SCOPE);
}
}
@@ -3040,7 +3049,7 @@ public class CPPTemplates {
return e.getProblem();
}
if (newArgs == null)
- return createProblem(classTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS, context.getPoint());
+ return createProblem(classTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
boolean changed= arguments != newArgs;
IType classTemplateSpecialization= instantiateType(classTemplate, context);
@@ -3050,7 +3059,7 @@ public class CPPTemplates {
}
if (changed) {
- IBinding inst= instantiate(classTemplate, newArgs, context.getPoint());
+ IBinding inst= instantiate(classTemplate, newArgs);
if (inst != null)
return inst;
}
@@ -3068,15 +3077,14 @@ public class CPPTemplates {
return e.getProblem();
}
if (newArgs == null) {
- return createProblem(variableTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS,
- context.getPoint());
+ return createProblem(variableTemplate, IProblemBinding.SEMANTIC_INVALID_TEMPLATE_ARGUMENTS);
}
// Unlike class templates, variable templates cannot be passed as template template arguments,
// so there is no need to instantiate the template itself.
if (arguments != newArgs) {
- IBinding inst = instantiate(variableTemplate, newArgs, context.getPoint());
+ IBinding inst = instantiate(variableTemplate, newArgs);
if (inst != null)
return inst;
}
@@ -3103,11 +3111,10 @@ public class CPPTemplates {
* @param template the template definition
* @param arguments the template arguments; arguments may be modified by this method due to type
* conversion performed for non-type arguments
- * @param point the point of instantiation
* @return the created template parameter map, or {@code null} if the arguments are invalid
*/
private static CPPTemplateParameterMap createParameterMap(ICPPTemplateDefinition template,
- ICPPTemplateArgument[] arguments, IASTNode point) {
+ ICPPTemplateArgument[] arguments) {
final ICPPTemplateParameter[] parameters= template.getTemplateParameters();
final int numArgs = arguments.length;
final int numParams= parameters.length;
@@ -3127,7 +3134,7 @@ public class CPPTemplates {
if (i < numArgs) {
ICPPTemplateArgument arg= arguments[i];
ICPPTemplateArgument newArg =
- matchTemplateParameterAndArgument(template, param, arg, map, point);
+ matchTemplateParameterAndArgument(template, param, arg, map);
if (newArg == null)
return null;
if (newArg != arg) {
@@ -3167,15 +3174,14 @@ public class CPPTemplates {
/**
* Returns the instantiated function body of the given function specialization.
- * @param point The point of instantiation for name lookups
*/
- public static ICPPExecution instantiateFunctionBody(ICPPFunctionSpecialization f, IASTNode point) {
+ public static ICPPExecution instantiateFunctionBody(ICPPFunctionSpecialization f) {
ICPPFunction spec = (ICPPFunction) f.getSpecializedBinding();
ICPPExecution exec = null;
if (spec instanceof ICPPComputableFunction) {
- exec = ((ICPPComputableFunction) spec).getFunctionBodyExecution(point);
+ exec = ((ICPPComputableFunction) spec).getFunctionBodyExecution();
if (exec != null) {
- InstantiationContext context = new InstantiationContext(f.getTemplateParameterMap(), f, point);
+ InstantiationContext context = new InstantiationContext(f.getTemplateParameterMap(), f);
CPPTemplates.addInstantiatedParameters(context, f);
exec = exec.instantiate(context, IntegralValue.MAX_RECURSION_DEPTH);
}
@@ -3199,15 +3205,14 @@ public class CPPTemplates {
/**
* Returns the instantiated constructor chain of the given constructor specialization.
- * @param point The point of instantiation for name lookups
*/
- public static ICPPExecution instantiateConstructorChain(ICPPConstructorSpecialization f, IASTNode point) {
+ public static ICPPExecution instantiateConstructorChain(ICPPConstructorSpecialization f) {
ICPPConstructor spec = (ICPPConstructor) f.getSpecializedBinding();
ICPPExecution exec = null;
if (spec != null) {
- exec = spec.getConstructorChainExecution(point);
+ exec = spec.getConstructorChainExecution();
if (exec != null) {
- InstantiationContext context = new InstantiationContext(f.getTemplateParameterMap(), f, point);
+ InstantiationContext context = new InstantiationContext(f.getTemplateParameterMap(), f);
exec = exec.instantiate(context, IntegralValue.MAX_RECURSION_DEPTH);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVariableReadWriteFlags.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVariableReadWriteFlags.java
index 549e8b726d4..5193c87c51a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVariableReadWriteFlags.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVariableReadWriteFlags.java
@@ -47,7 +47,12 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
private static CPPVariableReadWriteFlags INSTANCE= new CPPVariableReadWriteFlags();
public static int getReadWriteFlags(IASTName variable) {
- return INSTANCE.rwAnyNode(variable, 0);
+ CPPSemantics.pushLookupPoint(variable);
+ try {
+ return INSTANCE.rwAnyNode(variable, 0);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
@Override
@@ -67,7 +72,7 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
IType type = CPPVisitor.createType(parent);
if (type instanceof ICPPUnknownType ||
type instanceof ICPPClassType &&
- !TypeTraits.hasTrivialDefaultConstructor((ICPPClassType) type, parent, CPPSemantics.MAX_INHERITANCE_DEPTH)) {
+ !TypeTraits.hasTrivialDefaultConstructor((ICPPClassType) type, CPPSemantics.MAX_INHERITANCE_DEPTH)) {
return WRITE;
}
return super.rwInDeclarator(parent, indirection);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 9b16af473fd..8e0168cabe7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -491,7 +491,7 @@ public class CPPVisitor extends ASTQueries {
binding = CPPSemantics.resolveBinding(elabType.getName());
}
if (binding instanceof IIndexBinding && binding instanceof ICPPClassType) {
- binding= (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding, elabType);
+ binding= (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding);
ASTInternal.addDeclaration(binding, elabType);
}
@@ -1289,7 +1289,7 @@ public class CPPVisitor extends ASTQueries {
boolean done= true;
IScope scope= null;
if (binding instanceof ICPPClassType) {
- binding= (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding, name);
+ binding= (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding);
scope= ((ICPPClassType) binding).getCompositeScope();
} else if (binding instanceof ICPPNamespace) {
scope= ((ICPPNamespace) binding).getNamespaceScope();
@@ -1320,7 +1320,7 @@ public class CPPVisitor extends ASTQueries {
}
type= getUltimateTypeUptoPointers(type);
if (type instanceof ICPPClassType) {
- type= SemanticUtil.mapToAST(type, fieldReference);
+ type= SemanticUtil.mapToAST(type);
return ((ICPPClassType) type).getCompositeScope();
} else if (type instanceof ICPPUnknownBinding) {
return ((ICPPUnknownBinding) type).asScope();
@@ -1346,7 +1346,7 @@ public class CPPVisitor extends ASTQueries {
if (type != null) {
type= getNestedType(type, TDEF | CVTYPE);
if (type instanceof ICPPClassType) {
- type= SemanticUtil.mapToAST(type, name);
+ type= SemanticUtil.mapToAST(type);
return ((ICPPClassType) type).getCompositeScope();
}
}
@@ -2045,7 +2045,7 @@ public class CPPVisitor extends ASTQueries {
sizeValue = IntegralValue.create(clauses.length);
} else if (clause instanceof ICPPASTLiteralExpression) {
ICPPEvaluation value = ((ICPPASTExpression) clause).getEvaluation();
- IType valueType = value.getType(clause);
+ IType valueType = value.getType();
if (valueType instanceof IArrayType) {
sizeValue = ((IArrayType) valueType).getSize();
}
@@ -2071,7 +2071,12 @@ public class CPPVisitor extends ASTQueries {
public static IType createType(IASTDeclarator declarator) {
// Resolve placeholders by default.
- return createType(declarator, RESOLVE_PLACEHOLDERS);
+ try {
+ CPPSemantics.pushLookupPoint(declarator);
+ return createType(declarator, RESOLVE_PLACEHOLDERS);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
public static IType createType(IASTDeclarator declarator, int flags) {
@@ -2259,7 +2264,7 @@ public class CPPVisitor extends ASTQueries {
return cannotDeduce;
}
if (placeholderKind == PlaceholderKind.Auto) {
- return createAutoType(autoInitClause.getEvaluation(), declSpec, declarator, autoInitClause);
+ return createAutoType(autoInitClause.getEvaluation(), declSpec, declarator);
} else /* decltype(auto) */ {
if (declarator.getPointerOperators().length > 0) {
// 'decltype(auto)' cannot be combined with * or & the way 'auto' can.
@@ -2277,24 +2282,24 @@ public class CPPVisitor extends ASTQueries {
}
private static IType createAutoType(final ICPPEvaluation evaluation, IASTDeclSpecifier declSpec,
- IASTDeclarator declarator, IASTNode point) {
+ IASTDeclarator declarator) {
// C++0x: 7.1.6.4
IType type = AutoTypeResolver.AUTO_TYPE;
IType initType = null;
ValueCategory valueCat= null;
- initType = evaluation.getType(declarator);
- valueCat = evaluation.getValueCategory(declarator);
+ initType = evaluation.getType();
+ valueCat = evaluation.getValueCategory();
if (initType == null || initType instanceof ISemanticProblem) {
return ProblemType.CANNOT_DEDUCE_AUTO_TYPE;
}
ICPPClassTemplate initializer_list_template = null;
if (evaluation instanceof EvalInitList) {
- initializer_list_template = get_initializer_list(declSpec);
+ initializer_list_template = get_initializer_list();
if (initializer_list_template == null) {
return ProblemType.CANNOT_DEDUCE_AUTO_TYPE;
}
type = (IType) CPPTemplates.instantiate(initializer_list_template,
- new ICPPTemplateArgument[] { new CPPTemplateTypeArgument(type) }, point);
+ new ICPPTemplateArgument[] { new CPPTemplateTypeArgument(type) });
if (type instanceof IProblemBinding) {
return ProblemType.CANNOT_DEDUCE_AUTO_TYPE;
}
@@ -2303,7 +2308,7 @@ public class CPPVisitor extends ASTQueries {
ICPPFunctionTemplate template = new AutoTypeResolver(type);
CPPTemplateParameterMap paramMap = new CPPTemplateParameterMap(1);
TemplateArgumentDeduction.deduceFromFunctionArgs(template, Collections.singletonList(initType),
- Collections.singletonList(valueCat), paramMap, point);
+ Collections.singletonList(valueCat), paramMap);
ICPPTemplateArgument argument = paramMap.getArgument(0, 0);
if (argument == null) {
return ProblemType.CANNOT_DEDUCE_AUTO_TYPE;
@@ -2320,7 +2325,7 @@ public class CPPVisitor extends ASTQueries {
type = t;
if (evaluation instanceof EvalInitList) {
type = (IType) CPPTemplates.instantiate(initializer_list_template,
- new ICPPTemplateArgument[] { new CPPTemplateTypeArgument(type) }, point);
+ new ICPPTemplateArgument[] { new CPPTemplateTypeArgument(type) });
}
return decorateType(type, declSpec, declarator);
}
@@ -2347,7 +2352,7 @@ public class CPPVisitor extends ASTQueries {
returnEval = ((ICPPASTInitializerClause) returnExpression).getEvaluation();
}
- IType returnType = returnEval.getType(stmt);
+ IType returnType = returnEval.getType();
if (returnType instanceof ISemanticProblem) {
// If a function makes a recursive call in some of its return statements,
// the type those return expressions will be a problem type. We ignore
@@ -2360,7 +2365,7 @@ public class CPPVisitor extends ASTQueries {
if (fReturnEval == null) {
fReturnEval = returnEval;
- } else if (!fReturnEval.getType(stmt).isSameType(returnType)) {
+ } else if (!fReturnEval.getType().isSameType(returnType)) {
fReturnEval = EvalFixed.INCOMPLETE;
}
}
@@ -2400,12 +2405,12 @@ public class CPPVisitor extends ASTQueries {
// 'decltype(auto)' cannot be combined with * or & the way 'auto' can.
return ProblemType.CANNOT_DEDUCE_DECLTYPE_AUTO_TYPE;
}
- return CPPSemantics.getDeclTypeForEvaluation(returnEval, point);
+ return CPPSemantics.getDeclTypeForEvaluation(returnEval);
} else /* auto */ {
if (autoDeclSpec == null || autoDeclarator == null) {
- return returnEval.getType(point);
+ return returnEval.getType();
} else {
- return createAutoType(returnEval, autoDeclSpec, autoDeclarator, autoDeclarator);
+ return createAutoType(returnEval, autoDeclSpec, autoDeclarator);
}
}
}
@@ -2666,12 +2671,13 @@ public class CPPVisitor extends ASTQueries {
return null;
}
- public static IType getPointerDiffType(final IASTNode point) {
- IType t= getStdType(point, PTRDIFF_T);
+ public static IType getPointerDiffType() {
+ IType t= getStdType(PTRDIFF_T);
return t != null ? t : CPPBasicType.LONG;
}
- private static IType getStdType(final IASTNode node, char[] name) {
+ private static IType getStdType(char[] name) {
+ IASTNode node = CPPSemantics.getCurrentLookupPoint();
if (node == null)
return null;
ASTTranslationUnit ast = (ASTTranslationUnit) node.getTranslationUnit();
@@ -2692,18 +2698,18 @@ public class CPPVisitor extends ASTQueries {
return null;
}
- public static IType get_type_info(IASTNode point) {
- IType t= getStdType(point, TYPE_INFO);
+ public static IType get_type_info() {
+ IType t= getStdType(TYPE_INFO);
return t != null ? t : CPPBasicType.INT;
}
- public static IType get_SIZE_T(IASTNode sizeofExpr) {
- IType t= getStdType(sizeofExpr, SIZE_T);
+ public static IType get_SIZE_T() {
+ IType t= getStdType(SIZE_T);
return t != null ? t : CPPBasicType.UNSIGNED_LONG;
}
- public static ICPPClassTemplate get_initializer_list(IASTNode node) {
- IType t= getStdType(node, INITIALIZER_LIST);
+ public static ICPPClassTemplate get_initializer_list() {
+ IType t= getStdType(INITIALIZER_LIST);
if (t instanceof ICPPClassTemplate)
return (ICPPClassTemplate) t;
return null;
@@ -2875,7 +2881,7 @@ public class CPPVisitor extends ASTQueries {
break;
IBinding binding = segments[i].resolveBinding();
if (binding instanceof IIndexBinding && binding instanceof ICPPClassType) {
- binding = (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding, name);
+ binding = (ICPPClassType) SemanticUtil.mapToAST((ICPPClassType) binding);
}
return bindingToOwner(binding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
index 3691efb0202..2319d2b606c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Conversions.java
@@ -31,7 +31,6 @@ import java.util.Collections;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
@@ -64,7 +63,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerToMemberType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Cost.DeferredUDC;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.Cost.Rank;
@@ -97,7 +95,7 @@ public class Conversions {
* @throws DOMException
*/
public static Cost checkImplicitConversionSequence(IType target, IType exprType,
- ValueCategory valueCat, UDCMode udc, Context ctx, IASTNode point) throws DOMException {
+ ValueCategory valueCat, UDCMode udc, Context ctx) throws DOMException {
final boolean isImpliedObject=
ctx == Context.IMPLICIT_OBJECT_FOR_METHOD_WITHOUT_REF_QUALIFIER ||
ctx == Context.IMPLICIT_OBJECT_FOR_METHOD_WITH_REF_QUALIFIER;
@@ -122,7 +120,7 @@ public class Conversions {
if (isLValueRef && getCVQualifier(cv1T1) != CVQualifier.CONST)
return Cost.NO_CONVERSION;
- Cost cost= listInitializationSequence(((InitializerListType) exprType).getEvaluation(), T1, udc, false, point);
+ Cost cost= listInitializationSequence(((InitializerListType) exprType).getEvaluation(), T1, udc, false);
if (cost.converts()) {
cost.setReferenceBinding(refBindingType);
}
@@ -144,7 +142,7 @@ public class Conversions {
if (valueCat != LVALUE)
refBindingType= ReferenceBinding.RVALUE_REF_BINDS_RVALUE;
// ... and "cv1 T1" is reference-compatible with "cv2 T2"
- Cost cost= isReferenceCompatible(cv1T1, cv2T2, isImpliedObject, point);
+ Cost cost= isReferenceCompatible(cv1T1, cv2T2, isImpliedObject);
if (cost != null) {
cost.setReferenceBinding(refBindingType);
return cost;
@@ -154,8 +152,8 @@ public class Conversions {
// implicitly converted to an lvalue of type 'cv3 T3', where 'cv1 T1' is reference-compatible with
// 'cv3 T3' (this conversion is selected by enumerating the applicable conversion functions (13.3.1.6)
// and choosing the best one through overload resolution (13.3)),
- if (T2 instanceof ICPPClassType && udc != UDCMode.FORBIDDEN && isReferenceRelated(T1, T2, point) < 0) {
- Cost cost= initializationByConversionForDirectReference(cv1T1, cv2T2, (ICPPClassType) T2, true, false, ctx, point);
+ if (T2 instanceof ICPPClassType && udc != UDCMode.FORBIDDEN && isReferenceRelated(T1, T2) < 0) {
+ Cost cost= initializationByConversionForDirectReference(cv1T1, cv2T2, (ICPPClassType) T2, true, false, ctx);
if (cost != null) {
cost.setReferenceBinding(refBindingType);
return cost;
@@ -175,7 +173,7 @@ public class Conversions {
if (valueCat == ValueCategory.XVALUE
|| (valueCat == ValueCategory.PRVALUE && (T2 instanceof ICPPClassType || T2 instanceof IArrayType))
|| (valueCat == ValueCategory.LVALUE && T2 instanceof ICPPFunctionType)) {
- Cost cost = isReferenceCompatible(cv1T1, cv2T2, isImpliedObject, point);
+ Cost cost = isReferenceCompatible(cv1T1, cv2T2, isImpliedObject);
if (cost != null) {
cost.setReferenceBinding(refBindingType);
return cost;
@@ -190,8 +188,8 @@ public class Conversions {
// sequence of the user-defined conversion sequence includes an lvalue-to-rvalue
// conversion, the program is ill-formed [this is why we pass illFormedIfLValue = true].
if (T2 instanceof ICPPClassType) {
- if (udc != UDCMode.FORBIDDEN && isReferenceRelated(T1, T2, point) < 0) {
- Cost cost= initializationByConversionForDirectReference(cv1T1, cv2T2, (ICPPClassType) T2, false, true, ctx, point);
+ if (udc != UDCMode.FORBIDDEN && isReferenceRelated(T1, T2) < 0) {
+ Cost cost= initializationByConversionForDirectReference(cv1T1, cv2T2, (ICPPClassType) T2, false, true, ctx);
if (cost != null) {
if (cost != Cost.NO_CONVERSION) {
cost.setReferenceBinding(refBindingType);
@@ -207,11 +205,11 @@ public class Conversions {
// 13.3.3.1.7 no temporary object when converting the implicit object parameter
if (!isImpliedObject && ctx != Context.REQUIRE_DIRECT_BINDING) {
- Cost cost= nonReferenceConversion(valueCat, cv2T2, T1, udc, point);
+ Cost cost= nonReferenceConversion(valueCat, cv2T2, T1, udc);
if (cost.converts()) {
cost.setReferenceBinding(refBindingType);
}
- boolean referenceRelated = isReferenceRelated(T1, T2, point) >= 0;
+ boolean referenceRelated = isReferenceRelated(T1, T2) >= 0;
// If T1 is reference-related to T2, cv1 shall be the same cv-qualification as,
// or greater cv-qualification than, cv2.
if (referenceRelated && compareQualifications(cv1T1, cv2T2) < 0) {
@@ -228,7 +226,7 @@ public class Conversions {
}
// Non-reference binding
- return nonReferenceConversion(valueCat, exprType, T1, udc, point);
+ return nonReferenceConversion(valueCat, exprType, T1, udc);
}
/**
@@ -241,9 +239,9 @@ public class Conversions {
* in the former case, the caller will continue trying other conversion methods.
*/
private static Cost initializationByConversionForDirectReference(final IType cv1T1, final IType cv2T2, final ICPPClassType T2,
- boolean needLValue, boolean illFormedIfLValue, Context ctx, IASTNode point)
+ boolean needLValue, boolean illFormedIfLValue, Context ctx)
throws DOMException {
- ICPPMethod[] fcns= SemanticUtil.getConversionOperators(T2, point);
+ ICPPMethod[] fcns= SemanticUtil.getConversionOperators(T2);
Cost operatorCost= null;
FunctionCost bestUdcCost= null;
boolean ambiguousConversionOperator= false;
@@ -261,14 +259,14 @@ public class Conversions {
continue;
}
IType implicitParameterType= CPPSemantics.getImplicitParameterType(op);
- Cost udcCost= isReferenceCompatible(getNestedType(implicitParameterType, TDEF | REF), cv2T2, true, point); // expression type to implicit object type
+ Cost udcCost= isReferenceCompatible(getNestedType(implicitParameterType, TDEF | REF), cv2T2, true); // expression type to implicit object type
if (udcCost != null) {
// Make sure top-level cv-qualifiers are compared
udcCost.setReferenceBinding(ReferenceBinding.LVALUE_REF);
- FunctionCost udcFuncCost= new FunctionCost(op, udcCost, point);
+ FunctionCost udcFuncCost= new FunctionCost(op, udcCost);
int cmp= udcFuncCost.compareTo(null, bestUdcCost);
if (cmp <= 0) {
- Cost cost= isReferenceCompatible(cv1T1, getNestedType(t, TDEF | REF), false, point); // converted to target
+ Cost cost= isReferenceCompatible(cv1T1, getNestedType(t, TDEF | REF), false); // converted to target
if (cost != null) {
bestUdcCost= udcFuncCost;
ambiguousConversionOperator= cmp == 0;
@@ -293,9 +291,9 @@ public class Conversions {
/**
* 8.5-16
*/
- private static Cost nonReferenceConversion(ValueCategory valueCat, IType source, IType target, UDCMode udc, IASTNode point) throws DOMException {
+ private static Cost nonReferenceConversion(ValueCategory valueCat, IType source, IType target, UDCMode udc) throws DOMException {
if (source instanceof InitializerListType) {
- return listInitializationSequence(((InitializerListType) source).getEvaluation(), target, udc, false, point);
+ return listInitializationSequence(((InitializerListType) source).getEvaluation(), target, udc, false);
}
IType uqTarget= SemanticUtil.getNestedType(target, TDEF | REF | CVTYPE);
@@ -303,7 +301,7 @@ public class Conversions {
if (uqTarget instanceof ICPPClassType) {
if (uqSource instanceof ICPPClassType) {
// 13.3.3.1-6 Conceptual derived to base conversion
- int depth= calculateInheritanceDepth(uqSource, uqTarget, point);
+ int depth= calculateInheritanceDepth(uqSource, uqTarget);
if (depth >= 0) {
if (depth == 0) {
return new Cost(source, target, Rank.IDENTITY);
@@ -316,17 +314,17 @@ public class Conversions {
if (udc == UDCMode.FORBIDDEN)
return Cost.NO_CONVERSION;
- return copyInitializationOfClass(valueCat, source, (ICPPClassType) uqTarget, udc == UDCMode.DEFER, point);
+ return copyInitializationOfClass(valueCat, source, (ICPPClassType) uqTarget, udc == UDCMode.DEFER);
}
if (uqSource instanceof ICPPClassType) {
if (udc == UDCMode.FORBIDDEN)
return Cost.NO_CONVERSION;
- return initializationByConversion(valueCat, source, (ICPPClassType) uqSource, target, udc == UDCMode.DEFER, point, false);
+ return initializationByConversion(valueCat, source, (ICPPClassType) uqSource, target, udc == UDCMode.DEFER, false);
}
- return checkStandardConversionSequence(uqSource, target, point);
+ return checkStandardConversionSequence(uqSource, target);
}
/**
@@ -334,8 +332,8 @@ public class Conversions {
* These are the declared fields, excluding static fields and anonymous bit-fields
* ([decl.init.aggr] p6).
*/
- static ICPPField[] getFieldsForAggregateInitialization(ICPPClassType targetClass, IASTNode point) {
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(targetClass, point);
+ static ICPPField[] getFieldsForAggregateInitialization(ICPPClassType targetClass) {
+ ICPPField[] fields = targetClass.getDeclaredFields();
ICPPField[] result = fields;
int j = 0;
for (int i = 0; i < fields.length; ++i) {
@@ -358,9 +356,9 @@ public class Conversions {
* Checks whether 'targetClass' can be initialized from 'list' according to the rules for
* aggregate initialization ([dcl.init.aggr]).
*/
- static boolean checkAggregateInitialization(EvalInitList list, ICPPClassType targetClass, IASTNode point)
+ static boolean checkAggregateInitialization(EvalInitList list, ICPPClassType targetClass)
throws DOMException {
- ICPPField[] fields = getFieldsForAggregateInitialization(targetClass, point);
+ ICPPField[] fields = getFieldsForAggregateInitialization(targetClass);
ICPPEvaluation[] initializers = list.getClauses();
// p7: An initializer-list is ill-formed if the number of initializer-clauses exceeds
@@ -377,15 +375,15 @@ public class Conversions {
ICPPField field = fields[i];
// Each element is copy-initialized from the corresponding initializer-clause.
- Cost cost = checkImplicitConversionSequence(field.getType(), initializer.getType(point),
- initializer.getValueCategory(point), UDCMode.ALLOWED, Context.ORDINARY, point);
+ Cost cost = checkImplicitConversionSequence(field.getType(), initializer.getType(),
+ initializer.getValueCategory(), UDCMode.ALLOWED, Context.ORDINARY);
if (!cost.converts()) {
return false;
}
// If the initializer-clause is an expression and a narrowing conversion is
// required to convert the expression, the program is ill-formed.
- if (!(initializer instanceof EvalInitList) && cost.isNarrowingConversion(point)) {
+ if (!(initializer instanceof EvalInitList) && cost.isNarrowingConversion()) {
return false;
}
}
@@ -409,8 +407,9 @@ public class Conversions {
}
// Empty initializer list
- EvalInitList emptyInit = new EvalInitList(ICPPEvaluation.EMPTY_ARRAY, point);
- Cost cost = listInitializationSequence(emptyInit, fieldType, UDCMode.ALLOWED, false, point);
+ EvalInitList emptyInit = new EvalInitList(ICPPEvaluation.EMPTY_ARRAY,
+ CPPSemantics.getCurrentLookupPoint());
+ Cost cost = listInitializationSequence(emptyInit, fieldType, UDCMode.ALLOWED, false);
if (!cost.converts()) {
return false;
}
@@ -424,13 +423,13 @@ public class Conversions {
/**
* 13.3.3.1.5 List-initialization sequence [over.ics.list]
*/
- static Cost listInitializationSequence(EvalInitList arg, IType target, UDCMode udc, boolean isDirect, IASTNode point) throws DOMException {
- Cost result = listInitializationSequenceHelper(arg, target, udc, isDirect, point);
+ static Cost listInitializationSequence(EvalInitList arg, IType target, UDCMode udc, boolean isDirect) throws DOMException {
+ Cost result = listInitializationSequenceHelper(arg, target, udc, isDirect);
result.setListInitializationTarget(target);
return result;
}
- static Cost listInitializationSequenceHelper(EvalInitList arg, IType target, UDCMode udc, boolean isDirect, IASTNode point) throws DOMException {
+ static Cost listInitializationSequenceHelper(EvalInitList arg, IType target, UDCMode udc, boolean isDirect) throws DOMException {
IType listType= getInitListType(target);
if (listType == null && target instanceof IArrayType) {
Number arraySize = ((IArrayType) target).getSize().numberValue();
@@ -446,13 +445,13 @@ public class Conversions {
if (listType != null) {
ICPPEvaluation[] clauses = arg.getClauses();
- Cost worstCost= new Cost(arg.getType(point), target, Rank.IDENTITY);
+ Cost worstCost= new Cost(arg.getType(), target, Rank.IDENTITY);
for (ICPPEvaluation clause : clauses) {
- Cost cost= checkImplicitConversionSequence(listType, clause.getType(point),
- clause.getValueCategory(point), UDCMode.ALLOWED, Context.ORDINARY, point);
+ Cost cost= checkImplicitConversionSequence(listType, clause.getType(),
+ clause.getValueCategory(), UDCMode.ALLOWED, Context.ORDINARY);
if (!cost.converts())
return cost;
- if (cost.isNarrowingConversion(point)) {
+ if (cost.isNarrowingConversion()) {
cost.setRank(Rank.NO_MATCH);
return cost;
}
@@ -469,27 +468,26 @@ public class Conversions {
return Cost.NO_CONVERSION;
ICPPClassType classTarget= (ICPPClassType) noCVTarget;
- if (TypeTraits.isAggregateClass(classTarget, point) &&
- checkAggregateInitialization(arg, classTarget, point)) {
- Cost cost= new Cost(arg.getType(point), target, Rank.IDENTITY);
+ if (TypeTraits.isAggregateClass(classTarget) && checkAggregateInitialization(arg, classTarget)) {
+ Cost cost= new Cost(arg.getType(), target, Rank.IDENTITY);
cost.setUserDefinedConversion(null);
return cost;
}
- return listInitializationOfClass(arg, classTarget, isDirect, udc == UDCMode.DEFER, point);
+ return listInitializationOfClass(arg, classTarget, isDirect, udc == UDCMode.DEFER);
}
ICPPEvaluation[] args = arg.getClauses();
if (args.length == 1) {
final ICPPEvaluation firstArg = args[0];
if (!firstArg.isInitializerList()) {
- Cost cost= checkImplicitConversionSequence(target, firstArg.getType(point), firstArg.getValueCategory(point), udc, Context.ORDINARY, point);
- if (cost.isNarrowingConversion(point)) {
+ Cost cost= checkImplicitConversionSequence(target, firstArg.getType(), firstArg.getValueCategory(), udc, Context.ORDINARY);
+ if (cost.isNarrowingConversion()) {
return Cost.NO_CONVERSION;
}
return cost;
}
} else if (args.length == 0) {
- return new Cost(arg.getType(point), target, Rank.IDENTITY);
+ return new Cost(arg.getType(), target, Rank.IDENTITY);
}
return Cost.NO_CONVERSION;
@@ -538,7 +536,7 @@ public class Conversions {
* Note this is not a symmetric relation.
* @return inheritance distance, or -1, if <code>cv1t1</code> is not reference-related to <code>cv2t2</code>
*/
- private static final int isReferenceRelated(IType cv1Target, IType cv2Source, IASTNode point) {
+ private static final int isReferenceRelated(IType cv1Target, IType cv2Source) {
IType t= SemanticUtil.getNestedType(cv1Target, TDEF | REF);
IType s= SemanticUtil.getNestedType(cv2Source, TDEF | REF);
@@ -573,7 +571,7 @@ public class Conversions {
s= SemanticUtil.getNestedType(((IQualifierType) s).getType(), TDEF | REF);
if (t instanceof ICPPClassType && s instanceof ICPPClassType) {
- return SemanticUtil.calculateInheritanceDepth(s, t, point);
+ return SemanticUtil.calculateInheritanceDepth(s, t);
}
}
if (t == s || (t != null && s != null && t.isSameType(s))) {
@@ -589,8 +587,8 @@ public class Conversions {
* @return The cost for converting or <code>null</code> if <code>cv1t1</code> is not
* reference-compatible with <code>cv2t2</code>
*/
- private static final Cost isReferenceCompatible(IType cv1Target, IType cv2Source, boolean isImpliedObject, IASTNode point) {
- int inheritanceDist= isReferenceRelated(cv1Target, cv2Source, point);
+ private static final Cost isReferenceCompatible(IType cv1Target, IType cv2Source, boolean isImpliedObject) {
+ int inheritanceDist= isReferenceRelated(cv1Target, cv2Source);
if (inheritanceDist < 0)
return null;
final int cmp= compareQualifications(cv1Target, cv2Source);
@@ -614,7 +612,7 @@ public class Conversions {
* [4] Standard Conversions
* Computes the cost of using the standard conversion sequence from source to target.
*/
- private static final Cost checkStandardConversionSequence(IType source, IType target, IASTNode point) {
+ private static final Cost checkStandardConversionSequence(IType source, IType target) {
final Cost cost= new Cost(source, target, Rank.IDENTITY);
if (lvalue_to_rvalue(cost))
return cost;
@@ -622,7 +620,7 @@ public class Conversions {
if (promotion(cost))
return cost;
- if (conversion(cost, point))
+ if (conversion(cost))
return cost;
if (qualificationConversion(cost))
@@ -634,9 +632,9 @@ public class Conversions {
}
// 13.3.1.7 Initialization by list-initialization
- static Cost listInitializationOfClass(EvalInitList arg, ICPPClassType t, boolean isDirect, boolean deferUDC, IASTNode point) throws DOMException {
+ static Cost listInitializationOfClass(EvalInitList arg, ICPPClassType t, boolean isDirect, boolean deferUDC) throws DOMException {
if (deferUDC) {
- Cost c= new Cost(arg.getType(point), t, Rank.USER_DEFINED_CONVERSION);
+ Cost c= new Cost(arg.getType(), t, Rank.USER_DEFINED_CONVERSION);
c.setDeferredUDC(isDirect ? DeferredUDC.DIRECT_LIST_INIT_OF_CLASS : DeferredUDC.LIST_INIT_OF_CLASS);
return c;
}
@@ -645,13 +643,13 @@ public class Conversions {
ICPPConstructor usedCtor= null;
Cost bestCost= null;
boolean hasInitListConstructor= false;
- final ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(t, point);
+ final ICPPConstructor[] constructors = t.getConstructors();
ICPPConstructor[] ctors= constructors;
for (ICPPConstructor ctor : ctors) {
final int minArgCount = ctor.getRequiredArgumentCount();
if (minArgCount == 0) {
if (arg.getClauses().length == 0) {
- Cost c= new Cost(arg.getType(point), t, Rank.IDENTITY);
+ Cost c= new Cost(arg.getType(), t, Rank.IDENTITY);
c.setUserDefinedConversion(ctor);
return c;
}
@@ -661,7 +659,7 @@ public class Conversions {
final IType target = parTypes[0];
if (getInitListType(target) != null) {
hasInitListConstructor= true;
- Cost cost= listInitializationSequence(arg, target, UDCMode.FORBIDDEN, isDirect, point);
+ Cost cost= listInitializationSequence(arg, target, UDCMode.FORBIDDEN, isDirect);
if (cost.converts()) {
int cmp= cost.compareTo(bestCost);
if (bestCost == null || cmp < 0) {
@@ -694,7 +692,7 @@ public class Conversions {
}
// No initializer-list constructor
- LookupData data= new LookupData(t.getNameCharArray(), null, point);
+ LookupData data= new LookupData(t.getNameCharArray(), null, CPPSemantics.getCurrentLookupPoint());
final ICPPEvaluation[] expandedArgs = arg.getClauses();
data.setFunctionArguments(false, expandedArgs);
data.fNoNarrowing= true;
@@ -719,11 +717,11 @@ public class Conversions {
final IBinding result= CPPSemantics.resolveFunction(data, filteredConstructors, true, false);
final Cost c;
if (result instanceof ICPPMethod) {
- c= new Cost(arg.getType(point), t, Rank.IDENTITY);
+ c= new Cost(arg.getType(), t, Rank.IDENTITY);
c.setUserDefinedConversion((ICPPMethod) result);
} else if (result instanceof IProblemBinding
&& ((IProblemBinding) result).getID() == IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP) {
- c = new Cost(arg.getType(point), t, Rank.USER_DEFINED_CONVERSION);
+ c = new Cost(arg.getType(), t, Rank.USER_DEFINED_CONVERSION);
c.setAmbiguousUDC(true);
} else {
c= Cost.NO_CONVERSION;
@@ -740,7 +738,7 @@ public class Conversions {
* 13.3.1.4 Copy-initialization of class by user-defined conversion [over.match.copy]
*/
static final Cost copyInitializationOfClass(ValueCategory valueCat, IType source, ICPPClassType t,
- boolean deferUDC, IASTNode point) throws DOMException {
+ boolean deferUDC) throws DOMException {
if (deferUDC) {
Cost c= new Cost(source, t, Rank.USER_DEFINED_CONVERSION);
c.setDeferredUDC(DeferredUDC.COPY_INIT_OF_CLASS);
@@ -749,9 +747,9 @@ public class Conversions {
FunctionCost cost1= null;
Cost cost2= null;
- ICPPFunction[] ctors= ClassTypeHelper.getConstructors(t, point);
+ ICPPFunction[] ctors= t.getConstructors();
ctors = CPPTemplates.instantiateForFunctionCall(ctors, null,
- Collections.singletonList(source), Collections.singletonList(valueCat), false, point);
+ Collections.singletonList(source), Collections.singletonList(valueCat), false);
for (ICPPFunction f : ctors) {
if (!(f instanceof ICPPConstructor) || f instanceof IProblemBinding)
@@ -767,7 +765,7 @@ public class Conversions {
FunctionCost c1;
if (ptypes.length == 0) {
if (ctor.takesVarArgs()) {
- c1= new FunctionCost(ctor, new Cost(source, null, Rank.ELLIPSIS_CONVERSION), point);
+ c1= new FunctionCost(ctor, new Cost(source, null, Rank.ELLIPSIS_CONVERSION));
} else {
continue;
}
@@ -779,7 +777,7 @@ public class Conversions {
if (ctor.getRequiredArgumentCount() > 1)
continue;
- c1= new FunctionCost(ctor, checkImplicitConversionSequence(ptype, source, valueCat, UDCMode.FORBIDDEN, Context.ORDINARY, point), point);
+ c1= new FunctionCost(ctor, checkImplicitConversionSequence(ptype, source, valueCat, UDCMode.FORBIDDEN, Context.ORDINARY));
}
int cmp= c1.compareTo(null, cost1);
if (cmp <= 0) {
@@ -795,8 +793,8 @@ public class Conversions {
final IType uqSource= getNestedType(source, TDEF | REF | CVTYPE);
if (uqSource instanceof ICPPClassType) {
- ICPPFunction[] ops = SemanticUtil.getConversionOperators((ICPPClassType) uqSource, point);
- ops= CPPTemplates.instantiateConversionTemplates(ops, t, point);
+ ICPPFunction[] ops = SemanticUtil.getConversionOperators((ICPPClassType) uqSource);
+ ops= CPPTemplates.instantiateConversionTemplates(ops, t);
for (final ICPPFunction f : ops) {
if (f instanceof ICPPMethod && !(f instanceof IProblemBinding)) {
ICPPMethod op= (ICPPMethod) f;
@@ -804,14 +802,14 @@ public class Conversions {
continue;
final IType returnType = op.getType().getReturnType();
final IType uqReturnType= getNestedType(returnType, REF | TDEF | CVTYPE);
- final int dist = SemanticUtil.calculateInheritanceDepth(uqReturnType, t, point);
+ final int dist = SemanticUtil.calculateInheritanceDepth(uqReturnType, t);
if (dist >= 0) {
IType implicitType= CPPSemantics.getImplicitParameterType(op);
- final Cost udcCost = isReferenceCompatible(getNestedType(implicitType, TDEF | REF), source, true, point);
+ final Cost udcCost = isReferenceCompatible(getNestedType(implicitType, TDEF | REF), source, true);
if (udcCost != null) {
// Make sure top-level cv-qualifiers are compared
udcCost.setReferenceBinding(ReferenceBinding.LVALUE_REF);
- FunctionCost c1= new FunctionCost(op, udcCost, point);
+ FunctionCost c1= new FunctionCost(op, udcCost);
int cmp= c1.compareTo(null, cost1);
if (cmp <= 0) {
cost1= c1;
@@ -839,14 +837,15 @@ public class Conversions {
/**
* 13.3.1.5 Initialization by conversion function [over.match.conv]
*/
- static Cost initializationByConversion(ValueCategory valueCat, IType source, ICPPClassType uqSource, IType target, boolean deferUDC, IASTNode point, boolean allowExplicitConversion) throws DOMException {
+ static Cost initializationByConversion(ValueCategory valueCat, IType source, ICPPClassType uqSource,
+ IType target, boolean deferUDC, boolean allowExplicitConversion) throws DOMException {
if (deferUDC) {
Cost c= new Cost(source, target, Rank.USER_DEFINED_CONVERSION);
c.setDeferredUDC(DeferredUDC.INIT_BY_CONVERSION);
return c;
}
- ICPPFunction[] ops = SemanticUtil.getConversionOperators(uqSource, point);
- ops= CPPTemplates.instantiateConversionTemplates(ops, target, point);
+ ICPPFunction[] ops = SemanticUtil.getConversionOperators(uqSource);
+ ops= CPPTemplates.instantiateConversionTemplates(ops, target);
FunctionCost cost1= null;
Cost cost2= null;
for (final ICPPFunction f : ops) {
@@ -859,12 +858,12 @@ public class Conversions {
ICPPFunctionType functionType = op.getType();
final IType returnType = functionType.getReturnType();
IType uqReturnType= getNestedType(returnType, TDEF | ALLCVQ);
- Cost c2= checkImplicitConversionSequence(target, uqReturnType, valueCategoryFromReturnType(uqReturnType), UDCMode.FORBIDDEN, Context.ORDINARY, point);
+ Cost c2= checkImplicitConversionSequence(target, uqReturnType, valueCategoryFromReturnType(uqReturnType), UDCMode.FORBIDDEN, Context.ORDINARY);
if (c2.converts()) {
if (isExplicitConversion && c2.getRank() != Rank.IDENTITY)
continue;
IType implicitType= CPPSemantics.getImplicitParameterType(op);
- final Cost udcCost = isReferenceCompatible(getNestedType(implicitType, TDEF | REF), source, true, point);
+ final Cost udcCost = isReferenceCompatible(getNestedType(implicitType, TDEF | REF), source, true);
if (udcCost != null) {
// Make sure top-level cv-qualifiers are compared
if (functionType.hasRefQualifier() && functionType.isRValueReference()) {
@@ -872,7 +871,7 @@ public class Conversions {
} else {
udcCost.setReferenceBinding(ReferenceBinding.LVALUE_REF);
}
- FunctionCost c1= new FunctionCost(op, udcCost, point);
+ FunctionCost c1= new FunctionCost(op, udcCost);
int cmp= c1.compareTo(null, cost1);
if (cmp <= 0) {
cost1= c1;
@@ -1125,7 +1124,7 @@ public class Conversions {
* [4.10] Pointer conversions
* [4.11] Pointer to member conversions
*/
- private static final boolean conversion(Cost cost, IASTNode point) {
+ private static final boolean conversion(Cost cost) {
final IType s = cost.source;
final IType t = cost.target;
@@ -1196,7 +1195,7 @@ public class Conversions {
// to an rvalue of type "pointer to cv B", where B is a base class of D.
IType srcPtrTgt= getNestedType(srcPtr.getType(), TDEF | CVTYPE | REF);
if (tgtPtrTgt instanceof ICPPClassType && srcPtrTgt instanceof ICPPClassType) {
- int depth= SemanticUtil.calculateInheritanceDepth(srcPtrTgt, tgtPtrTgt, point);
+ int depth= SemanticUtil.calculateInheritanceDepth(srcPtrTgt, tgtPtrTgt);
if (depth == -1) {
cost.setRank(Rank.NO_MATCH);
return true;
@@ -1219,7 +1218,7 @@ public class Conversions {
IType tt = tpm.getType();
if (st != null && tt != null && st.isSameType(tt)) {
int depth = SemanticUtil.calculateInheritanceDepth(tpm.getMemberOfClass(),
- spm.getMemberOfClass(), point);
+ spm.getMemberOfClass());
if (depth == -1) {
cost.setRank(Rank.NO_MATCH);
return true;
@@ -1274,7 +1273,7 @@ public class Conversions {
* Composite pointer type computed as described in 5.9-2 except that if the conversion to
* the pointer is not possible, the method returns {@code null}.
*/
- public static IType compositePointerType(IType t1, IType t2, IASTNode point) {
+ public static IType compositePointerType(IType t1, IType t2) {
t1 = SemanticUtil.getNestedType(t1, TDEF);
t2 = SemanticUtil.getNestedType(t2, TDEF);
final boolean isPtr1 = t1 instanceof IPointerType;
@@ -1306,7 +1305,7 @@ public class Conversions {
return addQualifiers(p2, p1.isConst(), p1.isVolatile(), p1.isRestrict());
}
- IType t= mergePointers(target1, target2, point, true, true);
+ IType t= mergePointers(target1, target2, true, true);
if (t == null)
return null;
if (t == target1)
@@ -1316,7 +1315,7 @@ public class Conversions {
return copyPointer(p1, t, false, false);
}
- private static IType mergePointers(IType t1, IType t2, IASTNode point, boolean allcq, boolean allowInheritance) {
+ private static IType mergePointers(IType t1, IType t2, boolean allcq, boolean allowInheritance) {
t1= getNestedType(t1, TDEF | REF);
t2= getNestedType(t2, TDEF | REF);
if (t1 instanceof IPointerType && t2 instanceof IPointerType) {
@@ -1330,7 +1329,7 @@ public class Conversions {
return null;
final IType p1target = p1.getType();
- IType merged= mergePointers(p1target, p2.getType(), point, allcq && (cv1.isConst() || cv2.isConst()), false);
+ IType merged= mergePointers(p1target, p2.getType(), allcq && (cv1.isConst() || cv2.isConst()), false);
if (merged == null)
return null;
if (p1target == merged && cv1.isAtLeastAsQualifiedAs(cv2))
@@ -1369,9 +1368,9 @@ public class Conversions {
} else if (allowInheritance) {
// Allow for conversion from pointer-to-derived to pointer-to-base as per [conv.ptr] p3.
IType base;
- if (SemanticUtil.calculateInheritanceDepth(uq1, uq2, point) > 0) {
+ if (SemanticUtil.calculateInheritanceDepth(uq1, uq2) > 0) {
base = uq2;
- } else if (SemanticUtil.calculateInheritanceDepth(uq2, uq1, point) > 0) {
+ } else if (SemanticUtil.calculateInheritanceDepth(uq2, uq1) > 0) {
base = uq1;
} else {
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Cost.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Cost.java
index 4ed56c27e42..c92cd1ca43d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Cost.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/Cost.java
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@@ -305,7 +304,7 @@ public class Cost {
return buf.toString();
}
- public boolean isNarrowingConversion(IASTNode point) {
+ public boolean isNarrowingConversion() {
if (!fCouldNarrow)
return false;
@@ -356,7 +355,7 @@ public class Cost {
constantExprExceptionApplies = true;
} else if (BuiltinOperators.isIntegral(basicSource)
&& BuiltinOperators.isIntegral(basicTarget)
- && !ArithmeticConversion.fitsIntoType(basicTarget, basicSource, point)) {
+ && !ArithmeticConversion.fitsIntoType(basicTarget, basicSource)) {
// From an integer type or unscoped enumeration type to an integer type that
// cannot represent all the values of the original type
constantExprExceptionApplies = true;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java
index e270bcf2a55..39d489bb7b9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/DestructorCallCollector.java
@@ -101,8 +101,8 @@ public class DestructorCallCollector {
return destructorNames;
}
- static ICPPMethod findDestructor(ICPPClassType classType, IASTNode point) {
- return ClassTypeHelper.getMethodInClass(classType, MethodKind.DTOR, point);
+ static ICPPMethod findDestructor(ICPPClassType classType) {
+ return ClassTypeHelper.getMethodInClass(classType, MethodKind.DTOR);
}
protected void addDestructorCall(IASTName name, ICPPMethod destructor) {
@@ -129,10 +129,15 @@ public class DestructorCallCollector {
if (name instanceof IASTImplicitName && !(name.getParent() instanceof ICPPASTNewExpression)) {
IBinding binding = name.resolveBinding();
if (binding instanceof ICPPConstructor) {
- ICPPClassType classType = ((ICPPConstructor) binding).getClassOwner();
- ICPPMethod destructor = findDestructor(classType, name);
- if (destructor != null && !isBoundToVariable(name)) {
- addDestructorCall(name, destructor);
+ CPPSemantics.pushLookupPoint(name);
+ try {
+ ICPPClassType classType = ((ICPPConstructor) binding).getClassOwner();
+ ICPPMethod destructor = findDestructor(classType);
+ if (destructor != null && !isBoundToVariable(name)) {
+ addDestructorCall(name, destructor);
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
@@ -183,14 +188,19 @@ public class DestructorCallCollector {
IASTNode scopeNode = ((ICPPASTInternalScope) scope).getPhysicalNode();
if (scopeNode.equals(owner)) {
IType type = SemanticUtil.getNestedType(var.getType(), TDEF | CVTYPE);
- if (type instanceof ICPPClassType) {
- ICPPMethod destructor = findDestructor((ICPPClassType) type, name);
- if (destructor != null) {
- addDestructorCall(name, destructor);
+ CPPSemantics.pushLookupPoint(name);
+ try {
+ if (type instanceof ICPPClassType) {
+ ICPPMethod destructor = findDestructor((ICPPClassType) type);
+ if (destructor != null) {
+ addDestructorCall(name, destructor);
+ }
+ } else if (type instanceof ICPPReferenceType) {
+ IASTDeclarator decl = (IASTDeclarator) name.getParent();
+ addDestructorCallForTemporaryBoundToReference(decl);
}
- } else if (type instanceof ICPPReferenceType) {
- IASTDeclarator decl = (IASTDeclarator) name.getParent();
- addDestructorCallForTemporaryBoundToReference(decl);
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
@@ -213,7 +223,7 @@ public class DestructorCallCollector {
IBinding binding = name.resolveBinding();
if (binding instanceof ICPPConstructor) {
ICPPClassType classType = ((ICPPConstructor) binding).getClassOwner();
- ICPPMethod destructor = findDestructor(classType, name);
+ ICPPMethod destructor = findDestructor(classType);
if (destructor != null) {
addDestructorCall(name, destructor);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinary.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinary.java
index 9447ec12a4f..8e878f83ea8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinary.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinary.java
@@ -134,28 +134,28 @@ public class EvalBinary extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null) {
if (isTypeDependent()) {
fType= new TypeOfDependentExpression(this);
} else {
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null) {
fType= ExpressionTypes.restoreTypedefs(
- ExpressionTypes.typeFromFunctionCall(overload),
- fArg1.getType(point), fArg2.getType(point));
+ ExpressionTypes.typeFromFunctionCall(overload), fArg1.getType(), fArg2.getType());
} else {
- fType= computeType(point);
+ fType= computeType();
}
}
}
return fType;
}
- private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, IASTNode point, ICPPEvaluation arg1, ICPPEvaluation arg2) {
+ private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, ICPPEvaluation arg1, ICPPEvaluation arg2) {
EvalFunctionCall operatorCall;
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (overload instanceof ICPPMethod) {
- EvalMemberAccess opAccess = new EvalMemberAccess(arg1.getType(point), ValueCategory.LVALUE, overload, arg1, false, point);
+ EvalMemberAccess opAccess = new EvalMemberAccess(arg1.getType(), ValueCategory.LVALUE, overload, arg1, false, point);
ICPPEvaluation[] args = new ICPPEvaluation[]{opAccess, arg2};
operatorCall = new EvalFunctionCall(args, arg1, point);
} else {
@@ -171,16 +171,16 @@ public class EvalBinary extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
ICPPEvaluation arg1 = fArg1;
ICPPEvaluation arg2 = fArg2;
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null) {
IType[] parameterTypes = SemanticUtil.getParameterTypesIncludingImplicitThis(overload);
if (parameterTypes.length >= 2) {
boolean allowContextualConversion = operatorAllowsContextualConversion();
- arg1 = maybeApplyConversion(fArg1, parameterTypes[0], point, allowContextualConversion);
- arg2 = maybeApplyConversion(fArg2, parameterTypes[1], point, allowContextualConversion);
+ arg1 = maybeApplyConversion(fArg1, parameterTypes[0], allowContextualConversion);
+ arg2 = maybeApplyConversion(fArg2, parameterTypes[1], allowContextualConversion);
} else {
CCorePlugin.log(IStatus.ERROR, "Unexpected overload for binary operator " + fOperator //$NON-NLS-1$
+ ": '" + overload.getName() + "'"); //$NON-NLS-1$//$NON-NLS-2$
@@ -191,16 +191,16 @@ public class EvalBinary extends CPPDependentEvaluation {
return IntegralValue.ERROR;
}
if (fOverloadCall == null) {
- fOverloadCall = createOperatorOverloadEvaluation(overload, point, arg1, arg2);
+ fOverloadCall = createOperatorOverloadEvaluation(overload, arg1, arg2);
}
- return fOverloadCall.getValue(point);
+ return fOverloadCall.getValue();
}
}
- IValue v1 = arg1.getValue(point);
+ IValue v1 = arg1.getValue();
if (v1 == null || v1 == IntegralValue.UNKNOWN)
return IntegralValue.UNKNOWN;
- IValue v2 = arg2.getValue(point);
+ IValue v2 = arg2.getValue();
if (v2 == null || v2 == IntegralValue.UNKNOWN)
return IntegralValue.UNKNOWN;
@@ -249,26 +249,26 @@ public class EvalBinary extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return fArg1.isConstantExpression(point)
- && fArg2.isConstantExpression(point)
- && isNullOrConstexprFunc(getOverload(point));
+ private boolean computeIsConstantExpression() {
+ return fArg1.isConstantExpression()
+ && fArg2.isConstantExpression()
+ && isNullOrConstexprFunc(getOverload());
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
if (isTypeDependent())
return ValueCategory.PRVALUE;
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null)
return ExpressionTypes.valueCategoryFromFunctionCall(overload);
@@ -288,12 +288,12 @@ public class EvalBinary extends CPPDependentEvaluation {
return LVALUE;
case op_pmdot:
- if (!(getType(point) instanceof ICPPFunctionType))
- return fArg1.getValueCategory(point);
+ if (!(getType() instanceof ICPPFunctionType))
+ return fArg1.getValueCategory();
break;
case op_pmarrow:
- if (!(getType(point) instanceof ICPPFunctionType))
+ if (!(getType() instanceof ICPPFunctionType))
return LVALUE;
break;
}
@@ -301,47 +301,47 @@ public class EvalBinary extends CPPDependentEvaluation {
return ValueCategory.PRVALUE;
}
- public ICPPFunction getOverload(IASTNode point) {
+ public ICPPFunction getOverload() {
if (fOverload == CPPFunction.UNINITIALIZED_FUNCTION) {
- fOverload= computeOverload(point);
+ fOverload= computeOverload();
}
return fOverload;
}
- private ICPPFunction computeOverload(IASTNode point) {
+ private ICPPFunction computeOverload() {
if (isTypeDependent())
return null;
if (fOperator == op_arrayAccess) {
- IType type = fArg1.getType(point);
+ IType type = fArg1.getType();
type= SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (type instanceof ICPPClassType) {
- return CPPSemantics.findOverloadedBinaryOperator(point, getTemplateDefinitionScope(),
+ return CPPSemantics.findOverloadedBinaryOperator(getTemplateDefinitionScope(),
OverloadableOperator.BRACKET, fArg1, fArg2);
}
} else {
final OverloadableOperator op = OverloadableOperator.fromBinaryExpression(fOperator);
if (op != null) {
- return CPPSemantics.findOverloadedBinaryOperator(point, getTemplateDefinitionScope(),
+ return CPPSemantics.findOverloadedBinaryOperator(getTemplateDefinitionScope(),
op, fArg1, fArg2);
}
}
return null;
}
- public IType computeType(IASTNode point) {
+ public IType computeType() {
// Check for overloaded operator.
- ICPPFunction o= getOverload(point);
+ ICPPFunction o= getOverload();
if (o != null)
return typeFromFunctionCall(o);
- final IType originalType1 = fArg1.getType(point);
+ final IType originalType1 = fArg1.getType();
final IType type1 = prvalueTypeWithResolvedTypedefs(originalType1);
if (type1 instanceof ISemanticProblem) {
return type1;
}
- final IType originalType2 = fArg2.getType(point);
+ final IType originalType2 = fArg2.getType();
final IType type2 = prvalueTypeWithResolvedTypedefs(originalType2);
if (type2 instanceof ISemanticProblem) {
return type2;
@@ -384,7 +384,7 @@ public class EvalBinary extends CPPDependentEvaluation {
case op_minus:
if (type1 instanceof IPointerType) {
if (type2 instanceof IPointerType) {
- return CPPVisitor.getPointerDiffType(point);
+ return CPPVisitor.getPointerDiffType();
}
return originalType1;
}
@@ -396,7 +396,7 @@ public class EvalBinary extends CPPDependentEvaluation {
IType t= ((ICPPPointerToMemberType) type2).getType();
if (t instanceof ICPPFunctionType)
return t;
- if (fOperator == op_pmdot && fArg1.getValueCategory(point) == PRVALUE) {
+ if (fOperator == op_pmdot && fArg1.getValueCategory() == PRVALUE) {
return prvalueType(t);
}
return glvalueType(t);
@@ -434,9 +434,9 @@ public class EvalBinary extends CPPDependentEvaluation {
@Override
public ICPPEvaluation computeForFunctionCall(ActivationRecord record, ConstexprEvaluationContext context) {
- ICPPFunction overload = getOverload(context.getPoint());
+ ICPPFunction overload = getOverload();
if (overload != null) {
- ICPPEvaluation operatorCall = createOperatorOverloadEvaluation(overload, context.getPoint(), fArg1, fArg2);
+ ICPPEvaluation operatorCall = createOperatorOverloadEvaluation(overload, fArg1, fArg2);
return operatorCall.computeForFunctionCall(record, context);
}
@@ -448,10 +448,10 @@ public class EvalBinary extends CPPDependentEvaluation {
ICPPEvaluation eval = fixed1 == fArg1 && fixed2 == fArg2 ? this : new EvalBinary(fOperator, fixed1, fixed2, getTemplateDefinition());
if (isBinaryOperationWithAssignment(fOperator)) {
- if (isPointerToArray(fixed1) && hasIntType(fixed2, context)) {
+ if (isPointerToArray(fixed1) && hasIntType(fixed2)) {
EvalPointer evalPointer = (EvalPointer) fixed1;
int currentPos = evalPointer.getPosition();
- int rhs = fixed2.getValue(context.getPoint()).numberValue().intValue();
+ int rhs = fixed2.getValue().numberValue().intValue();
if (fOperator == op_plusAssign) {
evalPointer.setPosition(currentPos + rhs);
@@ -473,7 +473,7 @@ public class EvalBinary extends CPPDependentEvaluation {
if (fixed2 instanceof EvalPointer) {
newValue = fixed2;
} else {
- newValue = new EvalFixed(fixed2.getType(context.getPoint()), fixed2.getValueCategory(context.getPoint()), fixed2.getValue(context.getPoint()));
+ newValue = new EvalFixed(fixed2.getType(), fixed2.getValueCategory(), fixed2.getValue());
}
if (updateable1 instanceof EvalReference && !(updateable1 instanceof EvalPointer)) {
@@ -488,29 +488,29 @@ public class EvalBinary extends CPPDependentEvaluation {
}
return updateable1;
} else if (fOperator == op_arrayAccess) {
- Number numericValue = fixed2.getValue(context.getPoint()).numberValue();
+ Number numericValue = fixed2.getValue().numberValue();
if (numericValue == null)
return EvalFixed.INCOMPLETE;
return new EvalCompositeAccess(fixed1, numericValue.intValue());
- } else if ((isArray(fixed1, context) || isArray(fixed2, context)) && (hasIntType(fixed1, context) || hasIntType(fixed2, context))) {
- int offset = hasIntType(fixed1, context) ? fixed1.getValue(context.getPoint()).numberValue().intValue() : fixed2.getValue(context.getPoint()).numberValue().intValue();
- EvalCompositeAccess evalCompositeAccess = new EvalCompositeAccess(isArray(fixed1, context) ? fixed1 : fixed2, offset);
+ } else if ((isArray(fixed1) || isArray(fixed2)) && (hasIntType(fixed1) || hasIntType(fixed2))) {
+ int offset = hasIntType(fixed1) ? fixed1.getValue().numberValue().intValue() : fixed2.getValue().numberValue().intValue();
+ EvalCompositeAccess evalCompositeAccess = new EvalCompositeAccess(isArray(fixed1) ? fixed1 : fixed2, offset);
return new EvalPointer(record, evalCompositeAccess, evalCompositeAccess.getTemplateDefinition());
- } else if ((isPointerToArray(fixed1) || isPointerToArray(fixed2)) && (hasIntType(fixed1, context) || hasIntType(fixed2, context))) {
+ } else if ((isPointerToArray(fixed1) || isPointerToArray(fixed2)) && (hasIntType(fixed1) || hasIntType(fixed2))) {
final EvalPointer pointer = isPointerToArray(fixed1) ? ((EvalPointer) fixed1).copy() : ((EvalPointer) fixed2).copy();
- pointer.setPosition(eval.getValue(context.getPoint()).numberValue().intValue());
+ pointer.setPosition(eval.getValue().numberValue().intValue());
return pointer;
}
return eval;
}
- private boolean hasIntType(ICPPEvaluation arg2, ConstexprEvaluationContext context) {
- IType type = arg2.getType(context.getPoint());
+ private boolean hasIntType(ICPPEvaluation arg2) {
+ IType type = arg2.getType();
return (type instanceof IBasicType && ((IBasicType) type).getKind() == IBasicType.Kind.eInt);
}
- private boolean isArray(ICPPEvaluation eval, ConstexprEvaluationContext context) {
- return eval.getType(context.getPoint()) instanceof IArrayType;
+ private boolean isArray(ICPPEvaluation eval) {
+ return eval.getType() instanceof IArrayType;
}
private boolean isPointerToArray(ICPPEvaluation argument) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinaryTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinaryTypeId.java
index 86b23e9f7c4..29869fb966c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinaryTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinaryTypeId.java
@@ -73,7 +73,7 @@ public class EvalBinaryTypeId extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
switch (fOperator) {
case __is_base_of:
case __is_trivially_assignable:
@@ -83,11 +83,11 @@ public class EvalBinaryTypeId extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent())
return DependentValue.create(this);
- return ValueFactory.evaluateBinaryTypeIdExpression(fOperator, fType1, fType2, point);
+ return ValueFactory.evaluateBinaryTypeIdExpression(fOperator, fType1, fType2);
}
@Override
@@ -105,12 +105,12 @@ public class EvalBinaryTypeId extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
return true;
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return PRVALUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
index ac444f8c9d9..dea9a222a87 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
-import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.glvalueType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.prvalueType;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
@@ -244,29 +243,29 @@ public class EvalBinding extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
+ private boolean computeIsConstantExpression() {
return fBinding instanceof IEnumerator
|| fBinding instanceof ICPPFunction
- || (fBinding instanceof IVariable && isConstexprValue(((IVariable) fBinding).getInitialValue(), point));
+ || (fBinding instanceof IVariable && isConstexprValue(((IVariable) fBinding).getInitialValue()));
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null) {
- fType= computeType(point);
+ fType= computeType();
}
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
IBinding binding = getBinding();
if (binding instanceof IEnumerator) {
return ((IEnumerator) binding).getType();
@@ -283,6 +282,7 @@ public class EvalBinding extends CPPDependentEvaluation {
}
if (binding instanceof IVariable) {
IType type = ((IVariable) binding).getType();
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (type instanceof IArrayType && ((IArrayType) type).getSize() == null &&
binding instanceof IIndexBinding && point != null) {
// Refine the type of the array variable by filling in missing size information.
@@ -313,17 +313,17 @@ public class EvalBinding extends CPPDependentEvaluation {
}
}
}
- return SemanticUtil.mapToAST(glvalueType(type), point);
+ return SemanticUtil.mapToAST(ExpressionTypes.glvalueType(type));
}
if (binding instanceof IFunction) {
final IFunctionType type = ((IFunction) binding).getType();
- return SemanticUtil.mapToAST(type, point);
+ return SemanticUtil.mapToAST(type);
}
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent())
return DependentValue.create(this);
@@ -331,9 +331,9 @@ public class EvalBinding extends CPPDependentEvaluation {
if (fBinding instanceof ICPPVariable) {
ICPPEvaluation valueEval = EvalUtil.getVariableValue((ICPPVariable) fBinding,
- new ActivationRecord(), point);
+ new ActivationRecord());
if (valueEval != null) {
- value = valueEval.getValue(point);
+ value = valueEval.getValue();
}
} else if (fBinding instanceof IEnumerator) {
value= ((IEnumerator) fBinding).getValue();
@@ -345,7 +345,7 @@ public class EvalBinding extends CPPDependentEvaluation {
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
if (fBinding instanceof ICPPTemplateNonTypeParameter)
return ValueCategory.PRVALUE;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalComma.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalComma.java
index 1f924f9c3d3..d0a775e3a3a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalComma.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalComma.java
@@ -76,16 +76,16 @@ public class EvalComma extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- if (!areAllConstantExpressions(fArguments, point)) {
+ private boolean computeIsConstantExpression() {
+ if (!areAllConstantExpressions(fArguments)) {
return false;
}
for (ICPPFunction overload : fOverloads) {
@@ -96,14 +96,14 @@ public class EvalComma extends CPPDependentEvaluation {
return true;
}
- public ICPPFunction[] getOverloads(IASTNode point) {
+ public ICPPFunction[] getOverloads() {
if (fOverloads == null) {
- fOverloads= computeOverloads(point);
+ fOverloads= computeOverloads();
}
return fOverloads;
}
- private ICPPFunction[] computeOverloads(IASTNode point) {
+ private ICPPFunction[] computeOverloads() {
if (fArguments.length < 2)
return NO_FUNCTIONS;
@@ -114,13 +114,13 @@ public class EvalComma extends CPPDependentEvaluation {
ICPPEvaluation e1= fArguments[0];
for (int i = 1; i < fArguments.length; i++) {
ICPPEvaluation e2 = fArguments[i];
- ICPPFunction overload = CPPSemantics.findOverloadedOperatorComma(point, getTemplateDefinitionScope(), e1, e2);
+ ICPPFunction overload = CPPSemantics.findOverloadedOperatorComma(getTemplateDefinitionScope(), e1, e2);
if (overload == null) {
e1= e2;
} else {
overloads[i - 1] = overload;
e1= new EvalFixed(typeFromFunctionCall(overload), valueCategoryFromFunctionCall(overload), IntegralValue.UNKNOWN);
- if (e1.getType(point) instanceof ISemanticProblem) {
+ if (e1.getType() instanceof ISemanticProblem) {
e1= e2;
}
}
@@ -129,48 +129,48 @@ public class EvalComma extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null) {
- fType= computeType(point);
+ fType= computeType();
}
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
if (isTypeDependent()) {
return new TypeOfDependentExpression(this);
}
- ICPPFunction[] overloads = getOverloads(point);
+ ICPPFunction[] overloads = getOverloads();
if (overloads.length > 0) {
ICPPFunction last = overloads[overloads.length - 1];
if (last != null) {
return typeFromFunctionCall(last);
}
}
- return fArguments[fArguments.length - 1].getType(point);
+ return fArguments[fArguments.length - 1].getType();
}
@Override
- public IValue getValue(IASTNode point) {
- ICPPFunction[] overloads = getOverloads(point);
+ public IValue getValue() {
+ ICPPFunction[] overloads = getOverloads();
if (overloads.length > 0) {
// TODO(sprigogin): Simulate execution of a function call.
return DependentValue.create(this);
}
- return fArguments[fArguments.length - 1].getValue(point);
+ return fArguments[fArguments.length - 1].getValue();
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
- ICPPFunction[] overloads = getOverloads(point);
+ public ValueCategory getValueCategory() {
+ ICPPFunction[] overloads = getOverloads();
if (overloads.length > 0) {
ICPPFunction last = overloads[overloads.length - 1];
if (last != null) {
return valueCategoryFromFunctionCall(last);
}
}
- return fArguments[fArguments.length - 1].getValueCategory(point);
+ return fArguments[fArguments.length - 1].getValueCategory();
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
index 29bb9162fc2..6058ff7247b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompositeAccess.java
@@ -13,7 +13,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IField;
@@ -47,7 +46,7 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
}
public void update(ICPPEvaluation newValue) {
- parent.getValue(null).setSubValue(elementId, newValue);
+ parent.getValue().setSubValue(elementId, newValue);
}
@Override
@@ -56,7 +55,7 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
}
private ICPPEvaluation getTargetEvaluation() {
- return parent.getValue(null).getSubValue(elementId);
+ return parent.getValue().getSubValue(elementId);
}
@Override
@@ -75,13 +74,13 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
- return getTargetEvaluation().isConstantExpression(point);
+ public boolean isConstantExpression() {
+ return getTargetEvaluation().isConstantExpression();
}
@Override
- public IType getType(IASTNode point) {
- IType type = getParent().getType(point);
+ public IType getType() {
+ IType type = getParent().getType();
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (type instanceof IArrayType) {
@@ -91,13 +90,13 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
InitializerListType initListType = (InitializerListType) type;
ICPPEvaluation[] clauses = initListType.getEvaluation().getClauses();
if (elementId >= 0 && elementId < clauses.length) {
- return clauses[elementId].getType(point);
+ return clauses[elementId].getType();
} else {
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
}
} else if (type instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) type;
- IField[] fields = ClassTypeHelper.getFields(classType, point);
+ IField[] fields = ClassTypeHelper.getFields(classType);
if (elementId >= 0 && elementId < fields.length) {
return fields[elementId].getType();
} else {
@@ -113,13 +112,13 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
- return getTargetEvaluation().getValue(point);
+ public IValue getValue() {
+ return getTargetEvaluation().getValue();
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
- return getTargetEvaluation().getValueCategory(point);
+ public ValueCategory getValueCategory() {
+ return getTargetEvaluation().getValueCategory();
}
@Override
@@ -133,7 +132,7 @@ public final class EvalCompositeAccess implements ICPPEvaluation {
return getTargetEvaluation().computeForFunctionCall(record, context);
} else {
ICPPEvaluation evaluatedComposite = parent.computeForFunctionCall(record, context);
- return evaluatedComposite.getValue(context.getPoint()).getSubValue(elementId).computeForFunctionCall(record, context);
+ return evaluatedComposite.getValue().getSubValue(elementId).computeForFunctionCall(record, context);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompoundStatementExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompoundStatementExpression.java
index 6b112a1a4e6..85e2eb1a4b4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompoundStatementExpression.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalCompoundStatementExpression.java
@@ -69,22 +69,22 @@ public class EvalCompoundStatementExpression extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
- return fDelegate.isConstantExpression(point);
+ public boolean isConstantExpression() {
+ return fDelegate.isConstantExpression();
}
@Override
- public IType getType(IASTNode point) {
- return fDelegate.getType(point);
+ public IType getType() {
+ return fDelegate.getType();
}
@Override
- public IValue getValue(IASTNode point) {
- return fDelegate.getValue(point);
+ public IValue getValue() {
+ return fDelegate.getValue();
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return PRVALUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConditional.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConditional.java
index 19157cc6ec7..32c39bea944 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConditional.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConditional.java
@@ -104,36 +104,36 @@ public class EvalConditional extends CPPDependentEvaluation {
return false;
}
- public ICPPFunction getOverload(IASTNode point) {
- evaluate(point);
+ public ICPPFunction getOverload() {
+ evaluate();
return fOverload;
}
@Override
- public IType getType(IASTNode point) {
- evaluate(point);
+ public IType getType() {
+ evaluate();
return fType;
}
@Override
- public IValue getValue(IASTNode point) {
- IValue condValue = fCondition.getValue(point);
+ public IValue getValue() {
+ IValue condValue = fCondition.getValue();
if (condValue == IntegralValue.UNKNOWN)
return IntegralValue.UNKNOWN;
Number cond = condValue.numberValue();
if (cond != null) {
if (cond.longValue() != 0) {
- return fPositive == null ? condValue : fPositive.getValue(point);
+ return fPositive == null ? condValue : fPositive.getValue();
} else {
- return fNegative.getValue(point);
+ return fNegative.getValue();
}
}
return DependentValue.create(this);
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
- evaluate(point);
+ public ValueCategory getValueCategory() {
+ evaluate();
return fValueCategory;
}
@@ -150,21 +150,21 @@ public class EvalConditional extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return fCondition.isConstantExpression(point)
- && (fPositive == null || fPositive.isConstantExpression(point))
- && fNegative.isConstantExpression(point);
+ private boolean computeIsConstantExpression() {
+ return fCondition.isConstantExpression()
+ && (fPositive == null || fPositive.isConstantExpression())
+ && fNegative.isConstantExpression();
}
- private void evaluate(IASTNode point) {
+ private void evaluate() {
if (fValueCategory != null)
return;
@@ -172,8 +172,8 @@ public class EvalConditional extends CPPDependentEvaluation {
final ICPPEvaluation positive = fPositive == null ? fCondition : fPositive;
- IType t2 = positive.getType(point);
- IType t3 = fNegative.getType(point);
+ IType t2 = positive.getType();
+ IType t3 = fNegative.getType();
final IType uqt2= getNestedType(t2, TDEF | REF | CVTYPE);
final IType uqt3= getNestedType(t3, TDEF | REF | CVTYPE);
@@ -203,8 +203,8 @@ public class EvalConditional extends CPPDependentEvaluation {
return;
}
- final ValueCategory vcat2= positive.getValueCategory(point);
- final ValueCategory vcat3= fNegative.getValueCategory(point);
+ final ValueCategory vcat2= positive.getValueCategory();
+ final ValueCategory vcat3= fNegative.getValueCategory();
// Same type
if (t2.isSameType(t3)) {
@@ -223,8 +223,8 @@ public class EvalConditional extends CPPDependentEvaluation {
// Different types with at least one class type
if (isClassType2 || isClassType3) {
- final Cost cost2= convertToMatch(t2, vcat2, uqt2, t3, vcat3, uqt3, point); // sets fType and fValueCategory
- final Cost cost3= convertToMatch(t3, vcat3, uqt3, t2, vcat2, uqt2, point); // sets fType and fValueCategory
+ final Cost cost2= convertToMatch(t2, vcat2, uqt2, t3, vcat3, uqt3); // sets fType and fValueCategory
+ final Cost cost3= convertToMatch(t3, vcat3, uqt3, t2, vcat2, uqt2); // sets fType and fValueCategory
if (cost2.converts() || cost3.converts()) {
if (cost2.converts()) {
if (cost3.converts() || cost2.isAmbiguousUDC()) {
@@ -253,7 +253,7 @@ public class EvalConditional extends CPPDependentEvaluation {
// 5.16-5: At least one class type but no conversion
if (isClassType2 || isClassType3) {
- fOverload = CPPSemantics.findOverloadedConditionalOperator(point, getTemplateDefinitionScope(), positive, fNegative);
+ fOverload = CPPSemantics.findOverloadedConditionalOperator(getTemplateDefinitionScope(), positive, fNegative);
if (fOverload != null) {
fType= ExpressionTypes.typeFromFunctionCall(fOverload);
} else {
@@ -270,7 +270,7 @@ public class EvalConditional extends CPPDependentEvaluation {
} else {
fType= CPPArithmeticConversion.convertCppOperandTypes(IASTBinaryExpression.op_plus, t2, t3);
if (fType == null) {
- fType= Conversions.compositePointerType(t2, t3, point);
+ fType= Conversions.compositePointerType(t2, t3);
if (fType == null) {
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@@ -278,12 +278,12 @@ public class EvalConditional extends CPPDependentEvaluation {
}
}
- private Cost convertToMatch(IType t1, ValueCategory vcat1, IType uqt1, IType t2, ValueCategory vcat2, IType uqt2, IASTNode point) {
+ private Cost convertToMatch(IType t1, ValueCategory vcat1, IType uqt1, IType t2, ValueCategory vcat2, IType uqt2) {
// E2 is an lvalue or E2 is an xvalue
try {
if (vcat2.isGLValue()) {
IType target= new CPPReferenceType(t2, vcat2 == XVALUE);
- Cost c= Conversions.checkImplicitConversionSequence(target, t1, vcat1, UDCMode.ALLOWED, Context.REQUIRE_DIRECT_BINDING, point);
+ Cost c= Conversions.checkImplicitConversionSequence(target, t1, vcat1, UDCMode.ALLOWED, Context.REQUIRE_DIRECT_BINDING);
if (c.converts()) {
fType= t2;
fValueCategory= vcat2;
@@ -292,7 +292,7 @@ public class EvalConditional extends CPPDependentEvaluation {
}
// Both are class types and one derives from the other
if (uqt1 instanceof ICPPClassType && uqt2 instanceof ICPPClassType) {
- int dist= SemanticUtil.calculateInheritanceDepth(uqt1, uqt2, point);
+ int dist= SemanticUtil.calculateInheritanceDepth(uqt1, uqt2);
if (dist >= 0) {
CVQualifier cv1 = SemanticUtil.getCVQualifier(t1);
CVQualifier cv2 = SemanticUtil.getCVQualifier(t2);
@@ -303,14 +303,14 @@ public class EvalConditional extends CPPDependentEvaluation {
}
return Cost.NO_CONVERSION;
}
- if (SemanticUtil.calculateInheritanceDepth(uqt2, uqt1, point) >= 0)
+ if (SemanticUtil.calculateInheritanceDepth(uqt2, uqt1) >= 0)
return Cost.NO_CONVERSION;
}
// Unrelated class types or just one class:
if (vcat2 != PRVALUE) {
t2= Conversions.lvalue_to_rvalue(t2, false);
}
- Cost c= Conversions.checkImplicitConversionSequence(t2, t1, vcat1, UDCMode.ALLOWED, Context.ORDINARY, point);
+ Cost c= Conversions.checkImplicitConversionSequence(t2, t1, vcat1, UDCMode.ALLOWED, Context.ORDINARY);
if (c.converts()) {
fType= t2;
fValueCategory= PRVALUE;
@@ -368,7 +368,7 @@ public class EvalConditional extends CPPDependentEvaluation {
// just the branch that is taken. This avoids infinite recursion
// when computing a recursive constexpr function where the base
// case of the recursion is one of the branches of the conditional.
- Number conditionValue = condition.getValue(context.getPoint()).numberValue();
+ Number conditionValue = condition.getValue().numberValue();
if (conditionValue != null) {
if (conditionValue.longValue() != 0) {
return fPositive == null ? null : fPositive.computeForFunctionCall(record, context.recordStep());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
index 42263616c8a..1f3b058d748 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
@@ -101,35 +101,35 @@ public final class EvalConstructor extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return fConstructor.isConstexpr() && areAllConstantExpressions(fArguments, point);
+ private boolean computeIsConstantExpression() {
+ return fConstructor.isConstexpr() && areAllConstantExpressions(fArguments);
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
return fType;
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
ICPPEvaluation computed =
- computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext(point));
+ computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext());
if (computed == this)
return IntegralValue.ERROR;
- return computed.getValue(point);
+ return computed.getValue();
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return null;
}
@@ -141,17 +141,16 @@ public final class EvalConstructor extends CPPDependentEvaluation {
return this;
}
final ICPPClassType classType = (ICPPClassType) unwrappedType;
- final CompositeValue compositeValue = CompositeValue.create(classType, context.getPoint());
+ final CompositeValue compositeValue = CompositeValue.create(classType);
ICPPEvaluation[] argList = evaluateArguments(fArguments, callSiteRecord, context);
EvalFixed constructedObject = new EvalFixed(fType, ValueCategory.PRVALUE, compositeValue);
CPPVariable binding = new CPPVariable(TEMP_NAME);
- IASTNode point = context.getPoint();
- ActivationRecord localRecord = EvalFunctionCall.createActivationRecord(
- fConstructor.getParameters(), argList, constructedObject, point);
+ ActivationRecord localRecord = EvalFunctionCall.createActivationRecord(fConstructor.getParameters(),
+ argList, constructedObject);
localRecord.update(binding, constructedObject);
- ICPPExecution exec = fConstructor.getConstructorChainExecution(point);
+ ICPPExecution exec = fConstructor.getConstructorChainExecution();
if (exec instanceof ExecConstructorChain) {
ExecConstructorChain memberInitList = (ExecConstructorChain) exec;
Map<IBinding, ICPPEvaluation> ccInitializers = memberInitList.getConstructorChainInitializers();
@@ -161,21 +160,21 @@ public final class EvalConstructor extends CPPDependentEvaluation {
final ICPPEvaluation memberEval = ccInitializer.getValue();
ICPPEvaluation memberValue =
memberEval.computeForFunctionCall(localRecord, context.recordStep());
- ICPPEvaluation[] baseClassValues = memberValue.getValue(point).getAllSubValues();
+ ICPPEvaluation[] baseClassValues = memberValue.getValue().getAllSubValues();
- ICPPField[] baseFields = ClassTypeHelper.getFields(baseClassType, point);
+ ICPPField[] baseFields = ClassTypeHelper.getFields(baseClassType);
for (ICPPField baseField : baseFields) {
// TODO: This has the same problem with multiple inheritance as
// CompositeValue.create(ICPPClassType).
int fieldPos = CPPASTFieldReference.getFieldPosition(baseField);
- constructedObject.getValue(point).setSubValue(fieldPos, baseClassValues[fieldPos]);
+ constructedObject.getValue().setSubValue(fieldPos, baseClassValues[fieldPos]);
}
}
}
}
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
final Map.Entry<IBinding, ICPPEvaluation> initializer =
getInitializerFromMemberInitializerList(field, exec);
@@ -185,7 +184,7 @@ public final class EvalConstructor extends CPPDependentEvaluation {
ExecDeclarator declaratorExec = getDeclaratorExecutionFromMemberInitializerList(initializer);
value = getFieldValue(declaratorExec, classType, localRecord, context);
} else {
- value = EvalUtil.getVariableValue(field, localRecord, point);
+ value = EvalUtil.getVariableValue(field, localRecord);
}
final int fieldPos = CPPASTFieldReference.getFieldPosition(field);
compositeValue.setSubValue(fieldPos, value);
@@ -195,8 +194,8 @@ public final class EvalConstructor extends CPPDependentEvaluation {
// - evaluate the arguments again
// - create another ActivationRecord (inside evaluateFunctionBody())
// Are these necessary?
- new EvalFunctionCall(argList, constructedObject, point).computeForFunctionCall(
- localRecord, context.recordStep());
+ new EvalFunctionCall(argList, constructedObject, CPPSemantics.getCurrentLookupPoint())
+ .computeForFunctionCall(localRecord, context.recordStep());
return localRecord.getVariable(binding);
}
@@ -349,8 +348,9 @@ public final class EvalConstructor extends CPPDependentEvaluation {
CPPFunctionSet functionSet =
new CPPFunctionSet(candidates, new ICPPTemplateArgument[]{}, null);
EvalFunctionSet evalFunctionSet =
- new EvalFunctionSet(functionSet, false, false, newType, context.getPoint());
- ICPPEvaluation resolved = evalFunctionSet.resolveFunction(newArguments, context.getPoint());
+ new EvalFunctionSet(functionSet, false, false, newType,
+ CPPSemantics.getCurrentLookupPoint());
+ ICPPEvaluation resolved = evalFunctionSet.resolveFunction(newArguments);
if (resolved instanceof EvalBinding) {
EvalBinding evalBinding = (EvalBinding) resolved;
newConstructor = (ICPPConstructor) evalBinding.getBinding();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFixed.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFixed.java
index e560748b1c3..3a48ae0eacc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFixed.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFixed.java
@@ -16,7 +16,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.XVALUE;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -70,18 +69,6 @@ public final class EvalFixed extends CPPEvaluation {
fValue= value;
}
- public IType getType() {
- return fType;
- }
-
- public IValue getValue() {
- return fValue;
- }
-
- public ValueCategory getValueCategory() {
- return fValueCategory;
- }
-
@Override
public boolean isInitializerList() {
return false;
@@ -111,31 +98,31 @@ public final class EvalFixed extends CPPEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return (fType instanceof ICPPClassType && TypeTraits.isEmpty(fType, point))
- || isConstexprValue(fValue, point);
+ private boolean computeIsConstantExpression() {
+ return (fType instanceof ICPPClassType && TypeTraits.isEmpty(fType))
+ || isConstexprValue(fValue);
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
return fType;
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
return fValue;
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return fValueCategory;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java
index 9a39c097122..a110e575e0e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionCall.java
@@ -109,58 +109,58 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
@Override
public boolean isValueDependent() {
return containsDependentValue(fArguments) ||
- !CPPTemplates.isFullyInstantiated(resolveFunctionBinding(null));
+ !CPPTemplates.isFullyInstantiated(resolveFunctionBinding());
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return areAllConstantExpressions(fArguments, point) && isNullOrConstexprFunc(getOverload(point));
+ private boolean computeIsConstantExpression() {
+ return areAllConstantExpressions(fArguments) && isNullOrConstexprFunc(getOverload());
}
- public ICPPFunction getOverload(IASTNode point) {
+ public ICPPFunction getOverload() {
if (fOverload == CPPFunction.UNINITIALIZED_FUNCTION) {
- fOverload = computeOverload(point);
+ fOverload = computeOverload();
}
return fOverload;
}
- private ICPPFunction computeOverload(IASTNode point) {
+ private ICPPFunction computeOverload() {
if (isTypeDependent())
return null;
- IType t= SemanticUtil.getNestedType(fArguments[0].getType(point), TDEF | REF | CVTYPE);
+ IType t= SemanticUtil.getNestedType(fArguments[0].getType(), TDEF | REF | CVTYPE);
if (t instanceof ICPPClassType) {
- return CPPSemantics.findOverloadedOperator(point, getTemplateDefinitionScope(), fArguments, t,
+ return CPPSemantics.findOverloadedOperator(getTemplateDefinitionScope(), fArguments, t,
OverloadableOperator.PAREN, LookupMode.NO_GLOBALS);
}
return null;
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null)
- fType = computeType(point);
+ fType = computeType();
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
if (isTypeDependent())
return new TypeOfDependentExpression(this);
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null)
return ExpressionTypes.typeFromFunctionCall(overload);
ICPPEvaluation function = fArguments[0];
- IType result = ExpressionTypes.typeFromFunctionCall(function.getType(point));
+ IType result = ExpressionTypes.typeFromFunctionCall(function.getType());
if (function instanceof EvalMemberAccess) {
result = ExpressionTypes.restoreTypedefs(result, ((EvalMemberAccess) function).getOwnerType());
}
@@ -168,21 +168,21 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
- ICPPEvaluation eval = evaluateFunctionBody(new ConstexprEvaluationContext(point));
+ public IValue getValue() {
+ ICPPEvaluation eval = evaluateFunctionBody(new ConstexprEvaluationContext());
if (eval == this) {
return DependentValue.create(eval);
}
- return eval.getValue(point);
+ return eval.getValue();
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
- ICPPFunction overload = getOverload(point);
+ public ValueCategory getValueCategory() {
+ ICPPFunction overload = getOverload();
if (overload != null)
return valueCategoryFromFunctionCall(overload);
- IType t= fArguments[0].getType(point);
+ IType t= fArguments[0].getType();
if (t instanceof IPointerType) {
t = SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
}
@@ -221,10 +221,10 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
if (args == fArguments)
return this;
- if (args[0] instanceof EvalFunctionSet && getOverload(context.getPoint()) == null) {
+ if (args[0] instanceof EvalFunctionSet && getOverload() == null) {
// Resolve the function using the parameters of the function call.
EvalFunctionSet functionSet = (EvalFunctionSet) args[0];
- args[0] = functionSet.resolveFunction(Arrays.copyOfRange(args, 1, args.length), context.getPoint());
+ args[0] = functionSet.resolveFunction(Arrays.copyOfRange(args, 1, args.length));
// Propagate instantiation errors for SFINAE purposes.
if (args[0] == EvalFixed.INCOMPLETE) {
@@ -242,7 +242,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
return EvalFixed.INCOMPLETE;
}
- ICPPFunction functionBinding = resolveFunctionBinding(context.getPoint());
+ ICPPFunction functionBinding = resolveFunctionBinding();
if (functionBinding == null)
return EvalFixed.INCOMPLETE;
@@ -261,8 +261,8 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
return EvalFixed.INCOMPLETE;
arg = new EvalReference(record, binding, evalBinding.getTemplateDefinition());
} else if (0 < i && i <= parameters.length && !isReference(parameters[i - 1])) {
- IValue copiedValue = arg.getValue(context.getPoint()).clone();
- arg = new EvalFixed(arg.getType(context.getPoint()), arg.getValueCategory(context.getPoint()), copiedValue);
+ IValue copiedValue = arg.getValue().clone();
+ arg = new EvalFixed(arg.getType(), arg.getValueCategory(), copiedValue);
}
if (arg == EvalFixed.INCOMPLETE)
return EvalFixed.INCOMPLETE;
@@ -296,10 +296,10 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
// If the arguments are not all constant expressions, there is
// no point trying to substitute them into the return expression.
- if (!areAllConstantExpressions(fArguments, 1, fArguments.length, context.getPoint()))
+ if (!areAllConstantExpressions(fArguments, 1, fArguments.length))
return EvalFixed.INCOMPLETE;
- ICPPFunction function = resolveFunctionBinding(context.getPoint());
+ ICPPFunction function = resolveFunctionBinding();
if (function == null)
return this;
@@ -307,8 +307,8 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
return EvalFixed.INCOMPLETE;
ActivationRecord record = createActivationRecord(function.getParameters(), fArguments,
- getImplicitThis(), context.getPoint());
- ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function, context.getPoint());
+ getImplicitThis());
+ ICPPExecution bodyExec = CPPFunction.getFunctionBodyExecution(function);
if (bodyExec == null) {
if (!(function instanceof ICPPTemplateInstance)
|| ((ICPPTemplateInstance) function).isExplicitSpecialization()) {
@@ -318,7 +318,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
IBinding specialized = functionInstance.getSpecializedBinding();
if (!(specialized instanceof ICPPFunction))
return this;
- bodyExec = CPPFunction.getFunctionBodyExecution((ICPPFunction) specialized, context.getPoint());
+ bodyExec = CPPFunction.getFunctionBodyExecution((ICPPFunction) specialized);
}
if (bodyExec != null) {
bodyExec = bodyExec.executeForFunctionCall(record, context.recordStep());
@@ -346,13 +346,13 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
return EvalFixed.INCOMPLETE;
}
- private ICPPFunction resolveFunctionBinding(IASTNode point) {
- ICPPFunction function = getOverload(point);
+ private ICPPFunction resolveFunctionBinding() {
+ ICPPFunction function = getOverload();
if (function == null) {
ICPPEvaluation funcEval = fArguments[0];
if (funcEval instanceof EvalFunctionSet) {
EvalFunctionSet funcEvalFunctionSet = (EvalFunctionSet) funcEval;
- funcEval = funcEvalFunctionSet.resolveFunction(Arrays.copyOfRange(fArguments, 1, fArguments.length), point);
+ funcEval = funcEvalFunctionSet.resolveFunction(Arrays.copyOfRange(fArguments, 1, fArguments.length));
}
IBinding binding = null;
@@ -377,7 +377,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
.getType() instanceof IPointerType);
}
- public static ActivationRecord createActivationRecord(ICPPParameter[] parameters, ICPPEvaluation[] arguments, ICPPEvaluation implicitThis, IASTNode point) {
+ public static ActivationRecord createActivationRecord(ICPPParameter[] parameters, ICPPEvaluation[] arguments, ICPPEvaluation implicitThis) {
ActivationRecord record = new ActivationRecord(parameters, implicitThis);
// We start at arguments[1] because arguments[0] is the function's evaluation.
@@ -391,7 +391,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
for (int i = 0; i < paramPackLen; i++) {
ICPPEvaluation arg = arguments[j+i];
values[i] = arg;
- types[i] = arg.getType(null);
+ types[i] = arg.getType();
}
IValue paramPackValue = new CompositeValue(null, values);
@@ -401,7 +401,7 @@ public final class EvalFunctionCall extends CPPDependentEvaluation {
break;
} else {
if (j < arguments.length) {
- ICPPEvaluation argument = maybeApplyConversion(arguments[j++], param.getType(), point, false);
+ ICPPEvaluation argument = maybeApplyConversion(arguments[j++], param.getType(), false);
record.update(param, argument);
} else if (param.hasDefaultValue()) {
IValue value = param.getDefaultValue();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java
index b0448106ff6..cef11e192a3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java
@@ -33,7 +33,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
import org.eclipse.cdt.internal.core.dom.parser.IntegralValue;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.InstantiationContext;
@@ -140,15 +139,15 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
+ private boolean computeIsConstantExpression() {
if (fFunctionSet == null)
return false;
for (ICPPFunction f : fFunctionSet.getBindings()) {
@@ -160,17 +159,17 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
return new FunctionSetType(fFunctionSet, fAddressOf);
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
return IntegralValue.UNKNOWN;
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return PRVALUE;
}
@@ -268,7 +267,7 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
functions = new ICPPFunction[originalFunctions.length];
for (int i = 0; i < originalFunctions.length; i++) {
functions[i] = (ICPPFunction) CPPTemplates.createSpecialization((ICPPClassSpecialization) owner,
- originalFunctions[i], context.getPoint());
+ originalFunctions[i]);
}
}
// No need to instantiate the implied object type. An EvalFunctioNSet should only be created
@@ -288,14 +287,14 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
* Attempts to resolve the function using the parameters of a function call.
*
* @param args the arguments of a function call
- * @param point the name lookup context
* @return the resolved or the original evaluation depending on whether function resolution
* succeeded or not
*/
- public ICPPEvaluation resolveFunction(ICPPEvaluation[] args, IASTNode point) {
+ public ICPPEvaluation resolveFunction(ICPPEvaluation[] args) {
// Set up the LookupData.
LookupData data;
ICPPFunction[] functions = null;
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (fFunctionSet == null) {
data = new LookupData(fName, null, point);
} else {
@@ -323,7 +322,7 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
functions = ArrayUtil.append(ICPPFunction.class, functions, (ICPPFunction) obj);
} else if (obj instanceof ICPPClassType) {
functions = ArrayUtil.addAll(ICPPFunction.class, functions,
- ClassTypeHelper.getConstructors((ICPPClassType) obj, point));
+ ((ICPPClassType) obj).getConstructors());
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
index f76d3471ef0..718e96c0d78 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalID.java
@@ -148,23 +148,23 @@ public class EvalID extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
return false;
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
return new TypeOfDependentExpression(this);
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
// Name lookup is not needed here because it was already done in the "instantiate" method.
return DependentValue.create(this);
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return PRVALUE;
}
@@ -380,7 +380,7 @@ public class EvalID extends CPPDependentEvaluation {
boolean nameOwnerStillDependent = false;
if (nameOwner instanceof ICPPClassType) {
- ICPPEvaluation eval = resolveName(name, (ICPPClassType) nameOwner, null, templateArgs, null, context.getPoint());
+ ICPPEvaluation eval = resolveName(name, (ICPPClassType) nameOwner, null, templateArgs, null);
if (eval != null)
return eval;
if (CPPTemplates.isDependentType((ICPPClassType) nameOwner)) {
@@ -391,7 +391,7 @@ public class EvalID extends CPPDependentEvaluation {
}
if (!nameOwnerStillDependent && fieldOwner != null && !fieldOwner.isTypeDependent()) {
- IType fieldOwnerType = fieldOwner.getType(context.getPoint());
+ IType fieldOwnerType = fieldOwner.getType();
if (fIsPointerDeref) {
fieldOwnerType = SemanticUtil.getSimplifiedType(fieldOwnerType);
if (fieldOwnerType instanceof IPointerType) {
@@ -404,7 +404,7 @@ public class EvalID extends CPPDependentEvaluation {
IType fieldOwnerClassType = SemanticUtil.getNestedType(fieldOwnerClassTypeCV, CVTYPE);
if (fieldOwnerClassType instanceof ICPPClassType) {
ICPPEvaluation eval = resolveName(name, (ICPPClassType) fieldOwnerClassType, fieldOwner,
- templateArgs, fieldOwnerClassTypeCV, context.getPoint());
+ templateArgs, fieldOwnerClassTypeCV);
if (eval != null)
return eval;
if (!CPPTemplates.isDependentType(fieldOwnerClassType))
@@ -430,7 +430,8 @@ public class EvalID extends CPPDependentEvaluation {
}
private ICPPEvaluation resolveName(char[] name, ICPPClassType nameOwner, ICPPEvaluation ownerEval,
- ICPPTemplateArgument[] templateArgs, IType impliedObjectType, IASTNode point) {
+ ICPPTemplateArgument[] templateArgs, IType impliedObjectType) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
LookupData data = new LookupData(name, templateArgs, point);
data.qualified = fQualified;
try {
@@ -459,7 +460,7 @@ public class EvalID extends CPPDependentEvaluation {
return new EvalBinding(binding, null, getTemplateDefinition());
}
if (ownerEval != null) {
- return new EvalMemberAccess(nameOwner, ownerEval.getValueCategory(point), binding, ownerEval, false, point);
+ return new EvalMemberAccess(nameOwner, ownerEval.getValueCategory(), binding, ownerEval, false, point);
} else {
return new EvalMemberAccess(nameOwner, ValueCategory.PRVALUE, binding, false, getTemplateDefinition());
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalInitList.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalInitList.java
index 4f05a467f6a..be8279912fb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalInitList.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalInitList.java
@@ -74,33 +74,33 @@ public class EvalInitList extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return areAllConstantExpressions(fClauses, point);
+ private boolean computeIsConstantExpression() {
+ return areAllConstantExpressions(fClauses);
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
return new InitializerListType(this);
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent()) {
return DependentValue.create(this);
}
- return CompositeValue.create(this, point);
+ return CompositeValue.create(this);
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return PRVALUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
index 646c27557a3..6e49cc6b1d0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
@@ -181,14 +181,14 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (fOwnerEval != null) {
- return fOwnerEval.isConstantExpression(point);
+ return fOwnerEval.isConstantExpression();
}
return false;
}
- public static IType getFieldOwnerType(IType fieldOwnerExpressionType, boolean isDeref, IASTNode point,
+ public static IType getFieldOwnerType(IType fieldOwnerExpressionType, boolean isDeref,
Collection<ICPPFunction> functionBindings, boolean returnDependent) {
IType type= fieldOwnerExpressionType;
if (!isDeref)
@@ -214,7 +214,7 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
*/
ICPPEvaluation[] args= { new EvalFixed(type, LVALUE, IntegralValue.UNKNOWN) };
- ICPPFunction op= CPPSemantics.findOverloadedOperator(point, null, args, classType,
+ ICPPFunction op= CPPSemantics.findOverloadedOperator(null, args, classType,
OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
if (op == null)
break;
@@ -223,7 +223,7 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
functionBindings.add(op);
type = typeFromFunctionCall(op);
- type = SemanticUtil.mapToAST(type, point);
+ type = SemanticUtil.mapToAST(type);
}
IType prValue = prvalueTypeWithResolvedTypedefs(type);
@@ -235,7 +235,8 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
return returnDependent
// The type resulting from dereferecing 'type'
? new TypeOfDependentExpression(new EvalUnary(IASTUnaryExpression.op_star,
- new EvalFixed(type, LVALUE, IntegralValue.UNKNOWN), null, point))
+ new EvalFixed(type, LVALUE, IntegralValue.UNKNOWN), null,
+ CPPSemantics.getCurrentLookupPoint()))
: null;
}
@@ -243,14 +244,14 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null) {
- fType = computeType(point);
+ fType = computeType();
}
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
if (fMember instanceof ICPPUnknownBinding) {
return new TypeOfDependentExpression(this);
}
@@ -265,10 +266,10 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
} else if (fMember instanceof ICPPField && !((ICPPField) fMember).isStatic()) {
e2 = addQualifiersForAccess((ICPPField) fMember, e2, fOwnerType);
}
- return SemanticUtil.mapToAST(e2, point);
+ return SemanticUtil.mapToAST(e2);
}
if (fMember instanceof IFunction) {
- return SemanticUtil.mapToAST(((IFunction) fMember).getType(), point);
+ return SemanticUtil.mapToAST(((IFunction) fMember).getType());
}
return ProblemType.UNKNOWN_FOR_EXPRESSION;
}
@@ -291,15 +292,15 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (fOwnerEval != null) {
int fieldPos = CPPASTFieldReference.getFieldPosition(fMember, fOwnerType);
- IValue ownerValue = fOwnerEval.getValue(point);
+ IValue ownerValue = fOwnerEval.getValue();
if (ownerValue instanceof CompositeValue) {
CompositeValue compValue = (CompositeValue) ownerValue;
ICPPEvaluation field = compValue.getSubValue(fieldPos);
if (field != null) {
- return field.getValue(point);
+ return field.getValue();
}
} else {
return IntegralValue.UNKNOWN;
@@ -320,7 +321,7 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
if (fMember instanceof IVariable) {
IType e2 = ((IVariable) fMember).getType();
e2 = SemanticUtil.getNestedType(e2, TDEF);
@@ -387,7 +388,7 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
IBinding member = fMember;
IType ownerClass = SemanticUtil.getNestedType(ownerType, ALLCVQ);
if (ownerClass instanceof ICPPClassSpecialization) {
- member = CPPTemplates.createSpecialization((ICPPClassSpecialization) ownerClass, fMember, context.getPoint());
+ member = CPPTemplates.createSpecialization((ICPPClassSpecialization) ownerClass, fMember);
}
ICPPEvaluation ownerEval = fOwnerEval;
if (ownerEval != null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalParameterPack.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalParameterPack.java
index 8cfa1383d45..2d47dece982 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalParameterPack.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalParameterPack.java
@@ -65,14 +65,14 @@ public class EvalParameterPack extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
return false;
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null) {
- IType type = fExpansionPattern.getType(point);
+ IType type = fExpansionPattern.getType();
if (type == null) {
fType= ProblemType.UNKNOWN_FOR_EXPRESSION;
} else {
@@ -83,12 +83,12 @@ public class EvalParameterPack extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
return DependentValue.create(fExpansionPattern);
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return ValueCategory.PRVALUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPointer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPointer.java
index e0157ad9159..12d5a438c9e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPointer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPointer.java
@@ -51,8 +51,8 @@ public final class EvalPointer extends EvalReference {
}
@Override
- public IType getType(IASTNode point) {
- IType valueType = getTargetEvaluation().getType(point);
+ public IType getType() {
+ IType valueType = getTargetEvaluation().getType();
return new CPPPointerType(valueType, false, false, false);
}
@@ -77,11 +77,11 @@ public final class EvalPointer extends EvalReference {
}
private boolean subValuePositionOutOfrange() {
- return referredSubValue != null && (position - referredSubValue.getParent().getValue(null).numberOfSubValues() > 0 || position < 0);
+ return referredSubValue != null && (position - referredSubValue.getParent().getValue().numberOfSubValues() > 0 || position < 0);
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
// TODO(nathanridge): Why does it make sense to consider a pointer's value to be its offset
// into the underlying array?
return IntegralValue.create(position);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalReference.java
index 67039f36213..56a01b80389 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalReference.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalReference.java
@@ -69,18 +69,18 @@ public class EvalReference extends CPPDependentEvaluation {
}
@Override
- public final boolean isConstantExpression(IASTNode point) {
- return getTargetEvaluation().isConstantExpression(point);
+ public final boolean isConstantExpression() {
+ return getTargetEvaluation().isConstantExpression();
}
@Override
- public IType getType(IASTNode point) {
- return getTargetEvaluation().getType(point);
+ public IType getType() {
+ return getTargetEvaluation().getType();
}
@Override
- public IValue getValue(IASTNode point) {
- return getTargetEvaluation().getValue(point);
+ public IValue getValue() {
+ return getTargetEvaluation().getValue();
}
public final ICPPEvaluation getTargetEvaluation() {
@@ -109,7 +109,7 @@ public class EvalReference extends CPPDependentEvaluation {
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
// An EvalReference always refers to a named variable, so its value category is lvalue.
return ValueCategory.LVALUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java
index 8d9cc05f756..38e30b88cae 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalTypeId.java
@@ -120,7 +120,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fOutputType == null) {
fOutputType= computeType();
}
@@ -138,7 +138,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent())
return DependentValue.create(this);
if (isTypeDependent())
@@ -149,17 +149,17 @@ public class EvalTypeId extends CPPDependentEvaluation {
IType inputType = SemanticUtil.getNestedType(fInputType, CVTYPE);
if (inputType instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) inputType;
- IBinding ctor = getConstructor(point);
+ IBinding ctor = getConstructor();
if (EvalUtil.isCompilerGeneratedCtor(ctor)) {
- return CompositeValue.create(classType, point);
+ return CompositeValue.create(classType);
} else if (ctor == AGGREGATE_INITIALIZATION) {
return CompositeValue.create(new EvalInitList(fArguments, getTemplateDefinition()),
- classType, point);
+ classType);
} else if (ctor != null) {
EvalConstructor evalCtor = new EvalConstructor(classType, (ICPPConstructor) ctor,
fArguments, getTemplateDefinition());
- ICPPEvaluation computedEvalCtor = evalCtor.computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext(point));
- return computedEvalCtor.getValue(point);
+ ICPPEvaluation computedEvalCtor = evalCtor.computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext());
+ return computedEvalCtor.getValue();
} else {
return IntegralValue.ERROR;
}
@@ -187,7 +187,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
}
if (fArguments.length == 1) {
- return fArguments[0].getValue(point);
+ return fArguments[0].getValue();
}
return IntegralValue.UNKNOWN;
}
@@ -217,28 +217,28 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
+ private boolean computeIsConstantExpression() {
return !fRepresentsNewExpression
- && areAllConstantExpressions(fArguments, point)
- && isNullOrConstexprFunc(getConstructor(point));
+ && areAllConstantExpressions(fArguments)
+ && isNullOrConstexprFunc(getConstructor());
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return valueCategoryFromReturnType(fInputType);
}
- public ICPPFunction getConstructor(IASTNode point) {
+ public ICPPFunction getConstructor() {
if (fConstructor == CPPFunction.UNINITIALIZED_FUNCTION) {
- fConstructor = computeConstructor(point);
+ fConstructor = computeConstructor();
}
return fConstructor;
}
@@ -251,7 +251,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
return true;
}
- private ICPPFunction computeConstructor(IASTNode point) {
+ private ICPPFunction computeConstructor() {
if (isTypeDependent())
return null;
@@ -259,10 +259,10 @@ public class EvalTypeId extends CPPDependentEvaluation {
if (simplifiedType instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) simplifiedType;
ICPPEvaluation[] arguments = fArguments;
- ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, point);
+ ICPPConstructor[] constructors = classType.getConstructors();
if (arguments.length == 1 && arguments[0] instanceof EvalInitList) {
// List-initialization of a class (dcl.init.list-3).
- if (TypeTraits.isAggregateClass(classType, point)) {
+ if (TypeTraits.isAggregateClass(classType)) {
// Pretend that aggregate initialization is calling the default constructor.
return findDefaultConstructor(classType, constructors);
}
@@ -271,7 +271,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
if (ctor != null)
return ctor;
}
- ICPPConstructor[] ctors = getInitializerListConstructors(constructors, point);
+ ICPPConstructor[] ctors = getInitializerListConstructors(constructors);
if (ctors.length != 0) {
constructors = ctors;
} else {
@@ -279,7 +279,8 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
}
- LookupData data = new LookupData(classType.getNameCharArray(), null, point);
+ LookupData data = new LookupData(classType.getNameCharArray(), null,
+ CPPSemantics.getCurrentLookupPoint());
data.foundItems = constructors;
data.setFunctionArguments(false, arguments);
try {
@@ -310,9 +311,9 @@ public class EvalTypeId extends CPPDependentEvaluation {
* Returns constructors that can be called by passing a single {@code std::initializer_list}
* as an argument.
*/
- private ICPPConstructor[] getInitializerListConstructors(ICPPConstructor[] constructors, IASTNode point) {
+ private ICPPConstructor[] getInitializerListConstructors(ICPPConstructor[] constructors) {
ICPPConstructor[] result = ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
- ICPPClassTemplate template = CPPVisitor.get_initializer_list(point);
+ ICPPClassTemplate template = CPPVisitor.get_initializer_list();
if (template == null)
return result;
@@ -383,7 +384,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
if (simplifiedType instanceof ICPPClassType) {
// Check the constructor call and return EvalFixed.INCOMPLETE to indicate a substitution
// failure if the call cannot be resolved.
- ICPPFunction constructor = result.getConstructor(context.getPoint());
+ ICPPFunction constructor = result.getConstructor();
if (constructor == null || constructor instanceof IProblemBinding || constructor.isDeleted()) {
return EvalFixed.INCOMPLETE;
}
@@ -396,7 +397,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
@Override
public ICPPEvaluation computeForFunctionCall(ActivationRecord record,
ConstexprEvaluationContext context) {
- ICPPFunction constructor = getConstructor(context.getPoint());
+ ICPPFunction constructor = getConstructor();
if (constructor != null && constructor instanceof ICPPConstructor) {
return new EvalConstructor(fInputType, (ICPPConstructor) constructor, fArguments,
getTemplateDefinition()).computeForFunctionCall(record, context);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java
index 5432eadb7ec..1f70e61deb7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnary.java
@@ -158,27 +158,27 @@ public class EvalUnary extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
if (!fCheckedIsConstantExpression) {
fCheckedIsConstantExpression = true;
- fIsConstantExpression = computeIsConstantExpression(point);
+ fIsConstantExpression = computeIsConstantExpression();
}
return fIsConstantExpression;
}
- private boolean computeIsConstantExpression(IASTNode point) {
- return fArgument.isConstantExpression(point)
- && isNullOrConstexprFunc(getOverload(point));
+ private boolean computeIsConstantExpression() {
+ return fArgument.isConstantExpression()
+ && isNullOrConstexprFunc(getOverload());
}
- public ICPPFunction getOverload(IASTNode point) {
+ public ICPPFunction getOverload() {
if (fOverload == CPPFunction.UNINITIALIZED_FUNCTION) {
- fOverload= computeOverload(point);
+ fOverload= computeOverload();
}
return fOverload;
}
- private ICPPFunction computeOverload(IASTNode point) {
+ private ICPPFunction computeOverload() {
OverloadableOperator op = OverloadableOperator.fromUnaryExpression(fOperator);
if (op == null)
return null;
@@ -192,7 +192,7 @@ public class EvalUnary extends CPPDependentEvaluation {
return null;
}
- IType type = fArgument.getType(point);
+ IType type = fArgument.getType();
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (!CPPSemantics.isUserDefined(type))
return null;
@@ -203,31 +203,31 @@ public class EvalUnary extends CPPDependentEvaluation {
} else {
args = new ICPPEvaluation[] { fArgument };
}
- return CPPSemantics.findOverloadedOperator(point, getTemplateDefinitionScope(), args, type,
+ return CPPSemantics.findOverloadedOperator(getTemplateDefinitionScope(), args, type,
op, LookupMode.LIMITED_GLOBALS);
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null)
- fType= computeType(point);
+ fType= computeType();
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
if (isTypeDependent())
return new TypeOfDependentExpression(this);
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null)
return ExpressionTypes.typeFromFunctionCall(overload);
switch (fOperator) {
case op_sizeof:
case op_sizeofParameterPack:
- return CPPVisitor.get_SIZE_T(point);
+ return CPPVisitor.get_SIZE_T();
case op_typeid:
- return CPPVisitor.get_type_info(point);
+ return CPPVisitor.get_type_info();
case op_throw:
return CPPSemantics.VOID_TYPE;
case op_amper:
@@ -242,9 +242,9 @@ public class EvalUnary extends CPPDependentEvaluation {
}
}
}
- return new CPPPointerType(fArgument.getType(point));
+ return new CPPPointerType(fArgument.getType());
case op_star:
- IType type= fArgument.getType(point);
+ IType type= fArgument.getType();
type = prvalueTypeWithResolvedTypedefs(type);
if (type instanceof IPointerType) {
return glvalueType(((IPointerType) type).getType());
@@ -258,14 +258,14 @@ public class EvalUnary extends CPPDependentEvaluation {
return CPPBasicType.BOOLEAN;
case op_postFixDecr:
case op_postFixIncr:
- return prvalueType(fArgument.getType(point));
+ return prvalueType(fArgument.getType());
case op_plus:
- return promoteType(fArgument.getType(point), true);
+ return promoteType(fArgument.getType(), true);
case op_minus:
case op_tilde:
- return promoteType(fArgument.getType(point), false);
+ return promoteType(fArgument.getType(), false);
}
- return fArgument.getType(point);
+ return fArgument.getType();
}
private IType promoteType(IType type, boolean allowPointer) {
@@ -289,44 +289,44 @@ public class EvalUnary extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent())
return DependentValue.create(this);
ICPPEvaluation arg = fArgument;
- ICPPFunction overload = getOverload(point);
+ ICPPFunction overload = getOverload();
if (overload != null) {
ICPPFunctionType functionType = overload.getType();
IType[] parameterTypes = functionType.getParameterTypes();
if (parameterTypes.length == 0)
return IntegralValue.ERROR;
IType targetType = parameterTypes[0];
- arg = maybeApplyConversion(arg, targetType, point, fOperator == op_not);
+ arg = maybeApplyConversion(arg, targetType, fOperator == op_not);
if (!(overload instanceof CPPImplicitFunction)) {
if (!overload.isConstexpr())
return IntegralValue.ERROR;
ICPPEvaluation eval = new EvalBinding(overload, null, (IBinding) null);
arg = new EvalFunctionCall(new ICPPEvaluation[] {eval, arg}, null, (IBinding) null);
- return arg.getValue(point);
+ return arg.getValue();
}
}
switch (fOperator) {
case op_sizeof: {
SizeAndAlignment info =
- SizeofCalculator.getSizeAndAlignment(fArgument.getType(point), point);
+ SizeofCalculator.getSizeAndAlignment(fArgument.getType());
return info == null ? IntegralValue.UNKNOWN : IntegralValue.create(info.size);
}
case op_alignOf: {
SizeAndAlignment info =
- SizeofCalculator.getSizeAndAlignment(fArgument.getType(point), point);
+ SizeofCalculator.getSizeAndAlignment(fArgument.getType());
return info == null ? IntegralValue.UNKNOWN : IntegralValue.create(info.alignment);
}
case op_noexcept:
return IntegralValue.UNKNOWN; // TODO(sprigogin): Implement
case op_sizeofParameterPack:
- IValue opVal = fArgument.getValue(point);
+ IValue opVal = fArgument.getValue();
return IntegralValue.create(opVal.numberOfSubValues());
case op_typeid:
return IntegralValue.UNKNOWN; // TODO(sprigogin): Implement
@@ -334,7 +334,7 @@ public class EvalUnary extends CPPDependentEvaluation {
return IntegralValue.UNKNOWN; // TODO(sprigogin): Implement
}
- IValue val = arg.getValue(point);
+ IValue val = arg.getValue();
if (val == null)
return IntegralValue.UNKNOWN;
@@ -342,8 +342,8 @@ public class EvalUnary extends CPPDependentEvaluation {
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
- ICPPFunction overload = getOverload(point);
+ public ValueCategory getValueCategory() {
+ ICPPFunction overload = getOverload();
if (overload != null)
return valueCategoryFromFunctionCall(overload);
@@ -395,15 +395,17 @@ public class EvalUnary extends CPPDependentEvaluation {
return new EvalUnary(fOperator, argument, binding, getTemplateDefinition());
}
- private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, IASTNode point, ICPPEvaluation arg) {
+ private ICPPEvaluation createOperatorOverloadEvaluation(ICPPFunction overload, ICPPEvaluation arg) {
+ IBinding templateDefinition = getTemplateDefinition();
if (overload instanceof ICPPMethod) {
- EvalMemberAccess opAccess = new EvalMemberAccess(arg.getType(point), ValueCategory.LVALUE, overload, arg, false, point);
+ EvalMemberAccess opAccess = new EvalMemberAccess(arg.getType(), ValueCategory.LVALUE, overload,
+ arg, false, templateDefinition);
ICPPEvaluation[] args = new ICPPEvaluation[]{opAccess};
- return new EvalFunctionCall(args, arg, point);
+ return new EvalFunctionCall(args, arg, templateDefinition);
} else {
- EvalBinding op = new EvalBinding(overload, overload.getType(), point);
+ EvalBinding op = new EvalBinding(overload, overload.getType(), templateDefinition);
ICPPEvaluation[] args = new ICPPEvaluation[]{op, arg};
- return new EvalFunctionCall(args, null, point);
+ return new EvalFunctionCall(args, null, templateDefinition);
}
}
@@ -413,9 +415,9 @@ public class EvalUnary extends CPPDependentEvaluation {
@Override
public ICPPEvaluation computeForFunctionCall(ActivationRecord record, ConstexprEvaluationContext context) {
- ICPPFunction overload = getOverload(context.getPoint());
+ ICPPFunction overload = getOverload();
if (overload != null) {
- ICPPEvaluation operatorCall = createOperatorOverloadEvaluation(overload, context.getPoint(), fArgument);
+ ICPPEvaluation operatorCall = createOperatorOverloadEvaluation(overload, fArgument);
ICPPEvaluation eval = operatorCall.computeForFunctionCall(record, context);
return eval;
}
@@ -455,7 +457,7 @@ public class EvalUnary extends CPPDependentEvaluation {
applyPointerArithmetics(evalPointer);
return evalPointer;
} else {
- EvalFixed newValue = new EvalFixed(evalUnary.getType(context.getPoint()), evalUnary.getValueCategory(context.getPoint()), evalUnary.getValue(context.getPoint()));
+ EvalFixed newValue = new EvalFixed(evalUnary.getType(), evalUnary.getValueCategory(), evalUnary.getValue());
if (updateable instanceof EvalReference) {
EvalReference evalRef = (EvalReference) updateable;
evalRef.update(newValue);
@@ -468,7 +470,7 @@ public class EvalUnary extends CPPDependentEvaluation {
record.update(binding, newValue);
}
- if (this.getValueCategory(context.getPoint()) == ValueCategory.LVALUE) {
+ if (this.getValueCategory() == ValueCategory.LVALUE) {
return updateable;
} else {
return fixed;
@@ -480,7 +482,7 @@ public class EvalUnary extends CPPDependentEvaluation {
}
private boolean isStarOperatorOnArrayName(ConstexprEvaluationContext context) {
- return fOperator == op_star && fArgument.getType(context.getPoint()) instanceof IArrayType;
+ return fOperator == op_star && fArgument.getType() instanceof IArrayType;
}
private void applyPointerArithmetics(EvalPointer poiner) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
index 6492ea83476..41ff79f4ebe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUnaryTypeID.java
@@ -130,25 +130,25 @@ public class EvalUnaryTypeID extends CPPDependentEvaluation {
}
@Override
- public boolean isConstantExpression(IASTNode point) {
+ public boolean isConstantExpression() {
return true;
}
@Override
- public IType getType(IASTNode point) {
+ public IType getType() {
if (fType == null)
- fType= computeType(point);
+ fType= computeType();
return fType;
}
- private IType computeType(IASTNode point) {
+ private IType computeType() {
switch (fOperator) {
case op_sizeof:
case op_sizeofParameterPack:
case op_alignof:
- return CPPVisitor.get_SIZE_T(point);
+ return CPPVisitor.get_SIZE_T();
case op_typeid:
- return CPPVisitor.get_type_info(point);
+ return CPPVisitor.get_type_info();
case op_has_nothrow_copy:
case op_has_nothrow_constructor:
case op_has_trivial_assign:
@@ -178,15 +178,15 @@ public class EvalUnaryTypeID extends CPPDependentEvaluation {
}
@Override
- public IValue getValue(IASTNode point) {
+ public IValue getValue() {
if (isValueDependent())
return DependentValue.create(this);
- return ValueFactory.evaluateUnaryTypeIdExpression(fOperator, fOrigType, point);
+ return ValueFactory.evaluateUnaryTypeIdExpression(fOperator, fOrigType);
}
@Override
- public ValueCategory getValueCategory(IASTNode point) {
+ public ValueCategory getValueCategory() {
return fOperator == op_typeid ? LVALUE : PRVALUE;
}
@@ -212,8 +212,7 @@ public class EvalUnaryTypeID extends CPPDependentEvaluation {
if (packSize == CPPTemplates.PACK_SIZE_FAIL || packSize == CPPTemplates.PACK_SIZE_NOT_FOUND) {
return EvalFixed.INCOMPLETE;
} else if (packSize != CPPTemplates.PACK_SIZE_DEFER) {
- IASTNode point = context.getPoint();
- return new EvalFixed(getType(point), getValueCategory(point), IntegralValue.create(packSize));
+ return new EvalFixed(getType(), getValueCategory(), IntegralValue.create(packSize));
}
}
IType type = CPPTemplates.instantiateType(fOrigType, context);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUtil.java
index bfa9a8d570d..9fe5386b5fe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalUtil.java
@@ -16,7 +16,6 @@ import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -46,14 +45,14 @@ public class EvalUtil {
public static IValue getConditionExprValue(ICPPEvaluation conditionExprEval, ActivationRecord record,
ConstexprEvaluationContext context) {
- return conditionExprEval.computeForFunctionCall(record, context.recordStep()).getValue(context.getPoint());
+ return conditionExprEval.computeForFunctionCall(record, context.recordStep()).getValue();
}
public static IValue getConditionDeclValue(ExecSimpleDeclaration conditionDeclExec, ActivationRecord record,
ConstexprEvaluationContext context) {
ICPPBinding declaredBinding = ((ExecDeclarator) conditionDeclExec.getDeclaratorExecutions()[0]).getDeclaredBinding();
conditionDeclExec.executeForFunctionCall(record, context.recordStep());
- return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue(context.getPoint());
+ return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue();
}
public static boolean conditionExprSatisfied(ICPPEvaluation conditionExprEval, ActivationRecord record,
@@ -160,8 +159,7 @@ public class EvalUtil {
* Returns the initial value of the given variable, evaluated in the context of
* the given activation record.
*/
- public static ICPPEvaluation getVariableValue(ICPPVariable variable, ActivationRecord record,
- IASTNode point) {
+ public static ICPPEvaluation getVariableValue(ICPPVariable variable, ActivationRecord record) {
Set<ICPPVariable> recursionProtectionSet = fInitialValueInProgress.get();
if (!recursionProtectionSet.add(variable)) {
return EvalFixed.INCOMPLETE;
@@ -180,7 +178,7 @@ public class EvalUtil {
}
ExecDeclarator declaratorExec = new ExecDeclarator(variable, initializerEval);
- ConstexprEvaluationContext context = new ConstexprEvaluationContext(point);
+ ConstexprEvaluationContext context = new ConstexprEvaluationContext();
if (declaratorExec.executeForFunctionCall(record, context) != ExecIncomplete.INSTANCE) {
valueEval = record.getVariable(declaratorExec.getDeclaredBinding());
}
@@ -189,7 +187,7 @@ public class EvalUtil {
}
if (valueEval != null && (valueEval == EvalFixed.INCOMPLETE ||
- valueEval.getValue(point) == IntegralValue.UNKNOWN)) {
+ valueEval.getValue() == IntegralValue.UNKNOWN)) {
return null;
}
return valueEval;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
index 07476efcbbe..63d40248ec5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecDeclarator.java
@@ -13,8 +13,8 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IArrayType;
+import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -60,7 +60,7 @@ public final class ExecDeclarator implements ICPPExecution {
return declaredBinding;
}
- private static ICPPEvaluation maybeUnwrapInitList(ICPPEvaluation eval, IType targetType, IASTNode point) {
+ private static ICPPEvaluation maybeUnwrapInitList(ICPPEvaluation eval, IType targetType) {
// Only 1-element initializer lists are eligible for unwrapping.
if (!(eval instanceof EvalInitList))
return eval;
@@ -78,7 +78,7 @@ public final class ExecDeclarator implements ICPPExecution {
// element matches the class type, indicating that we're calling the
// implicit copy constructor (as opposed to doing memberwise initialization).
ICPPEvaluation clause = clauses[0];
- if (targetType instanceof ICPPClassType && !clause.getType(point).isSameType(targetType))
+ if (targetType instanceof ICPPClassType && !clause.getType().isSameType(targetType))
return eval;
// Otherwise unwrap.
@@ -88,7 +88,7 @@ public final class ExecDeclarator implements ICPPExecution {
private ICPPEvaluation createInitialValue(IType type, ActivationRecord record,
ConstexprEvaluationContext context) {
if (initializerEval == null)
- return createDefaultInitializedCompositeValue(type, context.getPoint());
+ return createDefaultInitializedCompositeValue(type);
IType nestedType = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
@@ -96,7 +96,7 @@ public final class ExecDeclarator implements ICPPExecution {
initializerEval.computeForFunctionCall(record, context.recordStep());
// In some contexts, unwrap 1-element initializer lists.
- computedInitializerEval = maybeUnwrapInitList(computedInitializerEval, nestedType, context.getPoint());
+ computedInitializerEval = maybeUnwrapInitList(computedInitializerEval, nestedType);
if (type instanceof ICPPReferenceType)
return createReferenceValue(record, context, computedInitializerEval);
@@ -107,8 +107,8 @@ public final class ExecDeclarator implements ICPPExecution {
if (nestedType instanceof IArrayType && !isCStringType(nestedType)) {
if (computedInitializerEval instanceof EvalInitList) {
IValue value = CompositeValue.create((EvalInitList) computedInitializerEval,
- (IArrayType) nestedType, context.getPoint());
- return new EvalFixed(type, computedInitializerEval.getValueCategory(context.getPoint()), value);
+ (IArrayType) nestedType);
+ return new EvalFixed(type, computedInitializerEval.getValueCategory(), value);
}
// TODO(sprigogin): Should something else be done here?
return EvalFixed.INCOMPLETE;
@@ -116,23 +116,23 @@ public final class ExecDeclarator implements ICPPExecution {
if (isValueInitialization(computedInitializerEval)) {
ICPPEvaluation defaultValue =
- new EvalTypeId(type, context.getPoint(), false, ICPPEvaluation.EMPTY_ARRAY);
- return new EvalFixed(type, defaultValue.getValueCategory(context.getPoint()),
- defaultValue.getValue(context.getPoint()));
+ new EvalTypeId(type, computedInitializerEval.getTemplateDefinition(), false, false,
+ ICPPEvaluation.EMPTY_ARRAY);
+ return new EvalFixed(type, defaultValue.getValueCategory(), defaultValue.getValue());
}
- return new EvalFixed(type, computedInitializerEval.getValueCategory(context.getPoint()),
- computedInitializerEval.getValue(context.getPoint()));
+ return new EvalFixed(type, computedInitializerEval.getValueCategory(),
+ computedInitializerEval.getValue());
}
- private static ICPPEvaluation createDefaultInitializedCompositeValue(IType type, IASTNode point) {
+ private static ICPPEvaluation createDefaultInitializedCompositeValue(IType type) {
if (!(type instanceof ICPPClassType)) {
return EvalFixed.INCOMPLETE;
}
ICPPClassType classType = (ICPPClassType) type;
// TODO(nathanridge): CompositeValue.create() only consider default member initializers, not
// constructors. Should we be considering constructors here as well?
- IValue compositeValue = CompositeValue.create(classType, point);
+ IValue compositeValue = CompositeValue.create(classType);
EvalFixed initialValue = new EvalFixed(type, ValueCategory.PRVALUE, compositeValue);
return initialValue;
}
@@ -143,24 +143,26 @@ public final class ExecDeclarator implements ICPPExecution {
if (initValue instanceof EvalInitList) {
initValue = ((EvalInitList) initValue).getClauses()[0];
} else if (!(initValue instanceof EvalBinding)) {
- initValue = initializerEval.getValue(context.getPoint()).getSubValue(0);
+ initValue = initializerEval.getValue().getSubValue(0);
}
+ IBinding templateDefinition = initializerEval.getTemplateDefinition();
if (initValue instanceof EvalBinding)
- return createReferenceFromBinding(record, context, (EvalBinding) initValue);
+ return createReferenceFromBinding(record, templateDefinition, (EvalBinding) initValue);
if (initValue instanceof EvalBinary && computedInitializerEval instanceof EvalCompositeAccess)
- return createReferenceFromCompositeAccess(record, context, (EvalCompositeAccess) computedInitializerEval);
+ return createReferenceFromCompositeAccess(record, templateDefinition,
+ (EvalCompositeAccess) computedInitializerEval);
return EvalFixed.INCOMPLETE;
}
private ICPPEvaluation createPointerValue(ActivationRecord record, ConstexprEvaluationContext context,
ICPPEvaluation computedInitializerEval) {
- ICPPEvaluation initValue = initializerEval.getValue(context.getPoint()).getSubValue(0);
- if (isPointerToArray(initValue, context)) {
+ ICPPEvaluation initValue = initializerEval.getValue().getSubValue(0);
+ if (isPointerToArray(initValue)) {
EvalCompositeAccess arrayPointer = new EvalCompositeAccess(computedInitializerEval, 0);
- return createPointerFromCompositeAccess(record, context, arrayPointer);
+ return createPointerFromCompositeAccess(record, initializerEval.getTemplateDefinition(), arrayPointer);
}
if (computedInitializerEval instanceof EvalPointer)
@@ -178,23 +180,23 @@ public final class ExecDeclarator implements ICPPExecution {
return false;
}
- private static boolean isPointerToArray(ICPPEvaluation eval, ConstexprEvaluationContext context) {
- return eval.getType(context.getPoint()) instanceof IArrayType;
+ private static boolean isPointerToArray(ICPPEvaluation eval) {
+ return eval.getType() instanceof IArrayType;
}
private static ICPPEvaluation createReferenceFromBinding(ActivationRecord record,
- ConstexprEvaluationContext context, EvalBinding evalBinding) {
- return new EvalReference(record, evalBinding.getBinding(), context.getPoint());
+ IBinding templateDefinition, EvalBinding evalBinding) {
+ return new EvalReference(record, evalBinding.getBinding(), templateDefinition);
}
private static ICPPEvaluation createReferenceFromCompositeAccess(ActivationRecord record,
- ConstexprEvaluationContext context, EvalCompositeAccess evalCompAccess) {
- return new EvalReference(record, evalCompAccess, context.getPoint());
+ IBinding templateDefinition, EvalCompositeAccess evalCompAccess) {
+ return new EvalReference(record, evalCompAccess, templateDefinition);
}
private static ICPPEvaluation createPointerFromCompositeAccess(ActivationRecord record,
- ConstexprEvaluationContext context, EvalCompositeAccess evalCompAccess) {
- return new EvalPointer(record, evalCompAccess, context.getPoint());
+ IBinding templateDefinition, EvalCompositeAccess evalCompAccess) {
+ return new EvalPointer(record, evalCompAccess, templateDefinition);
}
private static boolean isCStringType(IType type) {
@@ -221,7 +223,7 @@ public final class ExecDeclarator implements ICPPExecution {
newDeclaredBinding = CPPTemplates.createVariableSpecialization(context, declaredVariable);
} else {
newDeclaredBinding = (ICPPBinding) CPPTemplates.createSpecialization(
- context.getContextSpecialization(), declaredBinding, context.getPoint());
+ context.getContextSpecialization(), declaredBinding);
}
ICPPEvaluation newInitializerEval =
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecRangeBasedFor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecRangeBasedFor.java
index a0366f69944..863fd7b218b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecRangeBasedFor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecRangeBasedFor.java
@@ -14,9 +14,9 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType;
+import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
@@ -47,9 +47,9 @@ public class ExecRangeBasedFor implements ICPPExecution {
}
private ICPPExecution loopOverArray(IVariable rangeVar, ICPPEvaluation valueRange, ActivationRecord record, ConstexprEvaluationContext context) {
- ICPPEvaluation[] range = valueRange.getValue(context.getPoint()).getAllSubValues();
+ ICPPEvaluation[] range = valueRange.getValue().getAllSubValues();
for (int i = 0; i < range.length; i++) {
- ICPPEvaluation value = new EvalFixed(range[i].getType(context.getPoint()), range[i].getValueCategory(context.getPoint()), range[i].getValue(context.getPoint()));
+ ICPPEvaluation value = new EvalFixed(range[i].getType(), range[i].getValueCategory(), range[i].getValue());
if (rangeVar.getType() instanceof ICPPReferenceType) {
value = new EvalReference(record, new EvalCompositeAccess(valueRange, i), value.getTemplateDefinition());
}
@@ -72,8 +72,8 @@ public class ExecRangeBasedFor implements ICPPExecution {
ICPPEvaluation beginEval = callFunction(classType, begin, rangeEval, record, context);
ICPPEvaluation endEval = callFunction(classType, end, rangeEval, record, context);
boolean isRef = rangeVar.getType() instanceof ICPPReferenceType;
-
- for (; !isEqual(beginEval, endEval, context.getPoint()); beginEval = inc(record, beginEval, context)) {
+
+ for (; !isEqual(beginEval, endEval); beginEval = inc(record, beginEval, context)) {
record.update(rangeVar, deref(beginEval, isRef, record, context));
ICPPExecution result = EvalUtil.executeStatement(bodyExec, record, context);
@@ -90,36 +90,41 @@ public class ExecRangeBasedFor implements ICPPExecution {
return ExecIncomplete.INSTANCE;
}
- private static boolean isEqual(ICPPEvaluation a, ICPPEvaluation b, IASTNode point) {
- Number result = new EvalBinary(IASTBinaryExpression.op_equals, a, b, point).getValue(point).numberValue();
+ private static boolean isEqual(ICPPEvaluation a, ICPPEvaluation b) {
+ Number result = new EvalBinary(IASTBinaryExpression.op_equals, a, b, a.getTemplateDefinition()).getValue().numberValue();
return result != null && result.longValue() != 0;
}
- private static ICPPEvaluation deref(ICPPEvaluation ptr, boolean isRef, ActivationRecord record, ConstexprEvaluationContext context) {
- ICPPEvaluation derefEval = new EvalUnary(ICPPASTUnaryExpression.op_star, ptr, null, context.getPoint()).computeForFunctionCall(record, context);
+ private static ICPPEvaluation deref(ICPPEvaluation ptr, boolean isRef, ActivationRecord record,
+ ConstexprEvaluationContext context) {
+ ICPPEvaluation derefEval = new EvalUnary(ICPPASTUnaryExpression.op_star, ptr, null,
+ ptr.getTemplateDefinition()).computeForFunctionCall(record, context);
if (isRef) {
return derefEval;
} else {
- return new EvalFixed(derefEval.getType(context.getPoint()), derefEval.getValueCategory(context.getPoint()), derefEval.getValue(context.getPoint()));
+ return new EvalFixed(derefEval.getType(), derefEval.getValueCategory(), derefEval.getValue());
}
}
private static ICPPEvaluation inc(ActivationRecord record, ICPPEvaluation ptr,
ConstexprEvaluationContext context) {
- return new EvalUnary(IASTUnaryExpression.op_prefixIncr, ptr, null, context.getPoint())
+ return new EvalUnary(IASTUnaryExpression.op_prefixIncr, ptr, null, ptr.getTemplateDefinition())
.computeForFunctionCall(record, context);
}
- private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func, ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) {
+ private static ICPPEvaluation callFunction(ICPPClassType classType, ICPPFunction func,
+ ICPPEvaluation rangeEval, ActivationRecord record, ConstexprEvaluationContext context) {
EvalFunctionCall call = null;
+ IBinding templateDefinition = rangeEval.getTemplateDefinition();
if (func instanceof ICPPMethod) {
- EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func, rangeEval, false, context.getPoint());
+ EvalMemberAccess memberAccess = new EvalMemberAccess(classType, ValueCategory.LVALUE, func,
+ rangeEval, false, templateDefinition);
ICPPEvaluation[] args = new ICPPEvaluation[]{ memberAccess };
- call = new EvalFunctionCall(args, rangeEval, context.getPoint());
+ call = new EvalFunctionCall(args, rangeEval, templateDefinition);
} else {
- EvalBinding op = new EvalBinding(func, func.getType(), context.getPoint());
+ EvalBinding op = new EvalBinding(func, func.getType(), templateDefinition);
ICPPEvaluation[] args = new ICPPEvaluation[]{ op, rangeEval};
- call = new EvalFunctionCall(args, null, context.getPoint());
+ call = new EvalFunctionCall(args, null, templateDefinition);
}
return call.computeForFunctionCall(record, context);
}
@@ -137,8 +142,8 @@ public class ExecRangeBasedFor implements ICPPExecution {
return ExecIncomplete.INSTANCE;
}
- boolean rangeIsConst = SemanticUtil.isConst(initClauseEval.getType(context.getPoint()));
- IType type = SemanticUtil.getNestedType(valueRange.getType(context.getPoint()), ALLCVQ | TDEF | REF);
+ boolean rangeIsConst = SemanticUtil.isConst(initClauseEval.getType());
+ IType type = SemanticUtil.getNestedType(valueRange.getType(), ALLCVQ | TDEF | REF);
if (type instanceof IArrayType || type instanceof InitializerListType) {
return loopOverArray(rangeVar, valueRange, record, context);
} else if (type instanceof ICPPClassType) {
@@ -163,9 +168,9 @@ public class ExecRangeBasedFor implements ICPPExecution {
// described in the standard (by constructing the corresponding executions and evaluations),
// and the above instantiations will fall out of that automatically.
ICPPFunction newBegin = begin != null ? (ICPPFunction)CPPTemplates.createSpecialization(
- context.getContextSpecialization(), begin, context.getPoint()) : null;
+ context.getContextSpecialization(), begin) : null;
ICPPFunction newEnd = end != null ? (ICPPFunction)CPPTemplates.createSpecialization(
- context.getContextSpecialization(), end, context.getPoint()) : null;
+ context.getContextSpecialization(), end) : null;
ICPPExecution newBodyExec = bodyExec.instantiate(context, maxDepth);
if (newDeclarationExec == declarationExec &&
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecSwitch.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecSwitch.java
index 9493f156e5d..29fde99e858 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecSwitch.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/ExecSwitch.java
@@ -63,7 +63,7 @@ public class ExecSwitch implements ICPPExecution {
if (stmtExec instanceof ExecCase) {
ExecCase caseStmtExec = (ExecCase) stmtExec;
caseStmtExec = (ExecCase) caseStmtExec.executeForFunctionCall(record, context);
- Number caseVal = caseStmtExec.getCaseExpressionEvaluation().getValue(context.getPoint()).numberValue();
+ Number caseVal = caseStmtExec.getCaseExpressionEvaluation().getValue().numberValue();
Number controllerVal = controllerValue.numberValue();
return caseVal != null && controllerVal != null && caseVal.equals(controllerVal);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionCost.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionCost.java
index 53bd9d323a8..25d969bf22b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionCost.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionCost.java
@@ -21,7 +21,6 @@ import java.util.Arrays;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
@@ -43,21 +42,18 @@ class FunctionCost {
private final ICPPFunction fFunction;
private final Cost[] fCosts;
private final ValueCategory[] fValueCategories;
- private final IASTNode fPoint;
private boolean fIsDirectCopyCtor;
- public FunctionCost(ICPPFunction fn, int paramCount, IASTNode point) {
+ public FunctionCost(ICPPFunction fn, int paramCount) {
fFunction= fn;
fCosts= new Cost[paramCount];
fValueCategories= new ValueCategory[paramCount];
- fPoint = point;
}
- public FunctionCost(ICPPFunction fn, Cost cost, IASTNode point) {
+ public FunctionCost(ICPPFunction fn, Cost cost) {
fFunction= fn;
fCosts= new Cost[] {cost};
fValueCategories= null; // no udc will be performed
- fPoint = point;
}
public int getLength() {
@@ -95,7 +91,7 @@ class FunctionCost {
return false;
}
- public boolean performUDC(IASTNode point) throws DOMException {
+ public boolean performUDC() throws DOMException {
for (int i = 0; i < fCosts.length; i++) {
Cost cost = fCosts[i];
Cost udcCost= null;
@@ -104,20 +100,20 @@ class FunctionCost {
continue;
case COPY_INIT_OF_CLASS:
udcCost = Conversions.copyInitializationOfClass(fValueCategories[i], cost.source,
- (ICPPClassType) cost.target, false, point);
+ (ICPPClassType) cost.target, false);
break;
case INIT_BY_CONVERSION:
IType uqSource= getNestedType(cost.source, TDEF | REF | CVTYPE);
udcCost = Conversions.initializationByConversion(fValueCategories[i], cost.source,
- (ICPPClassType) uqSource, cost.target, false, point, allowsContextualBooleanConversion());
+ (ICPPClassType) uqSource, cost.target, false, allowsContextualBooleanConversion());
break;
case LIST_INIT_OF_CLASS:
udcCost = Conversions.listInitializationOfClass(((InitializerListType) cost.source).getEvaluation(),
- (ICPPClassType) cost.target, false, false, point);
+ (ICPPClassType) cost.target, false, false);
break;
case DIRECT_LIST_INIT_OF_CLASS:
udcCost = Conversions.listInitializationOfClass(((InitializerListType) cost.source).getEvaluation(),
- (ICPPClassType) cost.target, true, false, point);
+ (ICPPClassType) cost.target, true, false);
break;
default:
return false;
@@ -181,7 +177,7 @@ class FunctionCost {
haveBetter = true;
} else if (isTemplate && otherIsTemplate) {
TypeSelection ts= SemanticUtil.isConversionOperator(f1) ? RETURN_TYPE : PARAMETERS;
- int order = CPPTemplates.orderFunctionTemplates(otherAsTemplate, asTemplate, ts, fPoint);
+ int order = CPPTemplates.orderFunctionTemplates(otherAsTemplate, asTemplate, ts);
if (order < 0) {
haveBetter= true;
} else if (order > 0) {
@@ -227,10 +223,10 @@ class FunctionCost {
if (!parameterTypesMatch(ft1, ft2))
return 0;
- int diff= SemanticUtil.calculateInheritanceDepth(o2, o1, fPoint);
+ int diff= SemanticUtil.calculateInheritanceDepth(o2, o1);
if (diff >= 0)
return diff;
- return -SemanticUtil.calculateInheritanceDepth(o1, o2, fPoint);
+ return -SemanticUtil.calculateInheritanceDepth(o1, o2);
}
private boolean parameterTypesMatch(final ICPPFunctionType ft1, final ICPPFunctionType ft2) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionSetType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionSetType.java
index afe9b11e4f5..a4492712e8e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionSetType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/FunctionSetType.java
@@ -14,7 +14,6 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -47,8 +46,8 @@ public class FunctionSetType implements IType {
return fPointerType ? PRVALUE : LVALUE;
}
- public Cost costForTarget(IType paramType, IASTNode point) {
- IBinding result = CPPSemantics.resolveTargetedFunction(paramType, fFunctionSet, point);
+ public Cost costForTarget(IType paramType) {
+ IBinding result = CPPSemantics.resolveTargetedFunction(paramType, fFunctionSet);
if (result instanceof ICPPFunction && !(result instanceof IProblemBinding)) {
Cost c= new Cost(paramType, paramType, Rank.IDENTITY);
c.setSelectedFunction((ICPPFunction) result);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/HeuristicResolver.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/HeuristicResolver.java
index e8d1e76f228..b5d48fcfbb2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/HeuristicResolver.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/HeuristicResolver.java
@@ -106,12 +106,10 @@ public class HeuristicResolver {
/**
* Given a dependent type, heuristically tries to find a concrete scope (i.e. not an unknown scope)
* for it.
- *
- * @param point the point of instantiation for name lookups
*/
- public static IScope findConcreteScopeForType(IType type, IASTNode point) {
+ public static IScope findConcreteScopeForType(IType type) {
if (type instanceof ICPPUnknownType) {
- type = resolveUnknownType((ICPPUnknownType) type, point, SemanticUtil.TDEF | SemanticUtil.REF | SemanticUtil.CVTYPE);
+ type = resolveUnknownType((ICPPUnknownType) type, SemanticUtil.TDEF | SemanticUtil.REF | SemanticUtil.CVTYPE);
}
type = SemanticUtil.getNestedType(type, SemanticUtil.PTR);
if (type instanceof ICompositeType) {
@@ -125,14 +123,11 @@ public class HeuristicResolver {
/**
* Helper function for lookInside().
* Specializes the given bindings in the given context.
- *
- * @param point the point of instantiation for name lookups
*/
- private static IBinding[] specializeBindings(IBinding[] bindings, ICPPClassSpecialization context,
- IASTNode point) {
+ private static IBinding[] specializeBindings(IBinding[] bindings, ICPPClassSpecialization context) {
IBinding[] result = new IBinding[bindings.length];
for (int i = 0; i < bindings.length; ++i) {
- result[i] = context.specializeMember(bindings[i], point);
+ result[i] = context.specializeMember(bindings[i]);
}
return result;
}
@@ -144,8 +139,8 @@ public class HeuristicResolver {
private static class CPPDependentClassInstance extends CPPDeferredClassInstance
implements ICPPClassSpecialization {
- public CPPDependentClassInstance(ICPPDeferredClassInstance deferredInstance, IASTNode point) {
- super(chooseTemplateForDeferredInstance(deferredInstance, point),
+ public CPPDependentClassInstance(ICPPDeferredClassInstance deferredInstance) {
+ super(chooseTemplateForDeferredInstance(deferredInstance),
deferredInstance.getTemplateArguments());
}
@@ -154,16 +149,17 @@ public class HeuristicResolver {
return (ICPPClassType) super.getSpecializedBinding();
}
- // This overload of specializeMember() is all we're interested in.
- // Everything else is unsupported.
@Override
+ @Deprecated
public IBinding specializeMember(IBinding binding, IASTNode point) {
- return CPPTemplates.createSpecialization(this, binding, point);
+ return specializeMember(binding);
}
+ // This overload of specializeMember() is all we're interested in.
+ // Everything else is unsupported.
@Override
public IBinding specializeMember(IBinding binding) {
- throw new UnsupportedOperationException();
+ return CPPTemplates.createSpecialization(this, binding);
}
@Override
@@ -264,7 +260,7 @@ public class HeuristicResolver {
* @return results of the name lookup
*/
private static IBinding[] lookInside(IType ownerType, boolean isPointerDeref, char[] name,
- ICPPTemplateArgument[] templateArgs, Set<HeuristicLookup> lookupSet, IASTNode point) {
+ ICPPTemplateArgument[] templateArgs, Set<HeuristicLookup> lookupSet) {
// If this is a pointer dereference, the pointer type might be outside of the dependent type.
ownerType = SemanticUtil.getSimplifiedType(ownerType);
if (isPointerDeref && ownerType instanceof IPointerType) {
@@ -289,11 +285,11 @@ public class HeuristicResolver {
break;
} else if (lookupType instanceof ICPPDeferredClassInstance) {
specializationContext = new CPPDependentClassInstance(
- (ICPPDeferredClassInstance) lookupType, point);
+ (ICPPDeferredClassInstance) lookupType);
lookupType = specializationContext.getSpecializedBinding();
break;
}
- IType resolvedType = resolveUnknownTypeOnce((ICPPUnknownType) lookupType, lookupSet, point);
+ IType resolvedType = resolveUnknownTypeOnce((ICPPUnknownType) lookupType, lookupSet);
resolvedType = SemanticUtil.getNestedType(resolvedType,
SemanticUtil.TDEF | SemanticUtil.REF | SemanticUtil.CVTYPE);
@@ -332,14 +328,14 @@ public class HeuristicResolver {
if (lookupScope != null) {
HeuristicLookup entry = new HeuristicLookup(lookupScope, name);
if (lookupSet.add(entry)) {
- LookupData lookup = new LookupData(name, templateArgs, point);
+ LookupData lookup = new LookupData(name, templateArgs, CPPSemantics.getCurrentLookupPoint());
lookup.fHeuristicBaseLookup = true;
try {
CPPSemantics.lookup(lookup, lookupScope);
IBinding[] foundBindings = lookup.getFoundBindings();
if (foundBindings.length > 0) {
if (specializationContext != null) {
- foundBindings = specializeBindings(foundBindings, specializationContext, point);
+ foundBindings = specializeBindings(foundBindings, specializationContext);
}
return foundBindings;
}
@@ -378,11 +374,9 @@ public class HeuristicResolver {
* a concrete type is found, or the resolution of the last resolution
* round is the same as the result of the previous resolution round.
* In between each round, typedefs are unwrapped.
- *
- * @param point the point of instantiation for lookups
*/
- public static IType resolveUnknownType(ICPPUnknownType type, IASTNode point) {
- return resolveUnknownType(type, point, SemanticUtil.TDEF | SemanticUtil.CVTYPE);
+ public static IType resolveUnknownType(ICPPUnknownType type) {
+ return resolveUnknownType(type, SemanticUtil.TDEF | SemanticUtil.CVTYPE);
}
/**
@@ -390,10 +384,10 @@ public class HeuristicResolver {
* things other than typedefs to unwrap between rounds of resolution
* (e.g. references).
*/
- private static IType resolveUnknownType(ICPPUnknownType type, IASTNode point, int unwrapOptions) {
+ private static IType resolveUnknownType(ICPPUnknownType type, int unwrapOptions) {
while (true) {
Set<HeuristicLookup> lookupSet = new HashSet<>();
- IType resolvedType = resolveUnknownTypeOnce(type, lookupSet, point);
+ IType resolvedType = resolveUnknownTypeOnce(type, lookupSet);
resolvedType = SemanticUtil.getNestedType(resolvedType, unwrapOptions);
if (resolvedType != type && resolvedType instanceof ICPPUnknownType) {
@@ -408,13 +402,12 @@ public class HeuristicResolver {
* Heuristically choose between the primary template and any partial specializations
* for a deferred template instance.
*/
- private static ICPPClassTemplate chooseTemplateForDeferredInstance(ICPPDeferredClassInstance instance,
- IASTNode point) {
+ private static ICPPClassTemplate chooseTemplateForDeferredInstance(ICPPDeferredClassInstance instance) {
ICPPClassTemplate template = instance.getClassTemplate();
if (!instance.isExplicitSpecialization()) {
try {
- IBinding partial = CPPTemplates.selectSpecialization(template,
- instance.getTemplateArguments(), false, point);
+ IBinding partial = CPPTemplates.selectSpecialization(template,
+ instance.getTemplateArguments(), false);
if (partial != null && partial instanceof ICPPTemplateInstance)
return (ICPPClassTemplate) ((ICPPTemplateInstance) partial).getTemplateDefinition();
} catch (DOMException e) {
@@ -423,16 +416,15 @@ public class HeuristicResolver {
return template;
}
- private static IType resolveEvalType(ICPPEvaluation evaluation, Set<HeuristicLookup> lookupSet,
- IASTNode point) {
+ private static IType resolveEvalType(ICPPEvaluation evaluation, Set<HeuristicLookup> lookupSet) {
if (evaluation instanceof EvalUnary) {
EvalUnary unary = (EvalUnary) evaluation;
// Handle the common case of a dependent type representing the
// result of dereferencing another dependent type.
if (unary.getOperator() == IASTUnaryExpression.op_star) {
- IType argument = unary.getArgument().getType(point);
+ IType argument = unary.getArgument().getType();
if (argument instanceof ICPPUnknownType) {
- IType resolved = resolveUnknownType((ICPPUnknownType) argument, point);
+ IType resolved = resolveUnknownType((ICPPUnknownType) argument);
if (resolved instanceof IPointerType) {
return ((IPointerType) resolved).getType();
}
@@ -442,9 +434,9 @@ public class HeuristicResolver {
EvalID id = (EvalID) evaluation;
ICPPEvaluation fieldOwner = id.getFieldOwner();
if (fieldOwner != null) {
- IType fieldOwnerType = fieldOwner.getType(point);
+ IType fieldOwnerType = fieldOwner.getType();
IBinding[] candidates = lookInside(fieldOwnerType, id.isPointerDeref(), id.getName(),
- id.getTemplateArgs(), lookupSet, point);
+ id.getTemplateArgs(), lookupSet);
if (candidates.length > 0) {
// If there is more than one candidate, for now just
// choose the first one. A better thing to do would
@@ -455,9 +447,9 @@ public class HeuristicResolver {
} else if (evaluation instanceof EvalFunctionCall) {
EvalFunctionCall evalFunctionCall = (EvalFunctionCall) evaluation;
ICPPEvaluation function = evalFunctionCall.getArguments()[0];
- IType functionType = function.getType(point);
+ IType functionType = function.getType();
if (functionType instanceof ICPPUnknownType) {
- functionType = resolveUnknownType((ICPPUnknownType) functionType, point);
+ functionType = resolveUnknownType((ICPPUnknownType) functionType);
}
return ExpressionTypes.typeFromFunctionCall(functionType);
} else if (evaluation instanceof EvalMemberAccess) {
@@ -473,7 +465,7 @@ public class HeuristicResolver {
}
return result;
} else if (evaluation instanceof EvalBinding) {
- return evaluation.getType(point);
+ return evaluation.getType();
}
// TODO(nathanridge): Handle more cases.
return null;
@@ -482,29 +474,27 @@ public class HeuristicResolver {
/**
* Helper function for {@link #resolveUnknownType} which does one round of resolution.
*/
- private static IType resolveUnknownTypeOnce(ICPPUnknownType type, Set<HeuristicLookup> lookupSet,
- IASTNode point) {
+ private static IType resolveUnknownTypeOnce(ICPPUnknownType type, Set<HeuristicLookup> lookupSet) {
if (type instanceof ICPPDeferredClassInstance) {
ICPPDeferredClassInstance deferredInstance = (ICPPDeferredClassInstance) type;
- return chooseTemplateForDeferredInstance(deferredInstance, point);
+ return chooseTemplateForDeferredInstance(deferredInstance);
} else if (type instanceof TypeOfDependentExpression) {
ICPPEvaluation evaluation = ((TypeOfDependentExpression) type).getEvaluation();
- return resolveEvalType(evaluation, lookupSet, point);
+ return resolveEvalType(evaluation, lookupSet);
} else if (type instanceof ICPPUnknownMemberClass) {
ICPPUnknownMemberClass member = (ICPPUnknownMemberClass) type;
IType ownerType = member.getOwnerType();
- IBinding[] candidates = lookInside(ownerType, false, member.getNameCharArray(), null,
- lookupSet, point);
+ IBinding[] candidates = lookInside(ownerType, false, member.getNameCharArray(), null, lookupSet);
if (candidates.length == 1) {
if (candidates[0] instanceof IType) {
IType result = (IType) candidates[0];
if (type instanceof ICPPUnknownMemberClassInstance) {
ICPPTemplateArgument[] args = ((ICPPUnknownMemberClassInstance) type).getArguments();
if (result instanceof ICPPClassTemplate) {
- result = (IType) CPPTemplates.instantiate((ICPPClassTemplate) result, args, point);
+ result = (IType) CPPTemplates.instantiate((ICPPClassTemplate) result, args);
} else if (result instanceof ICPPAliasTemplate) {
result = (IType) CPPTemplates.instantiateAliasTemplate((ICPPAliasTemplate) result,
- args, point);
+ args);
}
}
return result;
@@ -519,18 +509,16 @@ public class HeuristicResolver {
* corresponding to it.
*
* Returns an empty array if no heuristic resolution could be performed.
-
- * @param point the point of instantiation for lookups
*/
- public static IBinding[] resolveUnknownBinding(ICPPUnknownBinding binding, IASTNode point) {
+ public static IBinding[] resolveUnknownBinding(ICPPUnknownBinding binding) {
if (binding instanceof ICPPDeferredClassInstance) {
return new IBinding[] { ((ICPPDeferredClassInstance) binding).getClassTemplate() };
} else if (binding instanceof ICPPUnknownMember) {
Set<HeuristicLookup> lookupSet = new HashSet<>();
return lookInside(((ICPPUnknownMember) binding).getOwnerType(), false,
- binding.getNameCharArray(), null, lookupSet, point);
+ binding.getNameCharArray(), null, lookupSet);
} else if (binding instanceof ICPPUnknownType) {
- IType resolved = resolveUnknownType((ICPPUnknownType) binding, point);
+ IType resolved = resolveUnknownType((ICPPUnknownType) binding);
if (resolved != binding && resolved instanceof IBinding) {
return new IBinding[] { (IBinding) resolved };
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
index 8f20cd4ed5a..71de0eea8d9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
@@ -539,7 +539,7 @@ public class LookupData extends ScopeLookupData {
functionArgTypes= new IType[functionArgs.length];
for (int i = 0; i < functionArgs.length; i++) {
ICPPEvaluation e = functionArgs[i];
- functionArgTypes[i]= getSimplifiedType(e.getType(getLookupPoint()));
+ functionArgTypes[i]= getSimplifiedType(e.getType());
}
}
return functionArgTypes;
@@ -552,7 +552,7 @@ public class LookupData extends ScopeLookupData {
functionArgValueCategories= new ValueCategory[args.length];
for (int i = 0; i < args.length; i++) {
final ICPPEvaluation arg = args[i];
- functionArgValueCategories[i] = arg.getValueCategory(getLookupPoint());
+ functionArgValueCategories[i] = arg.getValueCategory();
}
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
index 7cdbb6819ac..69be5b54483 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/SemanticUtil.java
@@ -122,7 +122,7 @@ public class SemanticUtil {
* @param clazz
* @return an array of conversion operators.
*/
- public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz, IASTNode point) throws DOMException {
+ public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz) throws DOMException {
ICPPMethod[] conversionOps= ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
if (clazz instanceof ICPPDeferredClassInstance) {
clazz= (ICPPClassType) ((ICPPDeferredClassInstance) clazz).getTemplateDefinition();
@@ -134,9 +134,9 @@ public class SemanticUtil {
// A new API ICPPClosureType.getNoninheritedMethods() might be more
// appropriate here.
if (clazz instanceof CPPClosureType) {
- methods = ClassTypeHelper.getMethods(clazz, point);
+ methods = ClassTypeHelper.getMethods(clazz);
} else {
- methods = ClassTypeHelper.getDeclaredMethods(clazz, point);
+ methods = clazz.getDeclaredMethods();
}
if (methods != null) {
for (ICPPMethod method : methods) {
@@ -156,11 +156,11 @@ public class SemanticUtil {
* @param clazz
* @return an array of conversion operators.
*/
- public static ICPPMethod[] getConversionOperators(ICPPClassType clazz, IASTNode point) throws DOMException {
+ public static ICPPMethod[] getConversionOperators(ICPPClassType clazz) throws DOMException {
ICPPMethod[] methods= ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
- ObjectSet<ICPPClassType> ancestry= inheritanceClosure(clazz, point);
+ ObjectSet<ICPPClassType> ancestry= inheritanceClosure(clazz);
for (int i = 0; i < ancestry.size(); i++) {
- methods= ArrayUtil.addAll(methods, getDeclaredConversionOperators(ancestry.keyAt(i), point));
+ methods= ArrayUtil.addAll(methods, getDeclaredConversionOperators(ancestry.keyAt(i)));
}
return methods;
}
@@ -170,7 +170,7 @@ public class SemanticUtil {
* @return the root and all its ancestor classes
* @throws DOMException
*/
- public static ObjectSet<ICPPClassType> inheritanceClosure(ICPPClassType root, IASTNode point) throws DOMException {
+ public static ObjectSet<ICPPClassType> inheritanceClosure(ICPPClassType root) throws DOMException {
ObjectSet<ICPPClassType> done= new ObjectSet<>(2);
ObjectSet<ICPPClassType> current= new ObjectSet<>(2);
current.put(root);
@@ -182,7 +182,7 @@ public class SemanticUtil {
ICPPClassType clazz= current.keyAt(i);
done.put(clazz);
- for (ICPPBase base : ClassTypeHelper.getBases(clazz, point)) {
+ for (ICPPBase base : clazz.getBases()) {
IBinding binding= base.getBaseClass();
if (binding instanceof ICPPClassType && !(binding instanceof IProblemBinding)) {
ICPPClassType ct= (ICPPClassType) binding;
@@ -499,18 +499,19 @@ public class SemanticUtil {
}
}
- public static IType mapToAST(IType type, IASTNode point) {
+ public static IType mapToAST(IType type) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (point != null && type instanceof IIndexBinding && type instanceof ICPPClassType) {
IASTTranslationUnit ast = point.getTranslationUnit();
if (ast instanceof CPPASTTranslationUnit) {
- return ((CPPASTTranslationUnit) ast).mapToAST((ICPPClassType) type, point);
+ return ((CPPASTTranslationUnit) ast).mapToAST((ICPPClassType) type);
}
}
return type;
}
- public static ICPPTemplateArgument[] mapToAST(ICPPTemplateArgument[] args, IASTNode point) {
- if (point == null)
+ public static ICPPTemplateArgument[] mapToAST(ICPPTemplateArgument[] args) {
+ if (CPPSemantics.getCurrentLookupPoint() == null)
return args;
// Don't create a new array until it's really needed.
@@ -519,7 +520,7 @@ public class SemanticUtil {
final ICPPTemplateArgument arg = args[i];
ICPPTemplateArgument newArg = arg;
if (arg != null) {
- newArg = mapToAST(arg, point);
+ newArg = mapToAST(arg);
if (result != args) {
result[i] = newArg;
} else if (arg != newArg) {
@@ -534,12 +535,12 @@ public class SemanticUtil {
return result;
}
- public static ICPPTemplateArgument mapToAST(ICPPTemplateArgument arg, IASTNode point) {
+ public static ICPPTemplateArgument mapToAST(ICPPTemplateArgument arg) {
IType type = arg.getTypeValue();
if (type != null) {
- IType mappedType = mapToAST(type, point);
+ IType mappedType = mapToAST(type);
IType originalType = arg.getOriginalTypeValue();
- IType mappedOriginalType = originalType == type ? mappedType : mapToAST(originalType, point);
+ IType mappedOriginalType = originalType == type ? mappedType : mapToAST(originalType);
if (mappedType != type || mappedOriginalType != originalType) {
return new CPPTemplateTypeArgument(mappedType, mappedOriginalType);
}
@@ -573,7 +574,8 @@ public class SemanticUtil {
}
public static ICPPClassTemplatePartialSpecialization mapToAST(
- ICPPClassTemplatePartialSpecialization indexSpec, IASTNode point) {
+ ICPPClassTemplatePartialSpecialization indexSpec) {
+ IASTNode point = CPPSemantics.getCurrentLookupPoint();
if (point != null) {
IASTTranslationUnit ast = point.getTranslationUnit();
if (ast instanceof CPPASTTranslationUnit) {
@@ -762,11 +764,11 @@ public class SemanticUtil {
* @return the number of edges in the inheritance graph, or -1 if the specified classes have
* no inheritance relation
*/
- public static final int calculateInheritanceDepth(IType type, IType baseClass, IASTNode point) {
- return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<>(), type, baseClass, point);
+ public static final int calculateInheritanceDepth(IType type, IType baseClass) {
+ return calculateInheritanceDepth(CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<>(), type, baseClass);
}
- private static final int calculateInheritanceDepth(int maxdepth, Set<Object> hashSet, IType type, IType baseClass, IASTNode point) {
+ private static final int calculateInheritanceDepth(int maxdepth, Set<Object> hashSet, IType type, IType baseClass) {
if (type == baseClass || type.isSameType(baseClass)) {
return 0;
}
@@ -778,9 +780,9 @@ public class SemanticUtil {
}
// The base classes may have changed since the definition of clazz was indexed.
- clazz = (ICPPClassType) mapToAST(clazz, point);
+ clazz = (ICPPClassType) mapToAST(clazz);
- for (ICPPBase cppBase : ClassTypeHelper.getBases(clazz, point)) {
+ for (ICPPBase cppBase : clazz.getBases()) {
IBinding base= cppBase.getBaseClass();
if (base instanceof IType && hashSet.add(base)) {
IType tbase= (IType) base;
@@ -791,7 +793,7 @@ public class SemanticUtil {
}
if (tbase instanceof ICPPClassType) {
- int n= calculateInheritanceDepth(maxdepth - 1, hashSet, tbase, baseClass, point);
+ int n= calculateInheritanceDepth(maxdepth - 1, hashSet, tbase, baseClass);
if (n > 0)
return n + 1;
}
@@ -861,37 +863,42 @@ public class SemanticUtil {
*/
public static IValue getValueOfInitializer(IASTInitializer init, IType type) {
IASTInitializerClause clause= null;
- if (init instanceof IASTEqualsInitializer) {
- clause= ((IASTEqualsInitializer) init).getInitializerClause();
- } else if (init instanceof ICPPASTConstructorInitializer) {
- IASTInitializerClause[] args= ((ICPPASTConstructorInitializer) init).getArguments();
- if (args.length == 1 && args[0] instanceof IASTExpression) {
- IType typeUpToPointers= SemanticUtil.getUltimateTypeUptoPointers(type);
- if (typeUpToPointers instanceof IPointerType || typeUpToPointers instanceof IBasicType) {
- clause= args[0];
+ CPPSemantics.pushLookupPoint(init);
+ try {
+ if (init instanceof IASTEqualsInitializer) {
+ clause= ((IASTEqualsInitializer) init).getInitializerClause();
+ } else if (init instanceof ICPPASTConstructorInitializer) {
+ IASTInitializerClause[] args= ((ICPPASTConstructorInitializer) init).getArguments();
+ if (args.length == 1 && args[0] instanceof IASTExpression) {
+ IType typeUpToPointers= SemanticUtil.getUltimateTypeUptoPointers(type);
+ if (typeUpToPointers instanceof IPointerType || typeUpToPointers instanceof IBasicType) {
+ clause= args[0];
+ }
+ }
+ } else if (init instanceof ICPPASTInitializerList) {
+ ICPPASTInitializerList list= (ICPPASTInitializerList) init;
+ switch (list.getSize()) {
+ case 0:
+ return IntegralValue.create(0);
+ case 1:
+ clause= list.getClauses()[0];
+ break;
+ default:
+ return ((ICPPASTInitializerList) init).getEvaluation().getValue();
+
}
}
- } else if (init instanceof ICPPASTInitializerList) {
- ICPPASTInitializerList list= (ICPPASTInitializerList) init;
- switch (list.getSize()) {
- case 0:
- return IntegralValue.create(0);
- case 1:
- clause= list.getClauses()[0];
- break;
- default:
- return ((ICPPASTInitializerList) init).getEvaluation().getValue(init);
-
+ if (clause instanceof IASTExpression) {
+ return ValueFactory.create((IASTExpression) clause);
}
+
+ if (clause instanceof ICPPASTInitializerList) {
+ return ((ICPPASTInitializerList) clause).getEvaluation().getValue();
+ }
+ return IntegralValue.UNKNOWN;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- if (clause instanceof IASTExpression) {
- return ValueFactory.create((IASTExpression) clause);
- }
-
- if (clause instanceof ICPPASTInitializerList) {
- return ((ICPPASTInitializerList) clause).getEvaluation().getValue(clause);
- }
- return IntegralValue.UNKNOWN;
}
/**
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
index 11cbefdc4d7..7f9a1930721 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TemplateArgumentDeduction.java
@@ -30,7 +30,6 @@ import java.util.Set;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType;
@@ -68,7 +67,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateParameterMap;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeArgument;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownMember;
@@ -91,13 +89,13 @@ public class TemplateArgumentDeduction {
*/
static ICPPTemplateArgument[] deduceForFunctionCall(ICPPFunctionTemplate template,
ICPPTemplateArgument[] tmplArgs, List<IType> fnArgs, List<ValueCategory> argIsLValue,
- CPPTemplateParameterMap map, IASTNode point) throws DOMException {
+ CPPTemplateParameterMap map) throws DOMException {
final ICPPTemplateParameter[] tmplParams = template.getTemplateParameters();
- if (tmplArgs != null && !addExplicitArguments(template, tmplParams, tmplArgs, map, point))
+ if (tmplArgs != null && !addExplicitArguments(template, tmplParams, tmplArgs, map))
return null;
- if (!deduceFromFunctionArgs(template, fnArgs, argIsLValue, map, point))
+ if (!deduceFromFunctionArgs(template, fnArgs, argIsLValue, map))
return null;
return createArguments(map, tmplParams);
@@ -108,7 +106,7 @@ public class TemplateArgumentDeduction {
* returns <code>false</code> if there is no mapping.
*/
static boolean deduceFromFunctionArgs(ICPPFunctionTemplate template, List<IType> fnArgs,
- List<ValueCategory> argCats, CPPTemplateParameterMap map, IASTNode point) {
+ List<ValueCategory> argCats, CPPTemplateParameterMap map) {
try {
IType[] fnPars = template.getType().getParameterTypes();
final int fnParCount = fnPars.length;
@@ -134,7 +132,7 @@ public class TemplateArgumentDeduction {
break;
}
- par= CPPTemplates.instantiateType(par, new InstantiationContext(map, point));
+ par= CPPTemplates.instantiateType(par, new InstantiationContext(map));
if (!SemanticUtil.isValidType(par))
return false;
@@ -151,8 +149,8 @@ public class TemplateArgumentDeduction {
if (inner != null) {
final EvalInitList eval = ((InitializerListType) arg).getEvaluation();
for (ICPPEvaluation clause : eval.getClauses()) {
- if (!deduceFromFunctionArg(inner, clause.getType(point),
- clause.getValueCategory(point), deduct, point))
+ if (!deduceFromFunctionArg(inner, clause.getType(),
+ clause.getValueCategory(), deduct))
return false;
}
}
@@ -174,7 +172,7 @@ public class TemplateArgumentDeduction {
}
if (handled.add(ASTTypeUtil.getType(arg, true))) {
final CPPTemplateParameterMap state = deduct.saveState();
- if (deduceFromFunctionArg(par, arg, argCats.get(j), deduct, point)) {
+ if (deduceFromFunctionArg(par, arg, argCats.get(j), deduct)) {
if (success != null) {
deduct.restoreState(state);
continue argLoop; // Non-deduced context
@@ -188,7 +186,7 @@ public class TemplateArgumentDeduction {
return false;
deduct.restoreState(success);
} else {
- if (!deduceFromFunctionArg(par, arg, argCats.get(j), deduct, point))
+ if (!deduceFromFunctionArg(par, arg, argCats.get(j), deduct))
return false;
}
}
@@ -203,7 +201,7 @@ public class TemplateArgumentDeduction {
ICPPTemplateArgument arg = deduct.fDeducedArgs.getArgument(tpar);
if (arg != null) {
IType type1 = ((ICPPTemplateNonTypeParameter) tpar).getType();
- type1= CPPTemplates.instantiateType(type1, new InstantiationContext(map, point));
+ type1= CPPTemplates.instantiateType(type1, new InstantiationContext(map));
IType type2= arg.getTypeOfNonTypeValue();
// Template-argument deduced from an array bound may be of any integral type.
if (type2 instanceof TypeOfValueDeducedFromArraySize && isIntegralType(type1)) {
@@ -217,7 +215,7 @@ public class TemplateArgumentDeduction {
}
}
- return verifyDeduction(tmplPars, map, true, point);
+ return verifyDeduction(tmplPars, map, true);
} catch (DOMException e) {
}
return false;
@@ -248,7 +246,7 @@ public class TemplateArgumentDeduction {
}
private static boolean deduceFromFunctionArg(IType par, IType arg, ValueCategory valueCat,
- TemplateArgumentDeduction deduct, IASTNode point) throws DOMException {
+ TemplateArgumentDeduction deduct) throws DOMException {
boolean isReferenceTypeParameter= false;
if (par instanceof ICPPReferenceType) {
// Cannot deduce a reference type from a void type.
@@ -303,7 +301,7 @@ public class TemplateArgumentDeduction {
ICPPTemplateInstance pInst = (ICPPTemplateInstance) pcheck;
ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst);
if (pTemplate != null) {
- ICPPClassType aInst= findBaseInstance((ICPPClassType) argcheck, pTemplate, point);
+ ICPPClassType aInst= findBaseInstance((ICPPClassType) argcheck, pTemplate);
if (aInst != null && aInst != argcheck) {
par= pcheck;
arg= aInst;
@@ -313,7 +311,7 @@ public class TemplateArgumentDeduction {
}
}
- return deduct.fromType(par, arg, true, false, point);
+ return deduct.fromType(par, arg, true, false);
}
/**
@@ -323,14 +321,14 @@ public class TemplateArgumentDeduction {
* @throws DOMException
*/
static ICPPTemplateArgument[] deduceForAddressOf(ICPPFunctionTemplate template,
- ICPPTemplateArgument[] tmplArgs, IFunctionType arg, CPPTemplateParameterMap map, IASTNode point)
+ ICPPTemplateArgument[] tmplArgs, IFunctionType arg, CPPTemplateParameterMap map)
throws DOMException {
final ICPPTemplateParameter[] tmplParams = template.getTemplateParameters();
- if (!addExplicitArguments(template, tmplParams, tmplArgs, map, point))
+ if (!addExplicitArguments(template, tmplParams, tmplArgs, map))
return null;
IType par= template.getType();
- InstantiationContext context = new InstantiationContext(map, point);
+ InstantiationContext context = new InstantiationContext(map);
par= CPPTemplates.instantiateType(par, context);
if (!SemanticUtil.isValidType(par))
return null;
@@ -340,13 +338,13 @@ public class TemplateArgumentDeduction {
TemplateArgumentDeduction deduct=
new TemplateArgumentDeduction(tmplParams, map, new CPPTemplateParameterMap(tmplParams.length), 0);
par= SemanticUtil.getNestedType(par, SemanticUtil.TDEF);
- if (arg != null && !deduct.fromType(par, arg, false, false, point))
+ if (arg != null && !deduct.fromType(par, arg, false, false))
return null;
if (!map.addDeducedArgs(deduct.fDeducedArgs))
return null;
}
- if (!verifyDeduction(tmplParams, map, true, point))
+ if (!verifyDeduction(tmplParams, map, true))
return null;
if (isDependentPar)
@@ -362,8 +360,8 @@ public class TemplateArgumentDeduction {
* Deduce arguments for a user defined conversion template
* 14.8.2.3
*/
- static ICPPTemplateArgument[] deduceForConversion(ICPPFunctionTemplate template,
- IType conversionType, CPPTemplateParameterMap map, IASTNode point) throws DOMException {
+ static ICPPTemplateArgument[] deduceForConversion(ICPPFunctionTemplate template, IType conversionType,
+ CPPTemplateParameterMap map) throws DOMException {
final ICPPTemplateParameter[] tmplParams = template.getTemplateParameters();
final int length = tmplParams.length;
@@ -373,11 +371,11 @@ public class TemplateArgumentDeduction {
p= getArgumentTypeForDeduction(p, a instanceof ICPPReferenceType);
a= SemanticUtil.getNestedType(a, SemanticUtil.REF | SemanticUtil.TDEF);
TemplateArgumentDeduction deduct= new TemplateArgumentDeduction(tmplParams, null, map, 0);
- if (!deduct.fromType(p, a, true, false, point)) {
+ if (!deduct.fromType(p, a, true, false)) {
return null;
}
- InstantiationContext context = new InstantiationContext(map, point);
+ InstantiationContext context = new InstantiationContext(map);
for (int i = 0; i < length; i++) {
if (result[i] == null) {
final ICPPTemplateParameter tpar = tmplParams[i];
@@ -398,29 +396,29 @@ public class TemplateArgumentDeduction {
* 14.8.2.6
*/
static ICPPTemplateArgument[] deduceForDeclaration(ICPPFunctionTemplate template,
- ICPPTemplateArgument[] args, ICPPFunctionType ftype, CPPTemplateParameterMap map, IASTNode point)
+ ICPPTemplateArgument[] args, ICPPFunctionType ftype, CPPTemplateParameterMap map)
throws DOMException {
final ICPPTemplateParameter[] tmplParams = template.getTemplateParameters();
- if (!addExplicitArguments(template, tmplParams, args, map, point))
+ if (!addExplicitArguments(template, tmplParams, args, map))
return null;
IType a= SemanticUtil.getSimplifiedType(ftype);
- InstantiationContext context = new InstantiationContext(map, point);
+ InstantiationContext context = new InstantiationContext(map);
IType p= CPPTemplates.instantiateType(template.getType(), context);
if (!SemanticUtil.isValidType(p))
return null;
TemplateArgumentDeduction deduct=
new TemplateArgumentDeduction(tmplParams, map, new CPPTemplateParameterMap(tmplParams.length), 0);
- if (!deduct.fromType(p, a, false, false, point)) {
+ if (!deduct.fromType(p, a, false, false)) {
return null;
}
if (!map.addDeducedArgs(deduct.fDeducedArgs))
return null;
- if (!verifyDeduction(tmplParams, map, true, point))
+ if (!verifyDeduction(tmplParams, map, true))
return null;
IType type= CPPTemplates.instantiateType(p, context);
@@ -434,7 +432,7 @@ public class TemplateArgumentDeduction {
* Deduces the mapping for the template parameters from the function parameters,
* returns <code>false</code> if there is no mapping.
*/
- static int deduceForPartialOrdering(ICPPTemplateParameter[] tmplPars, IType[] fnPars, IType[] fnArgs, IASTNode point) {
+ static int deduceForPartialOrdering(ICPPTemplateParameter[] tmplPars, IType[] fnPars, IType[] fnArgs) {
try {
final int fnParCount = fnPars.length;
final int fnArgCount = fnArgs.length;
@@ -464,7 +462,7 @@ public class TemplateArgumentDeduction {
IType arg = fnArgs[j];
addReferencedTemplateParameters(par, usedTemplateParIds);
- int cmpSpecialized= deduceForPartialOrdering(par, arg, deduct, point);
+ int cmpSpecialized= deduceForPartialOrdering(par, arg, deduct);
if (cmpSpecialized < 0)
return cmpSpecialized;
if (cmpSpecialized > 0)
@@ -551,7 +549,7 @@ public class TemplateArgumentDeduction {
return true;
}
- private static int deduceForPartialOrdering(IType par, IType arg, TemplateArgumentDeduction deduct, IASTNode point) throws DOMException {
+ private static int deduceForPartialOrdering(IType par, IType arg, TemplateArgumentDeduction deduct) throws DOMException {
par= getNestedType(par, TDEF);
arg= getNestedType(arg, TDEF);
boolean isMoreCVQualified= false;
@@ -565,7 +563,7 @@ public class TemplateArgumentDeduction {
par= getNestedType(par, TDEF | REF | ALLCVQ);
arg= getNestedType(arg, TDEF | REF | ALLCVQ);
- if (!deduct.fromType(par, arg, false, false, point))
+ if (!deduct.fromType(par, arg, false, false))
return -1;
return isMoreCVQualified ? 1 : 0;
@@ -575,7 +573,7 @@ public class TemplateArgumentDeduction {
* Adds the explicit arguments to the map.
*/
public static boolean addExplicitArguments(ICPPFunctionTemplate template, final ICPPTemplateParameter[] tmplParams,
- ICPPTemplateArgument[] tmplArgs, CPPTemplateParameterMap map, IASTNode point) {
+ ICPPTemplateArgument[] tmplArgs, CPPTemplateParameterMap map) {
tmplArgs= SemanticUtil.getSimplifiedArguments(tmplArgs);
ICPPTemplateParameter tmplParam= null;
int packOffset= -1;
@@ -590,7 +588,7 @@ public class TemplateArgumentDeduction {
}
}
ICPPTemplateArgument tmplArg= tmplArgs[i];
- tmplArg= CPPTemplates.matchTemplateParameterAndArgument(template, tmplParam, tmplArg, map, point);
+ tmplArg= CPPTemplates.matchTemplateParameterAndArgument(template, tmplParam, tmplArg, map);
if (tmplArg == null)
return false;
@@ -633,11 +631,12 @@ public class TemplateArgumentDeduction {
* 14.8.2.1.3 If P is a class and has the form template-id, then A can be a derived class of
* the deduced A.
*/
- private static ICPPClassType findBaseInstance(ICPPClassType a, ICPPClassTemplate pTemplate, IASTNode point) throws DOMException {
- return findBaseInstance(a, pTemplate, CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<>(), point);
+ private static ICPPClassType findBaseInstance(ICPPClassType a, ICPPClassTemplate pTemplate) throws DOMException {
+ return findBaseInstance(a, pTemplate, CPPSemantics.MAX_INHERITANCE_DEPTH, new HashSet<>());
}
- private static ICPPClassType findBaseInstance(ICPPClassType a, ICPPClassTemplate pTemplate, int maxdepth, HashSet<Object> handled, IASTNode point) throws DOMException {
+ private static ICPPClassType findBaseInstance(ICPPClassType a, ICPPClassTemplate pTemplate, int maxdepth,
+ HashSet<Object> handled) throws DOMException {
if (a instanceof ICPPTemplateInstance) {
ICPPTemplateInstance inst = (ICPPTemplateInstance) a;
ICPPClassTemplate tmpl= getPrimaryTemplate(inst);
@@ -645,10 +644,10 @@ public class TemplateArgumentDeduction {
return a;
}
if (maxdepth-- > 0) {
- for (ICPPBase cppBase : ClassTypeHelper.getBases(a, point)) {
+ for (ICPPBase cppBase : a.getBases()) {
IBinding base= cppBase.getBaseClass();
if (base instanceof ICPPClassType && handled.add(base)) {
- final ICPPClassType inst= findBaseInstance((ICPPClassType) base, pTemplate, maxdepth, handled, point);
+ final ICPPClassType inst= findBaseInstance((ICPPClassType) base, pTemplate, maxdepth, handled);
if (inst != null)
return inst;
}
@@ -698,8 +697,8 @@ public class TemplateArgumentDeduction {
* Deduces the template parameter mapping from pairs of template arguments.
*/
public static boolean fromTemplateArguments(final ICPPTemplateParameter[] pars,
- final ICPPTemplateArgument[] p, final ICPPTemplateArgument[] a, CPPTemplateParameterMap map,
- IASTNode point) throws DOMException {
+ final ICPPTemplateArgument[] p, final ICPPTemplateArgument[] a, CPPTemplateParameterMap map)
+ throws DOMException {
TemplateArgumentDeduction deduct= new TemplateArgumentDeduction(pars, null, map, 0);
if (p == null) {
return false;
@@ -716,7 +715,7 @@ public class TemplateArgumentDeduction {
for (int i= j; i < a.length; i++) {
if (i != j)
deduct.incPackOffset();
- if (!deduct.fromTemplateArgument(pattern, a[i], point)) {
+ if (!deduct.fromTemplateArgument(pattern, a[i])) {
return false;
}
}
@@ -725,19 +724,19 @@ public class TemplateArgumentDeduction {
if (j >= a.length) {
return false; // Not enough arguments.
}
- if (!deduct.fromTemplateArgument(p[j], a[j], point)) {
+ if (!deduct.fromTemplateArgument(p[j], a[j])) {
return false;
}
}
}
if (!containsPackExpansion && p.length < a.length)
return false; // Too many arguments.
- return verifyDeduction(pars, map, false, point);
+ return verifyDeduction(pars, map, false);
}
private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap,
- boolean useDefaults, IASTNode point) {
- InstantiationContext context = new InstantiationContext(tpMap, point);
+ boolean useDefaults) {
+ InstantiationContext context = new InstantiationContext(tpMap);
for (ICPPTemplateParameter tpar : pars) {
if (tpar.isParameterPack()) {
ICPPTemplateArgument[] deducedArgs= tpMap.getPackExpansion(tpar);
@@ -814,7 +813,7 @@ public class TemplateArgumentDeduction {
/**
* Deduces the template parameter mapping from one pair of template arguments.
*/
- private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a, IASTNode point)
+ private boolean fromTemplateArgument(ICPPTemplateArgument p, ICPPTemplateArgument a)
throws DOMException {
if (p.isNonTypeValue() != a.isNonTypeValue())
return false;
@@ -841,13 +840,13 @@ public class TemplateArgumentDeduction {
// Try to deduce from the original argument type, but if it fails, fall back to the simplified
// argument type.
- return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, true, point)
+ return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, true)
|| (a.getTypeValue() != a.getOriginalTypeValue()
- && fromType(p.getTypeValue(), a.getTypeValue(), false, true, point));
+ && fromType(p.getTypeValue(), a.getTypeValue(), false, true));
}
- private boolean fromType(IType p, IType a, boolean allowCVQConversion, boolean verifyNonDeduced,
- IASTNode point) throws DOMException {
+ private boolean fromType(IType p, IType a, boolean allowCVQConversion, boolean verifyNonDeduced)
+ throws DOMException {
IType originalArgType = a;
a = SemanticUtil.getSimplifiedType(a);
while (p != null) {
@@ -864,7 +863,7 @@ public class TemplateArgumentDeduction {
final ICPPPointerToMemberType ptrA = (ICPPPointerToMemberType) a;
if (!allowCVQConversion && (ptrP.isConst() != ptrA.isConst() || ptrP.isVolatile() != ptrA.isVolatile()))
return false;
- if (!fromType(ptrP.getMemberOfClass(), ptrA.getMemberOfClass(), false, false, point)) {
+ if (!fromType(ptrP.getMemberOfClass(), ptrA.getMemberOfClass(), false, false)) {
return false;
}
p = ptrP.getType();
@@ -942,7 +941,7 @@ public class TemplateArgumentDeduction {
} else if (p instanceof ICPPFunctionType) {
ICPPFunctionType ftp = (ICPPFunctionType) p;
if (a instanceof ICPPFunctionType)
- return fromFunctionType(ftp, (ICPPFunctionType) a, point);
+ return fromFunctionType(ftp, (ICPPFunctionType) a);
if (a instanceof FunctionSetType) {
// 14.8.2.1-6 Handling of overloaded function sets.
@@ -952,7 +951,7 @@ public class TemplateArgumentDeduction {
ICPPFunctionType fta = f.getType();
final CPPTemplateParameterMap saved = saveState();
try {
- if (fromFunctionType(ftp, fta, point)) {
+ if (fromFunctionType(ftp, fta)) {
if (success != null)
return false;
success = saveState();
@@ -982,13 +981,13 @@ public class TemplateArgumentDeduction {
} else if (p instanceof ICPPTemplateInstance) {
if (!(a instanceof ICPPTemplateInstance))
return false;
- return fromTemplateInstance((ICPPTemplateInstance) p, (ICPPTemplateInstance) a, point);
+ return fromTemplateInstance((ICPPTemplateInstance) p, (ICPPTemplateInstance) a);
} else if (p instanceof ICPPUnknownBinding) {
if (!verifyNonDeduced)
return true; // An unknown type may match anything.
// Verify that the resolved binding matches the argument type.
- InstantiationContext context = new InstantiationContext(fDeducedArgs, point);
+ InstantiationContext context = new InstantiationContext(fDeducedArgs);
IBinding binding = CPPTemplates.resolveUnknown((ICPPUnknownBinding) p, context);
if (binding instanceof ICPPUnknownBinding)
return true; // An unknown type may match anything.
@@ -1002,8 +1001,8 @@ public class TemplateArgumentDeduction {
return false;
}
- private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst,
- IASTNode point) throws DOMException {
+ private boolean fromTemplateInstance(ICPPTemplateInstance pInst, ICPPTemplateInstance aInst)
+ throws DOMException {
ICPPClassTemplate pTemplate= getPrimaryTemplate(pInst);
ICPPClassTemplate aTemplate= getPrimaryTemplate(aInst);
if (pTemplate == null || aTemplate == null)
@@ -1046,7 +1045,7 @@ public class TemplateArgumentDeduction {
p= expansionPattern;
deduct.incPackOffset();
InstantiationContext context =
- new InstantiationContext(fExplicitArgs, deduct.fPackOffset, point);
+ new InstantiationContext(fExplicitArgs, deduct.fPackOffset);
p= CPPTemplates.instantiateArgument(p, context);
if (!CPPTemplates.isValidArgument(p))
return false;
@@ -1056,19 +1055,19 @@ public class TemplateArgumentDeduction {
p= expansionPattern= p.getExpansionPattern();
deduct= new TemplateArgumentDeduction(this, aArgs.length - i);
InstantiationContext context =
- new InstantiationContext(fExplicitArgs, deduct.fPackOffset, point);
+ new InstantiationContext(fExplicitArgs, deduct.fPackOffset);
p= CPPTemplates.instantiateArgument(p, context);
if (!CPPTemplates.isValidArgument(p))
return false;
}
}
- if (!deduct.fromTemplateArgument(p, aArgs[i], point))
+ if (!deduct.fromTemplateArgument(p, aArgs[i]))
return false;
}
return true;
}
- private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta, IASTNode point)
+ private boolean fromFunctionType(ICPPFunctionType ftp, ICPPFunctionType fta)
throws DOMException {
if (ftp.isConst() != fta.isConst() ||
ftp.isVolatile() != fta.isVolatile() ||
@@ -1078,7 +1077,7 @@ public class TemplateArgumentDeduction {
return false;
}
- if (!fromType(ftp.getReturnType(), fta.getReturnType(), false, false, point))
+ if (!fromType(ftp.getReturnType(), fta.getReturnType(), false, false))
return false;
IType[] pParams = ftp.getParameterTypes();
@@ -1100,7 +1099,7 @@ public class TemplateArgumentDeduction {
p= parameterPack;
deduct.incPackOffset();
InstantiationContext context =
- new InstantiationContext(fExplicitArgs, deduct.fPackOffset, point);
+ new InstantiationContext(fExplicitArgs, deduct.fPackOffset);
p= CPPTemplates.instantiateType(p, context);
if (!SemanticUtil.isValidType(p))
return false;
@@ -1110,13 +1109,13 @@ public class TemplateArgumentDeduction {
p= parameterPack= ((ICPPParameterPackType) p).getType();
deduct= new TemplateArgumentDeduction(this, aParams.length - i);
InstantiationContext context =
- new InstantiationContext(fExplicitArgs, deduct.fPackOffset, point);
+ new InstantiationContext(fExplicitArgs, deduct.fPackOffset);
p= CPPTemplates.instantiateType(p, context);
if (!SemanticUtil.isValidType(p))
return false;
}
}
- if (!deduct.fromType(p, aParams[i], false, true, point))
+ if (!deduct.fromType(p, aParams[i], false, true))
return false;
}
return true;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
index dd8ac37801f..c513d7fbbc7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeInstantiationRequest.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import java.util.Arrays;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
@@ -30,7 +29,6 @@ public class TypeInstantiationRequest {
private final ICPPTemplateParameterMap parameterMap;
private final int packOffset;
private final ICPPTypeSpecialization contextTypeSpecialization;
- private final IASTNode point;
private int hashCode;
public TypeInstantiationRequest(IType type, InstantiationContext context) {
@@ -38,7 +36,6 @@ public class TypeInstantiationRequest {
this.parameterMap = context.getParameterMap();
this.packOffset = context.getPackOffset();
this.contextTypeSpecialization = context.getContextTypeSpecialization();
- this.point = context.getPoint();
}
@Override
@@ -72,8 +69,6 @@ public class TypeInstantiationRequest {
return false;
if (packOffset != other.packOffset)
return false;
- if (point != other.point)
- return false;
return true;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java
index 920564a757c..cff52fe035d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/TypeTraits.java
@@ -90,16 +90,16 @@ public class TypeTraits {
* - all of its non-static data members and base classes are of non-volatile literal types
* TODO: The last property isn't being checked.
*/
- public static boolean isLiteralClass(ICPPClassType classType, IASTNode point) {
- if (!hasTrivialDestructor(classType, point)) {
+ public static boolean isLiteralClass(ICPPClassType classType) {
+ if (!hasTrivialDestructor(classType)) {
return false;
}
- if (isAggregateClass(classType, point)) {
+ if (isAggregateClass(classType)) {
return true;
}
- ICPPConstructor[] ctors = ClassTypeHelper.getConstructors(classType, point);
+ ICPPConstructor[] ctors = classType.getConstructors();
for (ICPPConstructor ctor : ctors) {
MethodKind methodKind = ClassTypeHelper.getMethodKind(classType, ctor);
if (methodKind == MethodKind.COPY_CTOR || methodKind == MethodKind.MOVE_CTOR) {
@@ -118,13 +118,12 @@ public class TypeTraits {
/**
* C++11: 9-6
*/
- public static boolean isTrivial(ICPPClassType classType, IASTNode point) {
- return isTrivialImpl(classType, point, true);
+ public static boolean isTrivial(ICPPClassType classType) {
+ return isTrivialImpl(classType, true);
}
- private static boolean isTrivialImpl(ICPPClassType classType, IASTNode point,
- boolean checkDefaultConstructors) {
- for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
+ private static boolean isTrivialImpl(ICPPClassType classType, boolean checkDefaultConstructors) {
+ for (ICPPMethod method : classType.getDeclaredMethods()) {
if (method.isVirtual())
return false;
switch (ClassTypeHelper.getMethodKind(classType, method)) {
@@ -143,21 +142,21 @@ public class TypeTraits {
break;
}
}
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (!field.isStatic()) {
IType fieldType = SemanticUtil.getNestedType(field.getType(), TDEF);
- if (fieldType instanceof ICPPClassType && !isTrivial((ICPPClassType) fieldType, point))
+ if (fieldType instanceof ICPPClassType && !isTrivial((ICPPClassType) fieldType))
return false;
}
}
- for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
+ for (ICPPBase base : classType.getBases()) {
if (base.isVirtual())
return false;
}
- ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, point);
+ ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType);
for (ICPPClassType baseClass : baseClasses) {
- if (!isTrivial(baseClass, point))
+ if (!isTrivial(baseClass))
return false;
}
return true;
@@ -166,7 +165,7 @@ public class TypeTraits {
/**
* C++11: 9-7
*/
- public static boolean isStandardLayout(IType type, IASTNode point) {
+ public static boolean isStandardLayout(IType type) {
type = SemanticUtil.getNestedType(type, ARRAY | CVTYPE | TDEF);
if (type instanceof ICPPReferenceType)
return false;
@@ -175,10 +174,10 @@ public class TypeTraits {
ICPPClassType classType = (ICPPClassType) type;
int visibility = 0;
ICPPField firstNonStaticField = null;
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (!field.isStatic()) {
- if (!isStandardLayout(field.getType(), point))
+ if (!isStandardLayout(field.getType()))
return false;
int vis = field.getVisibility();
if (visibility == 0) {
@@ -190,18 +189,18 @@ public class TypeTraits {
firstNonStaticField = field;
}
}
- if (hasDeclaredVirtualMethod(classType, point))
+ if (hasDeclaredVirtualMethod(classType))
return false;
- for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
+ for (ICPPBase base : classType.getBases()) {
if (base.isVirtual())
return false;
}
- ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, point);
+ ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType);
for (ICPPClassType baseClass : baseClasses) {
- if (!isStandardLayout(baseClass, point))
+ if (!isStandardLayout(baseClass))
return false;
if (firstNonStaticField != null) {
- if (TypeTraits.hasNonStaticFields(baseClass, point))
+ if (TypeTraits.hasNonStaticFields(baseClass))
return false;
if (firstNonStaticField.getType().isSameType(baseClass))
return false;
@@ -213,13 +212,13 @@ public class TypeTraits {
/**
* C++11: 9-10
*/
- public static boolean isPOD(IType type, IASTNode point) {
- if (!isStandardLayout(type, point))
+ public static boolean isPOD(IType type) {
+ if (!isStandardLayout(type))
return false;
type = SemanticUtil.getNestedType(type, ARRAY | CVTYPE | TDEF);
if (!(type instanceof ICPPClassType))
return true;
- return isTrivial((ICPPClassType) type, point);
+ return isTrivial((ICPPClassType) type);
}
/**
@@ -227,35 +226,35 @@ public class TypeTraits {
* data members other than bit-fields of length 0, no virtual member functions, no virtual
* base classes, and no base class for which isEmpty is false. [meta.unary.prop]
*/
- public static boolean isEmpty(IType type, IASTNode point) {
+ public static boolean isEmpty(IType type) {
type = SemanticUtil.getNestedType(type, CVTYPE | TDEF);
if (!(type instanceof ICPPClassType))
return false;
ICPPClassType classType = (ICPPClassType) type;
- if (!isItselfEmpty(classType, point))
+ if (!isItselfEmpty(classType))
return false;
- ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType, point);
+ ICPPClassType[] baseClasses = ClassTypeHelper.getAllBases(classType);
for (ICPPClassType baseClass : baseClasses) {
- if (!isItselfEmpty(baseClass, point))
+ if (!isItselfEmpty(baseClass))
return false;
}
return true;
}
- private static boolean isItselfEmpty(ICPPClassType classType, IASTNode point) {
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ private static boolean isItselfEmpty(ICPPClassType classType) {
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (!field.isStatic()) {
// TODO(sprigogin): Check for empty bit fields when bit field size becomes available.
return false;
}
}
- ICPPMethod[] methods = ClassTypeHelper.getDeclaredMethods(classType, point);
+ ICPPMethod[] methods = classType.getDeclaredMethods();
for (ICPPMethod method : methods) {
if (method.isVirtual())
return false;
}
- ICPPBase[] bases = ClassTypeHelper.getBases(classType, point);
+ ICPPBase[] bases = classType.getBases();
for (ICPPBase base : bases) {
if (base.isVirtual())
return false;
@@ -269,10 +268,10 @@ public class TypeTraits {
* no private or protected non-static data members (Clause 11),
* no base classes (Clause 10), and no virtual functions (10.3).
*/
- public static boolean isAggregateClass(ICPPClassType classType, IASTNode point) {
- if (ClassTypeHelper.getBases(classType, point).length > 0)
+ public static boolean isAggregateClass(ICPPClassType classType) {
+ if (classType.getBases().length > 0)
return false;
- ICPPMethod[] methods = ClassTypeHelper.getDeclaredMethods(classType, point);
+ ICPPMethod[] methods = classType.getDeclaredMethods();
for (ICPPMethod m : methods) {
if (m instanceof ICPPConstructor)
return false;
@@ -280,7 +279,7 @@ public class TypeTraits {
return false;
}
}
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (!(field.getVisibility() == ICPPMember.v_public || field.isStatic())) {
return false;
@@ -305,25 +304,25 @@ public class TypeTraits {
* @param classType the class to check
* @return {@code true} if the class has a trivial copy constructor
*/
- public static boolean hasTrivialCopyCtor(ICPPClassType classType, IASTNode point) {
- if (getImplicitCopyCtor(classType, point) == null)
+ public static boolean hasTrivialCopyCtor(ICPPClassType classType) {
+ if (getImplicitCopyCtor(classType) == null)
return false;
- if (isPolymorphic(classType, point))
+ if (isPolymorphic(classType))
return false;
- for (ICPPBase base : ClassTypeHelper.getBases(classType, point)) {
+ for (ICPPBase base : classType.getBases()) {
if (base.isVirtual())
return false;
}
- for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, point)) {
- if (!classType.isSameType(baseClass) && !hasTrivialCopyCtor(baseClass, point))
+ for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType)) {
+ if (!classType.isSameType(baseClass) && !hasTrivialCopyCtor(baseClass))
return false;
}
- for (ICPPField field : ClassTypeHelper.getDeclaredFields(classType, point)) {
+ for (ICPPField field : classType.getDeclaredFields()) {
if (!field.isStatic()) {
IType type = field.getType();
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
if (type instanceof ICPPClassType && !classType.isSameType(type) &&
- !hasTrivialCopyCtor((ICPPClassType) type, point)) {
+ !hasTrivialCopyCtor((ICPPClassType) type)) {
return false;
}
}
@@ -343,27 +342,26 @@ public class TypeTraits {
* Similar to {@code std::tr1::has_trivial_default_constructor}.
*
* @param classType the class to check
- * @param point
* @return {@code true} if the class has a trivial default constructor
*/
- public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, IASTNode point, int maxdepth) {
+ public static boolean hasTrivialDefaultConstructor(ICPPClassType classType, int maxdepth) {
if (maxdepth <= 0) {
return false;
}
- for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
+ for (ICPPConstructor ctor : classType.getConstructors()) {
if (!ctor.isImplicit() && ctor.getParameters().length == 0)
return false;
}
- for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, null)) {
- if (!classType.isSameType(baseClass) && !hasTrivialDefaultConstructor(baseClass, point, maxdepth - 1))
+ for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType)) {
+ if (!classType.isSameType(baseClass) && !hasTrivialDefaultConstructor(baseClass, maxdepth - 1))
return false;
}
- for (ICPPField field : ClassTypeHelper.getDeclaredFields(classType, point)) {
+ for (ICPPField field : classType.getDeclaredFields()) {
if (!field.isStatic()) {
IType type = field.getType();
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
if (type instanceof ICPPClassType && !classType.isSameType(type) &&
- !hasTrivialDefaultConstructor((ICPPClassType) type, point, maxdepth - 1)) {
+ !hasTrivialDefaultConstructor((ICPPClassType) type, maxdepth - 1)) {
return false;
}
}
@@ -385,29 +383,28 @@ public class TypeTraits {
* @param classType the class to check
* @return {@code true} if the class has a trivial destructor
*/
- public static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point) {
- return hasTrivialDestructor(classType, point, new HashSet<>());
+ public static boolean hasTrivialDestructor(ICPPClassType classType) {
+ return hasTrivialDestructor(classType, new HashSet<>());
}
- private static boolean hasTrivialDestructor(ICPPClassType classType, IASTNode point,
- Set<ICPPClassType> checkedClasses) {
+ private static boolean hasTrivialDestructor(ICPPClassType classType, Set<ICPPClassType> checkedClasses) {
if (!checkedClasses.add(classType))
return true; // Checked already.
- for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
+ for (ICPPMethod method : classType.getDeclaredMethods()) {
if (method.isDestructor() && !isDefaultedMethod(method))
return false;
}
- for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, point)) {
- if (!hasTrivialDestructor(baseClass, point, checkedClasses))
+ for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType)) {
+ if (!hasTrivialDestructor(baseClass, checkedClasses))
return false;
}
- for (ICPPField field : ClassTypeHelper.getDeclaredFields(classType, point)) {
+ for (ICPPField field : classType.getDeclaredFields()) {
if (!field.isStatic()) {
IType type = field.getType();
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE | ARRAY);
if (type instanceof ICPPClassType &&
- !hasTrivialDestructor((ICPPClassType) type, point, checkedClasses)) {
+ !hasTrivialDestructor((ICPPClassType) type, checkedClasses)) {
return false;
}
}
@@ -422,18 +419,18 @@ public class TypeTraits {
* @param classType the class to check
* @return {@code true} if the class declares or inherits a virtual function.
*/
- public static boolean isPolymorphic(ICPPClassType classType, IASTNode point) {
- if (hasDeclaredVirtualMethod(classType, point))
+ public static boolean isPolymorphic(ICPPClassType classType) {
+ if (hasDeclaredVirtualMethod(classType))
return true;
- for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType, point)) {
- if (hasDeclaredVirtualMethod(baseClass, point))
+ for (ICPPClassType baseClass : ClassTypeHelper.getAllBases(classType)) {
+ if (hasDeclaredVirtualMethod(baseClass))
return true;
}
return false;
}
- private static boolean hasNonStaticFields(ICPPClassType classType, IASTNode point) {
- ICPPField[] fields = ClassTypeHelper.getDeclaredFields(classType, point);
+ private static boolean hasNonStaticFields(ICPPClassType classType) {
+ ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
if (!field.isStatic())
return true;
@@ -441,8 +438,8 @@ public class TypeTraits {
return false;
}
- public static boolean isAbstract(ICPPClassType classType, IASTNode point) {
- return SemanticQueries.getPureVirtualMethods(classType, point).length != 0;
+ public static boolean isAbstract(ICPPClassType classType) {
+ return SemanticQueries.getPureVirtualMethods(classType).length != 0;
}
/**
@@ -453,16 +450,16 @@ public class TypeTraits {
* @return the compiler-generated copy constructor, or {@code null} if the class doesn't
* have a compiler-generated copy constructor.
*/
- private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType, IASTNode point) {
- for (ICPPConstructor ctor : ClassTypeHelper.getConstructors(classType, point)) {
+ private static ICPPConstructor getImplicitCopyCtor(ICPPClassType classType) {
+ for (ICPPConstructor ctor : classType.getConstructors()) {
if (ctor.isImplicit() && ClassTypeHelper.getMethodKind(classType, ctor) == MethodKind.COPY_CTOR)
return ctor;
}
return null;
}
- private static boolean hasDeclaredVirtualMethod(ICPPClassType classType, IASTNode point) {
- for (ICPPMethod method : ClassTypeHelper.getDeclaredMethods(classType, point)) {
+ private static boolean hasDeclaredVirtualMethod(ICPPClassType classType) {
+ for (ICPPMethod method : classType.getDeclaredMethods()) {
if (method.isVirtual()) {
return true;
}
@@ -536,8 +533,8 @@ public class TypeTraits {
* - has no non-trivial move assignment operators, and
* - has a trivial destructor."
*/
- private static boolean isTriviallyCopyableClass(ICPPClassType type, IASTNode point) {
- return isTrivialImpl(type, point, false);
+ private static boolean isTriviallyCopyableClass(ICPPClassType type) {
+ return isTrivialImpl(type, false);
}
/**
@@ -547,17 +544,17 @@ public class TypeTraits {
* of such types, and non-volatile const-qualified versions of these
* types are collectively called trivially copyable types."
*/
- public static boolean isTriviallyCopyable(IType type, IASTNode point) {
+ public static boolean isTriviallyCopyable(IType type) {
type = SemanticUtil.getSimplifiedType(type);
CVQualifier qualifier = SemanticUtil.getCVQualifier(type);
if (qualifier.isVolatile()) {
return false;
} else if (qualifier.isConst()) {
- return isTriviallyCopyable(SemanticUtil.getNestedType(type, SemanticUtil.ALLCVQ), point);
+ return isTriviallyCopyable(SemanticUtil.getNestedType(type, SemanticUtil.ALLCVQ));
} else if (type instanceof IArrayType) {
- return isTriviallyCopyable(((IArrayType) type).getType(), point);
+ return isTriviallyCopyable(((IArrayType) type).getType());
} else if (type instanceof ICPPClassType) {
- return isTriviallyCopyableClass((ICPPClassType) type, point);
+ return isTriviallyCopyableClass((ICPPClassType) type);
} else {
return isScalar(type);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java
index 15c17ff07e3..5408f245928 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.index.composite.cpp;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IField;
@@ -75,11 +74,6 @@ public class CompositeCPPClassSpecialization extends CompositeCPPClassType imple
@Override
public IBinding specializeMember(IBinding original) {
- return specializeMember(original, null);
- }
-
- @Override
- public IBinding specializeMember(IBinding original, IASTNode point) {
if (specializationMap == null) {
final Object key= CPPCompositesFactory.createSpecializationKey(cf, rbinding);
final IIndexFragment frag= rbinding.getFragment();
@@ -92,7 +86,7 @@ public class CompositeCPPClassSpecialization extends CompositeCPPClassType imple
IIndexFragmentBinding[] frags= cf.findEquivalentBindings(rbinding);
for (IIndexFragmentBinding fb : frags) {
if (fb instanceof ICPPClassType) {
- final ICPPClassType[] nested = ClassTypeHelper.getNestedClasses((ICPPClassType) fb, point);
+ final ICPPClassType[] nested = ((ICPPClassType) fb).getNestedClasses();
if (nested.length > 0) {
for (ICPPClassType ct : nested) {
if (ct instanceof ICPPClassSpecialization &&
@@ -118,10 +112,10 @@ public class CompositeCPPClassSpecialization extends CompositeCPPClassType imple
IBinding newSpec;
Set<IBinding> recursionProtectionSet= fInProgress.get();
if (!recursionProtectionSet.add(original))
- return RecursionResolvingBinding.createFor(original, point);
+ return RecursionResolvingBinding.createFor(original);
try {
- newSpec= CPPTemplates.createSpecialization(this, original, point);
+ newSpec= CPPTemplates.createSpecialization(this, original);
} finally {
recursionProtectionSet.remove(original);
}
@@ -135,149 +129,155 @@ public class CompositeCPPClassSpecialization extends CompositeCPPClassType imple
}
return newSpec;
}
-
+
@Override
- public final ICPPBase[] getBases() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getBases(null);
+ @Deprecated
+ public IBinding specializeMember(IBinding original, IASTNode point) {
+ return specializeMember(original);
}
@Override
- public final ICPPBase[] getBases(IASTNode point) {
+ public final ICPPBase[] getBases() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getBases(point);
+ return ((ICPPClassSpecializationScope) scope).getBases();
}
- ICPPBase[] bases = ClassTypeHelper.getBases((ICPPClassType) rbinding, point);
+ ICPPBase[] bases = ((ICPPClassType) rbinding).getBases();
return wrapBases(bases);
}
+
+ @Override
+ @Deprecated
+ public final ICPPBase[] getBases(IASTNode point) {
+ return getBases();
+ }
@Override
public final ICPPConstructor[] getConstructors() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getConstructors(null);
+ IScope scope= getCompositeScope();
+ if (scope instanceof ICPPClassScope) {
+ return ((ICPPClassScope) scope).getConstructors();
+ }
+ ICPPConstructor[] result = ((ICPPClassType) rbinding).getConstructors();
+ return wrapBindings(result);
}
@Override
+ @Deprecated
public final ICPPConstructor[] getConstructors(IASTNode point) {
- IScope scope= getCompositeScope();
- if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getConstructors(point);
- }
- ICPPConstructor[] result = ClassTypeHelper.getConstructors((ICPPClassType) rbinding, point);
- return wrapBindings(result);
+ return getConstructors();
}
@Override
public ICPPMethod[] getMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getMethods(null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
+ @Deprecated
public ICPPMethod[] getMethods(IASTNode point) {
- return ClassTypeHelper.getMethods(this, point);
+ return getMethods();
}
@Override
public final ICPPMethod[] getDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredMethods(null);
- }
-
- @Override
- public final ICPPMethod[] getDeclaredMethods(IASTNode point) {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getDeclaredMethods(point);
+ return ((ICPPClassSpecializationScope) scope).getDeclaredMethods();
}
- ICPPMethod[] result = ClassTypeHelper.getDeclaredMethods((ICPPClassType) rbinding, point);
+ ICPPMethod[] result = ((ICPPClassType) rbinding).getDeclaredMethods();
return wrapBindings(result);
}
@Override
- public final ICPPMethod[] getAllDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getAllDeclaredMethods(null);
+ @Deprecated
+ public final ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ return getDeclaredMethods();
}
@Override
- public final ICPPMethod[] getAllDeclaredMethods(IASTNode point) {
- return ClassTypeHelper.getAllDeclaredMethods(this, point);
+ public final ICPPMethod[] getAllDeclaredMethods() {
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
- public final ICPPField[] getDeclaredFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredFields(null);
+ @Deprecated
+ public final ICPPMethod[] getAllDeclaredMethods(IASTNode point) {
+ return getAllDeclaredMethods();
}
@Override
- public final ICPPField[] getDeclaredFields(IASTNode point) {
+ public final ICPPField[] getDeclaredFields() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getDeclaredFields(point);
+ return ((ICPPClassSpecializationScope) scope).getDeclaredFields();
}
- ICPPField[] result = ClassTypeHelper.getDeclaredFields((ICPPClassType) rbinding, point);
+ ICPPField[] result = ((ICPPClassType) rbinding).getDeclaredFields();
return wrapBindings(result);
}
@Override
- public IField[] getFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFields(null);
+ @Deprecated
+ public final ICPPField[] getDeclaredFields(IASTNode point) {
+ return getDeclaredFields();
}
@Override
- public final IField[] getFields(IASTNode point) {
- return ClassTypeHelper.getFields(this, point);
+ public IField[] getFields() {
+ return ClassTypeHelper.getFields(this);
}
@Override
- public final IBinding[] getFriends() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFriends(null);
+ @Deprecated
+ public final IField[] getFields(IASTNode point) {
+ return getFields();
}
@Override
- public final IBinding[] getFriends(IASTNode point) {
+ public final IBinding[] getFriends() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getFriends(point);
+ return ((ICPPClassSpecializationScope) scope).getFriends();
}
- IBinding[] result = ClassTypeHelper.getFriends((ICPPClassType) rbinding, point);
+ IBinding[] result = ((ICPPClassType) rbinding).getFriends();
return wrapBindings(result);
}
@Override
- public final ICPPClassType[] getNestedClasses() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getNestedClasses(null);
+ @Deprecated
+ public final IBinding[] getFriends(IASTNode point) {
+ return getFriends();
}
@Override
- public final ICPPClassType[] getNestedClasses(IASTNode point) {
+ public final ICPPClassType[] getNestedClasses() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getNestedClasses(point);
+ return ((ICPPClassSpecializationScope) scope).getNestedClasses();
}
- ICPPClassType[] result = ClassTypeHelper.getNestedClasses((ICPPClassType) rbinding, point);
+ ICPPClassType[] result = ((ICPPClassType) rbinding).getNestedClasses();
return wrapBindings(result);
}
-
+
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getUsingDeclarations(null);
+ @Deprecated
+ public final ICPPClassType[] getNestedClasses(IASTNode point) {
+ return getNestedClasses();
}
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ public ICPPUsingDeclaration[] getUsingDeclarations() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getUsingDeclarations(point);
+ return ((ICPPClassSpecializationScope) scope).getUsingDeclarations();
}
- ICPPUsingDeclaration[] result = ClassTypeHelper.getUsingDeclarations((ICPPClassType) rbinding, point);
+ ICPPUsingDeclaration[] result = ((ICPPClassType) rbinding).getUsingDeclarations();
return wrapBindings(result);
}
+
+ @Override
+ @Deprecated
+ public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ return getUsingDeclarations();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecializationScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecializationScope.java
index ae40154c925..b50fba3c0bd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecializationScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecializationScope.java
@@ -12,10 +12,8 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite.cpp;
-import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
@@ -72,14 +70,8 @@ public class CompositeCPPClassSpecializationScope extends CompositeScope impleme
@Override
public ICPPMethod[] getImplicitMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getImplicitMethods(null);
- }
-
- @Override
- public ICPPMethod[] getImplicitMethods(IASTNode point) {
createDelegate();
- return fDelegate.getImplicitMethods(point);
+ return fDelegate.getImplicitMethods();
}
@Override
@@ -114,49 +106,43 @@ public class CompositeCPPClassSpecializationScope extends CompositeScope impleme
@Override
public ICPPConstructor[] getConstructors() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getConstructors(null);
- }
-
- @Override
- public ICPPConstructor[] getConstructors(IASTNode point) {
createDelegate();
- return fDelegate.getConstructors(point);
+ return fDelegate.getConstructors();
}
@Override
- public ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ public ICPPMethod[] getDeclaredMethods() {
createDelegate();
- return fDelegate.getDeclaredMethods(point);
+ return fDelegate.getDeclaredMethods();
}
@Override
- public ICPPBase[] getBases(IASTNode point) {
+ public ICPPBase[] getBases() {
createDelegate();
- return fDelegate.getBases(point);
+ return fDelegate.getBases();
}
@Override
- public ICPPField[] getDeclaredFields(IASTNode point) {
+ public ICPPField[] getDeclaredFields() {
createDelegate();
- return fDelegate.getDeclaredFields(point);
+ return fDelegate.getDeclaredFields();
}
@Override
- public IBinding[] getFriends(IASTNode point) {
+ public IBinding[] getFriends() {
createDelegate();
- return fDelegate.getFriends(point);
+ return fDelegate.getFriends();
}
@Override
- public ICPPClassType[] getNestedClasses(IASTNode point) {
+ public ICPPClassType[] getNestedClasses() {
createDelegate();
- return fDelegate.getNestedClasses(point);
+ return fDelegate.getNestedClasses();
}
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ public ICPPUsingDeclaration[] getUsingDeclarations() {
createDelegate();
- return fDelegate.getUsingDeclarations(point);
+ return fDelegate.getUsingDeclarations();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java
index a394cdc3547..76bd47ca6b8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassType.java
@@ -50,7 +50,7 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- return ClassTypeHelper.getAllDeclaredMethods(this, null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
private class CPPBaseDelegate implements ICPPBase {
@@ -154,7 +154,7 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
@Override
public IField[] getFields() {
- return ClassTypeHelper.getFields(this, null);
+ return ClassTypeHelper.getFields(this);
}
@Override
@@ -165,7 +165,7 @@ class CompositeCPPClassType extends CompositeCPPBinding implements ICPPClassType
@Override
public ICPPMethod[] getMethods() {
- return ClassTypeHelper.getMethods(this, null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructor.java
index 1106b95c29d..a0efb5f3b28 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructor.java
@@ -22,7 +22,13 @@ class CompositeCPPConstructor extends CompositeCPPMethod implements ICPPConstruc
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return ((ICPPConstructor) rbinding).getConstructorChainExecution(point);
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
+ return ((ICPPConstructor) rbinding).getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorInstance.java
index 059c7876626..3f638e16938 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorInstance.java
@@ -21,7 +21,13 @@ public class CompositeCPPConstructorInstance extends CompositeCPPMethodInstance
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return ((ICPPConstructor) rbinding).getConstructorChainExecution(point);
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
+ return ((ICPPConstructor) rbinding).getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorSpecialization.java
index 37baee4e9b5..adb95acd1a3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorSpecialization.java
@@ -21,9 +21,15 @@ public class CompositeCPPConstructorSpecialization extends CompositeCPPMethodSpe
public CompositeCPPConstructorSpecialization(ICompositesFactory cf, ICPPConstructor cons) {
super(cf, cons);
}
-
+
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return ((ICPPConstructor) rbinding).getConstructorChainExecution(point);
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
+ return ((ICPPConstructor) rbinding).getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplate.java
index 982c7fc6807..6edc1fadc9f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplate.java
@@ -20,9 +20,15 @@ public class CompositeCPPConstructorTemplate extends CompositeCPPMethodTemplate
public CompositeCPPConstructorTemplate(ICompositesFactory cf, ICPPConstructor rbinding) {
super(cf, rbinding);
}
-
+
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return ((ICPPConstructor) rbinding).getConstructorChainExecution(point);
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
+ return ((ICPPConstructor) rbinding).getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplateSpecialization.java
index 8d5d65a35ae..5a58577a6fe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPConstructorTemplateSpecialization.java
@@ -24,9 +24,15 @@ public class CompositeCPPConstructorTemplateSpecialization
ICPPFunction ft) {
super(cf, ft);
}
-
+
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
- return ((ICPPConstructor) rbinding).getConstructorChainExecution(point);
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
+ return ((ICPPConstructor) rbinding).getConstructorChainExecution();
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPFunction.java
index caa9dfeea7c..4f917697606 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPFunction.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.index.composite.cpp;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
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;
@@ -146,7 +145,7 @@ class CompositeCPPFunction extends CompositeCPPBinding implements ICPPFunction,
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
- return CPPFunction.getFunctionBodyExecution((ICPPFunction) rbinding, point);
+ public ICPPExecution getFunctionBodyExecution() {
+ return CPPFunction.getFunctionBodyExecution((ICPPFunction) rbinding);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
index c5b177624d2..26f6feb5f00 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/TemplateInstanceUtil.java
@@ -104,7 +104,7 @@ public class TemplateInstanceUtil {
ICPPEvaluation eval = arg.getNonTypeEvaluation();
ICPPEvaluation eval2 = ((CPPCompositesFactory) cf).getCompositeEvaluation(eval);
if (eval2 != eval) {
- return new CPPTemplateNonTypeArgument(eval2, null);
+ return new CPPTemplateNonTypeArgument(eval2);
}
}
return arg;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java
index 7237dc9099b..3dea8f935b4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMBinding.java
@@ -19,7 +19,6 @@ import java.lang.reflect.Modifier;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
@@ -448,10 +447,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
/**
* The binding is reused by a declaration or definition, update the binding, e.g. modifiers,
* with the new information.
- *
- * @param point the point of instantiation for name lookups
*/
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/TypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/TypeMarshalBuffer.java
index 0ce3adb885e..9954fe4b22d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/TypeMarshalBuffer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/TypeMarshalBuffer.java
@@ -237,7 +237,7 @@ public final class TypeMarshalBuffer implements ITypeMarshalBuffer {
int oldPos = fPos;
short firstBytes = getShort();
if (firstBytes == VALUE) {
- return new CPPTemplateNonTypeArgument(unmarshalEvaluation(), null);
+ return new CPPTemplateNonTypeArgument(unmarshalEvaluation());
} else {
fPos = oldPos;
IType type = unmarshalType();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java
index 751f96c4d2a..70b7f97feb1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumeration.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -63,7 +62,7 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType,
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
storeValueBounds((IEnumeration) newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java
index 806ebeb80a9..fea7cb93d52 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCEnumerator.java
@@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.c;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -65,7 +64,7 @@ class PDOMCEnumerator extends PDOMBinding implements IEnumerator {
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IEnumerator)
storeValue(getDB(), (IEnumerator) newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java
index 0fd1ac060cc..a652675b9f9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java
@@ -15,7 +15,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.c;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
@@ -77,7 +76,7 @@ class PDOMCFunction extends PDOMBinding implements IFunction {
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (!(newBinding instanceof IFunction))
return;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java
index 70efe9f4f83..f24d00ec053 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java
@@ -35,6 +35,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CPointerType;
import org.eclipse.cdt.internal.core.dom.parser.c.CQualifierType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPExecution;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.index.IIndexBindingConstants;
import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants;
import org.eclipse.cdt.internal.core.index.composite.CompositeIndexBinding;
@@ -115,7 +116,12 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
if (shouldUpdate(pdomBinding, fromName)) {
IBinding fromBinding = fromName.getBinding();
- pdomBinding.update(this, fromBinding, fromName);
+ try {
+ CPPSemantics.pushLookupPoint(fromName);
+ pdomBinding.update(this, fromBinding);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
// Update the tags based on the tags from the new binding. This cannot be done in
// PDOMBinding.update, because not all subclasses (e.g., PDOMCFunction) call
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java
index 960a844c178..34dc6f7862a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java
@@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
@@ -72,12 +71,12 @@ public class PDOMCStructure extends PDOMBinding implements ICompositeType, ICCom
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICompositeType) {
ICompositeType ct= (ICompositeType) newBinding;
setKind(ct);
setAnonymous(ct);
- super.update(linkage, newBinding, point);
+ super.update(linkage, newBinding);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java
index 2dfe872faef..988f0f23ae7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCTypedef.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -56,7 +55,7 @@ class PDOMCTypedef extends PDOMBinding implements ITypedef, ITypeContainer, IInd
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ITypedef) {
ITypedef td= (ITypedef) newBinding;
try {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java
index 6342a713e31..a9496b3fb01 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.c;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -66,7 +65,7 @@ class PDOMCVariable extends PDOMBinding implements IVariable {
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IVariable) {
IVariable var= (IVariable) newBinding;
linkage.storeType(record + TYPE_OFFSET, var.getType());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
index 81434190527..3229a60d6c3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/IPDOMCPPTemplateParameter.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.internal.core.pdom.dom.IInternalPDOMNode;
@@ -30,9 +29,9 @@ public interface IPDOMCPPTemplateParameter extends IInternalPDOMNode, ICPPTempla
void configure(ICPPTemplateParameter templateParameter);
/**
- * @see org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding#update(PDOMLinkage, IBinding, IASTNode)
+ * @see org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding#update(PDOMLinkage, IBinding)
*/
- void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException;
+ void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException;
/**
* parameters of template template parameters need to be deleted.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java
index 8a4607d8ff1..610992f2f67 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPAliasTemplate.java
@@ -70,7 +70,7 @@ class PDOMCPPAliasTemplate extends PDOMCPPBinding implements ICPPAliasTemplate,
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (!(newBinding instanceof ICPPAliasTemplate)) {
return;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java
index 02fd20bd7d6..2365d6827ba 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassScope.java
@@ -42,7 +42,6 @@ import org.eclipse.cdt.core.parser.Keywords;
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassScope;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.cdt.internal.core.index.DeclaredBindingsFilter;
@@ -164,7 +163,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
if (!lookup.isPrefixLookup()) {
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
if (CPPClassScope.shallReturnConstructors(lookup.getLookupName(), false)){
- return ClassTypeHelper.getConstructors(fBinding, lookup.getLookupPoint());
+ return fBinding.getConstructors();
}
return new IBinding[] { getClassNameBinding() };
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java
index 2c10c194503..7883148bc8b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassSpecialization.java
@@ -90,11 +90,11 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPClassType) {
ICPPClassType classType= (ICPPClassType) newBinding;
setFlags(classType);
- super.update(linkage, newBinding, point);
+ super.update(linkage, newBinding);
}
}
@@ -115,11 +115,6 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
@Override
public IBinding specializeMember(IBinding original) {
- return specializeMember(original, null);
- }
-
- @Override
- public IBinding specializeMember(IBinding original, IASTNode point) {
if (specializationMap == null) {
final Long key= record + PDOMCPPLinkage.CACHE_INSTANCE_SCOPE;
Object cached= getPDOM().getCachedResult(key);
@@ -151,10 +146,10 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
IBinding newSpec;
Set<IBinding> recursionProtectionSet= fInProgress.get();
if (!recursionProtectionSet.add(original))
- return RecursionResolvingBinding.createFor(original, point);
+ return RecursionResolvingBinding.createFor(original);
try {
- newSpec= CPPTemplates.createSpecialization(this, original, point);
+ newSpec= CPPTemplates.createSpecialization(this, original);
} finally {
recursionProtectionSet.remove(original);
}
@@ -170,6 +165,12 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
+ @Deprecated
+ public IBinding specializeMember(IBinding original, IASTNode point) {
+ return specializeMember(original);
+ }
+
+ @Override
public ICPPClassScope getCompositeScope() {
if (fScope == null) {
try {
@@ -240,15 +241,9 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
@Override
public ICPPBase[] getBases() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getBases(null);
- }
-
- @Override
- public ICPPBase[] getBases(IASTNode point) {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getBases(point);
+ return ((ICPPClassSpecializationScope) scope).getBases();
}
// This is an explicit specialization.
@@ -273,24 +268,24 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
- public ICPPConstructor[] getConstructors() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getConstructors(null);
+ @Deprecated
+ public ICPPBase[] getBases(IASTNode point) {
+ return getBases();
}
@Override
- public ICPPConstructor[] getConstructors(IASTNode point) {
+ public ICPPConstructor[] getConstructors() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- ICPPConstructor[] constructors = ((ICPPClassSpecializationScope) scope).getConstructors(point);
- return ClassTypeHelper.getAllConstructors(this, constructors, point);
+ ICPPConstructor[] constructors = ((ICPPClassSpecializationScope) scope).getConstructors();
+ return ClassTypeHelper.getAllConstructors(this, constructors);
}
try {
PDOMClassUtil.ConstructorCollector visitor= new PDOMClassUtil.ConstructorCollector();
PDOMCPPClassScope.acceptViaCache(this, visitor, false);
ICPPConstructor[] constructors = visitor.getConstructors();
- return ClassTypeHelper.getAllConstructors(this, constructors, point);
+ return ClassTypeHelper.getAllConstructors(this, constructors);
} catch (CoreException e) {
CCorePlugin.log(e);
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
@@ -298,16 +293,16 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
- public ICPPMethod[] getDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredMethods(null);
+ @Deprecated
+ public ICPPConstructor[] getConstructors(IASTNode point) {
+ return getConstructors();
}
@Override
- public ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ public ICPPMethod[] getDeclaredMethods() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getDeclaredMethods(point);
+ return ((ICPPClassSpecializationScope) scope).getDeclaredMethods();
}
try {
PDOMClassUtil.MethodCollector methods = new PDOMClassUtil.MethodCollector(false);
@@ -320,16 +315,16 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
- public ICPPField[] getDeclaredFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getDeclaredFields(null);
+ @Deprecated
+ public ICPPMethod[] getDeclaredMethods(IASTNode point) {
+ return getDeclaredMethods();
}
@Override
- public ICPPField[] getDeclaredFields(IASTNode point) {
+ public ICPPField[] getDeclaredFields() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getDeclaredFields(point);
+ return ((ICPPClassSpecializationScope) scope).getDeclaredFields();
}
try {
PDOMClassUtil.FieldCollector visitor = new PDOMClassUtil.FieldCollector();
@@ -342,16 +337,16 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
}
@Override
- public ICPPClassType[] getNestedClasses() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getNestedClasses(null);
+ @Deprecated
+ public ICPPField[] getDeclaredFields(IASTNode point) {
+ return getDeclaredFields();
}
@Override
- public ICPPClassType[] getNestedClasses(IASTNode point) {
+ public ICPPClassType[] getNestedClasses() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getNestedClasses(point);
+ return ((ICPPClassSpecializationScope) scope).getNestedClasses();
}
try {
PDOMClassUtil.NestedClassCollector visitor = new PDOMClassUtil.NestedClassCollector();
@@ -362,18 +357,18 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
return ICPPClassType.EMPTY_CLASS_ARRAY;
}
}
-
+
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getUsingDeclarations(null);
+ @Deprecated
+ public ICPPClassType[] getNestedClasses(IASTNode point) {
+ return getNestedClasses();
}
@Override
- public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ public ICPPUsingDeclaration[] getUsingDeclarations() {
IScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope) {
- return ((ICPPClassSpecializationScope) scope).getUsingDeclarations(point);
+ return ((ICPPClassSpecializationScope) scope).getUsingDeclarations();
}
try {
PDOMClassUtil.UsingDeclarationCollector visitor = new PDOMClassUtil.UsingDeclarationCollector();
@@ -384,52 +379,58 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization
return ICPPUsingDeclaration.EMPTY_USING_DECL_ARRAY;
}
}
-
+
@Override
- public IBinding[] getFriends() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFriends(null);
+ @Deprecated
+ public ICPPUsingDeclaration[] getUsingDeclarations(IASTNode point) {
+ return getUsingDeclarations();
}
@Override
- public IBinding[] getFriends(IASTNode point) {
+ public IBinding[] getFriends() {
ICPPClassScope scope= getCompositeScope();
if (scope instanceof ICPPClassSpecializationScope)
- return ((ICPPClassSpecializationScope) scope).getFriends(point);
+ return ((ICPPClassSpecializationScope) scope).getFriends();
return IBinding.EMPTY_BINDING_ARRAY;
}
@Override
+ @Deprecated
+ public IBinding[] getFriends(IASTNode point) {
+ return getFriends();
+ }
+
+ @Override
public ICPPMethod[] getMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getMethods(null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
+ @Deprecated
public ICPPMethod[] getMethods(IASTNode point) {
- return ClassTypeHelper.getMethods(this, point);
+ return getMethods();
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getAllDeclaredMethods(null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
+ @Deprecated
public ICPPMethod[] getAllDeclaredMethods(IASTNode point) {
- return ClassTypeHelper.getAllDeclaredMethods(this, point);
+ return getAllDeclaredMethods();
}
@Override
public IField[] getFields() {
- CCorePlugin.log(new Exception("Unsafe method call. Instantiation of dependent expressions may not work.")); //$NON-NLS-1$
- return getFields(null);
+ return ClassTypeHelper.getFields(this);
}
@Override
+ @Deprecated
public IField[] getFields(IASTNode point) {
- return ClassTypeHelper.getFields(this, point);
+ return getFields();
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
index 99b18c1dcfa..2789171a391 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplate.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
@@ -117,8 +116,8 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
- super.update(linkage, newBinding, point);
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
+ super.update(linkage, newBinding);
if (newBinding instanceof ICPPClassTemplate) {
ICPPClassTemplate ct= (ICPPClassTemplate) newBinding;
try {
@@ -158,7 +157,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
// Reuse param
result[i]= j;
props[j]= -1;
- allParams[j].update(linkage, newPar, null);
+ allParams[j].update(linkage, newPar);
if (j != i)
reorder= true;
continue outer;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
index 22b52e33d73..a5ee6258698 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassTemplateSpecialization.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -182,13 +181,12 @@ class PDOMCPPClassTemplateSpecialization extends PDOMCPPClassSpecialization
@Override
public ICPPClassTemplatePartialSpecialization[] getPartialSpecializations() {
- IASTNode point= null; // Instantiation of dependent expressions may not work.
ICPPClassTemplate origTemplate= (ICPPClassTemplate) getSpecializedBinding();
ICPPClassTemplatePartialSpecialization[] orig = origTemplate.getPartialSpecializations();
ICPPClassTemplatePartialSpecialization[] spec = new ICPPClassTemplatePartialSpecialization[orig.length];
ICPPClassSpecialization owner = (ICPPClassSpecialization) getOwner();
for (int i = 0; i < orig.length; i++) {
- spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i], point);
+ spec[i]= (ICPPClassTemplatePartialSpecialization) owner.specializeMember(orig[i]);
}
return spec;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java
index f2a36792d1e..1cb07ac3874 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java
@@ -22,7 +22,6 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -86,13 +85,13 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPClassType) {
ICPPClassType ct= (ICPPClassType) newBinding;
setKind(ct);
setAnonymous(ct);
setFinal(ct);
- super.update(linkage, newBinding, point);
+ super.update(linkage, newBinding);
}
}
@@ -332,7 +331,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
try {
PDOMCPPClassScope.acceptViaCache(this, visitor, false);
ICPPConstructor[] constructors = visitor.getConstructors();
- return ClassTypeHelper.getAllConstructors(this, constructors, null);
+ return ClassTypeHelper.getAllConstructors(this, constructors);
} catch (CoreException e) {
CCorePlugin.log(e);
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
@@ -404,17 +403,17 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
@Override
public ICPPMethod[] getMethods() {
- return ClassTypeHelper.getMethods(this, null);
+ return ClassTypeHelper.getMethods(this);
}
@Override
public ICPPMethod[] getAllDeclaredMethods() {
- return ClassTypeHelper.getAllDeclaredMethods(this, null);
+ return ClassTypeHelper.getAllDeclaredMethods(this);
}
@Override
public IField[] getFields() {
- return ClassTypeHelper.getFields(this, null);
+ return ClassTypeHelper.getFields(this);
}
@Override
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java
index ce1cd8e23b7..785cc899528 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructor.java
@@ -33,9 +33,9 @@ class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor {
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = CONSTRUCTOR_CHAIN + Database.EXECUTION_SIZE;
- public PDOMCPPConstructor(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method, IASTNode point)
+ public PDOMCPPConstructor(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method)
throws CoreException, DOMException {
- super(linkage, parent, method, point);
+ super(linkage, parent, method);
linkage.new ConfigureConstructor(method, this);
}
@@ -67,7 +67,13 @@ class PDOMCPPConstructor extends PDOMCPPMethod implements ICPPConstructor {
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr())
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java
index 43636c71e17..51a0905925f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorInstance.java
@@ -38,9 +38,9 @@ public class PDOMCPPConstructorInstance extends PDOMCPPMethodInstance
protected static final int RECORD_SIZE = CONSTRUCTOR_CHAIN + Database.EXECUTION_SIZE;
public PDOMCPPConstructorInstance(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method,
- PDOMBinding instantiated, IASTNode point) throws CoreException {
- super(linkage, parent, method, instantiated, point);
- linkage.new ConfigureConstructorInstance(method, this, point);
+ PDOMBinding instantiated) throws CoreException {
+ super(linkage, parent, method, instantiated);
+ linkage.new ConfigureConstructorInstance(method, this);
}
public PDOMCPPConstructorInstance(PDOMLinkage linkage, long bindingRecord) {
@@ -68,14 +68,20 @@ public class PDOMCPPConstructorInstance extends PDOMCPPMethodInstance
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr())
return null;
try {
ICPPExecution exec = getLinkage().loadExecution(record + CONSTRUCTOR_CHAIN);
if (exec == null) {
- exec = CPPTemplates.instantiateConstructorChain(this, point);
+ exec = CPPTemplates.instantiateConstructorChain(this);
}
return exec;
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java
index edf0742e99b..9bb81bdce18 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorSpecialization.java
@@ -38,9 +38,9 @@ class PDOMCPPConstructorSpecialization extends PDOMCPPMethodSpecialization
protected static final int RECORD_SIZE = CONSTRUCTOR_CHAIN + Database.EXECUTION_SIZE;
public PDOMCPPConstructorSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
- ICPPConstructor constructor, PDOMBinding specialized, IASTNode point) throws CoreException {
- super(linkage, parent, constructor, specialized, point);
- linkage.new ConfigureConstructorSpecialization(constructor, this, point);
+ ICPPConstructor constructor, PDOMBinding specialized) throws CoreException {
+ super(linkage, parent, constructor, specialized);
+ linkage.new ConfigureConstructorSpecialization(constructor, this);
}
public PDOMCPPConstructorSpecialization(PDOMLinkage linkage, long bindingRecord) {
@@ -68,14 +68,20 @@ class PDOMCPPConstructorSpecialization extends PDOMCPPMethodSpecialization
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr())
return null;
try {
ICPPExecution exec = getLinkage().loadExecution(record + CONSTRUCTOR_CHAIN);
if (exec == null) {
- exec = CPPTemplates.instantiateConstructorChain(this, point);
+ exec = CPPTemplates.instantiateConstructorChain(this);
}
return exec;
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java
index d9fb5e28d29..4797cd133aa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplate.java
@@ -35,9 +35,9 @@ class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements ICPPCo
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = CONSTRUCTOR_CHAIN + Database.EXECUTION_SIZE;
- public PDOMCPPConstructorTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method,
- IASTNode point) throws CoreException, DOMException {
- super(linkage, parent, method, point);
+ public PDOMCPPConstructorTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPConstructor method)
+ throws CoreException, DOMException {
+ super(linkage, parent, method);
linkage.new ConfigureConstructorTemplate(method, this);
}
@@ -64,7 +64,13 @@ class PDOMCPPConstructorTemplate extends PDOMCPPMethodTemplate implements ICPPCo
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr())
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java
index 42eb13c2d9c..78d3311d742 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPConstructorTemplateSpecialization.java
@@ -36,9 +36,9 @@ class PDOMCPPConstructorTemplateSpecialization extends PDOMCPPMethodTemplateSpec
protected static final int RECORD_SIZE = CONSTRUCTOR_CHAIN + Database.EXECUTION_SIZE;
public PDOMCPPConstructorTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
- ICPPConstructor constructor, PDOMBinding specialized, IASTNode point) throws CoreException {
- super(linkage, parent, constructor, specialized, point);
- linkage.new ConfigureConstructorTemplateSpecialization(constructor, this, point);
+ ICPPConstructor constructor, PDOMBinding specialized) throws CoreException {
+ super(linkage, parent, constructor, specialized);
+ linkage.new ConfigureConstructorTemplateSpecialization(constructor, this);
}
public PDOMCPPConstructorTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) {
@@ -66,14 +66,20 @@ class PDOMCPPConstructorTemplateSpecialization extends PDOMCPPMethodTemplateSpec
}
@Override
+ @Deprecated
public ICPPExecution getConstructorChainExecution(IASTNode point) {
+ return getConstructorChainExecution();
+ }
+
+ @Override
+ public ICPPExecution getConstructorChainExecution() {
if (!isConstexpr())
return null;
try {
ICPPExecution exec = getLinkage().loadExecution(record + CONSTRUCTOR_CHAIN);
if (exec == null) {
- exec = CPPTemplates.instantiateConstructorChain(this, point);
+ exec = CPPTemplates.instantiateConstructorChain(this);
}
return exec;
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
index 0a6f1b741c4..2e6d170886e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
@@ -18,7 +18,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -68,7 +67,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
storeProperties((ICPPEnumeration) newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerationSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerationSpecialization.java
index 9449ef42b5a..d4742259d66 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerationSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerationSpecialization.java
@@ -17,7 +17,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMNode;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -75,7 +74,7 @@ class PDOMCPPEnumerationSpecialization extends PDOMCPPSpecialization
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
storeProperties((ICPPEnumeration) newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java
index a4bb144b0c9..7ec4cd9aee7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumerator.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -66,7 +65,7 @@ class PDOMCPPEnumerator extends PDOMCPPBinding implements IPDOMCPPEnumerator {
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IEnumerator) {
IValue value= ((IEnumerator) newBinding).getValue();
if (value != null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeratorSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeratorSpecialization.java
index 071a655bcc1..ce213f1465a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeratorSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeratorSpecialization.java
@@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -66,7 +65,7 @@ class PDOMCPPEnumeratorSpecialization extends PDOMCPPSpecialization implements I
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IEnumerator) {
IValue value= ((IEnumerator) newBinding).getValue();
if (value != null) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
index 4614a68f3b3..a35e58894da 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPField.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
@@ -44,8 +43,8 @@ class PDOMCPPField extends PDOMCPPVariable implements ICPPField {
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
- super.update(linkage, newBinding, point);
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
+ super.update(linkage, newBinding);
if (newBinding instanceof ICPPField) {
setFieldPosition((ICPPField)newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java
index 9068cb45d9d..5b8307b0aab 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunction.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
@@ -93,7 +92,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
private ICPPFunctionType fDeclaredType;
public PDOMCPPFunction(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunction function,
- boolean setTypes, IASTNode point) throws CoreException, DOMException {
+ boolean setTypes) throws CoreException, DOMException {
super(linkage, parent, function.getNameCharArray());
Database db = getDB();
Integer sigHash = IndexCPPSignatureUtil.getSignatureHash(function);
@@ -101,7 +100,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
db.putShort(record + ANNOTATION, getAnnotations(function));
db.putShort(record + REQUIRED_ARG_COUNT, (short) function.getRequiredArgumentCount());
if (setTypes) {
- linkage.new ConfigureFunction(function, this, point);
+ linkage.new ConfigureFunction(function, this);
}
}
@@ -123,7 +122,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (!(newBinding instanceof ICPPFunction))
return;
@@ -180,7 +179,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
if (oldRec != 0) {
PDOMCPPTypeList.clearTypes(this, oldRec);
}
- linkage.storeExecution(record + FUNCTION_BODY, CPPFunction.getFunctionBodyExecution(func, point));
+ linkage.storeExecution(record + FUNCTION_BODY, CPPFunction.getFunctionBodyExecution(func));
}
private void storeExceptionSpec(IType[] exceptionSpec) throws CoreException {
@@ -429,7 +428,7 @@ class PDOMCPPFunction extends PDOMCPPBinding implements ICPPFunction, IPDOMOverl
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
if (!isConstexpr())
return null;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java
index 79f309e9811..97a418ee893 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionInstance.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
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.ICPPFunctionInstance;
@@ -40,8 +39,8 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I
protected static final int RECORD_SIZE = PDOMCPPFunctionSpecialization.RECORD_SIZE + 8;
public PDOMCPPFunctionInstance(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunction function,
- PDOMBinding orig, IASTNode point) throws CoreException {
- super(linkage, parent, function, orig, point);
+ PDOMBinding orig) throws CoreException {
+ super(linkage, parent, function, orig);
final Database db = getDB();
long exceptSpecRec = PDOMCPPTypeList.putTypes(this, function.getExceptionSpecification());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java
index 367e7ef4216..b06919bc306 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionSpecialization.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -74,14 +73,14 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
private int fRequiredArgCount= -1;
public PDOMCPPFunctionSpecialization(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunction astFunction,
- PDOMBinding specialized, IASTNode point) throws CoreException {
+ PDOMBinding specialized) throws CoreException {
super(linkage, parent, (ICPPSpecialization) astFunction, specialized);
Database db = getDB();
fAnnotations = PDOMCPPAnnotations.encodeFunctionAnnotations(astFunction);
db.putShort(record + ANNOTATION, fAnnotations);
db.putShort(record + REQUIRED_ARG_COUNT , (short) astFunction.getRequiredArgumentCount());
- linkage.new ConfigureFunctionSpecialization(astFunction, this, specialized, point);
+ linkage.new ConfigureFunctionSpecialization(astFunction, this, specialized);
}
public PDOMCPPFunctionSpecialization(PDOMLinkage linkage, long bindingRecord) {
@@ -326,14 +325,14 @@ class PDOMCPPFunctionSpecialization extends PDOMCPPSpecialization
}
@Override
- public ICPPExecution getFunctionBodyExecution(IASTNode point) {
+ public ICPPExecution getFunctionBodyExecution() {
if (!isConstexpr())
return null;
try {
ICPPExecution exec = getLinkage().loadExecution(record + FUNCTION_BODY);
if (exec == null) {
- exec = CPPTemplates.instantiateFunctionBody(this, point);
+ exec = CPPTemplates.instantiateFunctionBody(this);
}
return exec;
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java
index 0a5e65f73ae..b885352a541 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplate.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
@@ -43,15 +42,15 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
private volatile IPDOMCPPTemplateParameter[] params; // Cached template parameters.
- public PDOMCPPFunctionTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunctionTemplate template,
- IASTNode point) throws CoreException, DOMException {
- super(linkage, parent, template, false, point);
+ public PDOMCPPFunctionTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPFunctionTemplate template)
+ throws CoreException, DOMException {
+ super(linkage, parent, template, false);
final ICPPTemplateParameter[] origParams= template.getTemplateParameters();
params = PDOMTemplateParameterArray.createPDOMTemplateParameters(linkage, this, origParams);
final Database db = getDB();
long rec= PDOMTemplateParameterArray.putArray(db, params);
db.putRecPtr(record + TEMPLATE_PARAMS, rec);
- linkage.new ConfigureFunctionTemplate(template, this, point);
+ linkage.new ConfigureFunctionTemplate(template, this);
}
public PDOMCPPFunctionTemplate(PDOMLinkage linkage, long bindingRecord) {
@@ -59,7 +58,7 @@ class PDOMCPPFunctionTemplate extends PDOMCPPFunction
}
@Override
- public void update(PDOMLinkage linkage, IBinding name, IASTNode point) {
+ public void update(PDOMLinkage linkage, IBinding name) {
// no support for updating templates, yet.
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java
index 40dac071cfa..5ec80ae85a8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFunctionTemplateSpecialization.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
@@ -33,8 +32,8 @@ class PDOMCPPFunctionTemplateSpecialization extends PDOMCPPFunctionSpecializatio
implements ICPPFunctionTemplate, ICPPInstanceCache, IPDOMMemberOwner {
public PDOMCPPFunctionTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
- ICPPFunctionTemplate template, PDOMBinding specialized, IASTNode point) throws CoreException {
- super(linkage, parent, template, specialized, point);
+ ICPPFunctionTemplate template, PDOMBinding specialized) throws CoreException {
+ super(linkage, parent, template, specialized);
}
public PDOMCPPFunctionTemplateSpecialization(PDOMLinkage linkage, long bindingRecord) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
index 3b22799aa91..a79dd854fcd 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java
@@ -115,6 +115,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPExecution;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalEnumerator;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinary;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.EvalBinaryTypeId;
@@ -192,13 +193,6 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
// Only used when writing to database, which is single-threaded
private final LinkedList<Runnable> postProcesses = new LinkedList<Runnable>();
- // The point of instantiation for name lookups.
- // This is set by onCreateName() and the top-level addBinding() call for
- // their duration, and picked up by nested addBinding() calls. This avoids
- // having to pass it around to every function that is called between
- // (which is a lot of functions).
- private IASTName pointOfInstantiation = null;
-
public PDOMCPPLinkage(PDOM pdom, long record) {
super(pdom, record);
}
@@ -297,14 +291,14 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final IType[] fOriginalExceptionSpec;
private final ICPPExecution fFunctionBody;
- public ConfigureFunction(ICPPFunction original, PDOMCPPFunction function, IASTNode point)
+ public ConfigureFunction(ICPPFunction original, PDOMCPPFunction function)
throws DOMException {
fFunction = function;
fOriginalFunctionType= original.getType();
fDeclaredType = original.getDeclaredType();
fOriginalParameters= original.getParameters();
fOriginalExceptionSpec= function.extractExceptionSpec(original);
- fFunctionBody = CPPFunction.getFunctionBodyExecution(original, point);
+ fFunctionBody = CPPFunction.getFunctionBodyExecution(original);
postProcesses.add(this);
}
@@ -321,7 +315,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
public ConfigureConstructor(ICPPConstructor original, PDOMCPPConstructor constructor) {
fConstructor = constructor;
- fConstructorChain = original.getConstructorChainExecution(null);
+ fConstructorChain = original.getConstructorChainExecution();
postProcesses.add(this);
}
@@ -342,7 +336,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final ICPPExecution fFunctionBody;
public ConfigureFunctionSpecialization(ICPPFunction original, PDOMCPPFunctionSpecialization spec,
- PDOMBinding specialized, IASTNode point) {
+ PDOMBinding specialized) {
fSpec = spec;
fSpecialized = specialized;
fType = original.getType();
@@ -358,7 +352,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
if (!(original instanceof ICPPTemplateInstance)
|| ((ICPPTemplateInstance) original).isExplicitSpecialization()) {
- fFunctionBody = CPPFunction.getFunctionBodyExecution(original, point);
+ fFunctionBody = CPPFunction.getFunctionBodyExecution(original);
} else {
fFunctionBody = null; // will be instantiated on request
}
@@ -377,9 +371,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final ICPPExecution fConstructorChain;
public ConfigureConstructorSpecialization(ICPPConstructor original,
- PDOMCPPConstructorSpecialization constructor, IASTNode point) {
+ PDOMCPPConstructorSpecialization constructor) {
fConstructor = constructor;
- fConstructorChain = original.getConstructorChainExecution(point);
+ fConstructorChain = original.getConstructorChainExecution();
postProcesses.add(this);
}
@@ -409,10 +403,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final PDOMCPPConstructorInstance fConstructor;
private final ICPPExecution fConstructorChain;
- public ConfigureConstructorInstance(ICPPConstructor original, PDOMCPPConstructorInstance constructor,
- IASTNode point) {
+ public ConfigureConstructorInstance(ICPPConstructor original, PDOMCPPConstructorInstance constructor) {
fConstructor = constructor;
- fConstructorChain = original.getConstructorChainExecution(point);
+ fConstructorChain = original.getConstructorChainExecution();
postProcesses.add(this);
}
@@ -432,8 +425,8 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final IType[] fOriginalExceptionSpec;
private final ICPPExecution fFunctionBody;
- public ConfigureFunctionTemplate(ICPPFunctionTemplate original, PDOMCPPFunctionTemplate template,
- IASTNode point) throws DOMException {
+ public ConfigureFunctionTemplate(ICPPFunctionTemplate original, PDOMCPPFunctionTemplate template)
+ throws DOMException {
fTemplate = template;
fTemplateParameters= template.getTemplateParameters();
fOriginalTemplateParameters= original.getTemplateParameters();
@@ -441,7 +434,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
fDeclaredType = original.getDeclaredType();
fOriginalParameters= original.getParameters();
fOriginalExceptionSpec= template.extractExceptionSpec(original);
- fFunctionBody = CPPFunction.getFunctionBodyExecution(original, point);
+ fFunctionBody = CPPFunction.getFunctionBodyExecution(original);
postProcesses.add(this);
}
@@ -463,7 +456,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
public ConfigureConstructorTemplate(ICPPConstructor original, PDOMCPPConstructorTemplate constructor) {
fConstructor = constructor;
- fConstructorChain = original.getConstructorChainExecution(null);
+ fConstructorChain = original.getConstructorChainExecution();
postProcesses.add(this);
}
@@ -478,9 +471,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
private final ICPPExecution fConstructorChain;
public ConfigureConstructorTemplateSpecialization(ICPPConstructor original,
- PDOMCPPConstructorTemplateSpecialization constructor, IASTNode point) {
+ PDOMCPPConstructorTemplateSpecialization constructor) {
fConstructor = constructor;
- fConstructorChain = original.getConstructorChainExecution(point);
+ fConstructorChain = original.getConstructorChainExecution();
postProcesses.add(this);
}
@@ -623,7 +616,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
try {
// For the duration of this call, record the name being added
// to the index as the point of instantiation for name lookups.
- pointOfInstantiation = name;
+ CPPSemantics.pushLookupPoint(name);
PDOMBinding pdomBinding = addBinding(binding, name);
@@ -637,7 +630,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
if (pdomBinding instanceof PDOMCPPClassType || pdomBinding instanceof PDOMCPPClassSpecialization) {
if (binding instanceof ICPPClassType && name.isDefinition()) {
- addImplicitMethods(pdomBinding, (ICPPClassType) binding, name);
+ addImplicitMethods(pdomBinding, (ICPPClassType) binding);
}
}
@@ -648,7 +641,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return pdomBinding;
} finally {
- pointOfInstantiation = null;
+ CPPSemantics.popLookupPoint();
}
}
@@ -657,63 +650,71 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
* then an existing binding is updated with the properties of the name.
*/
private PDOMBinding addBinding(IBinding inputBinding, IASTName fromName) throws CoreException {
- IASTNode point = fromName != null ? fromName : pointOfInstantiation;
-
- if (inputBinding instanceof CompositeIndexBinding) {
- inputBinding= ((CompositeIndexBinding) inputBinding).getRawBinding();
- }
-
- if (cannotAdapt(inputBinding)) {
- return null;
- }
-
- PDOMBinding pdomBinding= attemptFastAdaptBinding(inputBinding);
- if (pdomBinding == null) {
- // Assign names to anonymous types.
- IBinding binding= PDOMASTAdapter.getAdapterForAnonymousASTBinding(inputBinding);
- if (binding == null)
- return null;
-
- final PDOMNode parent= adaptOrAddParent(true, binding);
- if (parent == null)
+ try {
+ if (fromName != null) {
+ CPPSemantics.pushLookupPoint(fromName);
+ }
+
+ if (inputBinding instanceof CompositeIndexBinding) {
+ inputBinding= ((CompositeIndexBinding) inputBinding).getRawBinding();
+ }
+
+ if (cannotAdapt(inputBinding)) {
return null;
-
- long fileLocalRec[]= {0};
- pdomBinding = adaptBinding(parent, binding, fileLocalRec);
+ }
+
+ PDOMBinding pdomBinding= attemptFastAdaptBinding(inputBinding);
if (pdomBinding == null) {
- try {
- pdomBinding = createBinding(parent, binding, fileLocalRec[0], point);
- if (pdomBinding != null) {
- getPDOM().putCachedResult(inputBinding, pdomBinding);
- if (inputBinding instanceof CPPClosureType) {
- addImplicitMethods(pdomBinding, (ICPPClassType) binding, point);
+ // Assign names to anonymous types.
+ IBinding binding= PDOMASTAdapter.getAdapterForAnonymousASTBinding(inputBinding);
+ if (binding == null)
+ return null;
+
+ final PDOMNode parent= adaptOrAddParent(true, binding);
+ if (parent == null)
+ return null;
+
+ long fileLocalRec[]= {0};
+ pdomBinding = adaptBinding(parent, binding, fileLocalRec);
+ if (pdomBinding == null) {
+ try {
+ pdomBinding = createBinding(parent, binding, fileLocalRec[0]);
+ if (pdomBinding != null) {
+ getPDOM().putCachedResult(inputBinding, pdomBinding);
+ if (inputBinding instanceof CPPClosureType) {
+ addImplicitMethods(pdomBinding, (ICPPClassType) binding);
+ }
+
+ // Synchronize the tags associated with the persistent binding to match
+ // the set that is associated with the input binding.
+ TagManager.getInstance().syncTags(pdomBinding, inputBinding);
}
-
- // Synchronize the tags associated with the persistent binding to match
- // the set that is associated with the input binding.
- TagManager.getInstance().syncTags(pdomBinding, inputBinding);
+ } catch (DOMException e) {
+ throw new CoreException(Util.createStatus(e));
}
- } catch (DOMException e) {
- throw new CoreException(Util.createStatus(e));
+ return pdomBinding;
}
- return pdomBinding;
+
+ getPDOM().putCachedResult(inputBinding, pdomBinding);
+ }
+
+ if (fromName != null && shouldUpdate(pdomBinding, fromName)) {
+ IBinding fromBinding = fromName.getBinding();
+
+ pdomBinding.update(this, fromBinding);
+
+ // Update the tags based on the tags from the new binding. This cannot be done in
+ // PDOMBinding.update, because not all subclasses (e.g., PDOMCPPFunction) call
+ // the superclass implementation.
+ TagManager.getInstance().syncTags(pdomBinding, fromBinding);
+ }
+
+ return pdomBinding;
+ } finally {
+ if (fromName != null) {
+ CPPSemantics.popLookupPoint();
}
-
- getPDOM().putCachedResult(inputBinding, pdomBinding);
- }
-
- if (fromName != null && shouldUpdate(pdomBinding, fromName)) {
- IBinding fromBinding = fromName.getBinding();
-
- pdomBinding.update(this, fromBinding, fromName);
-
- // Update the tags based on the tags from the new binding. This cannot be done in
- // PDOMBinding.update, because not all subclasses (e.g., PDOMCPPFunction) call
- // the superclass implementation.
- TagManager.getInstance().syncTags(pdomBinding, fromBinding);
}
-
- return pdomBinding;
}
private boolean shouldUpdate(PDOMBinding pdomBinding, IASTName fromName) throws CoreException {
@@ -742,7 +743,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return !getPDOM().hasLastingDefinition(pdomBinding);
}
- PDOMBinding createBinding(PDOMNode parent, IBinding binding, long fileLocalRec, IASTNode point)
+ PDOMBinding createBinding(PDOMNode parent, IBinding binding, long fileLocalRec)
throws CoreException, DOMException {
PDOMBinding pdomBinding= null;
PDOMNode parent2= null;
@@ -759,7 +760,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
if (pdomSpecialized == null)
return null;
- pdomBinding = createSpecialization(parent, pdomSpecialized, binding, point);
+ pdomBinding = createSpecialization(parent, pdomSpecialized, binding);
} else if (binding instanceof ICPPPartialSpecialization) {
ICPPTemplateDefinition primary = ((ICPPPartialSpecialization) binding).getPrimaryTemplate();
PDOMBinding pdomPrimary = addBinding(primary, null);
@@ -810,22 +811,22 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
pdomBinding = new PDOMCPPVariable(this, parent, var, true);
} else if (binding instanceof ICPPFunctionTemplate) {
if (binding instanceof ICPPConstructor) {
- pdomBinding= new PDOMCPPConstructorTemplate(this, parent, (ICPPConstructor) binding, point);
+ pdomBinding= new PDOMCPPConstructorTemplate(this, parent, (ICPPConstructor) binding);
} else if (binding instanceof ICPPMethod) {
- pdomBinding= new PDOMCPPMethodTemplate(this, parent, (ICPPMethod) binding, point);
+ pdomBinding= new PDOMCPPMethodTemplate(this, parent, (ICPPMethod) binding);
} else if (binding instanceof ICPPFunction) {
- pdomBinding= new PDOMCPPFunctionTemplate(this, parent, (ICPPFunctionTemplate) binding, point);
+ pdomBinding= new PDOMCPPFunctionTemplate(this, parent, (ICPPFunctionTemplate) binding);
}
} else if (binding instanceof ICPPConstructor) {
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
- pdomBinding = new PDOMCPPConstructor(this, parent, (ICPPConstructor) binding, point);
+ pdomBinding = new PDOMCPPConstructor(this, parent, (ICPPConstructor) binding);
}
} else if (binding instanceof ICPPMethod) {
if (parent instanceof PDOMCPPClassType || parent instanceof PDOMCPPClassSpecialization) {
- pdomBinding = new PDOMCPPMethod(this, parent, (ICPPMethod) binding, point);
+ pdomBinding = new PDOMCPPMethod(this, parent, (ICPPMethod) binding);
}
} else if (binding instanceof ICPPFunction) {
- pdomBinding = new PDOMCPPFunction(this, parent, (ICPPFunction) binding, true, point);
+ pdomBinding = new PDOMCPPFunction(this, parent, (ICPPFunction) binding, true);
} else if (binding instanceof ICPPNamespaceAlias) {
pdomBinding = new PDOMCPPNamespaceAlias(this, parent, (ICPPNamespaceAlias) binding);
} else if (binding instanceof ICPPNamespace) {
@@ -928,16 +929,16 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
}
- private PDOMBinding createSpecialization(PDOMNode parent, PDOMBinding orig, IBinding special,
- IASTNode point) throws CoreException, DOMException {
+ private PDOMBinding createSpecialization(PDOMNode parent, PDOMBinding orig, IBinding special)
+ throws CoreException, DOMException {
PDOMBinding result= null;
if (special instanceof ICPPTemplateInstance) {
if (special instanceof ICPPConstructor && orig instanceof ICPPConstructor) {
- result= new PDOMCPPConstructorInstance(this, parent, (ICPPConstructor) special, orig, point);
+ result= new PDOMCPPConstructorInstance(this, parent, (ICPPConstructor) special, orig);
} else if (special instanceof ICPPMethod && orig instanceof ICPPMethod) {
- result= new PDOMCPPMethodInstance(this, parent, (ICPPMethod) special, orig, point);
+ result= new PDOMCPPMethodInstance(this, parent, (ICPPMethod) special, orig);
} else if (special instanceof ICPPFunction && orig instanceof ICPPFunction) {
- result= new PDOMCPPFunctionInstance(this, parent, (ICPPFunction) special, orig, point);
+ result= new PDOMCPPFunctionInstance(this, parent, (ICPPFunction) special, orig);
} else if (special instanceof ICPPClassType && orig instanceof ICPPClassType) {
result= new PDOMCPPClassInstance(this, parent, (ICPPClassType) special, orig);
} else if (special instanceof ICPPField && orig instanceof ICPPField) {
@@ -951,11 +952,11 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
result= new PDOMCPPFieldSpecialization(this, parent, (ICPPField) special, orig);
} else if (special instanceof ICPPFunctionTemplate) {
if (special instanceof ICPPConstructor) {
- result= new PDOMCPPConstructorTemplateSpecialization(this, parent, (ICPPConstructor) special, orig, point);
+ result= new PDOMCPPConstructorTemplateSpecialization(this, parent, (ICPPConstructor) special, orig);
} else if (special instanceof ICPPMethod) {
- result= new PDOMCPPMethodTemplateSpecialization(this, parent, (ICPPMethod) special, orig, point);
+ result= new PDOMCPPMethodTemplateSpecialization(this, parent, (ICPPMethod) special, orig);
} else if (special instanceof ICPPFunction) {
- result= new PDOMCPPFunctionTemplateSpecialization(this, parent, (ICPPFunctionTemplate) special, orig, point);
+ result= new PDOMCPPFunctionTemplateSpecialization(this, parent, (ICPPFunctionTemplate) special, orig);
}
} else if (special instanceof ICPPClassTemplatePartialSpecialization) {
ICPPClassTemplatePartialSpecialization partialSpecSpec = (ICPPClassTemplatePartialSpecialization) special;
@@ -966,11 +967,11 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
partialSpecSpec, (PDOMCPPClassTemplateSpecialization) pdomPrimarySpec);
}
} else if (special instanceof ICPPConstructor) {
- result= new PDOMCPPConstructorSpecialization(this, parent, (ICPPConstructor) special, orig, point);
+ result= new PDOMCPPConstructorSpecialization(this, parent, (ICPPConstructor) special, orig);
} else if (special instanceof ICPPMethod) {
- result= new PDOMCPPMethodSpecialization(this, parent, (ICPPMethod) special, orig, point);
+ result= new PDOMCPPMethodSpecialization(this, parent, (ICPPMethod) special, orig);
} else if (special instanceof ICPPFunction) {
- result= new PDOMCPPFunctionSpecialization(this, parent, (ICPPFunction) special, orig, point);
+ result= new PDOMCPPFunctionSpecialization(this, parent, (ICPPFunction) special, orig);
} else if (special instanceof ICPPClassTemplate) {
result= new PDOMCPPClassTemplateSpecialization(this, parent, (ICPPClassTemplate) special, orig);
} else if (special instanceof ICPPClassType) {
@@ -990,23 +991,23 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
return result;
}
- private void addImplicitMethods(PDOMBinding type, ICPPClassType binding, IASTNode point) throws CoreException {
+ private void addImplicitMethods(PDOMBinding type, ICPPClassType binding) throws CoreException {
try {
final long fileLocalRec= type.getLocalToFileRec();
IScope scope = binding.getCompositeScope();
if (scope instanceof ICPPClassScope) {
List<ICPPMethod> old= new ArrayList<>();
if (type instanceof ICPPClassType) {
- ArrayUtil.addAll(old, ClassTypeHelper.getImplicitMethods((ICPPClassType) type, point));
+ ArrayUtil.addAll(old, ClassTypeHelper.getImplicitMethods((ICPPClassType) type));
}
- ICPPMethod[] implicit= ClassTypeHelper.getImplicitMethods(scope, point);
+ ICPPMethod[] implicit= ClassTypeHelper.getImplicitMethods(scope);
for (ICPPMethod method : implicit) {
if (!(method instanceof IProblemBinding)) {
PDOMBinding pdomBinding= adaptBinding(method);
if (pdomBinding == null) {
- pdomBinding = createBinding(type, method, fileLocalRec, point);
+ pdomBinding = createBinding(type, method, fileLocalRec);
} else if (!getPDOM().hasLastingDefinition(pdomBinding)) {
- pdomBinding.update(this, method, point);
+ pdomBinding.update(this, method);
old.remove(pdomBinding);
// Update the tags based on the tags from the new binding. This was in
@@ -1018,7 +1019,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
}
for (ICPPMethod method : old) {
if (method instanceof PDOMBinding)
- ((PDOMBinding) method).update(this, null, null);
+ ((PDOMBinding) method).update(this, null);
}
}
} catch (DOMException e) {
@@ -1397,10 +1398,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
super.onCreateName(file, name, pdomName);
try {
- pointOfInstantiation = name;
+ CPPSemantics.pushLookupPoint(name);
onCreateNameHelper(file, name, pdomName);
} finally {
- pointOfInstantiation = null;
+ CPPSemantics.popLookupPoint();
}
}
@@ -1476,7 +1477,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
} else if (parentNode instanceof ICPPASTCompositeTypeSpecifier) {
IBinding classBinding = name.resolveBinding();
if (classBinding instanceof ICPPClassType) {
- ICPPBase[] bases = ClassTypeHelper.getBases((ICPPClassType)classBinding, name);
+ ICPPBase[] bases = ((ICPPClassType) classBinding).getBases();
if (bases.length > 0) {
PDOMBinding pdomBinding = pdomName.getBinding();
if (pdomBinding instanceof PDOMCPPClassType) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java
index cfaf840cdc2..cfa88d9d8a3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java
@@ -49,9 +49,9 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
private byte methodAnnotation= -1;
- public PDOMCPPMethod(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method, IASTNode point)
+ public PDOMCPPMethod(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method)
throws CoreException, DOMException {
- super(linkage, parent, method, true, point);
+ super(linkage, parent, method, true);
methodAnnotation= PDOMCPPAnnotations.encodeExtraMethodAnnotations(method);
getDB().putByte(record + METHOD_ANNOTATION, methodAnnotation);
}
@@ -61,10 +61,10 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
}
@Override
- public final void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public final void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPMethod) {
ICPPMethod method= (ICPPMethod) newBinding;
- super.update(linkage, newBinding, point);
+ super.update(linkage, newBinding);
methodAnnotation= -1;
byte annot = PDOMCPPAnnotations.encodeExtraMethodAnnotations(method);
getDB().putByte(record + METHOD_ANNOTATION, annot);
@@ -221,7 +221,7 @@ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod {
@Override
public IType[] getExceptionSpecification() {
if (isImplicit()) {
- return ClassTypeHelper.getInheritedExceptionSpecification(this, null);
+ return ClassTypeHelper.getInheritedExceptionSpecification(this);
}
return super.getExceptionSpecification();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java
index 3ecb13a18a8..7167ed5a05d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodInstance.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
@@ -32,8 +31,8 @@ class PDOMCPPMethodInstance extends PDOMCPPFunctionInstance implements ICPPMetho
protected static final int RECORD_SIZE = PDOMCPPFunctionInstance.RECORD_SIZE + 0;
public PDOMCPPMethodInstance(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method,
- PDOMBinding instantiated, IASTNode point) throws CoreException {
- super(linkage, parent, method, instantiated, point);
+ PDOMBinding instantiated) throws CoreException {
+ super(linkage, parent, method, instantiated);
}
public PDOMCPPMethodInstance(PDOMLinkage linkage, long bindingRecord) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java
index 30dbc23b86b..bada85b0d6e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodSpecialization.java
@@ -42,8 +42,8 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization implemen
protected static final int RECORD_SIZE = PDOMCPPFunctionSpecialization.RECORD_SIZE + 1;
public PDOMCPPMethodSpecialization(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method,
- PDOMBinding specialized, IASTNode point) throws CoreException {
- super(linkage, parent, method, specialized, point);
+ PDOMBinding specialized) throws CoreException {
+ super(linkage, parent, method, specialized);
Database db = getDB();
byte annotation = PDOMCPPAnnotations.encodeExtraMethodAnnotations(method);
@@ -113,7 +113,7 @@ class PDOMCPPMethodSpecialization extends PDOMCPPFunctionSpecialization implemen
@Override
public IType[] getExceptionSpecification(IASTNode point) {
if (isImplicit()) {
- return ClassTypeHelper.getInheritedExceptionSpecification(this, point);
+ return ClassTypeHelper.getInheritedExceptionSpecification(this);
}
return super.getExceptionSpecification();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java
index 426fe281dac..343823f361e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplate.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@@ -34,9 +33,9 @@ class PDOMCPPMethodTemplate extends PDOMCPPFunctionTemplate implements ICPPMetho
private byte methodAnnotation= -1;
- public PDOMCPPMethodTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method, IASTNode point)
+ public PDOMCPPMethodTemplate(PDOMCPPLinkage linkage, PDOMNode parent, ICPPMethod method)
throws CoreException, DOMException {
- super(linkage, parent, (ICPPFunctionTemplate) method, point);
+ super(linkage, parent, (ICPPFunctionTemplate) method);
methodAnnotation = PDOMCPPAnnotations.encodeExtraMethodAnnotations(method);
getDB().putByte(record + METHOD_ANNOTATION, methodAnnotation);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java
index 201138c0298..4a1d0edfa80 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethodTemplateSpecialization.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
@@ -41,8 +40,8 @@ class PDOMCPPMethodTemplateSpecialization extends PDOMCPPFunctionTemplateSpecial
private volatile IPDOMCPPTemplateParameter[] fTemplateParameters;
public PDOMCPPMethodTemplateSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
- ICPPMethod method, PDOMBinding specialized, IASTNode point) throws CoreException {
- super(linkage, parent, (ICPPFunctionTemplate) method, specialized, point);
+ ICPPMethod method, PDOMBinding specialized) throws CoreException {
+ super(linkage, parent, (ICPPFunctionTemplate) method, specialized);
computeTemplateParameters((ICPPFunctionTemplate) method); // Sets fTemplateParameters
final Database db = getDB();
long rec = PDOMTemplateParameterArray.putArray(db, fTemplateParameters);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java
index 21bdb0eb6f6..d092dbd718e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java
@@ -22,7 +22,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
@@ -77,7 +76,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
updateFlag((ICPPNamespace) newBinding);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java
index e2da43ac50b..0988353f308 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespaceAlias.java
@@ -13,7 +13,6 @@
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
@@ -44,7 +43,7 @@ class PDOMCPPNamespaceAlias extends PDOMCPPBinding implements ICPPNamespaceAlias
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPNamespaceAlias) {
ICPPNamespaceAlias alias= (ICPPNamespaceAlias) newBinding;
IBinding newTarget= alias.getBinding();
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
index 8b8f544585f..8622dceff3a 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateNonTypeParameter.java
@@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -82,7 +81,7 @@ class PDOMCPPTemplateNonTypeParameter extends PDOMCPPBinding
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPTemplateNonTypeParameter) {
ICPPTemplateNonTypeParameter ntp= (ICPPTemplateNonTypeParameter) newBinding;
updateName(newBinding.getNameCharArray());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
index 5c2f2da54ea..aeacb1e8329 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTemplateParameter.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IScope;
@@ -203,7 +202,7 @@ public class PDOMCPPTemplateTemplateParameter extends PDOMCPPBinding
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPTemplateTemplateParameter) {
final Database db = getDB();
ICPPTemplateTemplateParameter ttp= (ICPPTemplateTemplateParameter) newBinding;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
index c1b6095c7e1..bdeeac1057e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTemplateTypeParameter.java
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
@@ -186,7 +185,7 @@ class PDOMCPPTemplateTypeParameter extends PDOMCPPBinding implements IPDOMMember
}
@Override
- public void update(PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPTemplateTypeParameter) {
ICPPTemplateTypeParameter ttp= (ICPPTemplateTypeParameter) newBinding;
updateName(newBinding.getNameCharArray());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java
index cb96b8e05b3..6e0db8e2456 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPTypedef.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
@@ -48,7 +47,7 @@ class PDOMCPPTypedef extends PDOMCPPBinding implements ITypedef, ITypeContainer,
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ITypedef) {
ITypedef td= (ITypedef) newBinding;
setType(linkage, td.getType());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java
index ab371778d1b..19b06748fad 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariable.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.core.pdom.dom.cpp;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -66,7 +65,7 @@ class PDOMCPPVariable extends PDOMCPPBinding implements ICPPVariable {
}
@Override
- public void update(final PDOMLinkage linkage, IBinding newBinding, IASTNode point) throws CoreException {
+ public void update(final PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof IVariable) {
final Database db = getDB();
ICPPVariable var= (ICPPVariable) newBinding;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplate.java
index ab20ee8ddaf..a627a42e501 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplate.java
@@ -15,7 +15,6 @@ import java.util.ArrayList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IValue;
@@ -63,7 +62,7 @@ public class PDOMCPPVariableTemplate extends PDOMCPPVariable implements ICPPVari
}
@Override
- public void update(PDOMLinkage linkage, IBinding name, IASTNode point) {
+ public void update(PDOMLinkage linkage, IBinding name) {
// No support for updating templates, yet.
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java
index 22ef847ea45..155a3efa8eb 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHQueries.java
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ILinkage;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
@@ -99,7 +98,7 @@ public class CHQueries {
if (calleeBinding != null) {
findCalledBy1(index, calleeBinding, true, project, result);
if (calleeBinding instanceof ICPPMethod) {
- IBinding[] overriddenBindings= ClassTypeHelper.findOverridden((ICPPMethod) calleeBinding, null);
+ IBinding[] overriddenBindings= ClassTypeHelper.findOverridden((ICPPMethod) calleeBinding);
for (IBinding overriddenBinding : overriddenBindings) {
findCalledBy1(index, overriddenBinding, false, project, result);
}
@@ -110,8 +109,7 @@ public class CHQueries {
private static void findCalledBy1(IIndex index, IBinding callee, boolean includeOrdinaryCalls,
ICProject project, CalledByResult result) throws CoreException {
findCalledBy2(index, callee, includeOrdinaryCalls, project, result);
- IASTNode point= null; // Instantiation of dependent expressions may not work.
- List<? extends IBinding> specializations = IndexUI.findSpecializations(index, callee, point);
+ List<? extends IBinding> specializations = IndexUI.findSpecializations(index, callee);
for (IBinding spec : specializations) {
findCalledBy2(index, spec, includeOrdinaryCalls, project, result);
}
@@ -177,7 +175,7 @@ public class CHQueries {
* if there are none.
*/
static ICElement[] findOverriders(IIndex index, ICPPMethod binding) throws CoreException {
- IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding, null);
+ IBinding[] virtualOverriders= ClassTypeHelper.findOverriders(index, binding);
if (virtualOverriders.length > 0) {
ArrayList<ICElementHandle> list= new ArrayList<ICElementHandle>();
list.addAll(Arrays.asList(IndexUI.findRepresentative(index, binding)));
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
index e3ba251197f..ecb83e3613a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OverrideIndicatorManager.java
@@ -30,7 +30,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
@@ -43,6 +42,7 @@ import org.eclipse.cdt.ui.CDTUITools;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.model.ASTStringUtil;
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
@@ -132,7 +132,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
if (binding instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod) binding;
try {
- ICPPMethod overriddenMethod = testForOverride(method, declarator);
+ CPPSemantics.pushLookupPoint(declarator);
+ ICPPMethod overriddenMethod = testForOverride(method);
if (overriddenMethod != null) {
try {
ICElementHandle baseDeclaration = IndexUI.findAnyDeclaration(index, null, overriddenMethod);
@@ -152,6 +153,8 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
}
}
} catch (DOMException e) {
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
@@ -181,18 +184,18 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
}
}
- private ICPPMethod testForOverride(ICPPMethod method, IASTNode point) throws DOMException {
+ private ICPPMethod testForOverride(ICPPMethod method) throws DOMException {
if (method.isDestructor() || method.isPureVirtual()) {
return null;
}
- ICPPBase[] bases = ClassTypeHelper.getBases(method.getClassOwner(), point);
+ ICPPBase[] bases = method.getClassOwner().getBases();
if (bases.length == 0) {
return null;
}
ICPPClassType owningClass = method.getClassOwner();
- ICPPMethod overriddenMethod = getOverriddenMethodInBaseClass(owningClass, method, point);
+ ICPPMethod overriddenMethod = getOverriddenMethodInBaseClass(owningClass, method);
if (overriddenMethod != null) {
StringBuilder sb = new StringBuilder();
@@ -221,7 +224,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
IBinding baseClass = base.getBaseClass();
if (baseClass instanceof ICPPClassType) {
indirectingClass = (ICPPClassType) baseClass;
- if (getOverriddenMethodInBaseClass(indirectingClass, method, point) != null)
+ if (getOverriddenMethodInBaseClass(indirectingClass, method) != null)
break;
}
}
@@ -240,8 +243,7 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
return null;
}
- private ICPPMethod getOverriddenMethodInBaseClass(ICPPClassType aClass, ICPPMethod testedMethod,
- IASTNode point) throws DOMException {
+ private ICPPMethod getOverriddenMethodInBaseClass(ICPPClassType aClass, ICPPMethod testedMethod) throws DOMException {
final String testedMethodName = testedMethod.getName();
ICPPMethod[] allInheritedMethods;
@@ -249,10 +251,10 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
allInheritedMethods = methodsCache.get(aClass);
} else {
ICPPMethod[] inheritedMethods = null;
- ICPPClassType[] bases= ClassTypeHelper.getAllBases(aClass, point);
+ ICPPClassType[] bases= ClassTypeHelper.getAllBases(aClass);
for (ICPPClassType base : bases) {
inheritedMethods = ArrayUtil.addAll(ICPPMethod.class, inheritedMethods,
- ClassTypeHelper.getDeclaredMethods(base, point));
+ base.getDeclaredMethods());
}
allInheritedMethods = ArrayUtil.trim(ICPPMethod.class, inheritedMethods);
methodsCache.put(aClass, allInheritedMethods);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
index 196ddd5f448..ccea383874f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
@@ -49,6 +49,7 @@ import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.model.ASTCache;
import org.eclipse.cdt.internal.core.parser.scanner.ASTPreprocessorName;
@@ -218,26 +219,31 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
}
private boolean visitNode(IASTNode node) {
- boolean consumed= false;
- fToken.update(node);
- for (int i= 0, n= fHighlightings.length; i < n; ++i) {
- SemanticHighlighting semanticHighlighting= fHighlightings[i];
- // If the semantic highlighting doesn't color expressions, don't bother
- // passing it one to begin with.
- if (node instanceof IASTExpression && !semanticHighlighting.requiresExpressions()) {
- continue;
- }
- if (fHighlightingStyles[i].isEnabled() && semanticHighlighting.consumes(fToken)) {
- IASTNodeLocation location = getLocationToHighlight(node);
- if (location != null) {
- highlightLocation(location, fHighlightingStyles[i]);
+ try {
+ CPPSemantics.pushLookupPoint(node);
+ boolean consumed= false;
+ fToken.update(node);
+ for (int i= 0, n= fHighlightings.length; i < n; ++i) {
+ SemanticHighlighting semanticHighlighting= fHighlightings[i];
+ // If the semantic highlighting doesn't color expressions, don't bother
+ // passing it one to begin with.
+ if (node instanceof IASTExpression && !semanticHighlighting.requiresExpressions()) {
+ continue;
+ }
+ if (fHighlightingStyles[i].isEnabled() && semanticHighlighting.consumes(fToken)) {
+ IASTNodeLocation location = getLocationToHighlight(node);
+ if (location != null) {
+ highlightLocation(location, fHighlightingStyles[i]);
+ }
+ consumed= true;
+ break;
}
- consumed= true;
- break;
}
+ fToken.clear();
+ return consumed;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- fToken.clear();
- return consumed;
}
/**
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
index b038bf48351..5f29508996f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java
@@ -333,7 +333,7 @@ public class SemanticHighlightings {
IBinding binding= token.getBinding();
if (binding instanceof IField) {
if (binding instanceof ICPPUnknownBinding) {
- if (heuristicallyResolvesToEnumerator((ICPPUnknownBinding) binding, node)) {
+ if (heuristicallyResolvesToEnumerator((ICPPUnknownBinding) binding)) {
return false;
}
}
@@ -1050,7 +1050,7 @@ public class SemanticHighlightings {
IBinding binding= token.getBinding();
if (binding instanceof ICompositeType && !(binding instanceof ICPPTemplateParameter)) {
if (binding instanceof ICPPUnknownBinding) {
- if (heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding, node)) {
+ if (heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding)) {
return false;
}
}
@@ -1107,7 +1107,7 @@ public class SemanticHighlightings {
return true;
}
if (binding instanceof ICPPUnknownBinding) {
- if (heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding, node)) {
+ if (heuristicallyResolvesToEnumeration((ICPPUnknownBinding) binding)) {
return true;
}
}
@@ -1408,7 +1408,7 @@ public class SemanticHighlightings {
return true;
}
if (binding instanceof ICPPUnknownBinding) {
- if (heuristicallyResolvesToEnumerator((ICPPUnknownBinding) binding, node)) {
+ if (heuristicallyResolvesToEnumerator((ICPPUnknownBinding) binding)) {
return true;
}
}
@@ -1783,13 +1783,13 @@ public class SemanticHighlightings {
}
}
- private static boolean heuristicallyResolvesToEnumeration(ICPPUnknownBinding binding, IASTNode point) {
- IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(binding, point);
+ private static boolean heuristicallyResolvesToEnumeration(ICPPUnknownBinding binding) {
+ IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(binding);
return resolved.length == 1 && resolved[0] instanceof IEnumeration;
}
- private static boolean heuristicallyResolvesToEnumerator(ICPPUnknownBinding binding, IASTNode point) {
- IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(binding, point);
+ private static boolean heuristicallyResolvesToEnumerator(ICPPUnknownBinding binding) {
+ IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(binding);
return resolved.length == 1 && resolved[0] instanceof IEnumerator;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexViewSearchQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexViewSearchQuery.java
index 28959744ad9..65392418620 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexViewSearchQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/indexview/IndexViewSearchQuery.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.model.ICElement;
@@ -53,8 +52,9 @@ public class IndexViewSearchQuery extends CSearchQuery {
public IStatus runWithIndex(IIndex index, IProgressMonitor monitor) throws OperationCanceledException {
try {
if (CCoreInternals.getPDOMManager().getPDOM(fProject).getLastWriteAccess() == fLastWrite) {
- IASTNode point= null; // Instantiation of dependent expressions may not work.
- createMatches(index, fBinding, point);
+ // We should call CPPSemantics.pushLookupPoint() here.
+ // Until we do, instantiation of dependent expressions may not work.
+ createMatches(index, fBinding);
}
return Status.OK_STATUS;
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
index d2071d2d6bb..6e4281f6cfc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java
@@ -247,36 +247,41 @@ public class BindingClassifier {
IFunction function = (IFunction) binding;
IFunctionType functionType = function.getType();
- if (declarator.getPropertyInParent() == IASTFunctionDefinition.DECLARATOR ||
- declarator.getPropertyInParent() == ICPPASTLambdaExpression.DECLARATOR) {
- // Define the return type if necessary.
- IType returnType = functionType.getReturnType();
- if (!(returnType instanceof IPointerType || returnType instanceof ICPPReferenceType)) {
- defineTypeExceptTypedefOrNonFixedEnum(returnType);
- }
-
- // Define parameter types if necessary.
- IType[] parameterTypes = functionType.getParameterTypes();
- for (IType type : parameterTypes) {
- if (!(type instanceof IPointerType)) {
- if (!(type instanceof ICPPReferenceType) ||
- isTypeWithConvertingConstructor(type, declarator)) {
- defineTypeExceptTypedefOrNonFixedEnum(type);
+ try {
+ CPPSemantics.pushLookupPoint(declarator);
+ if (declarator.getPropertyInParent() == IASTFunctionDefinition.DECLARATOR ||
+ declarator.getPropertyInParent() == ICPPASTLambdaExpression.DECLARATOR) {
+ // Define the return type if necessary.
+ IType returnType = functionType.getReturnType();
+ if (!(returnType instanceof IPointerType || returnType instanceof ICPPReferenceType)) {
+ defineTypeExceptTypedefOrNonFixedEnum(returnType);
+ }
+
+ // Define parameter types if necessary.
+ IType[] parameterTypes = functionType.getParameterTypes();
+ for (IType type : parameterTypes) {
+ if (!(type instanceof IPointerType)) {
+ if (!(type instanceof ICPPReferenceType) ||
+ isTypeWithConvertingConstructor(type)) {
+ defineTypeExceptTypedefOrNonFixedEnum(type);
+ }
}
}
- }
- } else {
- // As a matter of policy, a function declaration is responsible for
- // providing definitions of parameter types that have implicit
- // converting constructors.
- IType[] parameterTypes = functionType.getParameterTypes();
- for (IType type : parameterTypes) {
- if (!(type instanceof IPointerType)) {
- if (isTypeWithConvertingConstructor(type, declarator)) {
- defineTypeExceptTypedefOrNonFixedEnum(type);
+ } else {
+ // As a matter of policy, a function declaration is responsible for
+ // providing definitions of parameter types that have implicit
+ // converting constructors.
+ IType[] parameterTypes = functionType.getParameterTypes();
+ for (IType type : parameterTypes) {
+ if (!(type instanceof IPointerType)) {
+ if (isTypeWithConvertingConstructor(type)) {
+ defineTypeExceptTypedefOrNonFixedEnum(type);
+ }
}
}
}
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
@@ -508,341 +513,346 @@ public class BindingClassifier {
if (isPartOfExternalMacroDefinition(expression))
return PROCESS_CONTINUE;
- ASTNodeProperty propertyInParent = expression.getPropertyInParent();
- if (propertyInParent == IASTIfStatement.CONDITION
- || propertyInParent == IASTForStatement.CONDITION
- || propertyInParent == IASTWhileStatement.CONDITIONEXPRESSION
- || propertyInParent == IASTDoStatement.CONDITION
- || propertyInParent == IASTConditionalExpression.LOGICAL_CONDITION) {
- /*
- * The type of the condition expression doesn't need to be defined if it's
- * a pointer type.
- *
- * Example:
- * void foo(X* x) {
- * if (x) { } // definition of typeof(x) is not required here
- * }
- */
- IType conditionExpressionType = expression.getExpressionType();
- if (!(conditionExpressionType instanceof IPointerType)) {
- defineTypeExceptTypedefOrNonFixedEnum(conditionExpressionType);
- }
- }
-
- if (expression instanceof IASTIdExpression) {
- /*
- * The type of an identifier expression doesn't need to be defined if it's a pointer
- * or a reference type.
- *
- * Example:
- * void foo(X& x) {
- * x; // definition of typeof(x) is not required here
- * }
- */
- IASTIdExpression idExpression = (IASTIdExpression) expression;
-
- IBinding binding = idExpression.getName().resolveBinding();
- if (binding instanceof IVariable) {
- // Get the declared type.
- IType variableType = ((IVariable) binding).getType();
- defineTypeForBinding(binding, variableType);
+ try {
+ CPPSemantics.pushLookupPoint(expression);
+ ASTNodeProperty propertyInParent = expression.getPropertyInParent();
+ if (propertyInParent == IASTIfStatement.CONDITION
+ || propertyInParent == IASTForStatement.CONDITION
+ || propertyInParent == IASTWhileStatement.CONDITIONEXPRESSION
+ || propertyInParent == IASTDoStatement.CONDITION
+ || propertyInParent == IASTConditionalExpression.LOGICAL_CONDITION) {
+ /*
+ * The type of the condition expression doesn't need to be defined if it's
+ * a pointer type.
+ *
+ * Example:
+ * void foo(X* x) {
+ * if (x) { } // definition of typeof(x) is not required here
+ * }
+ */
+ IType conditionExpressionType = expression.getExpressionType();
+ if (!(conditionExpressionType instanceof IPointerType)) {
+ defineTypeExceptTypedefOrNonFixedEnum(conditionExpressionType);
+ }
}
- } else if (expression instanceof IASTUnaryExpression) {
- /*
- * The type of the operand of an unary expression doesn't need to be defined if
- * the operator is the ampersand operator:
- *
- * Example:
- * void foo(X& x) {
- * &x; // ampersand operator
- * }
- *
- * If the operand is a pointer type, the following operators also don't require
- * a definition:
- *
- * Example:
- * void foo(X* x) {
- * __alignof(x); // alignof operator
- * !x; // not operator
- * +x; // unary plus operator
- * sizeof(x); // sizeof operator
- * typeid(x); // typeid operator
- * }
- */
- IASTUnaryExpression unaryExpression = (IASTUnaryExpression) expression;
- IASTExpression operand = unaryExpression.getOperand();
- if (operand != null) { // A throw expression may have no operand.
- if (unaryExpression instanceof ICPPASTUnaryExpression) {
- ICPPFunction overload = ((ICPPASTUnaryExpression) unaryExpression).getOverload();
- if (overload != null) {
- defineForFunctionCall(overload, true, new IASTInitializerClause[] { operand });
- return PROCESS_CONTINUE;
- }
+
+ if (expression instanceof IASTIdExpression) {
+ /*
+ * The type of an identifier expression doesn't need to be defined if it's a pointer
+ * or a reference type.
+ *
+ * Example:
+ * void foo(X& x) {
+ * x; // definition of typeof(x) is not required here
+ * }
+ */
+ IASTIdExpression idExpression = (IASTIdExpression) expression;
+
+ IBinding binding = idExpression.getName().resolveBinding();
+ if (binding instanceof IVariable) {
+ // Get the declared type.
+ IType variableType = ((IVariable) binding).getType();
+ defineTypeForBinding(binding, variableType);
}
-
- boolean expressionDefinitionRequired = true;
- switch (unaryExpression.getOperator()) {
- case IASTUnaryExpression.op_amper:
- case IASTUnaryExpression.op_bracketedPrimary:
- // The ampersand operator as well as brackets never require a definition.
- expressionDefinitionRequired = false;
- break;
- case IASTUnaryExpression.op_star:
- if (expression.getParent() instanceof IASTExpression)
- break;
- //$FALL-THROUGH$
- case IASTUnaryExpression.op_alignOf:
- case IASTUnaryExpression.op_not:
- case IASTUnaryExpression.op_plus:
- case IASTUnaryExpression.op_sizeof:
- case IASTUnaryExpression.op_typeid:
- // If the operand is a pointer type, then it doesn't need to be defined.
- if (operand.getExpressionType() instanceof IPointerType) {
+ } else if (expression instanceof IASTUnaryExpression) {
+ /*
+ * The type of the operand of an unary expression doesn't need to be defined if
+ * the operator is the ampersand operator:
+ *
+ * Example:
+ * void foo(X& x) {
+ * &x; // ampersand operator
+ * }
+ *
+ * If the operand is a pointer type, the following operators also don't require
+ * a definition:
+ *
+ * Example:
+ * void foo(X* x) {
+ * __alignof(x); // alignof operator
+ * !x; // not operator
+ * +x; // unary plus operator
+ * sizeof(x); // sizeof operator
+ * typeid(x); // typeid operator
+ * }
+ */
+ IASTUnaryExpression unaryExpression = (IASTUnaryExpression) expression;
+ IASTExpression operand = unaryExpression.getOperand();
+ if (operand != null) { // A throw expression may have no operand.
+ if (unaryExpression instanceof ICPPASTUnaryExpression) {
+ ICPPFunction overload = ((ICPPASTUnaryExpression) unaryExpression).getOverload();
+ if (overload != null) {
+ defineForFunctionCall(overload, true, new IASTInitializerClause[] { operand });
+ return PROCESS_CONTINUE;
+ }
+ }
+
+ boolean expressionDefinitionRequired = true;
+ switch (unaryExpression.getOperator()) {
+ case IASTUnaryExpression.op_amper:
+ case IASTUnaryExpression.op_bracketedPrimary:
+ // The ampersand operator as well as brackets never require a definition.
expressionDefinitionRequired = false;
+ break;
+ case IASTUnaryExpression.op_star:
+ if (expression.getParent() instanceof IASTExpression)
+ break;
+ //$FALL-THROUGH$
+ case IASTUnaryExpression.op_alignOf:
+ case IASTUnaryExpression.op_not:
+ case IASTUnaryExpression.op_plus:
+ case IASTUnaryExpression.op_sizeof:
+ case IASTUnaryExpression.op_typeid:
+ // If the operand is a pointer type, then it doesn't need to be defined.
+ if (operand.getExpressionType() instanceof IPointerType) {
+ expressionDefinitionRequired = false;
+ }
+ break;
+ }
+
+ if (expressionDefinitionRequired) {
+ defineTypeExceptTypedefOrNonFixedEnum(operand.getExpressionType());
}
- break;
- }
-
- if (expressionDefinitionRequired) {
- defineTypeExceptTypedefOrNonFixedEnum(operand.getExpressionType());
}
- }
- } else if (expression instanceof IASTBinaryExpression) {
- /*
- * The types of the operands of a binary expression don't need to be defined for
- * the following operators if the operands are pointer types:
- *
- * Example:
- * void foo(X* x) {
- * x = x; // assignment operator
- * x == x; // equals operator
- * x != x; // not equals operator
- * x >= x; // greater equal operator
- * x > x; // greater operator
- * x <= x; // less equal operator
- * x < x; // less operator
- * x && x; // logical and operator
- * x || x; // logical or operator
- * }
- *
- * However, note that if both operands are pointers of different types, then only
- * the following operators don't require a definition of the types of the operands:
- *
- * void foo(X* x, Y* y) {
- * x && y; // logical and operator
- * x || y; // logical or operator
- * }
- */
- IASTBinaryExpression binaryExpression = (IASTBinaryExpression) expression;
- if (binaryExpression instanceof ICPPASTBinaryExpression) {
- ICPPFunction overload = ((ICPPASTBinaryExpression) binaryExpression).getOverload();
- if (overload != null) {
- IASTInitializerClause[] arguments = new IASTInitializerClause[]
- { binaryExpression.getOperand1(), binaryExpression.getOperand2() };
- defineForFunctionCall(overload, true, arguments);
- return PROCESS_CONTINUE;
+ } else if (expression instanceof IASTBinaryExpression) {
+ /*
+ * The types of the operands of a binary expression don't need to be defined for
+ * the following operators if the operands are pointer types:
+ *
+ * Example:
+ * void foo(X* x) {
+ * x = x; // assignment operator
+ * x == x; // equals operator
+ * x != x; // not equals operator
+ * x >= x; // greater equal operator
+ * x > x; // greater operator
+ * x <= x; // less equal operator
+ * x < x; // less operator
+ * x && x; // logical and operator
+ * x || x; // logical or operator
+ * }
+ *
+ * However, note that if both operands are pointers of different types, then only
+ * the following operators don't require a definition of the types of the operands:
+ *
+ * void foo(X* x, Y* y) {
+ * x && y; // logical and operator
+ * x || y; // logical or operator
+ * }
+ */
+ IASTBinaryExpression binaryExpression = (IASTBinaryExpression) expression;
+ if (binaryExpression instanceof ICPPASTBinaryExpression) {
+ ICPPFunction overload = ((ICPPASTBinaryExpression) binaryExpression).getOverload();
+ if (overload != null) {
+ IASTInitializerClause[] arguments = new IASTInitializerClause[]
+ { binaryExpression.getOperand1(), binaryExpression.getOperand2() };
+ defineForFunctionCall(overload, true, arguments);
+ return PROCESS_CONTINUE;
+ }
}
- }
-
- IType operand1Type = binaryExpression.getOperand1().getExpressionType();
- IASTInitializerClause operand2 = binaryExpression.getInitOperand2();
- IType operand2Type;
- if (operand2 instanceof IASTExpression) {
- operand2Type = ((IASTExpression) operand2).getExpressionType();
- } else if (operand2 instanceof ICPPASTInitializerList) {
- ICPPASTInitializerList initializerList = (ICPPASTInitializerList) operand2;
- if (binaryExpression.getOperator() == IASTBinaryExpression.op_assign
- && initializerList.getSize() == 1) {
- IASTInitializerClause element = initializerList.getClauses()[0];
- if (element instanceof IASTExpression) {
- operand2Type = ((IASTExpression) element).getExpressionType();
+
+ IType operand1Type = binaryExpression.getOperand1().getExpressionType();
+ IASTInitializerClause operand2 = binaryExpression.getInitOperand2();
+ IType operand2Type;
+ if (operand2 instanceof IASTExpression) {
+ operand2Type = ((IASTExpression) operand2).getExpressionType();
+ } else if (operand2 instanceof ICPPASTInitializerList) {
+ ICPPASTInitializerList initializerList = (ICPPASTInitializerList) operand2;
+ if (binaryExpression.getOperator() == IASTBinaryExpression.op_assign
+ && initializerList.getSize() == 1) {
+ IASTInitializerClause element = initializerList.getClauses()[0];
+ if (element instanceof IASTExpression) {
+ operand2Type = ((IASTExpression) element).getExpressionType();
+ } else {
+ operand2Type = initializerList.getEvaluation().getType();
+ }
} else {
- operand2Type = initializerList.getEvaluation().getType(operand2);
+ operand2Type = initializerList.getEvaluation().getType();
}
} else {
- operand2Type = initializerList.getEvaluation().getType(operand2);
- }
- } else {
- operand2Type = operand1Type;
- }
-
- boolean expression1DefinitionRequired = true;
- boolean expression2DefinitionRequired = true;
-
- switch (binaryExpression.getOperator()) {
- case IASTBinaryExpression.op_logicalAnd:
- case IASTBinaryExpression.op_logicalOr:
- // Pointer types don't need to be defined for logical operations.
- if (operand1Type instanceof IPointerType) {
- expression1DefinitionRequired = false;
+ operand2Type = operand1Type;
}
- if (operand2Type instanceof IPointerType) {
- expression2DefinitionRequired = false;
- }
- break;
- case IASTBinaryExpression.op_assign:
- case IASTBinaryExpression.op_equals:
- case IASTBinaryExpression.op_notequals:
- case IASTBinaryExpression.op_greaterEqual:
- case IASTBinaryExpression.op_greaterThan:
- case IASTBinaryExpression.op_lessEqual:
- case IASTBinaryExpression.op_lessThan:
- // If both operands are identical pointer types, then they don't need to be defined.
- if (operand1Type instanceof IPointerType && operand2Type instanceof IPointerType) {
- if (!isTypeDefinitionRequiredForConversion(operand2Type, operand1Type)) {
+
+ boolean expression1DefinitionRequired = true;
+ boolean expression2DefinitionRequired = true;
+
+ switch (binaryExpression.getOperator()) {
+ case IASTBinaryExpression.op_logicalAnd:
+ case IASTBinaryExpression.op_logicalOr:
+ // Pointer types don't need to be defined for logical operations.
+ if (operand1Type instanceof IPointerType) {
+ expression1DefinitionRequired = false;
+ }
+ if (operand2Type instanceof IPointerType) {
+ expression2DefinitionRequired = false;
+ }
+ break;
+ case IASTBinaryExpression.op_assign:
+ case IASTBinaryExpression.op_equals:
+ case IASTBinaryExpression.op_notequals:
+ case IASTBinaryExpression.op_greaterEqual:
+ case IASTBinaryExpression.op_greaterThan:
+ case IASTBinaryExpression.op_lessEqual:
+ case IASTBinaryExpression.op_lessThan:
+ // If both operands are identical pointer types, then they don't need to be defined.
+ if (operand1Type instanceof IPointerType && operand2Type instanceof IPointerType) {
+ if (!isTypeDefinitionRequiredForConversion(operand2Type, operand1Type)) {
+ expression1DefinitionRequired = false;
+ expression2DefinitionRequired = false;
+ }
+ } else if (operand1Type instanceof IPointerType) {
+ // Only the first operand is a pointer type. It doesn't have to be defined.
expression1DefinitionRequired = false;
+ } else if (operand2Type instanceof IPointerType) {
+ // Only the second operand is a pointer type. It doesn't have to be defined.
expression2DefinitionRequired = false;
}
- } else if (operand1Type instanceof IPointerType) {
- // Only the first operand is a pointer type. It doesn't have to be defined.
- expression1DefinitionRequired = false;
- } else if (operand2Type instanceof IPointerType) {
- // Only the second operand is a pointer type. It doesn't have to be defined.
- expression2DefinitionRequired = false;
}
- }
-
- if (expression1DefinitionRequired) {
- defineTypeExceptTypedefOrNonFixedEnum(operand1Type);
- }
- if (expression2DefinitionRequired) {
- defineTypeExceptTypedefOrNonFixedEnum(operand2Type);
- }
- } else if (expression instanceof IASTFunctionCallExpression) {
- /*
- * The return type and argument types of a function call expression don't need to be
- * defined if they're pointer or reference types. The declared and actual types of
- * the arguments must further be identical, since implicit type conversions require
- * a definition of both the source and the target type.
- *
- * Example:
- * X& foo(X& x);
- * void bar(X& x) {
- * foo(x); // definition of typeof(foo) and typeof(x) is not required here
- * }
- *
- * Also note that the function call itself doesn't require a definition as long as
- * it's not a constructor call:
- *
- * Example 1:
- * void foo() {
- * bar(); // definition of bar() is not required here (assuming bar is a function)
- * }
- *
- * Example 2:
- * void foo() {
- * X(); // definition of X is required here (assuming X is a composite type)
- * }
- */
- IASTFunctionCallExpression functionCallExpression = (IASTFunctionCallExpression) expression;
- IASTExpression functionNameExpression = functionCallExpression.getFunctionNameExpression();
- if (isPartOfExternalMacroDefinition(functionNameExpression))
- return PROCESS_CONTINUE;
-
- IASTInitializerClause[] arguments = functionCallExpression.getArguments();
- IASTName functionName = getNameOfIdOrFieldReferenceExpression(functionNameExpression);
- if (functionName != null) {
- IBinding function = functionName.resolveBinding();
- if (function instanceof IProblemBinding) {
- IBinding[] candidates = ((IProblemBinding) function).getCandidateBindings();
- if (candidates.length != 0) {
- for (IBinding candidate : candidates) {
- defineBindingForFunctionCall(candidate, true, arguments);
+
+ if (expression1DefinitionRequired) {
+ defineTypeExceptTypedefOrNonFixedEnum(operand1Type);
+ }
+ if (expression2DefinitionRequired) {
+ defineTypeExceptTypedefOrNonFixedEnum(operand2Type);
+ }
+ } else if (expression instanceof IASTFunctionCallExpression) {
+ /*
+ * The return type and argument types of a function call expression don't need to be
+ * defined if they're pointer or reference types. The declared and actual types of
+ * the arguments must further be identical, since implicit type conversions require
+ * a definition of both the source and the target type.
+ *
+ * Example:
+ * X& foo(X& x);
+ * void bar(X& x) {
+ * foo(x); // definition of typeof(foo) and typeof(x) is not required here
+ * }
+ *
+ * Also note that the function call itself doesn't require a definition as long as
+ * it's not a constructor call:
+ *
+ * Example 1:
+ * void foo() {
+ * bar(); // definition of bar() is not required here (assuming bar is a function)
+ * }
+ *
+ * Example 2:
+ * void foo() {
+ * X(); // definition of X is required here (assuming X is a composite type)
+ * }
+ */
+ IASTFunctionCallExpression functionCallExpression = (IASTFunctionCallExpression) expression;
+ IASTExpression functionNameExpression = functionCallExpression.getFunctionNameExpression();
+ if (isPartOfExternalMacroDefinition(functionNameExpression))
+ return PROCESS_CONTINUE;
+
+ IASTInitializerClause[] arguments = functionCallExpression.getArguments();
+ IASTName functionName = getNameOfIdOrFieldReferenceExpression(functionNameExpression);
+ if (functionName != null) {
+ IBinding function = functionName.resolveBinding();
+ if (function instanceof IProblemBinding) {
+ IBinding[] candidates = ((IProblemBinding) function).getCandidateBindings();
+ if (candidates.length != 0) {
+ for (IBinding candidate : candidates) {
+ defineBindingForFunctionCall(candidate, true, arguments);
+ }
+ } else {
+ defineBinding(function);
}
} else {
- defineBinding(function);
- }
- } else {
- IASTName name = functionName;
- if (functionName instanceof ICPPASTTemplateId) {
- name = ((ICPPASTTemplateId) functionName).getTemplateName();
+ IASTName name = functionName;
+ if (functionName instanceof ICPPASTTemplateId) {
+ name = ((ICPPASTTemplateId) functionName).getTemplateName();
+ }
+ boolean defineFunction = !isPartOfExternalMacroDefinition(name);
+
+ if (defineFunction) {
+ LookupData data = new LookupData(functionName);
+ IType impliedObjectType = data.getImpliedObjectType();
+ if (impliedObjectType != null)
+ defineTypeExceptTypedefOrNonFixedEnum(impliedObjectType);
+ }
+
+ defineBindingForFunctionCall(function, defineFunction, arguments);
}
- boolean defineFunction = !isPartOfExternalMacroDefinition(name);
-
- if (defineFunction) {
- LookupData data = new LookupData(functionName);
- IType impliedObjectType = data.getImpliedObjectType();
- if (impliedObjectType != null)
- defineTypeExceptTypedefOrNonFixedEnum(impliedObjectType);
+ }
+
+ if (functionCallExpression instanceof IASTImplicitNameOwner) {
+ IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) functionCallExpression).getImplicitNames();
+ for (IASTName name : implicitNames) {
+ IBinding binding = name.resolveBinding();
+ if (binding instanceof IFunction) {
+ defineForFunctionCall((IFunction) binding, true, arguments);
+ }
}
-
- defineBindingForFunctionCall(function, defineFunction, arguments);
}
- }
-
- if (functionCallExpression instanceof IASTImplicitNameOwner) {
- IASTImplicitName[] implicitNames = ((IASTImplicitNameOwner) functionCallExpression).getImplicitNames();
- for (IASTName name : implicitNames) {
+ } else if (expression instanceof IASTFieldReference) {
+ /*
+ * The type of the expression part of a field reference always requires a definition.
+ *
+ * Example:
+ * void foo(X& x1, X* x2) {
+ * x1.bar(); // definition of typeof(x1) is required here
+ * x2->bar(); // definition of typeof(x2) is required here
+ * }
+ */
+
+ IASTExpression fieldOwner = ((IASTFieldReference) expression).getFieldOwner();
+ IType expressionType = fieldOwner.getExpressionType();
+ defineIndirectTypes(expressionType);
+ IASTName name = getNameOfIdOrFieldReferenceExpression(fieldOwner);
+ if (name != null) {
IBinding binding = name.resolveBinding();
- if (binding instanceof IFunction) {
- defineForFunctionCall((IFunction) binding, true, arguments);
- }
+ defineTypeForBinding(binding, expressionType);
+ }
+ } else if (expression instanceof ICPPASTNewExpression) {
+ /*
+ * The type specifier of a "new" expression always requires a definition.
+ *
+ * Example:
+ * void foo() {
+ * new X(); // definition of X is required here
+ * }
+ */
+ defineTypeExceptTypedefOrNonFixedEnum(((ICPPASTNewExpression) expression).getExpressionType());
+ } else if (expression instanceof ICPPASTDeleteExpression) {
+ /*
+ * The expression type of a "delete" expression always requires a full definition.
+ * This is necessary because the compiler needs to be able to call the destructor.
+ *
+ * Example:
+ * void foo(X* x) {
+ * delete x; // definition of typeof(x) is required here
+ * }
+ */
+ defineTypeExceptTypedefOrNonFixedEnum(((ICPPASTDeleteExpression) expression).getOperand().getExpressionType());
+ } else if (expression instanceof IASTCastExpression) {
+ /*
+ * Explicit type casts always need the definition of the underlying types.
+ *
+ * Example:
+ * void foo(X* x) {
+ * (Y*) x; // definition of both Y and typeof(x) is required here
+ * }
+ */
+ IASTCastExpression castExpression = (IASTCastExpression) expression;
+ IType targetType = castExpression.getExpressionType();
+ IType sourceType = castExpression.getOperand().getExpressionType();
+
+ if (isTypeDefinitionRequiredForConversion(sourceType, targetType)) {
+ // Source and target types of the cast expression are different.
+ // We need to define both types, even if they're pointers.
+ defineTypeExceptTypedefOrNonFixedEnum(targetType);
+ defineTypeExceptTypedefOrNonFixedEnum(sourceType);
+ } else if (!(targetType instanceof IPointerType || targetType instanceof ICPPReferenceType)) {
+ // Define the target type if it's not a pointer or reference type.
+ defineTypeExceptTypedefOrNonFixedEnum(targetType);
}
}
- } else if (expression instanceof IASTFieldReference) {
- /*
- * The type of the expression part of a field reference always requires a definition.
- *
- * Example:
- * void foo(X& x1, X* x2) {
- * x1.bar(); // definition of typeof(x1) is required here
- * x2->bar(); // definition of typeof(x2) is required here
- * }
- */
-
- IASTExpression fieldOwner = ((IASTFieldReference) expression).getFieldOwner();
- IType expressionType = fieldOwner.getExpressionType();
- defineIndirectTypes(expressionType);
- IASTName name = getNameOfIdOrFieldReferenceExpression(fieldOwner);
- if (name != null) {
- IBinding binding = name.resolveBinding();
- defineTypeForBinding(binding, expressionType);
- }
- } else if (expression instanceof ICPPASTNewExpression) {
- /*
- * The type specifier of a "new" expression always requires a definition.
- *
- * Example:
- * void foo() {
- * new X(); // definition of X is required here
- * }
- */
- defineTypeExceptTypedefOrNonFixedEnum(((ICPPASTNewExpression) expression).getExpressionType());
- } else if (expression instanceof ICPPASTDeleteExpression) {
- /*
- * The expression type of a "delete" expression always requires a full definition.
- * This is necessary because the compiler needs to be able to call the destructor.
- *
- * Example:
- * void foo(X* x) {
- * delete x; // definition of typeof(x) is required here
- * }
- */
- defineTypeExceptTypedefOrNonFixedEnum(((ICPPASTDeleteExpression) expression).getOperand().getExpressionType());
- } else if (expression instanceof IASTCastExpression) {
- /*
- * Explicit type casts always need the definition of the underlying types.
- *
- * Example:
- * void foo(X* x) {
- * (Y*) x; // definition of both Y and typeof(x) is required here
- * }
- */
- IASTCastExpression castExpression = (IASTCastExpression) expression;
- IType targetType = castExpression.getExpressionType();
- IType sourceType = castExpression.getOperand().getExpressionType();
-
- if (isTypeDefinitionRequiredForConversion(sourceType, targetType)) {
- // Source and target types of the cast expression are different.
- // We need to define both types, even if they're pointers.
- defineTypeExceptTypedefOrNonFixedEnum(targetType);
- defineTypeExceptTypedefOrNonFixedEnum(sourceType);
- } else if (!(targetType instanceof IPointerType || targetType instanceof ICPPReferenceType)) {
- // Define the target type if it's not a pointer or reference type.
- defineTypeExceptTypedefOrNonFixedEnum(targetType);
- }
+ return PROCESS_CONTINUE;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
- return PROCESS_CONTINUE;
}
protected void defineBindingForFunctionCall(IBinding binding, boolean defineFunction,
@@ -984,6 +994,7 @@ public class BindingClassifier {
fAst = node.getTranslationUnit();
}
try {
+ CPPSemantics.pushLookupPoint(fAst);
// Enable promiscuous binding resolution for this AST traversal,
// to allow names to be resolved even if the declarations of their
// target bindings are in a header not reachable via includes.
@@ -992,6 +1003,7 @@ public class BindingClassifier {
postprocessTemplates();
} finally {
CPPSemantics.disablePromiscuousBindingResolution();
+ CPPSemantics.popLookupPoint();
}
}
@@ -1119,7 +1131,7 @@ public class BindingClassifier {
lookupData.setFunctionArguments(false, new IASTInitializerClause[] { argument });
lookupData.qualified = true;
try {
- IBinding constructor = CPPSemantics.resolveFunction(lookupData, ClassTypeHelper.getConstructors(classType, argument), false, false);
+ IBinding constructor = CPPSemantics.resolveFunction(lookupData, classType.getConstructors(), false, false);
if (constructor instanceof ICPPConstructor && !((ICPPConstructor) constructor).isExplicit())
return true;
} catch (DOMException e) {
@@ -1132,8 +1144,8 @@ public class BindingClassifier {
* Returns {@code true} if {@code classType} has a constructor that can be used for
* implicit conversion from some other type.
*/
- private boolean hasConvertingConstructor(ICPPClassType classType, IASTNode point) {
- ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, point);
+ private boolean hasConvertingConstructor(ICPPClassType classType) {
+ ICPPConstructor[] constructors = classType.getConstructors();
for (ICPPConstructor constructor : constructors) {
if (!constructor.isExplicit()) {
ICPPParameter[] parameters = constructor.getParameters();
@@ -1150,9 +1162,9 @@ public class BindingClassifier {
return false;
}
- private boolean isTypeWithConvertingConstructor(IType type, IASTNode point) {
+ private boolean isTypeWithConvertingConstructor(IType type) {
type = getNestedType(type, REF | ALLCVQ);
- return type instanceof ICPPClassType && hasConvertingConstructor((ICPPClassType) type, point);
+ return type instanceof ICPPClassType && hasConvertingConstructor((ICPPClassType) type);
}
/**
@@ -1432,7 +1444,7 @@ public class BindingClassifier {
}
} else if (binding instanceof ICPPClassType && fAst.getDefinitionsInAST(binding).length == 0) {
// The header that defines a class must provide definitions of all its base classes.
- ICPPClassType[] bases = ClassTypeHelper.getAllBases((ICPPClassType) binding, fAst);
+ ICPPClassType[] bases = ClassTypeHelper.getAllBases((ICPPClassType) binding);
for (ICPPClassType base : bases) {
fProcessedDefinedBindings.add(base);
fBindingsToDefine.remove(base);
@@ -1629,10 +1641,15 @@ public class BindingClassifier {
return true;
ICPPClassScope classScope = ((ICPPASTCompositeTypeSpecifier) parent).getScope();
ICPPClassType classType = classScope.getClassType();
- ICPPMethod destructor = ClassTypeHelper.getMethodInClass(classType, MethodKind.DTOR, parent);
- if (destructor != null && fAst.getDefinitionsInAST(destructor).length != 0)
- return true;
- return false;
+ try {
+ CPPSemantics.pushLookupPoint(parent);
+ ICPPMethod destructor = ClassTypeHelper.getMethodInClass(classType, MethodKind.DTOR);
+ if (destructor != null && fAst.getDefinitionsInAST(destructor).length != 0)
+ return true;
+ return false;
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
private static boolean isEnumerationWithoutFixedUnderlyingType(IBinding typeBinding) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMethodProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMethodProcessor.java
index 6c7fac53eff..7cdf31d39bd 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMethodProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/CRenameMethodProcessor.java
@@ -30,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Rename processor for methods.
@@ -109,12 +110,15 @@ public class CRenameMethodProcessor extends CRenameGlobalProcessor {
if (binding instanceof ICPPMethod) {
ICPPMethod m= (ICPPMethod) binding;
try {
- IBinding[] bs= ClassTypeHelper.findOverridden(m, argument.getTranslationUnit());
+ CPPSemantics.pushLookupPoint(node);
+ IBinding[] bs= ClassTypeHelper.findOverridden(m);
bindings.addAll(Arrays.asList(bs));
- bs= ClassTypeHelper.findOverriders(getIndex(), m, node);
+ bs= ClassTypeHelper.findOverriders(getIndex(), m);
bindings.addAll(Arrays.asList(bs));
} catch (CoreException e) {
status.addError(e.getMessage());
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
return bindings.toArray(new IBinding[bindings.size()]);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchElementQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchElementQuery.java
index 1eeb6917d67..58e2f2b1028 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchElementQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchElementQuery.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.ICElement;
@@ -47,8 +46,9 @@ public class CSearchElementQuery extends CSearchQuery {
IBinding binding= IndexUI.elementToBinding(index, (ICElement) element);
if (binding != null) {
label= labelForBinding(index, binding, label);
- IASTNode point= null; // Instantiation of dependent expressions may not work.
- createMatches(index, binding, point);
+ // We should call CPPSemantics.pushLookupPoint() here.
+ // Until we do, instantiation of dependent expressions may not work.
+ createMatches(index, binding);
}
}
return Status.OK_STATUS;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java
index 46d132614bd..5f6dfa08ae8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPatternQuery.java
@@ -24,7 +24,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
@@ -188,8 +187,9 @@ public class CSearchPatternQuery extends CSearchQuery {
matchedBindings.add(indexBinding);
}
}
- IASTNode point= null; // Instantiation of dependent expressions may not work.
- createMatches(index, matchedBindings.toArray(new IIndexBinding[matchedBindings.size()]), point);
+ // We should call CPPSemantics.pushLookupPoint() here.
+ // Until we do, instantiation of dependent expressions may not work.
+ createMatches(index, matchedBindings.toArray(new IIndexBinding[matchedBindings.size()]));
} catch (CoreException e) {
return e.getStatus();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
index 541a3ed87b8..6af1e195c9d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
@@ -340,11 +340,11 @@ public abstract class CSearchQuery implements ISearchQuery {
}
}
- protected void createMatches(IIndex index, IBinding binding, IASTNode point) throws CoreException {
- createMatches(index, new IBinding[] { binding }, point);
+ protected void createMatches(IIndex index, IBinding binding) throws CoreException {
+ createMatches(index, new IBinding[] { binding });
}
- protected void createMatches(IIndex index, IBinding[] bindings, IASTNode point) throws CoreException {
+ protected void createMatches(IIndex index, IBinding[] bindings) throws CoreException {
if (bindings == null)
return;
List<IIndexName> names= new ArrayList<>();
@@ -360,7 +360,7 @@ public abstract class CSearchQuery implements ISearchQuery {
if ((flags & FIND_REFERENCES) != 0) {
for (IBinding binding : bindings) {
if (binding != null) {
- List<? extends IBinding> specializations = IndexUI.findSpecializations(index, binding, point);
+ List<? extends IBinding> specializations = IndexUI.findSpecializations(index, binding);
for (IBinding spec : specializations) {
if (spec != null && handled.add(spec)) {
createMatches1(index, spec, names);
@@ -369,7 +369,7 @@ public abstract class CSearchQuery implements ISearchQuery {
if (binding instanceof ICPPMethod) {
ICPPMethod m= (ICPPMethod) binding;
- ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m, point);
+ ICPPMethod[] msInBases = ClassTypeHelper.findOverridden(m);
if (msInBases.length > 0) {
if (polymorphicNames == null) {
polymorphicNames= new ArrayList<>();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTextSelectionQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTextSelectionQuery.java
index 55d1738d695..4143bf9661d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTextSelectionQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchTextSelectionQuery.java
@@ -30,6 +30,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
@@ -59,27 +60,32 @@ public class CSearchTextSelectionQuery extends CSearchQuery {
if (ast != null) {
IASTName searchName= ast.getNodeSelector(null).findEnclosingName(selection.getOffset(), selection.getLength());
if (searchName != null) {
- label= searchName.toString();
- IBinding binding= searchName.resolveBinding();
- if (!(binding instanceof IProblemBinding)) {
- if (binding != null) {
- IScope scope= null;
- try {
- scope = binding.getScope();
- } catch (DOMException e) {
+ try {
+ CPPSemantics.pushLookupPoint(searchName);
+ label= searchName.toString();
+ IBinding binding= searchName.resolveBinding();
+ if (!(binding instanceof IProblemBinding)) {
+ if (binding != null) {
+ IScope scope= null;
+ try {
+ scope = binding.getScope();
+ } catch (DOMException e) {
+ }
+ if (scope != null && scope.getKind() == EScopeKind.eLocal) {
+ createLocalMatches(ast, binding);
+ return Status.OK_STATUS;
+ }
}
- if (scope != null && scope.getKind() == EScopeKind.eLocal) {
- createLocalMatches(ast, binding);
+ binding = index.findBinding(searchName);
+ binding= CPPTemplates.findDeclarationForSpecialization(binding);
+ if (binding != null) {
+ label= labelForBinding(index, binding, label);
+ createMatches(index, binding);
return Status.OK_STATUS;
}
}
- binding = index.findBinding(searchName);
- binding= CPPTemplates.findDeclarationForSpecialization(binding);
- if (binding != null) {
- label= labelForBinding(index, binding, label);
- createMatches(index, binding, searchName);
- return Status.OK_STATUS;
- }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java
index a9ae59e8921..0803512efb3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LinkedNamesFinder.java
@@ -43,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.ASTTranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Finds locations of linked names. Used by Rename in File and Rename in Workspace.
@@ -59,19 +60,22 @@ public class LinkedNamesFinder {
if (target == null) {
return EMPTY_LOCATIONS_ARRAY;
}
- BindingFinder bindingFinder = new BindingFinder(root, name);
- bindingFinder.find(target);
- return bindingFinder.getLocations();
+ try {
+ CPPSemantics.pushLookupPoint(name);
+ BindingFinder bindingFinder = new BindingFinder(root, name);
+ bindingFinder.find(target);
+ return bindingFinder.getLocations();
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
private static class BindingFinder {
private final IASTTranslationUnit root;
private final List<IRegion> locations;
- private final IASTNode point;
public BindingFinder(IASTTranslationUnit root, IASTNode point) {
this.root = root;
- this.point = point;
locations = new ArrayList<IRegion>();
}
@@ -102,7 +106,7 @@ public class LinkedNamesFinder {
}
} else if (target instanceof ICPPMethod) {
ICPPMethod method= (ICPPMethod) target;
- for (ICPPMethod m : ClassTypeHelper.findOverridden(method, root)) {
+ for (ICPPMethod m : ClassTypeHelper.findOverridden(method)) {
findBinding(m);
}
try {
@@ -125,7 +129,7 @@ public class LinkedNamesFinder {
SubclassFinder subclassFinder = new SubclassFinder(ownerClass);
root.accept(subclassFinder);
- return ClassTypeHelper.findOverriders(subclassFinder.getSubclasses(), method, point);
+ return ClassTypeHelper.findOverriders(subclassFinder.getSubclasses(), method);
}
public IRegion[] getLocations() {
@@ -316,9 +320,14 @@ public class LinkedNamesFinder {
IBinding binding = name.resolveBinding();
if (binding instanceof ICPPClassType) {
if (seenClasses.add(binding)) {
- ICPPClassType candidate = (ICPPClassType) binding;
- if (ClassTypeHelper.isSubclass(candidate, baseClass, name)) {
- subclasses.add(candidate);
+ try {
+ CPPSemantics.pushLookupPoint(name);
+ ICPPClassType candidate = (ICPPClassType) binding;
+ if (ClassTypeHelper.isSubclass(candidate, baseClass)) {
+ subclasses.add(candidate);
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
index 4fdd9a3db97..e09b34be6b9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java
@@ -286,11 +286,16 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
// To try to do something useful anyways, we try to heuristically
// resolve the unknown binding to one or more concrete bindings,
// and use those instead.
- IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(
- (ICPPUnknownBinding) binding, sourceName);
- if (resolved.length > 0) {
- bindings = ArrayUtil.addAll(bindings, resolved);
- continue;
+ try {
+ CPPSemantics.pushLookupPoint(sourceName);
+ IBinding[] resolved = HeuristicResolver.resolveUnknownBinding(
+ (ICPPUnknownBinding) binding);
+ if (resolved.length > 0) {
+ bindings = ArrayUtil.addAll(bindings, resolved);
+ continue;
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
if (binding instanceof ICPPUsingDeclaration) {
@@ -479,19 +484,24 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
}
} else if (SemanticUtil.isAutoOrDecltype(fSelectedText)) {
IASTNode enclosingNode = nodeSelector.findEnclosingNode(offset, length);
- IType type = CPPSemantics.resolveDecltypeOrAutoType(enclosingNode);
- if (type instanceof ICPPUnknownType) {
- IType hType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) type, enclosingNode);
- if (hType != null)
- type = hType;
- }
- // Strip qualifiers, references, and pointers, but NOT
- // typedefs, since for typedefs we want to refer to the
- // typedef declaration.
- type = SemanticUtil.getNestedType(type, CVTYPE | REF | PTR);
- if (type instanceof IBinding) {
- IName[] declNames = findDeclNames(ast, NameKind.REFERENCE, (IBinding) type);
- definitions = ArrayUtil.addAll(definitions, declNames);
+ try {
+ CPPSemantics.pushLookupPoint(enclosingNode);
+ IType type = CPPSemantics.resolveDecltypeOrAutoType(enclosingNode);
+ if (type instanceof ICPPUnknownType) {
+ IType hType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) type);
+ if (hType != null)
+ type = hType;
+ }
+ // Strip qualifiers, references, and pointers, but NOT
+ // typedefs, since for typedefs we want to refer to the
+ // typedef declaration.
+ type = SemanticUtil.getNestedType(type, CVTYPE | REF | PTR);
+ if (type instanceof IBinding) {
+ IName[] declNames = findDeclNames(ast, NameKind.REFERENCE, (IBinding) type);
+ definitions = ArrayUtil.addAll(definitions, declNames);
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
return ArrayUtil.trim(definitions);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
index a64990de9d7..cab8763259a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
@@ -99,12 +99,10 @@ import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.HeuristicResolver;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.TypeOfDependentExpression;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.corext.util.Strings;
@@ -188,10 +186,15 @@ public class CSourceHover extends AbstractCEditorTextHover {
}
}
if (binding instanceof ICPPUnknownBinding) {
- IBinding[] resolved = HeuristicResolver
- .resolveUnknownBinding((ICPPUnknownBinding) binding, name);
- if (resolved.length == 1) {
- binding = resolved[0];
+ try {
+ CPPSemantics.pushLookupPoint(name);
+ IBinding[] resolved = HeuristicResolver
+ .resolveUnknownBinding((ICPPUnknownBinding) binding);
+ if (resolved.length == 1) {
+ binding = resolved[0];
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
if (binding instanceof IProblemBinding) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
index 3948214d9e3..338468bb4b8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
@@ -45,6 +45,7 @@ import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
import org.eclipse.cdt.ui.text.contentassist.IProposalFilter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.HeuristicResolver;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
@@ -277,8 +278,12 @@ public class CContentAssistProcessor extends ContentAssistProcessor {
IASTExpression ownerExpr = ref.getFieldOwner();
IType ownerExprType = SemanticUtil.getNestedType(ownerExpr.getExpressionType(), SemanticUtil.TDEF);
if (ownerExprType instanceof ICPPUnknownType) {
- ownerExprType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) ownerExprType,
- names[0]);
+ try {
+ CPPSemantics.pushLookupPoint(names[0]);
+ ownerExprType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) ownerExprType);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
}
if (ownerExprType instanceof IPointerType) {
context = replaceDotWithArrow(viewer, offset, isCompletion, context, activationChar);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
index 52360c7299c..1dc60c3cc9e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
@@ -184,9 +184,14 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
if (bindings != null) {
AccessContext accessibilityContext = new AccessContext(name, true);
- for (IBinding binding : bindings) {
- if (accessibilityContext.isAccessible(binding))
- handleBinding(binding, context, prefix, astContext, proposals);
+ try {
+ CPPSemantics.pushLookupPoint(completionNode.getTranslationUnit());
+ for (IBinding binding : bindings) {
+ if (accessibilityContext.isAccessible(binding))
+ handleBinding(binding, context, prefix, astContext, proposals);
+ }
+ } finally {
+ CPPSemantics.popLookupPoint();
}
}
}
@@ -742,8 +747,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
if (method.isVirtual()) {
return true;
}
- ICPPMethod[] overridden = ClassTypeHelper.findOverridden(method,
- context.getCompletionNode().getTranslationUnit());
+
+ ICPPMethod[] overridden = ClassTypeHelper.findOverridden(method);
for (ICPPMethod m : overridden) {
if (m.isVirtual()) {
return true;
@@ -879,8 +884,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
t= unwindTypedefs(t);
if (t instanceof ICPPClassType) {
ICPPClassType classType= (ICPPClassType) t;
- IASTTranslationUnit ast = cContext.getCompletionNode().getTranslationUnit();
- ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, ast);
+ ICPPConstructor[] constructors = classType.getConstructors();
for (ICPPConstructor constructor : constructors) {
handleFunction(constructor, astContext, cContext, baseRelevance, proposals);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuesser.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuesser.java
index 4f579d87f59..6d01b9b33d5 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuesser.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuesser.java
@@ -26,8 +26,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
-import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@@ -112,13 +110,12 @@ public class ParameterGuesser {
}
}
- private Collection<Variable> evaluateVisibleMatches(IType expectedType, List<IBinding> suggestions,
- IASTTranslationUnit ast)
+ private Collection<Variable> evaluateVisibleMatches(IType expectedType, List<IBinding> suggestions)
throws CModelException {
Set<Variable> res = new HashSet<>();
int size = suggestions.size();
for (int i = 0; i < size; i++) {
- Variable variable = createVariable(suggestions.get(i), expectedType, i, ast);
+ Variable variable = createVariable(suggestions.get(i), expectedType, i);
if (variable != null) {
if (fAlreadyMatchedNames.contains(variable.name)) {
variable.alreadyMatched = true;
@@ -140,15 +137,14 @@ public class ParameterGuesser {
return null;
}
- private Variable createVariable(IBinding element, IType enclosingType, int positionScore,
- IASTTranslationUnit ast)
+ private Variable createVariable(IBinding element, IType enclosingType, int positionScore)
throws CModelException {
IType elementType = getType(element);
String elementName = element.getName();
if (elementType != null && enclosingType != null
&& (elementType.toString().equals(enclosingType.toString())
|| elementType.isSameType(enclosingType)
- || isImplicitlyConvertible(enclosingType, elementType, ast)
+ || isImplicitlyConvertible(enclosingType, elementType)
|| isParent(elementType, enclosingType)
|| isReferenceTo(enclosingType, elementType)
|| isReferenceTo(elementType, enclosingType))) {
@@ -187,10 +183,10 @@ public class ParameterGuesser {
return false;
}
- private boolean isImplicitlyConvertible(IType orginType, IType candidateType, IASTNode point) {
+ private boolean isImplicitlyConvertible(IType orginType, IType candidateType) {
try {
Cost cost = Conversions.checkImplicitConversionSequence(orginType, candidateType,
- ValueCategory.LVALUE, UDCMode.ALLOWED, Context.ORDINARY, point);
+ ValueCategory.LVALUE, UDCMode.ALLOWED, Context.ORDINARY);
if (cost.converts())
return true;
} catch (DOMException e) {
@@ -290,9 +286,9 @@ public class ParameterGuesser {
* @return returns the name of the best match, or <code>null</code> if no match found
*/
public ICompletionProposal[] parameterProposals(IType expectedType, String paramName, Position pos,
- List<IBinding> suggestions, boolean isLastParameter, IASTTranslationUnit ast)
+ List<IBinding> suggestions, boolean isLastParameter)
throws CModelException {
- List<Variable> typeMatches = new ArrayList<>(evaluateVisibleMatches(expectedType, suggestions, ast));
+ List<Variable> typeMatches = new ArrayList<>(evaluateVisibleMatches(expectedType, suggestions));
orderMatches(typeMatches, paramName);
ICompletionProposal[] ret = new ICompletionProposal[typeMatches.size()];
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
index f27d3c5780b..c9f724e955b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParameterGuessingProposal.java
@@ -55,6 +55,7 @@ import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
@@ -260,10 +261,13 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
if (astRoot == null)
return Status.CANCEL_STATUS;
try {
- guessParameters(astRoot);
+ CPPSemantics.pushLookupPoint(astRoot);
+ guessParameters();
} catch (Exception e) {
CUIPlugin.log(e);
return Status.CANCEL_STATUS;
+ } finally {
+ CPPSemantics.popLookupPoint();
}
return Status.OK_STATUS;
}
@@ -272,7 +276,7 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
return;
}
- void guessParameters(IASTTranslationUnit ast) throws CModelException {
+ void guessParameters() throws CModelException {
// Initialize necessary fields.
fParametersNames = getFunctionParametersNames(fFunctionParameters);
fParametersTypes = getFunctionParametersTypes(fFunctionParameters);
@@ -290,7 +294,7 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
boolean isLastParameter = i == count - 1;
ArrayList<ICompletionProposal> allProposals = new ArrayList<>();
ICompletionProposal[] argumentProposals = guesser.parameterProposals(fParametersTypes[i],
- paramName, position, fAssignableElements, isLastParameter, ast);
+ paramName, position, fAssignableElements, isLastParameter);
allProposals.addAll(Arrays.asList(argumentProposals));
fPositions[i] = position;
fChoices[i] = argumentProposals;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java
index ab15f11153c..1151bc68995 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THGraph.java
@@ -32,7 +32,6 @@ import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
import org.eclipse.cdt.internal.core.model.ext.ICElementHandle;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
@@ -253,9 +252,9 @@ class THGraph {
ArrayList<ICElement> memberList= new ArrayList<>();
if (binding instanceof ICPPClassType) {
ICPPClassType ct= (ICPPClassType) binding;
- IBinding[] members= ClassTypeHelper.getDeclaredFields(ct, null);
+ IBinding[] members= ct.getDeclaredFields();
addMemberElements(index, members, memberList);
- members= ClassTypeHelper.getDeclaredMethods(ct, null);
+ members= ct.getDeclaredMethods();
addMemberElements(index, members, memberList);
} else if (binding instanceof ICompositeType) {
ICompositeType ct= (ICompositeType) binding;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java
index a153b0971c7..5e16b998ef3 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexUI.java
@@ -581,7 +581,7 @@ public class IndexUI {
/**
* Searches for all specializations that depend on the definition of the given binding.
*/
- public static List<? extends IBinding> findSpecializations(IIndex index, IBinding binding, IASTNode point)
+ public static List<? extends IBinding> findSpecializations(IIndex index, IBinding binding)
throws CoreException {
List<IBinding> result= null;
@@ -600,11 +600,11 @@ public class IndexUI {
// Check for specializations of the owner.
IBinding owner = binding.getOwner();
if (owner != null) {
- List<? extends IBinding> specializations = findSpecializations(index, owner, point);
+ List<? extends IBinding> specializations = findSpecializations(index, owner);
for (IBinding specOwner : specializations) {
if (specOwner instanceof ICPPClassSpecialization) {
// Add the specialized member.
- IBinding specializedMember = ((ICPPClassSpecialization) specOwner).specializeMember(binding, point);
+ IBinding specializedMember = ((ICPPClassSpecialization) specOwner).specializeMember(binding);
specializedMember= index.adaptBinding(specializedMember);
if (specializedMember != null) {
if (result == null)

Back to the top