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 a5ea4b878a2..478da74c6c7 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 @@ -5466,4 +5466,19 @@ public class AST2TemplateTests extends AST2BaseTest { ICPPTemplateInstance inst= bh.assertNonProblem("f() {", 1); assertSame(template, inst.getTemplateDefinition()); } + + // template class A{}; + // template class A{}; + // template class A{}; + // template<> class A; + // A fooA(); + // + // template class B{}; + // template class B{}; + // template class B{}; + // template<> class B {}; + // A fooB(); + public void testExplicitSpecializationOfForbiddenAsImplicit_356818() throws Exception { + parseAndCheckBindings(); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/TestMacro.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/TestMacro.java index 6faae13921f..c2440065db6 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/TestMacro.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/TestMacro.java @@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IMacroBinding; import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.core.runtime.CoreException; final class TestMacro implements IMacroBinding { private String fName; @@ -36,7 +35,7 @@ final class TestMacro implements IMacroBinding { return fParams != null; } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return null; } 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 9562839b7ad..bcb559c0bf8 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 @@ -18,6 +18,7 @@ import junit.framework.TestSuite; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IASTImplicitName; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.ICompositeType; @@ -1308,4 +1309,31 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas IFunction f= getBindingFromASTName("fun", 0); ITypedef t= getBindingFromASTName("Type", 0); } + + // struct base { + // virtual void operator+(base const &) { } + // virtual void operator-(base const &) { } + // }; + + // #include "header.h" + // struct inter : public base { + // virtual void operator+(base const &){} + // }; + // struct sub : public inter { + // void doSomething() { + // base *left, *right; + // + // *left + *right; + // *left - *right; + // } + // }; + public void test_Bug356982() throws Exception { + IASTName name= findName("+ ", 1); + assertTrue(name instanceof IASTImplicitName); + assertEquals("base", name.resolveBinding().getOwner().getName()); + + name= findName("- ", 1); + assertTrue(name instanceof IASTImplicitName); + assertEquals("base", name.resolveBinding().getOwner().getName()); + } } 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 9dbf441cd85..73aedf05974 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 @@ -1558,11 +1558,11 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa ICPPTemplateInstance inst= (ICPPTemplateInstance) t1; final ICPPClassTemplate tmplDef = (ICPPClassTemplate) inst.getTemplateDefinition(); - IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments(), false); + IBinding inst2= CPPTemplates.instantiate(tmplDef, inst.getTemplateArguments()); assertSame(inst, inst2); - IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, false); - IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}, false); + IBinding charInst1= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}); + IBinding charInst2= CPPTemplates.instantiate(tmplDef, new ICPPTemplateArgument[] {new CPPTemplateArgument(new CPPBasicType(Kind.eChar, 0))}); assertSame(charInst1, charInst2); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java index 2e61622b70f..18dded3ab59 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java @@ -53,6 +53,7 @@ public class IndexCompositeTests extends BaseTestCase { private static final int NONE = 0, REFS = IIndexManager.ADD_DEPENDENCIES; private static final int REFD = IIndexManager.ADD_DEPENDENT, BOTH = REFS | REFD; private static final IndexFilter FILTER= new IndexFilter() { + @Override public boolean acceptBinding(IBinding binding) throws CoreException { if (binding instanceof ICPPMethod) { return !((ICPPMethod) binding).isImplicit(); @@ -419,6 +420,7 @@ public class IndexCompositeTests extends BaseTestCase { index.acquireReadLock(); } + @Override protected void tearDown() throws Exception { if (index != null) { index.releaseReadLock(); @@ -451,7 +453,7 @@ class ProjectBuilder { return this; } - ICProject create() throws CoreException { + ICProject create() throws Exception { ICProject result = cpp ? CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER) : CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER); @@ -466,7 +468,7 @@ class ProjectBuilder { result.getProject().setDescription(desc, new NullProgressMonitor()); CCorePlugin.getIndexManager().setIndexerId(result, IPDOMManager.ID_FAST_INDEXER); - CCorePlugin.getIndexManager().joinIndexer(4000, new NullProgressMonitor()); + BaseTestCase.waitForIndexer(result); return result; } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java index d7792c838ec..879b11ef2e2 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexUpdateTests.java @@ -117,6 +117,15 @@ public class IndexUpdateTests extends IndexTestBase { assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_WAIT_TIME, npm())); } + private void updateHeader() throws Exception { + // Append variable comment to the end of the file to change its contents. + // Indexer would not reindex the file if its contents remain the same. + IProject project= fHeader.getProject(); + fHeader= TestSourceReader.createFile(project, "header.h", + fContents[++fContentUsed].toString() + "\n// " + fContentUsed); + TestSourceReader.waitUntilFileIsIndexed(fIndex, fHeader, INDEXER_WAIT_TIME); + } + private void setupFile(int totalFileVersions, boolean cpp) throws Exception { if (fContents == null) { fContents= getContentsForTest(totalFileVersions); @@ -135,7 +144,7 @@ public class IndexUpdateTests extends IndexTestBase { fContents[++fContentUsed].toString() + "\n// " + fContentUsed); TestSourceReader.waitUntilFileIsIndexed(fIndex, fFile, INDEXER_WAIT_TIME); } - + @Override public void tearDown() throws Exception { fIndex= null; @@ -1339,4 +1348,89 @@ public class IndexUpdateTests extends IndexTestBase { fIndex.releaseReadLock(); } } + + // typedef enum { + // AE_ON = 0 + // } Adaptiv_T; + // struct mystruct { + // Adaptiv_T eAdapt; + // }; + + // int main() { + // mystruct ms; + // ms.eAdapt = AE_ON; + // } + + // // insert line + // typedef enum { + // AE_ON = 0 + // } Adaptiv_T; + // struct mystruct { + // Adaptiv_T eAdapt; + // }; + public void testAnonymousEnum_Bug356057cpp() throws Exception { + setupHeader(3, true); + setupFile(3, true); + String name1; + fIndex.acquireReadLock(); + try { + final IEnumerator e = (IEnumerator) findBinding("AE_ON"); + assertNotNull(e); + name1= e.getOwner().getName(); + } finally { + fIndex.releaseReadLock(); + } + updateHeader(); + fIndex.acquireReadLock(); + try { + final IEnumerator e = (IEnumerator) findBinding("AE_ON"); + assertNotNull(e); + assertFalse(name1.equals(e.getOwner().getName())); + } finally { + fIndex.releaseReadLock(); + } + } + + // typedef enum { + // AE_ON = 0 + // } Adaptiv_T; + // struct mystruct { + // Adaptiv_T eAdapt; + // }; + + // int main() { + // mystruct ms; + // ms.eAdapt = AE_ON; + // } + + // // insert line + // typedef enum { + // AE_ON = 0 + // } Adaptiv_T; + // struct mystruct { + // Adaptiv_T eAdapt; + // }; + public void testAnonymousEnum_Bug356057c() throws Exception { + setupHeader(3, false); + setupFile(3, false); + String name1; + fIndex.acquireReadLock(); + try { + final IEnumerator e = (IEnumerator) findBinding("AE_ON"); + assertNotNull(e); + name1= e.getOwner().getName(); + } finally { + fIndex.releaseReadLock(); + } + updateHeader(); + fIndex.acquireReadLock(); + try { + final IEnumerator e = (IEnumerator) findBinding("AE_ON"); + assertNotNull(e); + assertFalse(name1.equals(e.getOwner().getName())); + } finally { + fIndex.releaseReadLock(); + } + } } + diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java index 5908ea076d7..86f8412761a 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/util/BaseTestCase.java @@ -57,7 +57,7 @@ public class BaseTestCase extends TestCase { super(name); } - public NullProgressMonitor npm() { + public static NullProgressMonitor npm() { return new NullProgressMonitor(); } @@ -284,7 +284,7 @@ public class BaseTestCase extends TestCase { } } - protected void waitForIndexer(ICProject project) throws InterruptedException { + public static void waitForIndexer(ICProject project) throws InterruptedException { final PDOMManager indexManager = CCoreInternals.getPDOMManager(); assertTrue(indexManager.joinIndexer(10000, npm())); long waitms= 1; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java index 5bca19d5550..2477df5a19d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBinding.java @@ -17,7 +17,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; /** @@ -42,7 +41,7 @@ public interface IBinding extends IAdaptable { * Returns the linkage the binding belongs to. C++-declarations declared as * extern "C" will still return c++-linkage. */ - public ILinkage getLinkage() throws CoreException; + public ILinkage getLinkage(); /** * Returns the binding that owns this binding, or null if there is no owner. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstance.java index b0280a25dc4..9385af855e6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstance.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp; 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.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IType; @@ -45,6 +46,17 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp return arguments; } + @Override + protected ICPPClassSpecializationScope getSpecializationScope() { + // An instance with a declaration has no specialization scope. + checkForDefinition(); + final IASTNode[] decls = getDeclarations(); + if (decls != null && decls.length > 0 && decls[0] != null) + return null; + + return super.getSpecializationScope(); + } + public boolean isExplicitSpecialization() { return !(getCompositeScope() instanceof ICPPClassSpecializationScope); } 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 27b210b55de..197ba953e87 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 @@ -26,9 +26,8 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; 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; @@ -83,9 +82,10 @@ public class CPPClassSpecialization extends CPPSpecialization } } - private class FindDefinitionAction extends ASTVisitor { + private class FindDeclarationDefinitionAction extends ASTVisitor { private char [] nameArray = CPPClassSpecialization.this.getNameCharArray(); - public IASTName result = null; + public IASTName foundDef = null; + public IASTName foundDecl = null; { shouldVisitNames = true; @@ -95,32 +95,27 @@ public class CPPClassSpecialization extends CPPSpecialization } @Override - public int visit( IASTName name ){ - if( name instanceof ICPPASTTemplateId ) - return PROCESS_SKIP; - if( name instanceof ICPPASTQualifiedName ) - return PROCESS_CONTINUE; - char[] c = name.getLookupKey(); - - if (name.getParent() instanceof ICPPASTQualifiedName) { - IASTName[] ns = ((ICPPASTQualifiedName) name.getParent()).getNames(); - if (ns[ns.length - 1] != name) - return PROCESS_CONTINUE; - name = (IASTName) name.getParent(); - } - - if (name.getParent() instanceof ICPPASTCompositeTypeSpecifier && CharArrayUtils.equals(c, nameArray)) { - IBinding binding = name.resolveBinding(); - if (binding == CPPClassSpecialization.this) { - if (name instanceof ICPPASTQualifiedName) { - IASTName[] ns = ((ICPPASTQualifiedName) name).getNames(); - name = ns[ns.length - 1]; + public int visit(IASTName name) { + final IASTNode parent = name.getParent(); + final boolean isDef = parent instanceof ICPPASTCompositeTypeSpecifier; + final boolean isDecl = !isDef && parent instanceof ICPPASTElaboratedTypeSpecifier + && parent.getParent() instanceof IASTSimpleDeclaration; + if (isDef || isDecl) { + name= name.getLastName(); + if (CharArrayUtils.equals(name.getLookupKey(), nameArray)) { + IBinding binding = name.resolveBinding(); + if (binding == CPPClassSpecialization.this) { + if (isDef) { + foundDef= name; + return PROCESS_ABORT; + } + if (foundDecl == null) + foundDecl= name; } - result = name; - return PROCESS_ABORT; } } - return PROCESS_CONTINUE; + // Don't look at members of qualified names or template ids. + return PROCESS_SKIP; } @Override @@ -155,9 +150,12 @@ public class CPPClassSpecialization extends CPPSpecialization orig= ((ICPPSpecialization) orig).getSpecializedBinding(); } if (tu != null) { - FindDefinitionAction action= new FindDefinitionAction(); + FindDeclarationDefinitionAction action= new FindDeclarationDefinitionAction(); tu.accept( action ); - definition = action.result; + definition = action.foundDef; + if (definition == null && action.foundDecl != null) { + addDeclaration(action.foundDecl); + } } checked = true; } @@ -260,10 +258,14 @@ public class CPPClassSpecialization extends CPPSpecialization if (specScope != null) return specScope; - return getCompositeTypeSpecifier().getScope(); + final ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier(); + if (typeSpecifier != null) + return typeSpecifier.getScope(); + + return null; } - private ICPPClassSpecializationScope getSpecializationScope() { + protected ICPPClassSpecializationScope getSpecializationScope() { checkForDefinition(); if (getDefinition() != null) return null; 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 42929385ba8..7fe24052b59 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 @@ -351,7 +351,7 @@ public class CPPScopeMapper { if (template instanceof IIndexBinding && template instanceof ICPPClassType) { IBinding mapped= mapToAST((ICPPClassType) template); if (mapped != template && mapped instanceof ICPPClassType) { - mapped= CPPTemplates.instantiate((ICPPClassTemplate) mapped, inst.getTemplateArguments(), false); + 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/ClassTypeHelper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/ClassTypeHelper.java index 2d7f054aa5a..e62bdc67091 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 @@ -314,11 +314,10 @@ public class ClassTypeHelper { private static ObjectSet getOwnMethods(ICPPClassType classType) { ObjectSet set= new ObjectSet(4); set.addAll(classType.getDeclaredMethods()); - if (classType instanceof IProblemBinding) { - return set; + IScope scope = classType.getCompositeScope(); + if (scope instanceof ICPPClassScope) { + set.addAll(((ICPPClassScope) scope).getImplicitMethods()); } - ICPPClassScope scope= (ICPPClassScope) classType.getCompositeScope(); - set.addAll(scope.getImplicitMethods()); return set; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AutoTypeResolver.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AutoTypeResolver.java index e851cdc10bc..24316c3a014 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AutoTypeResolver.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/AutoTypeResolver.java @@ -25,7 +25,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeParameter; -import org.eclipse.core.runtime.CoreException; /** * This class represents a template function used for deducing 'auto' types (C++0x: 7.1.6.4). @@ -115,7 +114,7 @@ class AutoTypeResolver implements ICPPFunctionTemplate { throw new UnsupportedOperationException(UNEXPECTED_CALL); } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { throw new UnsupportedOperationException(UNEXPECTED_CALL); } 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 2a087805332..6af7c70a0a8 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 @@ -373,7 +373,7 @@ public class CPPSemantics { if (data.tu != null) { ICPPASTTemplateId id = (ICPPASTTemplateId) data.astName; ICPPTemplateArgument[] args = CPPTemplates.createTemplateArgumentArray(id); - IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args, false); + IBinding inst= CPPTemplates.instantiate((ICPPClassTemplate) cls, args); if (inst instanceof ICPPClassType) { cls= (ICPPClassType) inst; } @@ -955,7 +955,7 @@ public class CPPSemantics { return; // Lookup in base classes - if (!data.usingDirectivesOnly && scope instanceof ICPPClassScope) { + if (!data.usingDirectivesOnly && scope instanceof ICPPClassScope && !data.ignoreMembers) { BaseClassLookup.lookupInBaseClasses(data, (ICPPClassScope) scope, fileSet); if (!data.contentAssist && data.hasResultOrProblem()) return; 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 a3cb25d933c..034b816e34b 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 @@ -64,6 +64,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization; @@ -155,11 +156,19 @@ public class CPPTemplates { private static final int PACK_SIZE_NOT_FOUND = Integer.MAX_VALUE; private static final ICPPFunction[] NO_FUNCTIONS = {}; static enum TypeSelection {PARAMETERS, RETURN_TYPE, PARAMETERS_AND_RETURN_TYPE} + + /** + * Instantiates a class template with the given arguments. May return null. + */ + public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args) { + return instantiate(template, args, false, false); + } /** * Instantiates a class template with the given arguments. May return null. */ - public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, boolean isDef) { + private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, + boolean isDefinition, boolean isExplicitSpecialization) { try { // Add default arguments, if necessary. ICPPTemplateArgument[] arguments= SemanticUtil.getSimplifiedArguments(args); @@ -172,7 +181,7 @@ public class CPPTemplates { } if (template instanceof ICPPClassTemplatePartialSpecialization) { - return instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) template, arguments, isDef, null); + return instantiatePartialSpecialization((ICPPClassTemplatePartialSpecialization) template, arguments, isDefinition, null); } @@ -222,15 +231,17 @@ public class CPPTemplates { map.put(param, pack); } - ICPPTemplateInstance prim= getInstance(template, arguments, isDef); - if (prim != null && prim.isExplicitSpecialization()) + ICPPTemplateInstance prim= getInstance(template, arguments, isDefinition); + if (prim != null && (isExplicitSpecialization || prim.isExplicitSpecialization())) return prim; - IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDef); - if (result != null) - return result; + if (!isExplicitSpecialization) { + IBinding result= CPPTemplates.selectSpecialization(template, arguments, isDefinition); + if (result != null) + return result; + } - return instantiatePrimaryTemplate(template, arguments, map, isDef); + return instantiatePrimaryTemplate(template, arguments, map, isDefinition); } catch (DOMException e) { return e.getProblem(); } @@ -620,23 +631,26 @@ public class CPPTemplates { parentOfName = parentOfName.getParent(); } - boolean isDecl= false; - boolean isDef= false; - if (isLastName) { - if (parentOfName instanceof ICPPASTElaboratedTypeSpecifier) { - IASTNode parentOfDeclaration= parentOfName; - while (parentOfDeclaration != null) { - if (parentOfDeclaration instanceof IASTDeclaration) { - parentOfDeclaration= parentOfDeclaration.getParent(); - break; + boolean isDeclaration= false; + boolean isDefinition= false; + boolean isExplicitSpecialization= false; + if (isLastName && parentOfName != null) { + IASTNode declaration= parentOfName.getParent(); + if (declaration instanceof IASTSimpleDeclaration) { + if (parentOfName instanceof ICPPASTElaboratedTypeSpecifier) { + isDeclaration= true; + } else if (parentOfName instanceof ICPPASTCompositeTypeSpecifier) { + isDefinition= true; + } + if (isDeclaration || isDefinition) { + IASTNode parentOfDeclaration = declaration.getParent(); + if (parentOfDeclaration instanceof ICPPASTExplicitTemplateInstantiation) { + isDeclaration= false; + } else if (parentOfDeclaration instanceof ICPPASTTemplateSpecialization) { + isExplicitSpecialization= true; } - parentOfDeclaration= parentOfDeclaration.getParent(); } - - isDecl= !(parentOfDeclaration instanceof ICPPASTExplicitTemplateInstantiation); - } else if (parentOfName instanceof ICPPASTCompositeTypeSpecifier) { - isDef= true; - } + } } try { // class template instance @@ -669,7 +683,7 @@ public class CPPTemplates { result= classTemplate; } else { ICPPClassTemplatePartialSpecialization partialSpec= findPartialSpecialization(classTemplate, args); - if (isDecl || isDef) { + if (isDeclaration || isDefinition) { if (partialSpec == null) { partialSpec = new CPPClassTemplatePartialSpecialization(id); if (template instanceof ICPPInternalClassTemplate) @@ -684,11 +698,11 @@ public class CPPTemplates { } } if (result == null) { - result= instantiate(classTemplate, args, isDef); + result= instantiate(classTemplate, args, isDefinition, isExplicitSpecialization); if (result instanceof ICPPInternalBinding) { - if (isDecl) { + if (isDeclaration) { ASTInternal.addDeclaration(result, id); - } else if (isDef) { + } else if (isDefinition) { ASTInternal.addDefinition(result, id); } } @@ -2320,7 +2334,7 @@ public class CPPTemplates { ICPPTemplateArgument[] newArgs = CPPTemplates.instantiateArguments( ((ICPPUnknownClassInstance) unknown).getArguments(), tpMap, packOffset, within); if (result instanceof ICPPClassTemplate) { - result = instantiate((ICPPClassTemplate) result, newArgs, false); + result = instantiate((ICPPClassTemplate) result, newArgs); } } } @@ -2349,7 +2363,7 @@ public class CPPTemplates { } if (changed) { - IBinding inst= instantiate(classTemplate, newArgs, false); + IBinding inst= instantiate(classTemplate, newArgs); if (inst != null) return inst; } 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 3bfade24d91..323d31e342a 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 @@ -1893,7 +1893,7 @@ public class CPPVisitor extends ASTQueries { return new ProblemType(ISemanticProblem.TYPE_CANNOT_DEDUCE_AUTO_TYPE); } type = (IType) CPPTemplates.instantiate(initializer_list_template, - new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }, true); + new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }); if (type instanceof IProblemBinding) { return new ProblemType(ISemanticProblem.TYPE_CANNOT_DEDUCE_AUTO_TYPE); } @@ -1924,7 +1924,7 @@ public class CPPVisitor extends ASTQueries { type = argument.getTypeValue(); if (initClause instanceof ICPPASTInitializerList) { type = (IType) CPPTemplates.instantiate(initializer_list_template, - new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }, true); + new ICPPTemplateArgument[] { new CPPTemplateArgument(type) }); } return decorateType(type, declSpec, declarator); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CPPTypedefClone.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CPPTypedefClone.java index 6e19e14093f..2c5a02188eb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CPPTypedefClone.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CPPTypedefClone.java @@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; -import org.eclipse.core.runtime.CoreException; public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, ICPPBinding { protected final ITypedef delegate; @@ -35,7 +34,7 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC return type; } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return delegate.getLinkage(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexBindingConstants.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexBindingConstants.java index e52028562b4..07ea94e2747 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexBindingConstants.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexBindingConstants.java @@ -14,7 +14,8 @@ package org.eclipse.cdt.internal.core.index; * Constants used by IIndexFragment implementations for identifying persisted binding types */ public interface IIndexBindingConstants { - int MACRO_DEFINITION = 4; - int MACRO_CONTAINER = 5; - int LAST_CONSTANT= MACRO_CONTAINER; + int ENUMERATOR= 3; + int MACRO_DEFINITION = 4; + int MACRO_CONTAINER = 5; + int LAST_CONSTANT= MACRO_CONTAINER; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCBindingConstants.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCBindingConstants.java index e5046545405..0ad92d9dc32 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCBindingConstants.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCBindingConstants.java @@ -14,12 +14,13 @@ package org.eclipse.cdt.internal.core.index; * Constants used by IIndexFragment implementations for identifying persisted binding types */ public interface IIndexCBindingConstants { - int CVARIABLE = IIndexBindingConstants.LAST_CONSTANT + 1; - int CFUNCTION = IIndexBindingConstants.LAST_CONSTANT + 2; - int CSTRUCTURE = IIndexBindingConstants.LAST_CONSTANT + 3; - int CFIELD = IIndexBindingConstants.LAST_CONSTANT + 4; - int CENUMERATION = IIndexBindingConstants.LAST_CONSTANT + 5; - int CENUMERATOR = IIndexBindingConstants.LAST_CONSTANT + 6; - int CTYPEDEF = IIndexBindingConstants.LAST_CONSTANT + 7; - int CPARAMETER = IIndexBindingConstants.LAST_CONSTANT + 8; + int CENUMERATOR = IIndexBindingConstants.ENUMERATOR; + + int CVARIABLE = IIndexBindingConstants.LAST_CONSTANT + 1; + int CFUNCTION = IIndexBindingConstants.LAST_CONSTANT + 2; + int CSTRUCTURE = IIndexBindingConstants.LAST_CONSTANT + 3; + int CFIELD = IIndexBindingConstants.LAST_CONSTANT + 4; + int CENUMERATION = IIndexBindingConstants.LAST_CONSTANT + 5; + int CTYPEDEF = IIndexBindingConstants.LAST_CONSTANT + 7; + int CPARAMETER = IIndexBindingConstants.LAST_CONSTANT + 8; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java index 86adcfec0dc..6185ba51929 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexCPPBindingConstants.java @@ -15,6 +15,8 @@ package org.eclipse.cdt.internal.core.index; * Constants used by IIndexFragment implementations for identifying persisted binding types. */ public interface IIndexCPPBindingConstants { + int CPPENUMERATOR = IIndexBindingConstants.ENUMERATOR; + int CPPVARIABLE = IIndexBindingConstants.LAST_CONSTANT + 1; int CPPFUNCTION = IIndexBindingConstants.LAST_CONSTANT + 2; int CPPCLASSTYPE = IIndexBindingConstants.LAST_CONSTANT + 3; @@ -24,7 +26,6 @@ public interface IIndexCPPBindingConstants { int CPPNAMESPACEALIAS = IIndexBindingConstants.LAST_CONSTANT + 7; int CPPPARAMETER = IIndexBindingConstants.LAST_CONSTANT + 9; int CPPENUMERATION = IIndexBindingConstants.LAST_CONSTANT + 10; - int CPPENUMERATOR = IIndexBindingConstants.LAST_CONSTANT + 11; int CPPTYPEDEF = IIndexBindingConstants.LAST_CONSTANT + 12; int CPP_CONSTRUCTOR= IIndexBindingConstants.LAST_CONSTANT + 14; int CPP_FUNCTION_TEMPLATE= IIndexBindingConstants.LAST_CONSTANT + 16; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java index ce4227d702e..778a76ea282 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragmentBinding.java @@ -27,7 +27,7 @@ public interface IIndexFragmentBinding extends IIndexBinding { /** * Returns the linkage the binding belongs to. */ - ILinkage getLinkage() throws CoreException; + ILinkage getLinkage(); /** * Returns whether this binding has any definitions associated with it diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/CompositeIndexBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/CompositeIndexBinding.java index 9142ab03fcc..8bf0fb56e2f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/CompositeIndexBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/CompositeIndexBinding.java @@ -46,7 +46,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding { this.rbinding = rbinding; } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return rbinding.getLinkage(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java index 76b2f69c3e7..79f9fecac9d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java @@ -196,7 +196,7 @@ public class PDOM extends PlatformObject implements IPDOM { * 96.0 - storing pack expansions in the template parameter map, bug 294730. * 97.0 - storing file contents hash in PDOMFile, bug 302083. * #98.0# - strongly typed enums, bug 305975. <> - * 99.0 - correct marshalling of basic types, bug 319186. + * #99.0# - correct marshalling of basic types, bug 319186. <> * * CDT 8.0 development (versions not supported on the 7.0.x branch) * 110.0 - update index on encoding change, bug 317435. @@ -204,12 +204,15 @@ public class PDOM extends PlatformObject implements IPDOM { * 111.1 - defaulted and deleted functions, bug 305978 * 112.0 - inline namespaces, bug 305980 * 113.0 - Changed marshaling of values, bug 327878 - * 114.0 - Partial specializations for class template specializations, bug 332884. - * 115.0 - Corrected signatures for function templates, bug 335062. + * #114.0# - Partial specializations for class template specializations, bug 332884. + * - Corrected signatures for function templates, bug 335062. <> + * + * CDT 8.1 development (versions not supported on teh 8.0.x branch) + * 120.0 - Enumerators in global index, bug 356235 */ - private static final int MIN_SUPPORTED_VERSION= version(114, 0); - private static final int MAX_SUPPORTED_VERSION= version(114, Short.MAX_VALUE); - private static final int DEFAULT_VERSION = version(114, 0); + private static final int MIN_SUPPORTED_VERSION= version(120, 0); + private static final int MAX_SUPPORTED_VERSION= version(120, Short.MAX_VALUE); + private static final int DEFAULT_VERSION = version(120, 0); private static int version(int major, int minor) { return (major << 16) + minor; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java index a9f7d5b52ab..57450629dc0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBinding.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.pdom.dom; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.core.dom.IPDOMVisitor; +import org.eclipse.cdt.internal.core.index.IIndexBindingConstants; import org.eclipse.cdt.internal.core.pdom.db.BTree; import org.eclipse.cdt.internal.core.pdom.db.Database; import org.eclipse.cdt.internal.core.pdom.db.IBTreeComparator; @@ -44,6 +45,11 @@ public class FindBinding { if (t1 == t2) { t1 = PDOMNode.getNodeType(database, record1); t2 = PDOMNode.getNodeType(database, record2); + if (t1 == t2 && t1 == IIndexBindingConstants.ENUMERATOR) { + // Allow to insert multiple enumerators into the global index. + t1= record1; + t2= record2; + } } cmp= t1 < t2 ? -1 : (t1 > t2 ? 1 : 0); } @@ -164,7 +170,6 @@ public class FindBinding { public static PDOMBinding findBinding(IPDOMNode node, final PDOMLinkage linkage, final char[] name, final int[] constants, long localToFileRec) throws CoreException { - // mstodo faster searches final DefaultFindBindingVisitor visitor = new DefaultFindBindingVisitor(linkage, name, constants, localToFileRec); try { node.accept(visitor); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java index 647bdca6cdd..829ea8024b8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/IPDOMBinding.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.dom; import org.eclipse.cdt.core.dom.IPDOMNode; import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding; import org.eclipse.cdt.internal.core.pdom.PDOM; -import org.eclipse.core.runtime.CoreException; /** * Marker for bindings in the pdom @@ -33,5 +32,5 @@ public interface IPDOMBinding extends IPDOMNode, IIndexFragmentBinding { /** * Returns the linkage of the binding. */ - PDOMLinkage getLinkage() throws CoreException; + PDOMLinkage getLinkage(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java index 6dcd4f3a500..5e11beb7dc2 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMASTAdapter.java @@ -41,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; import org.eclipse.cdt.core.index.IIndexBinding; import org.eclipse.cdt.core.parser.IToken; -import org.eclipse.core.runtime.CoreException; public class PDOMASTAdapter { private static class AnonymousASTName implements IASTName { @@ -253,7 +252,7 @@ public class PDOMASTAdapter { return fDelegate.getEnumerators(); } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return fDelegate.getLinkage(); } @@ -321,7 +320,7 @@ public class PDOMASTAdapter { return fDelegate.getKey(); } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return fDelegate.getLinkage(); } @@ -395,7 +394,7 @@ public class PDOMASTAdapter { return fDelegate.getAdapter(adapter); } - public ILinkage getLinkage() throws CoreException { + public ILinkage getLinkage() { return fDelegate.getLinkage(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java index 1a13e1a13e5..7ea5c88564d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/PDOMMacro.java @@ -357,8 +357,8 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation { return false; } - public PDOMLinkage getLinkage() throws CoreException { - return getFile().getLinkage(); + public PDOMLinkage getLinkage() { + return fLinkage; } public IIndexScope getScope() { 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 10c58ac4cac..26cdc22c179 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 @@ -11,20 +11,28 @@ *******************************************************************************/ package org.eclipse.cdt.internal.core.pdom.dom.c; +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; import java.util.ArrayList; -import java.util.Collections; +import java.util.List; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.DOMException; +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.IBinding; import org.eclipse.cdt.core.dom.ast.IEnumeration; import org.eclipse.cdt.core.dom.ast.IEnumerator; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; +import org.eclipse.cdt.core.parser.util.CharArrayUtils; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.index.IIndexCBindingConstants; import org.eclipse.cdt.internal.core.index.IIndexType; +import org.eclipse.cdt.internal.core.pdom.PDOM; import org.eclipse.cdt.internal.core.pdom.db.Database; -import org.eclipse.cdt.internal.core.pdom.dom.PDOMASTAdapter; +import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList; +import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner; import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage; import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; @@ -33,12 +41,10 @@ import org.eclipse.core.runtime.CoreException; /** * Enumerations in the database. */ -class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType { - - private static final int FIRST_ENUMERATOR = PDOMBinding.RECORD_SIZE + 0; - private static final int OFFSET_MIN_VALUE= FIRST_ENUMERATOR + Database.PTR_SIZE; +class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType, IPDOMMemberOwner { + private static final int OFFSET_ENUMERATOR_LIST = PDOMBinding.RECORD_SIZE; + private static final int OFFSET_MIN_VALUE= OFFSET_ENUMERATOR_LIST + Database.PTR_SIZE; private static final int OFFSET_MAX_VALUE= OFFSET_MIN_VALUE + 8; - @SuppressWarnings("hiding") protected static final int RECORD_SIZE = OFFSET_MAX_VALUE + 8; @@ -80,35 +86,71 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType { return IIndexCBindingConstants.CENUMERATION; } - public IEnumerator[] getEnumerators() throws DOMException { + public IEnumerator[] getEnumerators() { + List result = getCachedEnumerators(true); + return result.toArray(new IEnumerator[result.size()]); + } + + private List getCachedEnumerators(boolean create) { + final Long key= record; + final PDOM pdom = getPDOM(); + @SuppressWarnings("unchecked") + Reference> cached= (Reference>) pdom.getCachedResult(key); + List result= cached == null ? null : cached.get(); + + if (result == null && create) { + // there is no cache, build it: + result= loadEnumerators(); + pdom.putCachedResult(key, new SoftReference>(result)); + } + return result; + } + + private List loadEnumerators() { + final ArrayList result= new ArrayList(); try { - ArrayList enums = new ArrayList(); - for (PDOMCEnumerator enumerator = getFirstEnumerator(); - enumerator != null; - enumerator = enumerator.getNextEnumerator()) { - enums.add(enumerator); - } - - // Reverse the list since they are last in first out - Collections.reverse(enums); - return enums.toArray(new IEnumerator[enums.size()]); + PDOMNodeLinkedList list = new PDOMNodeLinkedList(getLinkage(), record + OFFSET_ENUMERATOR_LIST); + list.accept(new IPDOMVisitor() { + public boolean visit(IPDOMNode node) throws CoreException { + if (node instanceof PDOMCEnumerator) { + result.add((PDOMCEnumerator) node); + } + return true; + } + public void leave(IPDOMNode node) {} + }); } catch (CoreException e) { CCorePlugin.log(e); - return new IEnumerator[0]; + } + result.trimToSize(); + return result; + } + + @Override + public void accept(IPDOMVisitor visitor) throws CoreException { + for (PDOMCEnumerator enumerator : getCachedEnumerators(true)) { + visitor.visit(enumerator); + visitor.leave(enumerator); } } - private PDOMCEnumerator getFirstEnumerator() throws CoreException { - long value = getDB().getRecPtr(record + FIRST_ENUMERATOR); - return value != 0 ? new PDOMCEnumerator(getLinkage(), value) : null; + @Override + public void addChild(PDOMNode node) throws CoreException { + if (node instanceof PDOMCEnumerator) { + PDOMNodeLinkedList list = new PDOMNodeLinkedList(getLinkage(), record + OFFSET_ENUMERATOR_LIST); + list.addMember(node); + List cache = getCachedEnumerators(false); + if (cache != null) + cache.add((PDOMCEnumerator) node); + } } - - public void addEnumerator(PDOMCEnumerator enumerator) throws CoreException { - PDOMCEnumerator first = getFirstEnumerator(); - enumerator.setNextEnumerator(first); - getDB().putRecPtr(record + FIRST_ENUMERATOR, enumerator.getRecord()); + + @Override + public boolean mayHaveChildren() { + return true; } - + + public long getMinValue() { if (fMinValue != null) { return fMinValue.longValue(); @@ -149,18 +191,20 @@ class PDOMCEnumeration extends PDOMBinding implements IEnumeration, IIndexType { if (type instanceof IEnumeration) { IEnumeration etype= (IEnumeration) type; - etype= (IEnumeration) PDOMASTAdapter.getAdapterForAnonymousASTBinding(etype); - try { - return getDBName().equals(etype.getNameCharArray()); - } catch (CoreException e) { - CCorePlugin.log(e); + char[] nchars = etype.getNameCharArray(); + if (nchars.length == 0) { + nchars= ASTTypeUtil.createNameForAnonymous(etype); } + if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) + return false; + + return SemanticUtil.isSameOwner(getOwner(), etype.getOwner()); } return false; } @Override public Object clone() { - throw new UnsupportedOperationException(); + throw new IllegalArgumentException("Enums must not be cloned"); //$NON-NLS-1$ } } 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 554979910eb..da9da2ba9a8 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 @@ -29,22 +29,17 @@ import org.eclipse.core.runtime.CoreException; * Binding for c enumerator in the index. */ class PDOMCEnumerator extends PDOMBinding implements IEnumerator { - - private static final int ENUMERATION = PDOMBinding.RECORD_SIZE + 0; - private static final int NEXT_ENUMERATOR = PDOMBinding.RECORD_SIZE + 4; - private static final int VALUE= PDOMBinding.RECORD_SIZE + 8; + private static final int VALUE= PDOMBinding.RECORD_SIZE + 0; @SuppressWarnings("hiding") - protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 12; + protected static final int RECORD_SIZE = VALUE + 4; - public PDOMCEnumerator(PDOMLinkage linkage, PDOMNode parent, IEnumerator enumerator, PDOMCEnumeration enumeration) + public PDOMCEnumerator(PDOMLinkage linkage, PDOMNode parent, IEnumerator enumerator) throws CoreException { super(linkage, parent, enumerator.getNameCharArray()); final Database db = getDB(); - db.putRecPtr(record + ENUMERATION, enumeration.getRecord()); storeValue(db, enumerator); - enumeration.addEnumerator(this); } public PDOMCEnumerator(PDOMLinkage linkage, long record) { @@ -75,35 +70,13 @@ class PDOMCEnumerator extends PDOMBinding implements IEnumerator { storeValue(getDB(), (IEnumerator) newBinding); } - - public PDOMCEnumerator getNextEnumerator() throws CoreException { - long value = getDB().getRecPtr(record + NEXT_ENUMERATOR); - return value != 0 ? new PDOMCEnumerator(getLinkage(), value) : null; - } - - public void setNextEnumerator(PDOMCEnumerator enumerator) throws CoreException { - long value = enumerator != null ? enumerator.getRecord() : 0; - getDB().putRecPtr(record + NEXT_ENUMERATOR, value); - } - public IType getType() throws DOMException { - return getEnumeration(); - } - - private PDOMCEnumeration getEnumeration() { - try { - return new PDOMCEnumeration(getLinkage(), getDB().getRecPtr(record + ENUMERATION)); - } catch (CoreException e) { - CCorePlugin.log(e); - return null; - } + IIndexFragmentBinding owner = getOwner(); + if (owner instanceof IType) + return (IType) owner; + return null; } - @Override - public IIndexFragmentBinding getOwner() { - return getEnumeration(); - } - public IValue getValue() { try { int val= getDB().getInt(record + VALUE); 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 9b2dd8fdd6c..2a8e142b953 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 @@ -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.IASTName; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.ICompositeType; @@ -110,6 +109,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { private PDOMBinding createBinding(PDOMNode parent, IBinding binding, long localToFile) throws CoreException { PDOMBinding pdomBinding= null; + PDOMNode insertIntoIndex= null; if (binding instanceof IField) { // must be before IVariable if (parent instanceof IPDOMMemberOwner) pdomBinding = new PDOMCField(this, (IPDOMMemberOwner)parent, (IField) binding); @@ -124,15 +124,11 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { } else if (binding instanceof IEnumeration) { pdomBinding = new PDOMCEnumeration(this, parent, (IEnumeration) binding); } else if (binding instanceof IEnumerator) { - try { - IType enumeration= ((IEnumerator)binding).getType(); - if (enumeration instanceof IEnumeration) { - PDOMBinding pdomEnumeration = adaptBinding((IEnumeration) enumeration); - if (pdomEnumeration instanceof PDOMCEnumeration) - pdomBinding = new PDOMCEnumerator(this, parent, (IEnumerator) binding, (PDOMCEnumeration)pdomEnumeration); - } - } catch (DOMException e) { - CCorePlugin.log(e); + assert parent instanceof IEnumeration; + pdomBinding = new PDOMCEnumerator(this, parent, (IEnumerator) binding); + insertIntoIndex= parent.getParentNode(); + if (insertIntoIndex == null) { + insertIntoIndex= this; } } else if (binding instanceof ITypedef) { pdomBinding = new PDOMCTypedef(this, parent, (ITypedef)binding); @@ -141,7 +137,12 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { if (pdomBinding != null) { pdomBinding.setLocalToFileRec(localToFile); parent.addChild(pdomBinding); - insertIntoNestedBindingsIndex(pdomBinding); + if (insertIntoIndex != null) { + insertIntoIndex.addChild(pdomBinding); + } + if (parent != this && insertIntoIndex != this) { + insertIntoNestedBindingsIndex(pdomBinding); + } } return pdomBinding; } @@ -214,10 +215,6 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { } IBinding owner= binding.getOwner(); - // For plain c the enumeration type is not the parent of the enumeration item. - if (owner instanceof IEnumeration) { - owner= owner.getOwner(); - } if (owner == null) { return this; } @@ -263,23 +260,11 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { if (parent == null) { parent= getAdaptedParent(binding); } - PDOMNode inheritFileLocal= parent; - if (binding instanceof IEnumerator) { - try { - IType enumeration= ((IEnumerator)binding).getType(); - if (enumeration instanceof IEnumeration) { - inheritFileLocal= adaptBinding((IEnumeration) enumeration); - } - } catch (DOMException e) { - CCorePlugin.log(e); - } - } - if (parent == this) { final int[] bindingTypes = new int[] {getBindingType(binding)}; final char[] nameChars = binding.getNameCharArray(); PDOMBinding nonLocal= FindBinding.findBinding(getIndex(), this, nameChars, bindingTypes, 0); - long localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); + long localToFileRec= getLocalToFileRec(parent, binding, nonLocal); if (localToFileRec == 0) return nonLocal; localToFileHolder[0]= localToFileRec; @@ -289,7 +274,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { final int[] bindingTypes = new int[] {getBindingType(binding)}; final char[] nameChars = binding.getNameCharArray(); PDOMBinding nonLocal= FindBinding.findBinding(parent, this, nameChars, bindingTypes, 0); - long localToFileRec= getLocalToFileRec(inheritFileLocal, binding, nonLocal); + long localToFileRec= getLocalToFileRec(parent, binding, nonLocal); if (localToFileRec == 0) return nonLocal; localToFileHolder[0]= localToFileRec; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java index 621cdd74531..f4f040c9d5c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/CPPFindBinding.java @@ -104,7 +104,6 @@ public class CPPFindBinding extends FindBinding { public static PDOMBinding findBinding(PDOMNode node, PDOMLinkage linkage, char[] name, int constant, int sigHash, long localToFileRec) throws CoreException { - // mstodo faster searches CPPFindBindingVisitor visitor= new CPPFindBindingVisitor(linkage, name, constant, sigHash, localToFileRec); try { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassInstance.java index b2b61df7471..53568867bf9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassInstance.java @@ -77,6 +77,12 @@ class PDOMCPPClassInstance extends PDOMCPPClassSpecialization implements ICPPTem } } + @Override + protected boolean hasOwnScope() throws CoreException { + // An instance with a declaration does not use the original template. + return hasDeclaration(); + } + public boolean isExplicitSpecialization() { return !(getCompositeScope() instanceof ICPPClassSpecializationScope); } 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 1b65fc663d3..feb89a0e4f2 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 @@ -129,7 +129,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements public ICPPClassScope getCompositeScope() { if (fScope == null) { try { - if (hasDefinition()) { + if (hasOwnScope()) { fScope= new PDOMCPPClassScope(this); return fScope; } @@ -140,6 +140,10 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements return fScope; } + protected boolean hasOwnScope() throws CoreException { + return hasDefinition(); + } + public PDOMCPPBase getFirstBase() throws CoreException { long rec = getDB().getRecPtr(record + FIRSTBASE); return rec != 0 ? new PDOMCPPBase(getLinkage(), rec) : 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 23451750eee..fdb432d0b0f 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 @@ -71,7 +71,7 @@ class PDOMCPPFunctionInstance extends PDOMCPPFunctionSpecialization implements I public boolean isExplicitSpecialization() { try { - return hasDefinition(); + return hasDeclaration(); } catch (CoreException e) { return false; } 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 0df80e84e1a..cad18e550a2 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 @@ -638,21 +638,9 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { if (parent == null) { parent= adaptOrAddParent(false, binding); } - PDOMNode inheritFileLocal= parent; - if (binding instanceof IEnumerator) { - try { - IType enumeration= ((IEnumerator) binding).getType(); - if (enumeration instanceof IEnumeration) { - inheritFileLocal= adaptBinding((IEnumeration) enumeration); - } - } catch (DOMException e) { - CCorePlugin.log(e); - } - } - if (parent == this) { PDOMBinding glob= CPPFindBinding.findBinding(getIndex(), this, binding, 0); - final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(parent, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; @@ -661,7 +649,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { if (parent instanceof PDOMCPPNamespace) { final BTree btree = ((PDOMCPPNamespace) parent).getIndex(); PDOMBinding glob= CPPFindBinding.findBinding(btree, this, binding, 0); - final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(parent, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; @@ -673,7 +661,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { } if (parent instanceof IPDOMMemberOwner) { PDOMBinding glob= CPPFindBinding.findBinding(parent, this, binding, 0); - final long loc= getLocalToFileRec(inheritFileLocal, binding, glob); + final long loc= getLocalToFileRec(parent, binding, glob); if (loc == 0) return glob; fileLocalRecHolder[0]= loc; diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/plugin.xml b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/plugin.xml index 45ab6e4a9c7..f6c2ea28a99 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/plugin.xml +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/plugin.xml @@ -2,117 +2,115 @@ - + - - - - - + id="cdt.managed.build.info" + name="%extension.name" + point="org.eclipse.cdt.managedbuilder.core.buildDefinitions"> + + + + command="${XL_compilerRoot}/xlC" + id="cdt.managedbuild.tool.xlc.cpp.linker" + name="%ToolName.linker.xlc.cpp" + natureFilter="ccnature" + superClass="org.eclipse.cdt.managedbuilder.xlc.ui.tool.abstractLinker"> + natureFilter="both" + isAbstract="true" + name="%ToolName.archiver.xlc" + command="ar -rv" + id="cdt.managedbuild.tool.xlc.archiver"> + name="%OptionCategory.General" + id="xlc.lib.category.general"> + paths="$(USER_OBJS)" + kind="additionalinputdependency"> + paths="$(LIBS)" + kind="additionalinput"> - - - - - - + + + + + + + name="%OptionCategory.Assembler" + id="xlc.asm.category.assembler"> - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + name="%ToolChainName.Rel" + targetTool="cdt.managedbuild.tool.xlc.c.linker.so.release;cdt.managedbuild.tool.xlc.cpp.linker.so.release" + id="cdt.managedbuild.toolchain.xlc.so.release"> + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + name="%ToolChainName.Rel" + targetTool="cdt.managedbuild.tool.xlc.archiver.lib.release" + id="cdt.managedbuild.toolchain.xlc.lib.release"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + name="%OptionCategory.Libs" + id="xlc.c.link.category.libs"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + name="%OptionCategory.Linking" + id="xlc.c.compiler.category.linking"> + + + + + + + + + + + + + + + + + paths="$(USER_OBJS)" + kind="additionalinputdependency"> + paths="$(LIBS)" + kind="additionalinput"> - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + + + + + + + + + + + + + + + + + point="org.eclipse.ui.preferencePages"> + category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage" + class="org.eclipse.cdt.managedbuilder.xlc.ui.preferences.XLCompilerPreferencePage" + id="org.eclipse.cdt.managedbuilder.xlc.ui.preferences.XLCompilerPreferencePage" + name="%XLCompilerPreferencePage.name"> + point="org.eclipse.core.runtime.preferences"> + class="org.eclipse.cdt.managedbuilder.xlc.ui.preferences.PreferenceInitializer"> + point="org.eclipse.ui.propertyPages"> + category="org.eclipse.cdt.managedbuilder.ui.properties.Page_head_build" + class="org.eclipse.cdt.managedbuilder.xlc.ui.properties.XLCompilerPropertyPage" + id="org.eclipse.cdt.managedbuilder.xlc.ui.properties.samplePropertyPage" + name="%XLCompilerPropertyPage.name"> - + name="projectNature" + value="org.eclipse.cdt.managedbuilder.core.managedBuildNature"> + - - - - - - - - - + + + + + + + + point="org.eclipse.cdt.managedbuilder.ui.newWizardPages"> + ID="org.eclipse.cdt.managedbuilder.xlc.ui.XlcSettingsWizardPage" + operationClass="org.eclipse.cdt.managedbuilder.xlc.ui.wizards.XLCSettingsWizardRunnable" + pageClass="org.eclipse.cdt.managedbuilder.xlc.ui.wizards.XLCSettingsWizardPage"> + projectTypeID="cdt.managedbuild.target.xlc.exe"> + projectTypeID="cdt.managedbuild.target.xlc.so"> + projectTypeID="cdt.managedbuild.target.xlc.lib"> - - - -