[llvm-commits] [llvm] r144451 - /llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
Sean Callanan
scallanan at apple.com
Fri Nov 11 18:31:32 PST 2011
Author: spyffe
Date: Fri Nov 11 20:31:32 2011
New Revision: 144451
URL: http://llvm.org/viewvc/llvm-project?rev=144451&view=rev
Log:
Fixed the MCJIT so that it can emit not only instance
methods but also class methods for Objective-C.
Clang emits Objective-C method names with '\1' at the
beginning, and the JIT has pre-existing logic to try
prepending a '\1' when searching a module for an
instance method (that is, a method whose name begins
with '-'). I simply extended it to do the same thing
when it encountered a class method (a method whose
name begins with '+').
Modified:
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h?rev=144451&r1=144450&r2=144451&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h Fri Nov 11 20:31:32 2011
@@ -39,9 +39,9 @@
if (Name[0] == '_') ++Name;
Function *F = M->getFunction(Name);
// Some ObjC names have a prefixed \01 in the IR. If we failed to find
- // the symbol and it's of the ObjC conventions (starts with "-"), try
- // prepending a \01 and see if we can find it that way.
- if (!F && Name[0] == '-')
+ // the symbol and it's of the ObjC conventions (starts with "-" or
+ // "+"), try prepending a \01 and see if we can find it that way.
+ if (!F && (Name[0] == '-' || Name[0] == '+'))
F = M->getFunction((Twine("\1") + Name).str());
assert(F && "No matching function in JIT IR Module!");
return JMM->startFunctionBody(F, Size);
@@ -56,9 +56,9 @@
if (Name[0] == '_') ++Name;
Function *F = M->getFunction(Name);
// Some ObjC names have a prefixed \01 in the IR. If we failed to find
- // the symbol and it's of the ObjC conventions (starts with "-"), try
- // prepending a \01 and see if we can find it that way.
- if (!F && Name[0] == '-')
+ // the symbol and it's of the ObjC conventions (starts with "-" or
+ // "+"), try prepending a \01 and see if we can find it that way.
+ if (!F && (Name[0] == '-' || Name[0] == '+'))
F = M->getFunction((Twine("\1") + Name).str());
assert(F && "No matching function in JIT IR Module!");
JMM->endFunctionBody(F, FunctionStart, FunctionEnd);
More information about the llvm-commits
mailing list