diff options
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 194811be90..a7b6d2b65e 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -1028,7 +1028,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, StringRef Name, DIFile F, unsigned LineNo, - DIType Ty, bool OptimizedBuild) { + DIType Ty, bool AlwaysPreserve) { Value *Elts[] = { GetTagConstant(Tag), Context, @@ -1038,7 +1038,10 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, Ty, }; MDNode *Node = MDNode::get(VMContext, &Elts[0], 6); - if (OptimizedBuild) { + if (AlwaysPreserve) { + // The optimizer may remove local variable. If there is an interest + // to preserve variable info in such situation then stash it in a + // named mdnode. NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.lv"); NMD->addOperand(Node); } |