Added handling for external variables in function

arguments to the expression parser.  This means that
structs can be returned from the "expr" command.

llvm-svn: 115698
This commit is contained in:
Sean Callanan 2010-10-05 22:26:43 +00:00
parent 0067ee02f9
commit 85a0a83a26
2 changed files with 35 additions and 0 deletions

View File

@ -219,6 +219,21 @@ private:
llvm::Value *V,
bool Store);
//------------------------------------------------------------------
/// Handle all the arguments to a function call
///
/// @param[in] M
/// The module currently being processed.
///
/// @param[in] C
/// The call instruction.
///
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
bool MaybeHandleCallArguments(llvm::Module &M,
llvm::CallInst *C);
//------------------------------------------------------------------
/// Handle a single external function call
///

View File

@ -628,6 +628,21 @@ IRForTarget::MaybeHandleVariable(Module &M,
return true;
}
bool
IRForTarget::MaybeHandleCallArguments(Module &M,
CallInst *C)
{
// lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
for (unsigned op_index = 0, num_ops = C->getNumArgOperands();
op_index < num_ops;
++op_index)
if (!MaybeHandleVariable(M, C->getArgOperand(op_index), true)) // conservatively believe that this is a store
return false;
return true;
}
bool
IRForTarget::MaybeHandleCall(Module &M,
CallInst *C)
@ -772,8 +787,13 @@ IRForTarget::resolveExternals(Module &M, BasicBlock &BB)
}
if (CallInst *call = dyn_cast<CallInst>(&inst))
{
if (!MaybeHandleCallArguments(M, call))
return false;
if (!MaybeHandleCall(M, call))
return false;
}
}
return true;