Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java6
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java7
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java4
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/NullSourceElementRequestor.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserFactory.java4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java108
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java7
12 files changed, 152 insertions, 29 deletions
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
index 47b5fc21fdd..cbb02d9c093 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -100,7 +100,7 @@ public class StructuralTemplateTests extends ITemplateTests {
String[] myExpectedValues = {
"fum",
"scrum",
- "nonVector::first",
+ "nonVector<T>::first",
"Foo::fum",
"IsGreaterThan",
};
@@ -216,7 +216,7 @@ public class StructuralTemplateTests extends ITemplateTests {
"fum<Bar>(int) : void",
"scrum<int>(void) : void", // TODO: deduce the rules of () versus (void), compare below.
// TODO: shouldn't signature indicate const function as well?
- "nonVector::first<T>() : const T&", // TODO: where should <T> be?
+ "nonVector<T>::first<T>() : const T&", // TODO: where should <T> be?
"Foo::fum<Bar>(int) : void",
"IsGreaterThan<X>(X, X) : bool",
/*"default_alloc_template<threads,inst>::S_start_free<bool, int> : char*",*/
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java
index 6b507df2aa6..83668c7827a 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -54,6 +54,7 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTNode;
@@ -771,6 +772,10 @@ public class CompleteParseBaseTest extends TestCase
getCurrentScope().addDeclaration( declaration );
}
+ public void acceptNamespaceAlias(IASTNamespaceAlias alias) {
+ getCurrentScope().addDeclaration( alias );
+ }
+
/**
* @return
*/
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
index 53179bda540..16262a60fd5 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/FileBasePluginTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,6 +53,7 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTNode;
@@ -290,6 +291,7 @@ public class FileBasePluginTest extends TestCase {
public void acceptParameterReference( IASTParameterReference reference ) { callbacks.add( ACCEPT_REFERENCE ); }
public void acceptTemplateParameterReference( IASTTemplateParameterReference reference ) { callbacks.add( ACCEPT_REFERENCE ); }
public void acceptFriendDeclaration( IASTDeclaration declaration ) { callbacks.add( ACCEPT_FRIEND ); }
+ public void acceptNamespaceAlias(IASTNamespaceAlias alias) {}
public void exitTemplateDeclaration( IASTTemplateDeclaration declaration ) { callbacks.add( EXIT_TEMPLATE_DECL); }
public void exitTemplateSpecialization( IASTTemplateSpecialization specialization ) { callbacks.add( EXIT_TEMPLATE_SPEC ); }
public void exitTemplateExplicitInstantiation( IASTTemplateInstantiation instantiation ) { callbacks.add( EXIT_TEMPLATE_INSTANCE ); }
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
index b84f57612f8..96a59483147 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -320,7 +320,7 @@ public class CModelBuilder {
// set the template parameters
StructureTemplate classTemplate = (StructureTemplate) element;
classTemplate.setTemplateParameterTypes(parameterTypes);
- } else if (element instanceof StructureTemplate) {
+ } else if (element instanceof StructureTemplateDeclaration) {
// set the template parameters
StructureTemplateDeclaration classTemplate = (StructureTemplateDeclaration) element;
classTemplate.setTemplateParameterTypes(parameterTypes);
@@ -335,7 +335,7 @@ public class CModelBuilder {
// set the template parameters
StructureTemplate classTemplate = (StructureTemplate) element;
classTemplate.setTemplateParameterTypes(parameterTypes);
- } else if (element instanceof StructureTemplate) {
+ } else if (element instanceof StructureTemplateDeclaration) {
// set the template parameters
StructureTemplateDeclaration classTemplate = (StructureTemplateDeclaration) element;
classTemplate.setTemplateParameterTypes(parameterTypes);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
index 160e17f91c5..42435d79f41 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,6 +32,7 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTParameterReference;
@@ -64,6 +65,7 @@ public interface ISourceElementRequestor {
public void acceptEnumerationSpecifier( IASTEnumerationSpecifier enumeration );
public void acceptElaboratedForewardDeclaration( IASTElaboratedTypeSpecifier elaboratedType );
public void acceptAbstractTypeSpecDeclaration( IASTAbstractTypeSpecifierDeclaration abstractDeclaration );
+ public void acceptNamespaceAlias( IASTNamespaceAlias alias );
public void enterFunctionBody( IASTFunction function );
public void exitFunctionBody( IASTFunction function );
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/NullSourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/NullSourceElementRequestor.java
index 3779d2fd4db..bb99d1c4368 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/NullSourceElementRequestor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/NullSourceElementRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,6 +33,7 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTParameterReference;
@@ -377,6 +378,9 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
// TODO Auto-generated method stub
}
+
+ public void acceptNamespaceAlias(IASTNamespaceAlias alias) {
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserFactory.java
index ecd407f0653..9f80bc427c8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,7 +41,7 @@ public class ParserFactory {
public static IASTFactory createASTFactory( ParserMode mode, ParserLanguage language )
{
- if( mode == ParserMode.QUICK_PARSE )
+ if( mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE )
return new QuickParseASTFactory(extensionFactory.createASTExtension( mode ));
return new CompleteParseASTFactory( language, mode, extensionFactory.createASTExtension( mode ));
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
index 52dc6c85d3e..829e22575ed 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2002, 2005 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -3926,6 +3926,7 @@ public class Parser implements IParserData, IParser
alias = astFactory.createNamespaceAlias(
scope, identifier.getCharImage(), duple, first.getOffset(),
first.getLineNumber(), identifier.getOffset(), identifier.getEndOffset(), identifier.getLineNumber(), duple.getLastToken().getEndOffset(), duple.getLastToken().getLineNumber() );
+ requestor.acceptNamespaceAlias(alias);
}
catch (Exception e1)
{
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
index 2d9c4b0a0fc..05fc4a01285 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,15 +15,32 @@ import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
-import org.eclipse.cdt.core.parser.*;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IQuickParseCallback;
+import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
+import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
+import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
+import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope;
public class QuickParseCallback extends NullSourceElementRequestor implements IQuickParseCallback
@@ -217,4 +234,91 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
public void setHasNoProblems(boolean hasProblems) {
this.hasNoProblems = hasProblems;
}
+
+ public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {
+ if (abstractDeclaration.getOwnerTemplateDeclaration() == null) {
+ addElement(abstractDeclaration);
+ }
+ }
+
+ public void acceptASMDefinition(IASTASMDefinition asmDefinition) {
+ addElement(asmDefinition);
+ }
+
+ public void acceptField(IASTField field) {
+ addElement(field);
+ }
+
+ public void acceptFriendDeclaration(IASTDeclaration declaration) {
+ addElement(declaration);
+ }
+
+ public void acceptFunctionDeclaration(IASTFunction function) {
+ if (function.getOwnerTemplateDeclaration() == null) {
+ addElement(function);
+ }
+ }
+
+ public void acceptMethodDeclaration(IASTMethod method) {
+ addElement(method);
+ }
+
+ public void acceptNamespaceAlias(IASTNamespaceAlias alias) {
+ addElement(alias);
+ }
+
+ public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) {
+ addElement(typedef);
+ }
+
+ public void acceptUsingDirective(IASTUsingDirective usageDirective) {
+ addElement(usageDirective);
+ }
+
+ public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) {
+ addElement(usageDeclaration);
+ }
+
+ public void acceptVariable(IASTVariable variable) {
+ addElement(variable);
+ }
+
+ public void enterFunctionBody(IASTFunction function) {
+ if (function.getOwnerTemplateDeclaration() == null) {
+ addElement(function);
+ }
+ }
+
+ public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {
+ addElement(linkageSpec);
+ }
+
+ public void enterMethodBody(IASTMethod method) {
+ if (method.getOwnerTemplateDeclaration() == null) {
+ addElement(method);
+ }
+ }
+
+ public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
+ addElement(namespaceDefinition);
+ }
+
+ public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
+ addElement(declaration);
+ }
+
+ public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) {
+ addElement(specialization);
+ }
+
+ public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation) {
+ addElement(instantiation);
+ }
+
+ protected void addElement(IASTDeclaration declaration) {
+ IASTScope scope = declaration.getOwnerScope();
+ if (scope != null && scope instanceof IASTQScope) {
+ ((IASTQScope) scope).addDeclaration(declaration);
+ }
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java
index 18ba9fadce8..dadef9fdc72 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,8 +31,8 @@ import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTLinkageSpecification;
-import org.eclipse.cdt.internal.core.parser.ast.complete.ASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.quick.ASTLinkageSpecification;
+import org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope;
/**
* @author hamer
@@ -47,20 +47,17 @@ public class StructuralParseCallback extends QuickParseCallback{
protected int inclusionLevel = 0;
- private void addElement (IASTDeclaration element){
+ protected void addElement (IASTDeclaration element){
if(inclusionLevel == 0){
- if( currentScope instanceof ASTScope )
- ((ASTScope)currentScope).addDeclaration(element);
- else if( currentScope instanceof ASTLinkageSpecification )
+ if( currentScope instanceof ASTLinkageSpecification )
((ASTLinkageSpecification)currentScope).addDeclaration( element );
+ else if( currentScope instanceof IASTQScope )
+ ((IASTQScope)currentScope).addDeclaration(element);
}
}
private void enterScope(IASTNode node){
if(node instanceof IASTScope){
- if(node instanceof ASTScope){
- ((ASTScope)node).initDeclarations();
- }
pushScope((IASTScope)node);
}
}
@@ -107,6 +104,11 @@ public class StructuralParseCallback extends QuickParseCallback{
addElement((IASTTemplateDeclaration)function.getOwnerTemplateDeclaration());
}
+ public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
+ // Ignore top-level template declarations because they are already
+ // handled by the enclosed type being parameterized.
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefDeclaration(org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration)
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
index 68ffa15aba6..dd5c4f615f8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTDeclaration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,8 +23,6 @@ public abstract class ASTDeclaration extends ASTNode implements IASTDeclaration
public ASTDeclaration( IASTScope scope )
{
this.scope = scope;
- if( scope != null && scope instanceof IASTQScope )
- ((IASTQScope)scope).addDeclaration(this);
}
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java
index 03121975df2..a325c2e124e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 QNX Software Systems and others.
+ * Copyright (c) 2002, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - initial implementation base on code from rational/IBM
+ * IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.compare;
@@ -39,6 +40,7 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceAlias;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTParameterReference;
@@ -359,4 +361,7 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
// TODO Auto-generated method stub
}
+
+ public void acceptNamespaceAlias(IASTNamespaceAlias alias) {
+ }
}

Back to the top