[clang] 2f3d7c2 - [clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 22:09:35 PDT 2022


Author: Arthur Eubanks
Date: 2022-09-28T22:06:04-07:00
New Revision: 2f3d7c2cc770c902b3a2fabc2ea92b98bf8f3e0a

URL: https://github.com/llvm/llvm-project/commit/2f3d7c2cc770c902b3a2fabc2ea92b98bf8f3e0a
DIFF: https://github.com/llvm/llvm-project/commit/2f3d7c2cc770c902b3a2fabc2ea92b98bf8f3e0a.diff

LOG: [clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()

(Probably) fixes https://crbug.com/1355639

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D134825

Added: 
    clang/test/CodeGenCXX/microsoft-abi-member-pointers-debug-info.cpp

Modified: 
    clang/lib/CodeGen/MicrosoftCXXABI.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index cc6ba4eba6d7..539f0a6eb8cb 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -2083,6 +2083,8 @@ MicrosoftCXXABI::EmitVirtualMemPtrThunk(const CXXMethodDecl *MD,
   // Start defining the function.
   CGF.StartFunction(GlobalDecl(), FnInfo.getReturnType(), ThunkFn, FnInfo,
                     FunctionArgs, MD->getLocation(), SourceLocation());
+
+  ApplyDebugLocation AL(CGF, MD->getLocation());
   setCXXABIThisValue(CGF, loadIncomingCXXThis(CGF));
 
   // Load the vfptr and then callee from the vftable.  The callee should have

diff  --git a/clang/test/CodeGenCXX/microsoft-abi-member-pointers-debug-info.cpp b/clang/test/CodeGenCXX/microsoft-abi-member-pointers-debug-info.cpp
new file mode 100644
index 000000000000..34be5557b5e9
--- /dev/null
+++ b/clang/test/CodeGenCXX/microsoft-abi-member-pointers-debug-info.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++11 -debug-info-kind=line-tables-only -fno-rtti -emit-llvm %s -o - -triple=x86_64-pc-win32 -fms-extensions | FileCheck %s
+
+struct Task {
+  virtual void Run() = 0;
+};
+
+auto b = &Task::Run;
+
+// CHECK: define {{.*}}@"??_9Task@@$BA at AA"
+// CHECK-NOT: define
+// CHECK: musttail call {{.*}}, !dbg ![[DBG:[0-9]+]]
+
+// CHECK: ![[DBG]] = !DILocation(line: 4
+


        


More information about the cfe-commits mailing list