summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-03-17 04:28:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2016-03-17 04:28:19 +0000
commit6377e4e09ada9d6d6a2dbbae0688b38f94401e2b (patch)
tree338f49cb5aa09f34df9dca61375ea5b3138f89e9
parenta58d430cace221fa3959962b8d374d968891aba3 (diff)
downloadbcm5719-llvm-6377e4e09ada9d6d6a2dbbae0688b38f94401e2b.tar.gz
bcm5719-llvm-6377e4e09ada9d6d6a2dbbae0688b38f94401e2b.zip
[index] Make sure that declarations of builtin functions are indexed.
rdar://25154630 llvm-svn: 263689
-rw-r--r--clang/lib/Index/IndexingContext.cpp7
-rw-r--r--clang/test/Index/Core/index-source.m1
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp
index 0a235afc28b..3d1d9902dd6 100644
--- a/clang/lib/Index/IndexingContext.cpp
+++ b/clang/lib/Index/IndexingContext.cpp
@@ -290,14 +290,17 @@ bool IndexingContext::handleDeclOccurrence(const Decl *D, SourceLocation Loc,
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!");
diff --git a/clang/test/Index/Core/index-source.m b/clang/test/Index/Core/index-source.m
index 6248f18bfb5..ac309c8e696 100644
--- a/clang/test/Index/Core/index-source.m
+++ b/clang/test/Index/Core/index-source.m
@@ -68,5 +68,6 @@ enum {
// CHECK: [[@LINE+1]]:13 | typedef/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Def | rel: 0
typedef int jmp_buf[(18)];
+// CHECK: [[@LINE+2]]:12 | function/C | setjmp | c:@F@setjmp | _setjmp | Decl | rel: 0
// CHECK: [[@LINE+1]]:19 | typedef/C | jmp_buf | c:index-source.m@T@jmp_buf | <no-cgname> | Ref | rel: 0
extern int setjmp(jmp_buf);
OpenPOWER on IntegriCloud