diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java index 5686c3f380e..85ae30b3334 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CSelectionTestsAnyIndexer.java @@ -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); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java index 65c20514b30..7cb71886aa3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/OpenDeclarationsJob.java @@ -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)