r263689 - [index] Make sure that declarations of builtin functions are indexed.

Argyrios Kyrtzidis via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 21:28:19 PDT 2016


Author: akirtzidis
Date: Wed Mar 16 23:28:19 2016
New Revision: 263689

URL: http://llvm.org/viewvc/llvm-project?rev=263689&view=rev
Log:
[index] Make sure that declarations of builtin functions are indexed.

rdar://25154630

Modified:
    cfe/trunk/lib/Index/IndexingContext.cpp
    cfe/trunk/test/Index/Core/index-source.m

Modified: cfe/trunk/lib/Index/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=263689&r1=263688&r2=263689&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexingContext.cpp (original)
+++ cfe/trunk/lib/Index/IndexingContext.cpp Wed Mar 16 23:28:19 2016
@@ -290,14 +290,17 @@ bool IndexingContext::handleDeclOccurren
     Roles |= (unsigned)SymbolRole::Declaration;
 
   D = getCanonicalDecl(D);
-  if (D->isImplicit() && !isa<ObjCMethodDecl>(D)) {
+  if (D->isImplicit() && !isa<ObjCMethodDecl>(D) &&
+      !(isa<FunctionDecl>(D) && cast<FunctionDecl>(D)->getBuiltinID())) {
     // operator new declarations will link to the implicit one as canonical.
     return true;
   }
   Parent = adjustParent(Parent);
   if (Parent)
     Parent = getCanonicalDecl(Parent);
-  assert((!Parent || !Parent->isImplicit() || isa<FunctionDecl>(Parent) ||
+  assert((!Parent || !Parent->isImplicit() ||
+          (isa<FunctionDecl>(Parent) &&
+           cast<FunctionDecl>(Parent)->getBuiltinID()) ||
           isa<ObjCInterfaceDecl>(Parent) || isa<ObjCMethodDecl>(Parent)) &&
          "unexpected implicit parent!");
 

Modified: cfe/trunk/test/Index/Core/index-source.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.m?rev=263689&r1=263688&r2=263689&view=diff
==============================================================================
--- cfe/trunk/test/Index/Core/index-source.m (original)
+++ cfe/trunk/test/Index/Core/index-source.m Wed Mar 16 23:28:19 2016
@@ -68,5 +68,6 @@ enum {
 
 // CHECK: [[@LINE+1]]:13 | typedef/C | jmp_buf | c:index-source.m at T@jmp_buf | <no-cgname> | Def | rel: 0
 typedef int jmp_buf[(18)];
+// CHECK: [[@LINE+2]]:12 | function/C | setjmp | c:@F at setjmp | _setjmp | Decl | rel: 0
 // CHECK: [[@LINE+1]]:19 | typedef/C | jmp_buf | c:index-source.m at T@jmp_buf | <no-cgname> | Ref | rel: 0
 extern int setjmp(jmp_buf);




More information about the cfe-commits mailing list