aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-05-20 20:35:24 +0000
committerDevang Patel <dpatel@apple.com>2010-05-20 20:35:24 +0000
commit6ed0ce3240d13ff5bdb9520f8563792b58e5257a (patch)
treea6b85e1ff3fb05c30472ee6adcbf09c4231f3779
parent402d43529c18d662d1964d70dbf55bc135a8b473 (diff)
downloadexternal_llvm-6ed0ce3240d13ff5bdb9520f8563792b58e5257a.zip
external_llvm-6ed0ce3240d13ff5bdb9520f8563792b58e5257a.tar.gz
external_llvm-6ed0ce3240d13ff5bdb9520f8563792b58e5257a.tar.bz2
Rename variable. add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104274 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DebugInfo.h2
-rw-r--r--lib/Analysis/DebugInfo.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index b69b3ba..473b127 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -677,7 +677,7 @@ namespace llvm {
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
StringRef Name,
DIFile F, unsigned LineNo,
- DIType Ty, bool OptimizedBuild = false);
+ DIType Ty, bool AlwaysPreserve = false);
/// CreateComplexVariable - Create a new descriptor for the specified
/// variable which has a complex address expression for its address.
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 194811b..a7b6d2b 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);
}