diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-20 18:32:29 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-20 18:32:29 +0000 |
commit | b54df5252a94075d5d070818b7da0dbc9a71d379 (patch) | |
tree | 82521d31ccd5f097113b492066270b1ccdb69c03 /examples | |
parent | 4943838e28347db340f2b45d1bbf666ab3fd3547 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235327 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Kaleidoscope/Chapter8/toy.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/examples/Kaleidoscope/Chapter8/toy.cpp b/examples/Kaleidoscope/Chapter8/toy.cpp index c7e096cc484..7b714cac7c6 100644 --- a/examples/Kaleidoscope/Chapter8/toy.cpp +++ b/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. |