1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

bug 525794 - NPE when invoking Open Declaration in "empty space"

Change-Id: I09a8670d113553c9046d829526149f869f4029a4
Signed-off-by: Michael Woski <woskimi@yahoo.de>
This commit is contained in:
Michael Woski 2017-10-10 23:04:13 +02:00 committed by Nathan Ridge
parent a20fb38223
commit 4b3aea7e2a
2 changed files with 13 additions and 0 deletions

View file

@ -742,6 +742,8 @@ public class SemanticUtil {
}
public static boolean isAutoOrDecltype(String code) {
if (code == null)
return false;
return (code.equals(Keywords.AUTO) || code.equals(Keywords.TYPEOF) || code.equals(Keywords.DECLTYPE));
}

View file

@ -1391,4 +1391,15 @@ public class CPPSelectionTestsNoIndexer extends BaseSelectionTests {
assertInstance(target, IASTName.class);
assertEquals("A", ((IASTName) target).toString());
}
// void npeTest() {
// auto i = 1;
// }
public void testEmptySpace_525794() throws Exception {
String code = getAboveComment();
IFile file = importFile("testBug525794.cpp", code);
int offset = code.indexOf("auto") - 2;
IASTNode target = testF3(file, offset);
}
}