From f68c28fb05eb9d6d552f38f478f3bb2636749827 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis <akyrtzi@gmail.com> Date: Fri, 4 Mar 2016 07:17:48 +0000 Subject: [PATCH] [index] Include parameter types in the USRs for C functions marked with 'overloadable' attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262694 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/USRGeneration.cpp | 3 ++- test/Index/Core/index-source.m | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Index/USRGeneration.cpp b/lib/Index/USRGeneration.cpp index 85478265c06..cb30090adc0 100644 --- a/lib/Index/USRGeneration.cpp +++ b/lib/Index/USRGeneration.cpp @@ -218,7 +218,8 @@ void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) { D->getDeclName().print(Out, Policy); ASTContext &Ctx = *Context; - if (!Ctx.getLangOpts().CPlusPlus || D->isExternC()) + if ((!Ctx.getLangOpts().CPlusPlus || D->isExternC()) && + !D->hasAttr<OverloadableAttr>()) return; if (const TemplateArgumentList * diff --git a/test/Index/Core/index-source.m b/test/Index/Core/index-source.m index d57879c8988..d1326624630 100644 --- a/test/Index/Core/index-source.m +++ b/test/Index/Core/index-source.m @@ -43,3 +43,8 @@ void goo(Base *b) { // CHECK-NOT: ObjectType -(ObjectType)getit; @end + +// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#I# | __Z9over_funci | Decl | rel: 0 +void over_func(int x) __attribute__((overloadable)); +// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#f# | __Z9over_funcf | Decl | rel: 0 +void over_func(float x) __attribute__((overloadable)); -- GitLab