mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +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:
parent
a20fb38223
commit
4b3aea7e2a
2 changed files with 13 additions and 0 deletions
|
@ -742,6 +742,8 @@ public class SemanticUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAutoOrDecltype(String code) {
|
public static boolean isAutoOrDecltype(String code) {
|
||||||
|
if (code == null)
|
||||||
|
return false;
|
||||||
return (code.equals(Keywords.AUTO) || code.equals(Keywords.TYPEOF) || code.equals(Keywords.DECLTYPE));
|
return (code.equals(Keywords.AUTO) || code.equals(Keywords.TYPEOF) || code.equals(Keywords.DECLTYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1391,4 +1391,15 @@ public class CPPSelectionTestsNoIndexer extends BaseSelectionTests {
|
||||||
assertInstance(target, IASTName.class);
|
assertInstance(target, IASTName.class);
|
||||||
assertEquals("A", ((IASTName) target).toString());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue