Rename variable. add comment.
authorDevang Patel <dpatel@apple.com>
Thu, 20 May 2010 20:35:24 +0000 (20:35 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 20 May 2010 20:35:24 +0000 (20:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104274 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp

index b69b3babb537e9de32b3937d96797aeb02419439..473b127247f3ddde7c2b1cb3bf71078ddce82bab 100644 (file)
@@ -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.
index 194811be903fe667b37b7fe48f78c425fa526263..a7b6d2b65eee0e6864a167721108df538fa30fe2 100644 (file)
@@ -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);
   }