diff --git a/lldb/include/lldb/Expression/IRForTarget.h b/lldb/include/lldb/Expression/IRForTarget.h index e60c5f068bc8..e055c8aa874e 100644 --- a/lldb/include/lldb/Expression/IRForTarget.h +++ b/lldb/include/lldb/Expression/IRForTarget.h @@ -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 /// diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 662c086373b4..6cf8628d293e 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -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(&inst)) + { + if (!MaybeHandleCallArguments(M, call)) + return false; + if (!MaybeHandleCall(M, call)) return false; + } } return true;