diff options
author | Devang Patel <dpatel@apple.com> | 2010-05-14 21:01:35 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-05-14 21:01:35 +0000 |
commit | e0a94bfe9f36f5dc79a18e33fd03963fa4024158 (patch) | |
tree | c2c4a09356ac88d7f209a0bb36dd6a7dc0b6b6ac /llvm/lib/Analysis/DebugInfo.cpp | |
parent | 670492c8ee01e8ed4ac03f418e982004873383eb (diff) | |
download | bcm5719-llvm-e0a94bfe9f36f5dc79a18e33fd03963fa4024158.tar.gz bcm5719-llvm-e0a94bfe9f36f5dc79a18e33fd03963fa4024158.zip |
Add support to preserve type info for the variables that are removed by the optimizer.
llvm-svn: 103798
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 92f91f4d600..194811be903 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -1028,7 +1028,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, StringRef Name, DIFile F, unsigned LineNo, - DIType Ty) { + DIType Ty, bool OptimizedBuild) { Value *Elts[] = { GetTagConstant(Tag), Context, @@ -1037,7 +1037,12 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), Ty, }; - return DIVariable(MDNode::get(VMContext, &Elts[0], 6)); + MDNode *Node = MDNode::get(VMContext, &Elts[0], 6); + if (OptimizedBuild) { + NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.lv"); + NMD->addOperand(Node); + } + return DIVariable(Node); } |