IR: Give 'DI' prefix to debug info metadata
Finish off PR23080 by renaming the debug info IR constructs from `MD*`
to `DI*`. The last of the `DIDescriptor` classes were deleted in
r235356, and the last of the related typedefs removed in r235413, so
this has all baked for about a week.
Note: If you have out-of-tree code (like a frontend), I recommend that
you get everything compiling and tests passing with the *previous*
commit before updating to this one. It'll be easier to keep track of
what code is using the `DIDescriptor` hierarchy and what you've already
updated, and I think you're extremely unlikely to insert bugs. YMMV of
course.
Back to *this* commit: I did this using the rename-md-di-nodes.sh
upgrade script I've attached to PR23080 (both code and testcases) and
filtered through clang-format-diff.py. I edited the tests for
test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns
were off-by-three. It should work on your out-of-tree testcases (and
code, if you've followed the advice in the previous paragraph).
Some of the tests are in badly named files now (e.g.,
test/Assembler/invalid-mdcompositetype-missing-tag.ll should be
'dicompositetype'); I'll come back and move the files in a follow-up
commit.
llvm-svn: 236120
diff --git a/llvm/unittests/Transforms/Utils/Cloning.cpp b/llvm/unittests/Transforms/Utils/Cloning.cpp
index 48168d8..18d3ca6 100644
--- a/llvm/unittests/Transforms/Utils/Cloning.cpp
+++ b/llvm/unittests/Transforms/Utils/Cloning.cpp
@@ -229,8 +229,8 @@
// Function DI
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
- MDTypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
- MDSubroutineType *FuncType =
+ DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
+ DISubroutineType *FuncType =
DBuilder.createSubroutineType(File, ParamTypes);
auto *CU =
DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c",
@@ -257,7 +257,7 @@
auto *E = DBuilder.createExpression();
auto *Variable = DBuilder.createLocalVariable(
dwarf::DW_TAG_auto_variable, Subprogram, "x", File, 5, IntType, true);
- auto *DL = MDLocation::get(Subprogram->getContext(), 5, 0, Subprogram);
+ auto *DL = DILocation::get(Subprogram->getContext(), 5, 0, Subprogram);
DBuilder.insertDeclare(Alloca, Variable, E, DL, Store);
DBuilder.insertDbgValueIntrinsic(AllocaContent, 0, Variable, E, DL,
Terminator);
@@ -304,9 +304,9 @@
EXPECT_EQ(2U, SubprogramCount);
auto Iter = Finder->subprograms().begin();
- auto *Sub1 = cast<MDSubprogram>(*Iter);
+ auto *Sub1 = cast<DISubprogram>(*Iter);
Iter++;
- auto *Sub2 = cast<MDSubprogram>(*Iter);
+ auto *Sub2 = cast<DISubprogram>(*Iter);
EXPECT_TRUE(
(Sub1->getFunction() == OldFunc && Sub2->getFunction() == NewFunc) ||
@@ -321,9 +321,9 @@
EXPECT_EQ(2U, Finder->compile_unit_count());
auto Iter = Finder->compile_units().begin();
- auto *CU1 = cast<MDCompileUnit>(*Iter);
+ auto *CU1 = cast<DICompileUnit>(*Iter);
Iter++;
- auto *CU2 = cast<MDCompileUnit>(*Iter);
+ auto *CU2 = cast<DICompileUnit>(*Iter);
EXPECT_TRUE(CU1->getSubprograms().size() == 0 ||
CU2->getSubprograms().size() == 0);
}
@@ -352,8 +352,8 @@
EXPECT_EQ(OldDL.getCol(), NewDL.getCol());
// But that they belong to different functions
- auto *OldSubprogram = cast<MDSubprogram>(OldDL.getScope());
- auto *NewSubprogram = cast<MDSubprogram>(NewDL.getScope());
+ auto *OldSubprogram = cast<DISubprogram>(OldDL.getScope());
+ auto *NewSubprogram = cast<DISubprogram>(NewDL.getScope());
EXPECT_EQ(OldFunc, OldSubprogram->getFunction());
EXPECT_EQ(NewFunc, NewSubprogram->getFunction());
}
@@ -390,11 +390,11 @@
// Old variable must belong to the old function
EXPECT_EQ(OldFunc,
- cast<MDSubprogram>(OldIntrin->getVariable()->getScope())
+ cast<DISubprogram>(OldIntrin->getVariable()->getScope())
->getFunction());
// New variable must belong to the New function
EXPECT_EQ(NewFunc,
- cast<MDSubprogram>(NewIntrin->getVariable()->getScope())
+ cast<DISubprogram>(NewIntrin->getVariable()->getScope())
->getFunction());
} else if (DbgValueInst* OldIntrin = dyn_cast<DbgValueInst>(&OldI)) {
DbgValueInst* NewIntrin = dyn_cast<DbgValueInst>(&NewI);
@@ -402,11 +402,11 @@
// Old variable must belong to the old function
EXPECT_EQ(OldFunc,
- cast<MDSubprogram>(OldIntrin->getVariable()->getScope())
+ cast<DISubprogram>(OldIntrin->getVariable()->getScope())
->getFunction());
// New variable must belong to the New function
EXPECT_EQ(NewFunc,
- cast<MDSubprogram>(NewIntrin->getVariable()->getScope())
+ cast<DISubprogram>(NewIntrin->getVariable()->getScope())
->getFunction());
}