if (FD->hasAttr<NoDebugAttr>())
DebugInfo = nullptr; // disable debug info indefinitely for this function
+ // The function might not have a body if we're generating thunks for a
+ // function declaration.
SourceRange BodyRange;
- if (Stmt *Body = FD->getBody()) BodyRange = Body->getSourceRange();
+ if (Stmt *Body = FD->getBody())
+ BodyRange = Body->getSourceRange();
+ else
+ BodyRange = FD->getLocation();
CurEHLocation = BodyRange.getEnd();
// Use the location of the start of the function to determine where
--- /dev/null
+// RUN: %clang_cc1 -triple i686--windows -emit-llvm -debug-info-kind=line-tables-only -x c++ %s -fms-extensions -o - | FileCheck %s
+
+struct __declspec(dllexport) S { virtual ~S(); };
+struct __declspec(dllexport) T { virtual ~T(); };
+struct __declspec(dllexport) U : S, T { virtual ~U(); };
+
+// CHECK-LABEL: define {{.*}} @"\01??_GS@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DS@@UAE@XZ"(%struct.S* %this1){{.*}}!dbg !{{[0-9]+}}
+
+// CHECK-LABEL: define {{.*}} @"\01??_GT@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DT@@UAE@XZ"(%struct.T* %this1){{.*}}!dbg !{{[0-9]+}}
+
+// CHECK-LABEL: define {{.*}} @"\01??_GU@@UAEPAXI@Z"
+// CHECK: call x86_thiscallcc void @"\01??_DU@@UAE@XZ"(%struct.U* %this1){{.*}}!dbg !{{[0-9]+}}