mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 21:15:23 +02:00
Fixed spelling of reverseConstantPropagationLookup (245053).
This commit is contained in:
parent
e9629b194e
commit
b4981a7e62
4 changed files with 60 additions and 58 deletions
|
@ -189,7 +189,7 @@ public class CPPTemplates {
|
||||||
*/
|
*/
|
||||||
private static IBinding instantiateSelectedTemplate(ICPPTemplateDefinition template, IType[] arguments)
|
private static IBinding instantiateSelectedTemplate(ICPPTemplateDefinition template, IType[] arguments)
|
||||||
throws DOMException {
|
throws DOMException {
|
||||||
Assert.isTrue(template instanceof ICPPClassTemplatePartialSpecialization == false);
|
Assert.isTrue(!(template instanceof ICPPClassTemplatePartialSpecialization));
|
||||||
|
|
||||||
ICPPTemplateParameter[] parameters= template.getTemplateParameters();
|
ICPPTemplateParameter[] parameters= template.getTemplateParameters();
|
||||||
if (parameters == null || parameters.length == 0)
|
if (parameters == null || parameters.length == 0)
|
||||||
|
@ -262,7 +262,7 @@ public class CPPTemplates {
|
||||||
// we do not correctly distinguish between type and non-type parameters, this works
|
// we do not correctly distinguish between type and non-type parameters, this works
|
||||||
// around getting the wrong instance when providing a value rather than a type.
|
// around getting the wrong instance when providing a value rather than a type.
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
if (argsContainDependentType || instance instanceof ICPPDeferredClassInstance == false)
|
if (argsContainDependentType || !(instance instanceof ICPPDeferredClassInstance))
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,8 +1007,8 @@ public class CPPTemplates {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
if (parent instanceof IASTDeclSpecifier) {
|
if (parent instanceof IASTDeclSpecifier) {
|
||||||
if (parent instanceof IASTCompositeTypeSpecifier == false
|
if (!(parent instanceof IASTCompositeTypeSpecifier) &&
|
||||||
&& parent instanceof IASTElaboratedTypeSpecifier == false) {
|
!(parent instanceof IASTElaboratedTypeSpecifier)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
@ -1017,7 +1017,7 @@ public class CPPTemplates {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parent instanceof IASTDeclaration == false) {
|
if (!(parent instanceof IASTDeclaration)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1282,7 +1282,7 @@ public class CPPTemplates {
|
||||||
* will include its value)
|
* will include its value)
|
||||||
*/
|
*/
|
||||||
if (param instanceof IASTIdExpression) {
|
if (param instanceof IASTIdExpression) {
|
||||||
param= CPPVisitor.reverseConstantPropogationLookup((IASTIdExpression)param);
|
param= CPPVisitor.reverseConstantPropagationLookup((IASTIdExpression)param);
|
||||||
}
|
}
|
||||||
|
|
||||||
IType type= CPPVisitor.createType(param);
|
IType type= CPPVisitor.createType(param);
|
||||||
|
@ -1523,8 +1523,8 @@ public class CPPTemplates {
|
||||||
if (e1 == null)
|
if (e1 == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
e1= CPPVisitor.reverseConstantPropogationLookup(e1);
|
e1= CPPVisitor.reverseConstantPropagationLookup(e1);
|
||||||
e2= CPPVisitor.reverseConstantPropogationLookup(e2);
|
e2= CPPVisitor.reverseConstantPropagationLookup(e2);
|
||||||
|
|
||||||
if (e1 instanceof IASTLiteralExpression && e2 instanceof IASTLiteralExpression) {
|
if (e1 instanceof IASTLiteralExpression && e2 instanceof IASTLiteralExpression) {
|
||||||
IType t1= e1.getExpressionType();
|
IType t1= e1.getExpressionType();
|
||||||
|
@ -1887,7 +1887,8 @@ public class CPPTemplates {
|
||||||
return !(argument instanceof IProblemBinding);
|
return !(argument instanceof IProblemBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected boolean matchTemplateParameterAndArgument(ICPPTemplateParameter param, IType argument, ObjectMap map) {
|
static protected boolean matchTemplateParameterAndArgument(ICPPTemplateParameter param, IType argument,
|
||||||
|
ObjectMap map) {
|
||||||
if (!isValidArgument(param, argument)) {
|
if (!isValidArgument(param, argument)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1897,7 +1898,8 @@ public class CPPTemplates {
|
||||||
if (!(argument instanceof ICPPTemplateDefinition))
|
if (!(argument instanceof ICPPTemplateDefinition))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ICPPTemplateParameter[] pParams = null, aParams = null;
|
ICPPTemplateParameter[] pParams = null;
|
||||||
|
ICPPTemplateParameter[] aParams = null;
|
||||||
try {
|
try {
|
||||||
pParams = ((ICPPTemplateTemplateParameter) param).getTemplateParameters();
|
pParams = ((ICPPTemplateTemplateParameter) param).getTemplateParameters();
|
||||||
aParams = ((ICPPTemplateDefinition) argument).getTemplateParameters();
|
aParams = ((ICPPTemplateDefinition) argument).getTemplateParameters();
|
||||||
|
|
|
@ -567,7 +567,7 @@ public class CPPVisitor {
|
||||||
if (parent instanceof IASTStandardFunctionDeclarator) {
|
if (parent instanceof IASTStandardFunctionDeclarator) {
|
||||||
IASTStandardFunctionDeclarator fdtor = (IASTStandardFunctionDeclarator) param.getParent();
|
IASTStandardFunctionDeclarator fdtor = (IASTStandardFunctionDeclarator) param.getParent();
|
||||||
// if the fdtor does not declare a function we don't create a binding for the parameter.
|
// if the fdtor does not declare a function we don't create a binding for the parameter.
|
||||||
if (findOutermostDeclarator(fdtor).getParent() instanceof IASTDeclaration == false ||
|
if (!(findOutermostDeclarator(fdtor).getParent() instanceof IASTDeclaration) ||
|
||||||
findTypeRelevantDeclarator(fdtor) != fdtor)
|
findTypeRelevantDeclarator(fdtor) != fdtor)
|
||||||
return null;
|
return null;
|
||||||
IBinding temp = findInnermostDeclarator(fdtor).getName().resolveBinding();
|
IBinding temp = findInnermostDeclarator(fdtor).getName().resolveBinding();
|
||||||
|
@ -2166,7 +2166,6 @@ public class CPPVisitor {
|
||||||
public static IASTProblem[] getProblems(IASTTranslationUnit tu) {
|
public static IASTProblem[] getProblems(IASTTranslationUnit tu) {
|
||||||
CollectProblemsAction action = new CollectProblemsAction();
|
CollectProblemsAction action = new CollectProblemsAction();
|
||||||
tu.accept(action);
|
tu.accept(action);
|
||||||
|
|
||||||
return action.getProblems();
|
return action.getProblems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2344,7 +2343,8 @@ public class CPPVisitor {
|
||||||
return BigInteger.ZERO;
|
return BigInteger.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int start=0, end= integral.length();
|
int start=0;
|
||||||
|
int end= integral.length();
|
||||||
|
|
||||||
boolean negate= integral.charAt(start) == '-';
|
boolean negate= integral.charAt(start) == '-';
|
||||||
if (negate || integral.charAt(start) == '+') {
|
if (negate || integral.charAt(start) == '+') {
|
||||||
|
@ -2379,7 +2379,7 @@ public class CPPVisitor {
|
||||||
* @param e1
|
* @param e1
|
||||||
* @return the first non id-expression by following values assigned to basic types.
|
* @return the first non id-expression by following values assigned to basic types.
|
||||||
*/
|
*/
|
||||||
public static final IASTExpression reverseConstantPropogationLookup(IASTExpression e1) {
|
public static final IASTExpression reverseConstantPropagationLookup(IASTExpression e1) {
|
||||||
try {
|
try {
|
||||||
for(int i= 0; e1 instanceof IASTIdExpression && i < 8; i++) {
|
for(int i= 0; e1 instanceof IASTIdExpression && i < 8; i++) {
|
||||||
IBinding b1= ((IASTIdExpression)e1).getName().resolveBinding();
|
IBinding b1= ((IASTIdExpression)e1).getName().resolveBinding();
|
||||||
|
@ -2436,9 +2436,9 @@ public class CPPVisitor {
|
||||||
public static IASTDeclarator findTypeRelevantDeclarator(IASTDeclarator declarator) {
|
public static IASTDeclarator findTypeRelevantDeclarator(IASTDeclarator declarator) {
|
||||||
IASTDeclarator result= findInnermostDeclarator(declarator);
|
IASTDeclarator result= findInnermostDeclarator(declarator);
|
||||||
while (result.getPointerOperators().length == 0
|
while (result.getPointerOperators().length == 0
|
||||||
&& result instanceof IASTFieldDeclarator == false
|
&& !(result instanceof IASTFieldDeclarator)
|
||||||
&& result instanceof IASTFunctionDeclarator == false
|
&& !(result instanceof IASTFunctionDeclarator)
|
||||||
&& result instanceof IASTArrayModifier == false) {
|
&& !(result instanceof IASTArrayModifier)) {
|
||||||
final IASTNode parent= result.getParent();
|
final IASTNode parent= result.getParent();
|
||||||
if (parent instanceof IASTDeclarator) {
|
if (parent instanceof IASTDeclarator) {
|
||||||
result= (IASTDeclarator) parent;
|
result= (IASTDeclarator) parent;
|
||||||
|
@ -2453,7 +2453,7 @@ public class CPPVisitor {
|
||||||
* Searches for the function enclosing the given node. May return <code>null</code>.
|
* Searches for the function enclosing the given node. May return <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public static IBinding findEnclosingFunction(IASTNode node) {
|
public static IBinding findEnclosingFunction(IASTNode node) {
|
||||||
while(node != null && node instanceof IASTFunctionDefinition == false) {
|
while (node != null && !(node instanceof IASTFunctionDefinition)) {
|
||||||
node= node.getParent();
|
node= node.getParent();
|
||||||
}
|
}
|
||||||
if (node == null)
|
if (node == null)
|
||||||
|
@ -2490,7 +2490,7 @@ public class CPPVisitor {
|
||||||
*/
|
*/
|
||||||
public static IBinding findDeclarationOwner(IASTNode node, boolean allowFunction) {
|
public static IBinding findDeclarationOwner(IASTNode node, boolean allowFunction) {
|
||||||
// search for declaration
|
// search for declaration
|
||||||
while (node instanceof IASTDeclaration == false) {
|
while (!(node instanceof IASTDeclaration)) {
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class IndexCPPSignatureUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getValueString(IASTExpression e) {
|
private static String getValueString(IASTExpression e) {
|
||||||
e= CPPVisitor.reverseConstantPropogationLookup(e);
|
e= CPPVisitor.reverseConstantPropagationLookup(e);
|
||||||
if (e instanceof IASTLiteralExpression) {
|
if (e instanceof IASTLiteralExpression) {
|
||||||
IType t1= e.getExpressionType();
|
IType t1= e.getExpressionType();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class PDOMCPPBasicType extends PDOMNode implements ICPPBasicType, IIndexType {
|
||||||
db.putShort(record + TYPE_ID, getTypeCode(type));
|
db.putShort(record + TYPE_ID, getTypeCode(type));
|
||||||
try {
|
try {
|
||||||
if(type.getValue() != null) {
|
if(type.getValue() != null) {
|
||||||
IASTExpression e= CPPVisitor.reverseConstantPropogationLookup(type.getValue());
|
IASTExpression e= CPPVisitor.reverseConstantPropagationLookup(type.getValue());
|
||||||
if(e != null) {
|
if(e != null) {
|
||||||
db.putInt(record + INTEGRAL, CPPVisitor.parseIntegral(e.toString()).intValue());
|
db.putInt(record + INTEGRAL, CPPVisitor.parseIntegral(e.toString()).intValue());
|
||||||
db.putByte(record + INTERNAL_FLAGS, (byte)1);
|
db.putByte(record + INTERNAL_FLAGS, (byte)1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue