summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorAmjad Aboud <amjad.aboud@intel.com>2015-12-10 12:56:35 +0000
committerAmjad Aboud <amjad.aboud@intel.com>2015-12-10 12:56:35 +0000
commit7db3980c5f97eb21bdcb58955ec7ed5e67ceda55 (patch)
tree4cbc4f1c7199bc33d58390d648435a552854b6c1 /unittests
parentf1cbc173046717ddfaf48eae5d6776653afa1090 (diff)
Macro debug info support in LLVM IR
Introduced DIMacro and DIMacroFile debug info metadata in the LLVM IR to support macros. Differential Revision: http://reviews.llvm.org/D14687 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/IR/MetadataTest.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/unittests/IR/MetadataTest.cpp b/unittests/IR/MetadataTest.cpp
index 8f346f53a2d..257ab7204c6 100644
--- a/unittests/IR/MetadataTest.cpp
+++ b/unittests/IR/MetadataTest.cpp
@@ -1312,10 +1312,12 @@ TEST_F(DICompileUnitTest, get) {
MDTuple *GlobalVariables = getTuple();
MDTuple *ImportedEntities = getTuple();
uint64_t DWOId = 0x10000000c0ffee;
+ MDTuple *Macros = getTuple();
auto *N = DICompileUnit::getDistinct(
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
- RetainedTypes, Subprograms, GlobalVariables, ImportedEntities, DWOId);
+ RetainedTypes, Subprograms, GlobalVariables, ImportedEntities, Macros,
+ DWOId);
EXPECT_EQ(dwarf::DW_TAG_compile_unit, N->getTag());
EXPECT_EQ(SourceLanguage, N->getSourceLanguage());
@@ -1331,6 +1333,7 @@ TEST_F(DICompileUnitTest, get) {
EXPECT_EQ(Subprograms, N->getSubprograms().get());
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
EXPECT_EQ(ImportedEntities, N->getImportedEntities().get());
+ EXPECT_EQ(Macros, N->getMacros().get());
EXPECT_EQ(DWOId, N->getDWOId());
TempDICompileUnit Temp = N->clone();
@@ -1348,6 +1351,7 @@ TEST_F(DICompileUnitTest, get) {
EXPECT_EQ(Subprograms, Temp->getSubprograms().get());
EXPECT_EQ(GlobalVariables, Temp->getGlobalVariables().get());
EXPECT_EQ(ImportedEntities, Temp->getImportedEntities().get());
+ EXPECT_EQ(Macros, Temp->getMacros().get());
EXPECT_EQ(DWOId, Temp->getDWOId());
auto *TempAddress = Temp.get();
@@ -1372,7 +1376,7 @@ TEST_F(DICompileUnitTest, replaceArrays) {
auto *N = DICompileUnit::getDistinct(
Context, SourceLanguage, File, Producer, IsOptimized, Flags,
RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes,
- RetainedTypes, nullptr, nullptr, ImportedEntities, DWOId);
+ RetainedTypes, nullptr, nullptr, ImportedEntities, nullptr, DWOId);
auto *Subprograms = MDTuple::getDistinct(Context, None);
EXPECT_EQ(nullptr, N->getSubprograms().get());
@@ -1387,6 +1391,13 @@ TEST_F(DICompileUnitTest, replaceArrays) {
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
N->replaceGlobalVariables(nullptr);
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
+
+ auto *Macros = MDTuple::getDistinct(Context, None);
+ EXPECT_EQ(nullptr, N->getMacros().get());
+ N->replaceMacros(Macros);
+ EXPECT_EQ(Macros, N->getMacros().get());
+ N->replaceMacros(nullptr);
+ EXPECT_EQ(nullptr, N->getMacros().get());
}
typedef MetadataTest DISubprogramTest;