parent
ea37aa7d64
commit
c77380b46f
|
|
@ -40,6 +40,7 @@ namespace {
|
||||||
SM = &Context->SourceMgr;
|
SM = &Context->SourceMgr;
|
||||||
MainFileID = mainFileID;
|
MainFileID = mainFileID;
|
||||||
MsgSendFunctionDecl = 0;
|
MsgSendFunctionDecl = 0;
|
||||||
|
GetClassFunctionDecl = 0;
|
||||||
Rewrite.setSourceMgr(Context->SourceMgr);
|
Rewrite.setSourceMgr(Context->SourceMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,9 +75,9 @@ void RewriteTest::HandleTopLevelDecl(Decl *D) {
|
||||||
|
|
||||||
// Look for built-in declarations that we need to refer during the rewrite.
|
// Look for built-in declarations that we need to refer during the rewrite.
|
||||||
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||||
if (FD->getIdentifier() == &Context->Idents.get("objc_msgSend"))
|
if (strcmp(FD->getName(), "objc_msgSend") == 0)
|
||||||
MsgSendFunctionDecl = FD;
|
MsgSendFunctionDecl = FD;
|
||||||
else if (FD->getIdentifier() == &Context->Idents.get("objc_getClass"))
|
else if (strcmp(FD->getName(), "objc_getClass") == 0)
|
||||||
GetClassFunctionDecl = FD;
|
GetClassFunctionDecl = FD;
|
||||||
}
|
}
|
||||||
if (SM->getDecomposedFileLoc(Loc).first == MainFileID)
|
if (SM->getDecomposedFileLoc(Loc).first == MainFileID)
|
||||||
|
|
@ -185,8 +186,7 @@ void RewriteTest::RewriteForwardClassDecl(ObjcClassDecl *ClassDecl) {
|
||||||
// Get the start location and compute the semi location.
|
// Get the start location and compute the semi location.
|
||||||
SourceLocation startLoc = ClassDecl->getLocation();
|
SourceLocation startLoc = ClassDecl->getLocation();
|
||||||
const char *startBuf = SM->getCharacterData(startLoc);
|
const char *startBuf = SM->getCharacterData(startLoc);
|
||||||
const char *semiPtr = startBuf;
|
const char *semiPtr = strchr(startBuf, ';');
|
||||||
while (semiPtr && (*semiPtr != ';')) semiPtr++;
|
|
||||||
|
|
||||||
// Translate to typedef's that forward reference structs with the same name
|
// Translate to typedef's that forward reference structs with the same name
|
||||||
// as the class. As a convenience, we include the original declaration
|
// as the class. As a convenience, we include the original declaration
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ static void InitializePredefinedMacros(Preprocessor &PP,
|
||||||
// Predefine ObjC primitive functions, traditionally declared in
|
// Predefine ObjC primitive functions, traditionally declared in
|
||||||
// <objc/objc-runtime.h>. Unlike the declarations above, we don't protect
|
// <objc/objc-runtime.h>. Unlike the declarations above, we don't protect
|
||||||
// these with a header guard (since multiple identical function declarations
|
// these with a header guard (since multiple identical function declarations
|
||||||
// don't result in an error.
|
// don't result in an error. FIXME: don't predefine these...
|
||||||
ObjcType = "OBJC_EXPORT id objc_getClass(const char *name);\n";
|
ObjcType = "OBJC_EXPORT id objc_getClass(const char *name);\n";
|
||||||
Buf.insert(Buf.end(), ObjcType, ObjcType+strlen(ObjcType));
|
Buf.insert(Buf.end(), ObjcType, ObjcType+strlen(ObjcType));
|
||||||
ObjcType = "OBJC_EXPORT id objc_getMetaClass(const char *name);\n";
|
ObjcType = "OBJC_EXPORT id objc_getMetaClass(const char *name);\n";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue