1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-30 19:53:30 +02:00

Fix for Bug 60948: Indexer should pick up all headers in include path

This commit is contained in:
Bogdan Gheorghe 2004-08-03 19:48:01 +00:00
parent 354fd3e9f8
commit 1ed9b81a2c
5 changed files with 33 additions and 22 deletions

View file

@ -1,3 +1,6 @@
2004-08-03 Bogdan Gheorghe
Updated indexer and dependency tests to work for indexing standalone headers
2004-06-09 Alain Magloire
Patch from Sam Rob to resolve 64022

View file

@ -221,7 +221,7 @@ import org.eclipse.core.runtime.Platform;
PathCollector pathCollector = new PathCollector();
getTableRefs(dH, pathCollector);
String[] dHModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
String[] dHModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest2.h"};
String[] iPath = pathCollector.getPaths();
if (dHModel.length != iPath.length)
@ -238,7 +238,7 @@ import org.eclipse.core.runtime.Platform;
pathCollector = new PathCollector();
getTableRefs(Inc1H, pathCollector);
String[] Inc1HModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp"};
String[] Inc1HModel = {IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp",IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.h"};
iPath = pathCollector.getPaths();
if (Inc1HModel.length != iPath.length)
@ -283,22 +283,23 @@ import org.eclipse.core.runtime.Platform;
getTableRefs(Inc1H, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
String[] inc1Model = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.cpp",Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest.h"};
compareArrays(iPath,inc1Model);
pathCollector = new PathCollector();
getTableRefs(aH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,inc1Model);
pathCollector = new PathCollector();
getTableRefs(cH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
String[] cHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "Inc1.h", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest.cpp", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "a.h", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest.h"};
compareArrays(iPath,cHModel);
editCode(depTestC,"#include \"DepTest.h\"","//#include \"DepTest.h\"");
@ -324,7 +325,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 1)
fail("Number of included files differs from model");
pathCollector = new PathCollector();
@ -332,7 +333,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 1)
fail("Number of included files differs from model");
@ -341,7 +342,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
if (iPath.length != 0)
if (iPath.length != 3)
fail("Number of included files differs from model");
}
@ -491,8 +492,9 @@ import org.eclipse.core.runtime.Platform;
IFile depTest3H = importFile("DepTest3.h","resources/dependency/DepTest3.h");
IFile depTest3C = importFile("DepTest3.cpp","resources/dependency/DepTest3.cpp");
String[] beforeModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp"};
String[] beforeModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp"};
String[] cHModel = {Path.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.cpp", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "a.h", IPath.SEPARATOR + "DepTestProject" + IPath.SEPARATOR + "DepTest3.h"};
String[] aHModel = {Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest3.cpp", Path.SEPARATOR + "DepTestProject" + Path.SEPARATOR + "DepTest3.h"};
PathCollector pathCollector = new PathCollector();
getTableRefs(depTest3H, pathCollector);
@ -505,14 +507,14 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,cHModel);
pathCollector = new PathCollector();
getTableRefs(aH, pathCollector);
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,aHModel);
editCode(aH,"#include \"c.h\"","//#include \"c.h\"");
@ -537,7 +539,7 @@ import org.eclipse.core.runtime.Platform;
iPath = pathCollector.getPaths();
compareArrays(iPath,beforeModel);
compareArrays(iPath,aHModel);
}
@ -579,7 +581,7 @@ import org.eclipse.core.runtime.Platform;
resultSet = resultCollector.getSearchResults();
if (resultSet.size() != 0)
if (resultSet.size() != 1)
fail("Expected no matches");
}

View file

