diff options
| author | Diego Novillo <dnovillo@google.com> | 2014-03-03 18:53:17 +0000 |
|---|---|---|
| committer | Diego Novillo <dnovillo@google.com> | 2014-03-03 18:53:17 +0000 |
| commit | 282450d94c9e059fc08d80d8e93eb994ce3c77fc (patch) | |
| tree | 5c5b3e29f060899b8839cf6de7bb88e5ff1673cc /llvm/lib | |
| parent | 1863582863867a5cb888e7a9f35f414df9db7958 (diff) | |
| download | bcm5719-llvm-282450d94c9e059fc08d80d8e93eb994ce3c77fc.tar.gz bcm5719-llvm-282450d94c9e059fc08d80d8e93eb994ce3c77fc.zip | |
Add DWARF discriminator support to DILexicalBlocks.
This adds support for emitting discriminators from DILexicalBlocks.
llvm-svn: 202736
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 57e5cd6be92..5d466204233 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1825,6 +1825,7 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, StringRef Fn; StringRef Dir; unsigned Src = 1; + unsigned Discriminator = 0; if (S) { DIDescriptor Scope(S); @@ -1848,13 +1849,15 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, DILexicalBlock DB(S); Fn = DB.getFilename(); Dir = DB.getDirectory(); + Discriminator = DB.getDiscriminator(); } else llvm_unreachable("Unexpected scope info"); Src = getOrCreateSourceID( Fn, Dir, Asm->OutStreamer.getContext().getDwarfCompileUnitID()); } - Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, Flags, 0, 0, Fn); + Asm->OutStreamer.EmitDwarfLocDirective(Src, Line, Col, Flags, 0, + Discriminator, Fn); } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index d15de61479f..773a8cf0f52 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1186,7 +1186,8 @@ DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope, } DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File, - unsigned Line, unsigned Col) { + unsigned Line, unsigned Col, + unsigned Discriminator) { // Defeat MDNode uniquing for lexical blocks by using unique id. static unsigned int unique_id = 0; Value *Elts[] = { @@ -1195,6 +1196,7 @@ 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 506f2dd926e..749e0b5057a 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -600,7 +600,7 @@ bool DISubrange::Verify() const { /// \brief Verify that the lexical block descriptor is well formed. bool DILexicalBlock::Verify() const { - return isLexicalBlock() && DbgNode->getNumOperands() == 6; + return isLexicalBlock() && DbgNode->getNumOperands() == 7; } /// \brief Verify that the file-scoped lexical block descriptor is well formed. |

