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/docs/tutorial/LangImpl8.rst b/llvm/docs/tutorial/LangImpl8.rst
index 90c3b83..0b9b39c 100644
--- a/llvm/docs/tutorial/LangImpl8.rst
+++ b/llvm/docs/tutorial/LangImpl8.rst
@@ -187,13 +187,13 @@
static DIBuilder *DBuilder;
struct DebugInfo {
- MDCompileUnit *TheCU;
- MDType *DblTy;
+ DICompileUnit *TheCU;
+ DIType *DblTy;
- MDType *getDoubleTy();
+ DIType *getDoubleTy();
} KSDbgInfo;
- MDType *DebugInfo::getDoubleTy() {
+ DIType *DebugInfo::getDoubleTy() {
if (DblTy.isValid())
return DblTy;
@@ -245,25 +245,25 @@
.. code-block:: c++
- MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
+ DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
KSDbgInfo.TheCU.getDirectory());
-giving us an MDFile and asking the ``Compile Unit`` we created above for the
+giving us an DIFile and asking the ``Compile Unit`` we created above for the
directory and filename where we are currently. Then, for now, we use some
source locations of 0 (since our AST doesn't currently have source location
information) and construct our function definition:
.. code-block:: c++
- MDScope *FContext = Unit;
+ DIScope *FContext = Unit;
unsigned LineNo = 0;
unsigned ScopeLine = 0;
- MDSubprogram *SP = DBuilder->createFunction(
+ DISubprogram *SP = DBuilder->createFunction(
FContext, Name, StringRef(), Unit, LineNo,
CreateFunctionType(Args.size(), Unit), false /* internal linkage */,
- true /* definition */, ScopeLine, DebugNode::FlagPrototyped, false, F);
+ true /* definition */, ScopeLine, DINode::FlagPrototyped, false, F);
-and we now have an MDSubprogram that contains a reference to all of our
+and we now have an DISubprogram that contains a reference to all of our
metadata for the function.
Source Locations
@@ -330,7 +330,7 @@
.. code-block:: c++
void DebugInfo::emitLocation(ExprAST *AST) {
- MDScope *Scope;
+ DIScope *Scope;
if (LexicalBlocks.empty())
Scope = TheCU;
else
@@ -347,11 +347,11 @@
.. code-block:: c++
- std::vector<MDScope *> LexicalBlocks;
- std::map<const PrototypeAST *, MDScope *> FnScopeMap;
+ std::vector<DIScope *> LexicalBlocks;
+ std::map<const PrototypeAST *, DIScope *> FnScopeMap;
and keep a map of each function to the scope that it represents (an
-MDSubprogram is also an MDScope).
+DISubprogram is also an DIScope).
Then we make sure to:
@@ -392,10 +392,10 @@
.. code-block:: c++
- MDScope *Scope = KSDbgInfo.LexicalBlocks.back();
- MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
+ DIScope *Scope = KSDbgInfo.LexicalBlocks.back();
+ DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
KSDbgInfo.TheCU.getDirectory());
- MDLocalVariable D = DBuilder->createLocalVariable(
+ DILocalVariable D = DBuilder->createLocalVariable(
dwarf::DW_TAG_arg_variable, Scope, Args[Idx], Unit, Line,
KSDbgInfo.getDoubleTy(), Idx);