1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

F3 on built-in macro throws NPE, bug 293864.

This commit is contained in:
Markus Schorn 2009-11-02 13:36:18 +00:00
parent 9c64a0e733
commit 64bae1cd11
2 changed files with 15 additions and 0 deletions

View file

@ -547,4 +547,16 @@ public abstract class CSelectionTestsAnyIndexer extends BaseSelectionTestsIndexe
assertTrue(name.isDefinition());
assertEquals("myFunc", name.toString());
}
// int x= __LINE__;
public void testBuiltinMacro_Bug293864() throws Exception {
final StringBuffer[] contents = getContentsForTest(1);
String code= contents[0].toString();
IFile file = importFile("source.c", code);
int offset= code.indexOf("__LINE__");
TestSourceReader.waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
// just make sure that no NPE is thrown.
testF3(file, offset);
}
}

View file

@ -394,6 +394,9 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
}
private boolean isSameName(IName n1, IName n2) {
if (n1 == n2)
return true;
IASTFileLocation loc1 = n1.getFileLocation();
IASTFileLocation loc2 = n2.getFileLocation();
if (loc1 == null || loc2 == null)