diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-01-03 23:42:00 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-01-03 23:42:00 +0000 |
commit | 5f0809410640e75b6da9adf215b3ec97d07015b5 (patch) | |
tree | 62c4bbc6460bb858de73e95e285204173736b27a /clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp | |
parent | 96e70d9148df9f62c0e0d9ff6368b90c0b440c97 (diff) | |
download | bcm5719-llvm-5f0809410640e75b6da9adf215b3ec97d07015b5.tar.gz bcm5719-llvm-5f0809410640e75b6da9adf215b3ec97d07015b5.zip |
[ms-cxxabi] Improve vbtable name mangling accuracy
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.
Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record. By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal. Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.
Reviewers: majnemer
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2509
llvm-svn: 198462
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp b/clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp index 6de556b1d81..79e32a84efd 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-vbtables.cpp @@ -477,3 +477,44 @@ F f; // CHECK-DAG: @"\01??_8F@Test26@@7BD@1@@" = linkonce_odr unnamed_addr constant [4 x i32] [i32 0, i32 16, i32 12, i32 20] // CHECK-DAG: @"\01??_8F@Test26@@7BE@1@@" = linkonce_odr unnamed_addr constant [2 x i32] [i32 -4, i32 28] } + +namespace Test27 { +// PR17748 +struct A {}; +struct B : virtual A {}; +struct C : virtual B {}; +struct D : C, B {}; +struct E : D {}; +struct F : C, E {}; +struct G : F, D, C, B {}; +G x; + +// CHECK-DAG: @"\01??_8G@Test27@@7BB@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BB@1@F@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@D@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@E@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BC@1@F@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BD@1@@" = +// CHECK-DAG: @"\01??_8G@Test27@@7BF@1@@" = +} + +namespace Test28 { +// PR17748 +struct A {}; +struct B : virtual A {}; +struct C : virtual B {}; +struct D : C, B {}; +struct E : C, D {}; +struct F : virtual E, virtual D, virtual C {}; +F x; + +// CHECK-DAG: @"\01??_8F@Test28@@7B01@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BB@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@D@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@D@1@E@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BC@1@E@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BD@1@@" = +// CHECK-DAG: @"\01??_8F@Test28@@7BE@1@@" = +} |