aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Interpreter/Execution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-07 20:12:30 +0000
committerChris Lattner <sabre@nondot.org>2001-11-07 20:12:30 +0000
commit070cf5e47ed67ef03cfd551005d6d1834ba51b79 (patch)
treea137f788cd3df06a21b17831c4fa8c36d810b69b /lib/ExecutionEngine/Interpreter/Execution.cpp
parentea38c0e85c29783fdaf3b6c25fe7e3aa43688521 (diff)
Correct problem that allows indirect function calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/Execution.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index 3541eb8228..41948c5806 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -806,7 +806,11 @@ void Interpreter::executeCallInst(CallInst *I, ExecutionContext &SF) {
for (unsigned i = 1; i < I->getNumOperands(); ++i)
ArgVals.push_back(getOperandValue(I->getOperand(i), SF));
- callMethod(I->getCalledMethod(), ArgVals);
+ // To handle indirect calls, we must get the pointer value from the argument
+ // and treat it as a method pointer.
+ GenericValue SRC = getOperandValue(I->getCalledValue(), SF);
+
+ callMethod((Method*)SRC.PointerVal, ArgVals);
}
static void executePHINode(PHINode *I, ExecutionContext &SF) {