diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 6 |
4 files changed, 13 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index ff97c72f7dd..77fd778df52 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1722,8 +1722,8 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, assert(Scope.isScope()); Fn = Scope.getFilename(); Dir = Scope.getDirectory(); - if (Scope.isLexicalBlock()) - Discriminator = DILexicalBlock(S).getDiscriminator(); + if (Scope.isLexicalBlockFile()) + Discriminator = DILexicalBlockFile(S).getDiscriminator(); unsigned CUID = Asm->OutStreamer.getContext().getDwarfCompileUnitID(); Src = static_cast<DwarfCompileUnit &>(*InfoHolder.getUnits()[CUID]) diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index a621f71a7f5..c3beae9a28b 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1249,11 +1249,13 @@ DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name, /// createLexicalBlockFile - This creates a new MDNode that encapsulates /// an existing scope with a new filename. DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope, - DIFile File) { + DIFile File, + unsigned Discriminator) { Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block), File.getFileNode(), - Scope + Scope, + ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator), }; DILexicalBlockFile R(MDNode::get(VMContext, Elts)); assert( @@ -1263,8 +1265,7 @@ DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope, } DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, - unsigned Line, unsigned Col, - unsigned Discriminator) { + unsigned Line, unsigned Col) { // FIXME: This isn't thread safe nor the right way to defeat MDNode uniquing. // I believe the right way is to have a self-referential element in the node. // Also: why do we bother with line/column - they're not used and the @@ -1280,7 +1281,6 @@ DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, getNonCompileUnitScope(Scope), ConstantInt::get(Type::getInt32Ty(VMContext), Line), ConstantInt::get(Type::getInt32Ty(VMContext), Col), - ConstantInt::get(Type::getInt32Ty(VMContext), Discriminator), ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++) }; DILexicalBlock R(MDNode::get(VMContext, Elts)); diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index c59b77eca0a..284f0443939 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -326,7 +326,7 @@ bool DIDescriptor::isNameSpace() const { /// lexical block with an extra file. bool DIDescriptor::isLexicalBlockFile() const { return DbgNode && getTag() == dwarf::DW_TAG_lexical_block && - (DbgNode->getNumOperands() == 3); + (DbgNode->getNumOperands() == 4); } /// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block. @@ -638,12 +638,12 @@ bool DISubrange::Verify() const { /// \brief Verify that the lexical block descriptor is well formed. bool DILexicalBlock::Verify() const { - return isLexicalBlock() && DbgNode->getNumOperands() == 7; + return isLexicalBlock() && DbgNode->getNumOperands() == 6; } /// \brief Verify that the file-scoped lexical block descriptor is well formed. bool DILexicalBlockFile::Verify() const { - return isLexicalBlockFile() && DbgNode->getNumOperands() == 3; + return isLexicalBlockFile() && DbgNode->getNumOperands() == 4; } /// \brief Verify that the template type parameter descriptor is well formed. @@ -851,7 +851,7 @@ DIArray DICompileUnit::getImportedEntities() const { /// copyWithNewScope - Return a copy of this location, replacing the /// current scope with the given one. DILocation DILocation::copyWithNewScope(LLVMContext &Ctx, - DILexicalBlock NewScope) { + DILexicalBlockFile NewScope) { SmallVector<Value *, 10> Elts; assert(Verify()); for (unsigned I = 0; I < DbgNode->getNumOperands(); ++I) { diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 196ac79aaf2..f8e5af5c768 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -193,13 +193,11 @@ bool AddDiscriminators::runOnFunction(Function &F) { // Create a new lexical scope and compute a new discriminator // number for it. StringRef Filename = FirstDIL.getFilename(); - unsigned LineNumber = FirstDIL.getLineNumber(); - unsigned ColumnNumber = FirstDIL.getColumnNumber(); DIScope Scope = FirstDIL.getScope(); DIFile File = Builder.createFile(Filename, Scope.getDirectory()); unsigned Discriminator = FirstDIL.computeNewDiscriminator(Ctx); - DILexicalBlock NewScope = Builder.createLexicalBlock( - Scope, File, LineNumber, ColumnNumber, Discriminator); + DILexicalBlockFile NewScope = + Builder.createLexicalBlockFile(Scope, File, Discriminator); DILocation NewDIL = FirstDIL.copyWithNewScope(Ctx, NewScope); DebugLoc newDebugLoc = DebugLoc::getFromDILocation(NewDIL); |