Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorNathan Ridge2017-10-01 04:34:38 +0000
committerNathan Ridge2017-10-04 02:23:09 +0000
commit33d33a8cd6081beac4d62e3556d82f818122cb55 (patch)
tree336a45805743d4b8865ad1937e0f8e77b420303c /codan
parente1b68206ae1431825742b529fd110e6433eddc9a (diff)
downloadorg.eclipse.cdt-33d33a8cd6081beac4d62e3556d82f818122cb55.tar.gz
org.eclipse.cdt-33d33a8cd6081beac4d62e3556d82f818122cb55.tar.xz
org.eclipse.cdt-33d33a8cd6081beac4d62e3556d82f818122cb55.zip
Bug 525350 - Ensure a lookup point is always set during indexing, code analysis, and code completion
Also push a more accurate lookup point in a few places. Change-Id: I635569178d8d9afd23f7782aeebdaed714f1a10d
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java8
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/AbstractIndexAstChecker.java3
2 files changed, 10 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
index df768a2a8f..6bcdb9fa30 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
@@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.SemanticQueries;
import org.eclipse.cdt.core.parser.util.StringUtil;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
/**
* Reports a problem if object of a class cannot be created because
@@ -191,7 +192,12 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
ICPPClassType classType = (ICPPClassType) unwindedType;
ICPPMethod[] pureVirtualMethods = pureVirtualMethodsCache.get(classType);
if (pureVirtualMethods == null) {
- pureVirtualMethods = SemanticQueries.getPureVirtualMethods(classType, problemNode);
+ CPPSemantics.pushLookupPoint(problemNode);
+ try {
+ pureVirtualMethods = SemanticQueries.getPureVirtualMethods(classType);
+ } finally {
+ CPPSemantics.popLookupPoint();
+ }
pureVirtualMethodsCache.put(classType, pureVirtualMethods);
}
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/AbstractIndexAstChecker.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/AbstractIndexAstChecker.java
index 2d3e282346..c9ec33b5e0 100644
--- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/AbstractIndexAstChecker.java
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/AbstractIndexAstChecker.java
@@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -113,11 +114,13 @@ public abstract class AbstractIndexAstChecker extends AbstractCheckerWithProblem
context.add(modelCache);
}
}
+ CPPSemantics.pushLookupPoint(ast);
try {
processAst(ast);
} finally {
modelCache = null;
setContext(null);
+ CPPSemantics.popLookupPoint();
}
}
}

Back to the top