[cfe-commits] r44066 - /cfe/trunk/Driver/RewriteTest.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Nov 13 13:02:00 PST 2007
Author: fjahanian
Date: Tue Nov 13 15:02:00 2007
New Revision: 44066
URL: http://llvm.org/viewvc/llvm-project?rev=44066&view=rev
Log:
Populate metadata with adrress of method code.
Modified:
cfe/trunk/Driver/RewriteTest.cpp
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44066&r1=44065&r2=44066&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Tue Nov 13 15:02:00 2007
@@ -34,6 +34,7 @@
llvm::SmallVector<ObjcCategoryImplDecl *, 8> CategoryImplementation;
llvm::SmallPtrSet<ObjcInterfaceDecl*, 8> ObjcSynthesizedStructs;
llvm::SmallPtrSet<ObjcInterfaceDecl*, 8> ObjcForwardDecls;
+ llvm::DenseMap<ObjcMethodDecl*, std::string> MethodInternalNames;
FunctionDecl *MsgSendFunctionDecl;
FunctionDecl *GetClassFunctionDecl;
@@ -384,35 +385,40 @@
}
ResultStr += "\nstatic ";
ResultStr += OMD->getResultType().getAsString();
- ResultStr += "\n_";
+ ResultStr += "\n";
// Unique method name
+ std::string NameStr;
+
if (OMD->isInstance())
- ResultStr += "I_";
+ NameStr += "_I_";
else
- ResultStr += "C_";
+ NameStr += "_C_";
- ResultStr += OMD->getClassInterface()->getName();
- ResultStr += "_";
+ NameStr += OMD->getClassInterface()->getName();
+ NameStr += "_";
NamedDecl *MethodContext = OMD->getMethodContext();
if (ObjcCategoryImplDecl *CID =
dyn_cast<ObjcCategoryImplDecl>(MethodContext)) {
- ResultStr += CID->getName();
- ResultStr += "_";
+ NameStr += CID->getName();
+ NameStr += "_";
}
// Append selector names, replacing ':' with '_'
const char *selName = OMD->getSelector().getName().c_str();
if (!strchr(selName, ':'))
- ResultStr += OMD->getSelector().getName();
+ NameStr += OMD->getSelector().getName();
else {
std::string selString = OMD->getSelector().getName();
int len = selString.size();
for (int i = 0; i < len; i++)
if (selString[i] == ':')
selString[i] = '_';
- ResultStr += selString;
+ NameStr += selString;
}
+ // Remember this name for metadata emission
+ MethodInternalNames[OMD] = NameStr;
+ ResultStr += NameStr;
// Rewrite arguments
ResultStr += "(";
@@ -1211,7 +1217,9 @@
Context->getObjcEncodingForMethodDecl(Methods[0], MethodTypeString);
Result += "\", \"";
Result += MethodTypeString;
- Result += "\", 0}\n";
+ Result += "\", ";
+ Result += MethodInternalNames[Methods[0]];
+ Result += "}\n";
for (int i = 1; i < NumMethods; i++) {
// TODO: Need method address as 3rd initializer.
Result += "\t ,{(SEL)\"";
@@ -1220,7 +1228,9 @@
Context->getObjcEncodingForMethodDecl(Methods[i], MethodTypeString);
Result += "\", \"";
Result += MethodTypeString;
- Result += "\", 0}\n";
+ Result += "\", ";
+ Result += MethodInternalNames[Methods[i]];
+ Result += "}\n";
}
Result += "\t }\n};\n";
}
More information about the cfe-commits
mailing list