diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-19 14:42:55 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-19 14:42:55 +0000 |
| commit | 86f1bf98dc518177ed78c16fa97a18f3deaa12da (patch) | |
| tree | 2adfab32ccf289f4b2b0236a451b50d47bb05abf /llvm/unittests/IR | |
| parent | 6145366510197e52862236960816c14b6e687004 (diff) | |
| download | bcm5719-llvm-86f1bf98dc518177ed78c16fa97a18f3deaa12da.tar.gz bcm5719-llvm-86f1bf98dc518177ed78c16fa97a18f3deaa12da.zip | |
IR: Require DICompositeType for ODR uniquing type map
Tighten up the API for debug info ODR type uniquing in LLVMContext. The
only reason to allow other DIType subclasses is to make the unit tests
prettier :/.
llvm-svn: 266737
Diffstat (limited to 'llvm/unittests/IR')
| -rw-r--r-- | llvm/unittests/IR/LLVMContextTest.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/unittests/IR/LLVMContextTest.cpp b/llvm/unittests/IR/LLVMContextTest.cpp index f1eeb05b1cb..028dc68827b 100644 --- a/llvm/unittests/IR/LLVMContextTest.cpp +++ b/llvm/unittests/IR/LLVMContextTest.cpp @@ -32,18 +32,20 @@ TEST(LLVMContextTest, getOrInsertODRUniquedType) { // Get the mapping. Context.enableDebugTypeODRUniquing(); - DIType **Mapping = Context.getOrInsertODRUniquedType(S); + DICompositeType **Mapping = Context.getOrInsertODRUniquedType(S); ASSERT_TRUE(Mapping); // Create some type and add it to the mapping. - auto &BT = - *DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, S.getString()); - *Mapping = &BT; + auto &CT = *DICompositeType::get(Context, dwarf::DW_TAG_class_type, "name", + nullptr, 0, nullptr, nullptr, 0, 0, 0, 0, + nullptr, 0, nullptr, nullptr, S.getString()); + ASSERT_EQ(S.getString(), CT.getIdentifier()); + *Mapping = &CT; // Check that we get it back. Mapping = Context.getOrInsertODRUniquedType(S); ASSERT_TRUE(Mapping); - EXPECT_EQ(&BT, *Mapping); + EXPECT_EQ(&CT, *Mapping); // Check that it's discarded with the type map. Context.disableDebugTypeODRUniquing(); |

