Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2009-02-11 10:39:07 -0500
committerMarkus Schorn2009-02-11 10:39:07 -0500
commit47e8c5ca7575c770b27414702a8830f82520e168 (patch)
tree0f029785e970894aa259545763dedac21f08ebaf
parent3c4d0d5300e44af285be8d3f691fd6a5f1cd0864 (diff)
downloadorg.eclipse.cdt-47e8c5ca7575c770b27414702a8830f82520e168.tar.gz
org.eclipse.cdt-47e8c5ca7575c770b27414702a8830f82520e168.tar.xz
org.eclipse.cdt-47e8c5ca7575c770b27414702a8830f82520e168.zip
Fixes a stack overflow, bug 263549.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java20
1 files changed, 17 insertions, 3 deletions
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 307d8354631..126e1327268 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
@@ -49,6 +49,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
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.ICPPMethod;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
@@ -168,9 +169,22 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
@Override
public void addName(IASTName name) throws DOMException {
if (name instanceof ICPPASTQualifiedName) {
- IASTName ln= ((ICPPASTQualifiedName) name).getLastName();
- if (CPPVisitor.getContainingScope(name) != CPPVisitor.getContainingScope(ln)) {
- return;
+ // check whether the qualification matches
+ IScope scope= this;
+ final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name;
+ final IASTName[] names= qname.getNames();
+ for (int i = names.length-2; i>=0;) {
+ IName scopeName= scope.getScopeName();
+ if (scopeName != null) {
+ char[] sname= scopeName.toCharArray();
+ if (sname.length != 0) {
+ if (!CharArrayUtils.equals(names[i--].toCharArray(), sname))
+ return;
+ }
+ }
+ do {
+ scope= scope.getParent();
+ } while (scope instanceof ICPPTemplateScope);
}
}
IASTNode parent = name.getParent();

Back to the top