[Lldb-commits] [lldb] r124001 - /lldb/trunk/source/Expression/IRForTarget.cpp

Sean Callanan scallanan at apple.com
Fri Jan 21 14:30:25 PST 2011


Author: spyffe
Date: Fri Jan 21 16:30:25 2011
New Revision: 124001

URL: http://llvm.org/viewvc/llvm-project?rev=124001&view=rev
Log:
Added a safeguard to ensure that the user does not create variables that override persistent result variables.

Modified:
    lldb/trunk/source/Expression/IRForTarget.cpp

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=124001&r1=124000&r2=124001&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Fri Jan 21 16:30:25 2011
@@ -901,9 +901,23 @@
         Instruction &inst = *ii;
         
         if (AllocaInst *alloc = dyn_cast<AllocaInst>(&inst))
-            if (alloc->getName().startswith("$") &&
-                !alloc->getName().startswith("$__lldb"))
+        {
+            llvm::StringRef alloc_name = alloc->getName();
+            
+            if (alloc_name.startswith("$") &&
+                !alloc_name.startswith("$__lldb"))
+            {
+                if (alloc_name.find_first_of("0123456789") == 1)
+                {
+                    if (log)
+                        log->Printf("Rejecting a numeric persistent variable.");
+                    
+                    return false;
+                }
+                
                 pvar_allocs.push_back(alloc);
+            }
+        }
     }
     
     InstrIterator iter;





More information about the lldb-commits mailing list