forked from OSchip/llvm-project
Added a safeguard to ensure that the user does not create variables that override persistent result variables.
llvm-svn: 124001
This commit is contained in:
parent
8f3432c916
commit
f694a55736
|
@ -901,9 +901,23 @@ IRForTarget::RewritePersistentAllocs(llvm::Module &llvm_module, llvm::BasicBlock
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue