From 191d76ccf9038603fd93ed91a5690f05e3406f20 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Sun, 4 Oct 2015 23:23:04 +0000 Subject: [PATCH] Module Debugging: Emit (ObjC) function declarations in the module scope when building a module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249282 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 2 +- test/Modules/ModuleDebugInfo.m | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 4a5c16e219..792b1b09a0 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -2731,7 +2731,7 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc, unsigned Flags = 0; llvm::DIFile *Unit = getOrCreateFile(Loc); - llvm::DIScope *FDContext = Unit; + llvm::DIScope *FDContext = getDeclContextDescriptor(D); llvm::DINodeArray TParamsArray; if (isa(D)) { // If there is a DISubprogram for this function available then use it. diff --git a/test/Modules/ModuleDebugInfo.m b/test/Modules/ModuleDebugInfo.m index 8139343147..31132c558c 100644 --- a/test/Modules/ModuleDebugInfo.m +++ b/test/Modules/ModuleDebugInfo.m @@ -41,6 +41,8 @@ // MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, // MODULE-CHECK-SAME: name: "ObjCClass", // MODULE-CHECK-SAME: scope: ![[MODULE]], +// MODULE-CHECK: !DISubprogram(name: "+[ObjCClass classMethod]", +// MODULE-CHECK-SAME: scope: ![[MODULE]], // The forward declaration should not be in the module scope. // MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file -- 2.40.0