summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-08-07 19:43:01 +0000
committerReid Kleckner <reid@kleckner.net>2014-08-07 19:43:01 +0000
commit9f6e43802297f4d8af7c4f33a5a1b1e3868afce8 (patch)
tree5c1bfb0fa17e7fda03495ff503cac92a90bedb7a
parente20470d39915ea507bc13df0869bd48935f242a4 (diff)
downloadbcm5719-llvm-9f6e43802297f4d8af7c4f33a5a1b1e3868afce8.tar.gz
bcm5719-llvm-9f6e43802297f4d8af7c4f33a5a1b1e3868afce8.zip
Debug info: Use record layout to find vbase offsets instead of vtables
This fixes an assertion when generating full debug info in the MS ABI for classes with virtual bases. Fixes PR20579. llvm-svn: 215137
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp4
-rw-r--r--clang/test/CodeGenCXX/debug-info.cpp10
2 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ddb8a838875..a736d7de25a 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1195,9 +1195,7 @@ CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit,
if (BI.isVirtual()) {
// virtual base offset offset is -ve. The code generator emits dwarf
// expression where it expects +ve number.
- BaseOffset =
- 0 - CGM.getItaniumVTableContext()
- .getVirtualBaseOffsetOffset(RD, Base).getQuantity();
+ BaseOffset = 0 - RL.getVBaseClassOffset(Base).getQuantity();
BFlags = llvm::DIDescriptor::FlagVirtual;
} else
BaseOffset = CGM.getContext().toBits(RL.getBaseClassOffset(Base));
diff --git a/clang/test/CodeGenCXX/debug-info.cpp b/clang/test/CodeGenCXX/debug-info.cpp
index 7c89dfc04ce..a3b75e2e143 100644
--- a/clang/test/CodeGenCXX/debug-info.cpp
+++ b/clang/test/CodeGenCXX/debug-info.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -g %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i686-pc-windows-msvc -emit-llvm -g %s -o - | FileCheck %s --check-prefix=MSVC
+
template<typename T> struct Identity {
typedef T Type;
};
@@ -43,14 +45,18 @@ namespace VirtualDtor {
}
namespace VirtualBase {
- struct A { };
- struct B : virtual A { };
+ struct A { int a; };
+ struct B : virtual A { int b; };
void f() {
B b;
}
}
+// MSVC: [[VBASE_B:![0-9]+]] = metadata !{i32 {{.*}}, metadata !"B", i32 {{[0-9]*}}, i64 96, i64 32, i32 0, i32 0, null, metadata [[ZZZ:![0-9]+]], i32 0, {{.*}}} ; [ DW_TAG_structure_type ] [B] [line 49, size 96, align 32, offset 0] [def] [from ]
+// MSVC: [[ZZZ]] = metadata !{metadata [[VBASE_A_IN_B:![0-9]+]],
+// MSVC: [[VBASE_A_IN_B]] = metadata !{i32 786460, null, metadata [[VBASE_B]], null, i32 0, i64 0, i64 0, i64 -8, i32 32, metadata !{{[0-9]*}}} ; [ DW_TAG_inheritance ] [line 0, size 0, align 0, offset 18446744073709551608] [from A]
+
namespace b5249287 {
template <typename T> class A {
struct B;
OpenPOWER on IntegriCloud