summaryrefslogtreecommitdiffstats
path: root/llvm/examples
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-20 18:32:29 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-20 18:32:29 +0000
commitbe9e4fe768faf92071960b99cb329dbbd7e4b355 (patch)
treeb9710e10adb562d67ef8c59f074ba608ac3be132 /llvm/examples
parentfc8d9d9a20906e2ee51796add3798538d653ee74 (diff)
downloadbcm5719-llvm-be9e4fe768faf92071960b99cb329dbbd7e4b355.tar.gz
bcm5719-llvm-be9e4fe768faf92071960b99cb329dbbd7e4b355.zip
DebugInfo: Remove DIScope
Replace uses of `DIScope` with `MDScope*`. There was one spot where I've left an `MDScope*` uninitialized (where `DIScope` would have been default-initialized to `nullptr`) -- this is intentional, since the if/else that follows should unconditional assign it to a value. llvm-svn: 235327
Diffstat (limited to 'llvm/examples')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter8/toy.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
index c7e096cc484..7b714cac7c6 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -93,13 +93,13 @@ class ExprAST;
}
static IRBuilder<> Builder(getGlobalContext());
struct DebugInfo {
- DICompileUnit TheCU;
- DIType DblTy;
- std::vector<DIScope *> LexicalBlocks;
- std::map<const PrototypeAST *, DIScope> FnScopeMap;
+ MDCompileUnit *TheCU;
+ MDType *DblTy;
+ std::vector<MDScope *> LexicalBlocks;
+ std::map<const PrototypeAST *, MDScope *> FnScopeMap;
void emitLocation(ExprAST *AST);
- DIType getDoubleTy();
+ MDType *getDoubleTy();
} KSDbgInfo;
static std::string IdentifierStr; // Filled in if tok_identifier
@@ -816,7 +816,7 @@ static PrototypeAST *ParseExtern() {
static DIBuilder *DBuilder;
-DIType DebugInfo::getDoubleTy() {
+MDType *DebugInfo::getDoubleTy() {
if (DblTy)
return DblTy;
@@ -836,9 +836,9 @@ void DebugInfo::emitLocation(ExprAST *AST) {
DebugLoc::get(AST->getLine(), AST->getCol(), Scope));
}
-static MDSubroutineType *CreateFunctionType(unsigned NumArgs, DIFile Unit) {
+static MDSubroutineType *CreateFunctionType(unsigned NumArgs, MDFile *Unit) {
SmallVector<Metadata *, 8> EltTys;
- DIType DblTy = KSDbgInfo.getDoubleTy();
+ MDType *DblTy = KSDbgInfo.getDoubleTy();
// Add the result type.
EltTys.push_back(DblTy);
@@ -846,8 +846,8 @@ static MDSubroutineType *CreateFunctionType(unsigned NumArgs, DIFile Unit) {
for (unsigned i = 0, e = NumArgs; i != e; ++i)
EltTys.push_back(DblTy);
- DITypeArray EltTypeArray = DBuilder->getOrCreateTypeArray(EltTys);
- return DBuilder->createSubroutineType(Unit, EltTypeArray);
+ return DBuilder->createSubroutineType(Unit,
+ DBuilder->getOrCreateTypeArray(EltTys));
}
//===----------------------------------------------------------------------===//
@@ -1224,12 +1224,12 @@ Function *PrototypeAST::Codegen() {
AI->setName(Args[Idx]);
// Create a subprogram DIE for this function.
- DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
- KSDbgInfo.TheCU->getDirectory());
+ MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
+ KSDbgInfo.TheCU->getDirectory());
MDScope *FContext = Unit;
unsigned LineNo = Line;
unsigned ScopeLine = Line;
- DISubprogram SP = DBuilder->createFunction(
+ MDSubprogram *SP = DBuilder->createFunction(
FContext, Name, StringRef(), Unit, LineNo,
CreateFunctionType(Args.size(), Unit), false /* internal linkage */,
true /* definition */, ScopeLine, DebugNode::FlagPrototyped, false, F);
@@ -1247,15 +1247,15 @@ void PrototypeAST::CreateArgumentAllocas(Function *F) {
AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
// Create a debug descriptor for the variable.
- DIScope *Scope = KSDbgInfo.LexicalBlocks.back();
- DIFile Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
- KSDbgInfo.TheCU->getDirectory());
- DIVariable D = DBuilder->createLocalVariable(dwarf::DW_TAG_arg_variable,
- *Scope, Args[Idx], Unit, Line,
- KSDbgInfo.getDoubleTy(), Idx);
+ MDScope *Scope = KSDbgInfo.LexicalBlocks.back();
+ MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
+ KSDbgInfo.TheCU->getDirectory());
+ MDLocalVariable *D = DBuilder->createLocalVariable(
+ dwarf::DW_TAG_arg_variable, Scope, Args[Idx], Unit, Line,
+ KSDbgInfo.getDoubleTy(), Idx);
DBuilder->insertDeclare(Alloca, D, DBuilder->createExpression(),
- DebugLoc::get(Line, 0, *Scope),
+ DebugLoc::get(Line, 0, Scope),
Builder.GetInsertBlock());
// Store the initial value into the alloca.
OpenPOWER on IntegriCloud