@ -206,7 +206,7 @@ public class IndexManagerTests extends TestCase {
ind = indexManager.getIndex(testProjectPath,true,true);
char[] prefix = "typeDecl/C/CDocumentManager".toCharArray();
String [] entryResultModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }"};
String [] entryResultModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }"};
IEntryResult[] eresults =ind.queryEntries(prefix);
assertTrue("Entry Result exists", eresults != null);
@ -271,7 +271,7 @@ public class IndexManagerTests extends TestCase {
IEntryResult[] eresults = ind.queryEntries(prefix);
assertTrue("Entry result found for typdeDecl/", eresults != null);
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }", "EntryResult: word=typeDecl/C/Mail, refs={ 2 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 2 }", "EntryResult: word=typeDecl/C/container, refs={ 2 }", "EntryResult: word=typeDecl/C/first_class, refs={ 2 }", "EntryResult: word=typeDecl/C/postcard, refs={ 2 }", "EntryResult: word=typeDecl/D/Mail, refs={ 2 }", "EntryResult: word=typeDecl/D/first_class, refs={ 2 }", "EntryResult: word=typeDecl/D/postcard, refs={ 2 }", "EntryResult: word=typeDecl/V/, refs={ 1 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 2 }", "EntryResult: word=typeDecl/V/index, refs={ 2 }", "EntryResult: word=typeDecl/V/mail, refs={ 2 }", "EntryResult: word=typeDecl/V/size, refs={ 2 }", "EntryResult: word=typeDecl/V/temp, refs={ 2 }", "EntryResult: word=typeDecl/V/x, refs={ 2 }"};
String [] entryResultBeforeModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }", "EntryResult: word=typeDecl/C/Mail, refs={ 3 }", "EntryResult: word=typeDecl/C/Unknown, refs={ 3 }", "EntryResult: word=typeDecl/C/container, refs={ 3 }", "EntryResult: word=typeDecl/C/first_class, refs={ 3 }", "EntryResult: word=typeDecl/C/postcard, refs={ 3 }", "EntryResult: word=typeDecl/D/Mail, refs={ 3 }", "EntryResult: word=typeDecl/D/first_class, refs={ 3 }", "EntryResult: word=typeDecl/D/postcard, refs={ 3 }", "EntryResult: word=typeDecl/V/, refs={ 1, 2 }", "EntryResult: word=typeDecl/V/PO_Box, refs={ 3 }", "EntryResult: word=typeDecl/V/index, refs={ 3 }", "EntryResult: word=typeDecl/V/mail, refs={ 3 }", "EntryResult: word=typeDecl/V/size, refs={ 3 }", "EntryResult: word=typeDecl/V/temp, refs={ 3 }", "EntryResult: word=typeDecl/V/x, refs={ 3 }"};
if (eresults.length != entryResultBeforeModel.length)
fail("Entry Result length different from model");
@ -291,7 +291,7 @@ public class IndexManagerTests extends TestCase {
eresults = ind.queryEntries(prefix);
assertTrue("Entry exists", eresults != null);
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1 }", "EntryResult: word=typeDecl/V/, refs={ 1 }"};
String [] entryResultAfterModel ={"EntryResult: word=typeDecl/C/CDocumentManager, refs={ 1, 2 }", "EntryResult: word=typeDecl/V/, refs={ 1, 2 }"};
if (eresults.length != entryResultAfterModel.length)
fail("Entry Result length different from model");

View file

@ -1,3 +1,7 @@
2004-08-03 Bogdan Gheorghe
Fix for Bug 60948: Indexer should pick up all headers in include path
2004-07-12 Bogdan Gheorghe
Fix for Bug 69166: NPE in IndexerModelListener.processDelta

View file

@ -468,12 +468,14 @@ public abstract class AbstractIndexer implements IIndexer, IIndexConstants, ICSe
public boolean shouldIndex(IFile fileToBeIndexed) {
if (fileToBeIndexed != null){
ICFileType type = CCorePlugin.getDefault().getFileType(fileToBeIndexed.getProject(),fileToBeIndexed.getName());
if (type.isSource()){
if (type.isSource() || type.isHeader()){
String id = type.getId();
if (id.equals(AbstractIndexer.C_SOURCE_ID) ||
id.equals(AbstractIndexer.CPP_SOURCE_ID))
id.equals(AbstractIndexer.CPP_SOURCE_ID) ||
id.equals(AbstractIndexer.C_HEADER_ID) ||
id.equals(AbstractIndexer.CPP_HEADER_ID))
return true;
}
}
}
return false;