From bc98cae74719c24e828b8acdaf6edd85027ef92d Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 7 Dec 2008 21:14:59 +0000 Subject: [PATCH] Second test case for bug 257818. --- .../internal/index/tests/IndexBugsTests.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java index 3f8a4ce838a..d2b5fd04a1a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java @@ -43,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.ITypedef; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.index.IIndex; @@ -721,7 +722,7 @@ public class IndexBugsTests extends BaseTestCase { // void test(B::value_type x) { // f(x); // problem on f // } - public void _test257818() throws Exception { + public void _test257818_1() throws Exception { waitForIndexer(); String[] testData = getContentsForTest(4); @@ -742,6 +743,47 @@ public class IndexBugsTests extends BaseTestCase { } } + // // test1.h + // template struct A { + // typedef U value_type; + // }; + + // // test2.h + // #include "test1.h" + // template struct B { + // typedef A container_type; + // typedef typename container_type::value_type value_type; + // void m(value_type* p); + // }; + + // #include "test1.h" + + // #include "test2.h" + // class C {}; + // void test(B x, C y) { + // x.m(&y); + // } + public void _test257818_2() throws Exception { + waitForIndexer(); + + String[] testData = getContentsForTest(4); + TestSourceReader.createFile(fCProject.getProject(), "test1.h", testData[0]); + TestSourceReader.createFile(fCProject.getProject(), "test2.h", testData[1]); + TestSourceReader.createFile(fCProject.getProject(), "test1.cpp", testData[2]); + IFile test2= TestSourceReader.createFile(fCProject.getProject(), "test2.cpp", testData[3]); + final IIndexManager indexManager = CCorePlugin.getIndexManager(); + indexManager.reindex(fCProject); + waitForIndexer(); + IIndex index= indexManager.getIndex(fCProject); + index.acquireReadLock(); + try { + IASTTranslationUnit ast = TestSourceReader.createIndexBasedAST(index, fCProject, test2); + getBindingFromASTName(ast, testData[3], "m(&y)", 1, ICPPMethod.class); + } finally { + index.releaseReadLock(); + } + } + // class A {}; class B {}; class C {}; public void testIndexContentOverProjectDelete() throws Exception { waitForIndexer();