Added a safeguard to ensure that the user does not create variables that override persistent result variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124001 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index bdcb225..bf4d7ae 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -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;