diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/templates/SimpleMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/templates/SimpleMakefileGenerator.java index 9150103c091..3792bba1b2a 100644 --- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/templates/SimpleMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/templates/SimpleMakefileGenerator.java @@ -99,7 +99,7 @@ public class SimpleMakefileGenerator extends ProcessRunner { for (Iterator i = valueStore.keySet().iterator(); i.hasNext();) { String key = (String)i.next(); String pattern = START + key +END; - if (!fileContents.contains(pattern)) + if (fileContents.indexOf(pattern)==-1) // Not used continue; diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2SelectionParseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2SelectionParseTest.java index 133be266a98..64ed367a51a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2SelectionParseTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2SelectionParseTest.java @@ -1646,11 +1646,13 @@ public class AST2SelectionParseTest extends AST2SelectionParseBaseTest { } public void testBug86126() throws Exception { - importFile("foo.h", "int x;\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ - String code = "#include \"foo.h\"\r\n"; //$NON-NLS-1$ - IFile file = importFile("blah.c", code); - int offset1 = code.indexOf( "#include \"foo.h\"" ); //$NON-NLS-1$ - int length = "#include \"foo.h\"".length(); //$NON-NLS-1$ + String header= "foo"+System.currentTimeMillis()+".h"; + String source= "blah"+System.currentTimeMillis()+".c"; + importFile(header, "int x;\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ + String code = "#include \""+header+"\"\r\n"; //$NON-NLS-1$ + IFile file = importFile(source, code); + int offset1 = code.indexOf( "#include \""+header+"\"" ); //$NON-NLS-1$ + int length = ("#include \""+header+"\"").length(); //$NON-NLS-1$ IASTNode node = parse( file, ParserLanguage.C, offset1, length ); assertNotNull(node); } 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 252906ea3ca..52ab90ddd45 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 @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.cdt.internal.index.tests; +import java.util.ArrayList; +import java.util.List; + import junit.framework.TestSuite; import org.eclipse.cdt.core.dom.ast.IBasicType; @@ -55,7 +58,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa setStrategy(new ReferencedProject(true)); } - // // Brian W.'s example from bugzilla#167098 + // // Bryan W.'s example from bugzilla#167098 // template // class D { //CPPClassTemplate // public: @@ -211,6 +214,50 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa } } + // class A {}; class B {}; class C {}; + // template + // class D {}; + // + // template + // class D {}; + + // template class D; // harmless declaration for test purposes + // template + // class D {}; + // template + // class D {}; + public void _testClassPartialSpecializations() throws Exception { + IBinding b0= getBindingFromASTName("D", 8, true); + IBinding b1= getBindingFromASTName("D", 8, true); + IBinding b2= getBindingFromASTName("D", 8, true); + IBinding b3= getBindingFromASTName("D @@ -498,9 +545,9 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // class Foo {}; // // Foo b2; - public void _testClassSpecializations() { + public void testClassSpecializations() { IBinding b1a = getBindingFromASTName("Foo b1;", 3); - IBinding b1b = getBindingFromASTName("Foo b1;", 5, true); + IBinding b1b = getBindingFromASTName("Foo b1;", 6, true); assertInstance(b1a, ICPPClassType.class); assertInstance(b1a, ICPPClassTemplate.class); @@ -515,7 +562,7 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa assertEquals("B", b1pct.getName()); IBinding b2a = getBindingFromASTName("Foo b2;", 3); - IBinding b2b = getBindingFromASTName("Foo b2;", 5, true); + IBinding b2b = getBindingFromASTName("Foo b2;", 6, true); assertInstance(b2a, ICPPClassType.class); assertInstance(b2a, ICPPClassTemplate.class); @@ -536,14 +583,20 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa // return a; // } // void sanity() {} + // int d; // void foo() { sanity(); } // class Int {}; // Int a,b; // Int c= left(a,b); + // Int c= left(a,d); public void testSimpleFunctionTemplate() { IBinding b0 = getBindingFromASTName("sanity();", 6); IBinding b1 = getBindingFromASTName("a,b;", 1); - IBinding b2 = getBindingFromASTName("left(a,b)", 4); + IBinding b2 = getBindingFromASTName("a,b)", 1); + IBinding b3 = getBindingFromASTName("b)", 1); + IBinding b4 = getBindingFromASTName("d)", 1); + IBinding b5 = getBindingFromASTName("left(a,b)", 4); + IBinding b6 = getBindingFromASTName("left(a,b)", 4); } }