summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/MetadataTest.cpp
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
commita9bcf16ebc8a3dbfc4999ddca63f064c29e89f6c (patch)
tree8c1f97f76f047d536f76f983304683adce045d6b /llvm/unittests/IR/MetadataTest.cpp
parentdd76cc1920b348276684c92cbd951c40922be8aa (diff)
downloadbcm5719-llvm-a9bcf16ebc8a3dbfc4999ddca63f064c29e89f6c.tar.gz
bcm5719-llvm-a9bcf16ebc8a3dbfc4999ddca63f064c29e89f6c.zip
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 llvm-svn: 255245
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r--llvm/unittests/IR/MetadataTest.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 8f346f53a2d..257ab7204c6 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud