[cfe-commits] r44142 - /cfe/trunk/Driver/RewriteTest.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Nov 14 14:26:26 PST 2007
Author: fjahanian
Date: Wed Nov 14 16:26:25 2007
New Revision: 44142
URL: http://llvm.org/viewvc/llvm-project?rev=44142&view=rev
Log:
Patch to comment out use of protocol qualifiers when rewriting ivars.
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=44142&r1=44141&r2=44142&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Wed Nov 14 16:26:25 2007
@@ -70,7 +70,8 @@
"extern void objc_exception_try_exit(void *);\n"
"extern struct objc_object *objc_exception_extract(void *);\n"
"extern int objc_exception_match"
- "(struct objc_class *, struct objc_object *, ...);\n";
+ "(struct objc_class *, struct objc_object *, ...);\n"
+ "#include <Objc/objc.h>\n";
Rewrite.InsertText(SourceLocation::getFileLoc(mainFileID, 0),
s, strlen(s));
@@ -421,11 +422,6 @@
void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD,
std::string &ResultStr) {
- static bool includeObjc = false;
- if (!includeObjc) {
- ResultStr += "#include <Objc/objc.h>\n";
- includeObjc = true;
- }
ResultStr += "\nstatic ";
ResultStr += OMD->getResultType().getAsString();
ResultStr += "\n";
@@ -1146,7 +1142,8 @@
// have no ivars (thus not synthesized) then no need to synthesize this class.
if (NumIvars <= 0 && (!RCDecl || !ObjcSynthesizedStructs.count(RCDecl)))
return;
-
+ // FIXME: This has potential of causing problem. If
+ // SynthesizeObjcInternalStruct is ever called recursively.
Result += "\nstruct ";
Result += CDecl->getName();
@@ -1186,9 +1183,20 @@
// this transformation as well, which is still correct c-code.
if (!strncmp(cursor, "public", strlen("public")) ||
!strncmp(cursor, "private", strlen("private")) ||
- !strncmp(cursor, "protected", strlen("private")))
+ !strncmp(cursor, "protected", strlen("protected")))
Rewrite.InsertText(atLoc, "// ", 3);
}
+ // FIXME: If there are cases where '<' is used in ivar declaration part
+ // of user code, then scan the ivar list and use needToScanForQualifiers
+ // for type checking.
+ else if (*cursor == '<') {
+ SourceLocation atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ Rewrite.InsertText(atLoc, "/* ", 3);
+ cursor = strchr(cursor, '>');
+ cursor++;
+ atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ Rewrite.InsertText(atLoc, " */", 3);
+ }
cursor++;
}
// Don't forget to add a ';'!!
@@ -1799,9 +1807,6 @@
for (int i = 0; i < CatDefCount; i++)
RewriteImplementationDecl(CategoryImplementation[i]);
- // TODO: This is temporary until we decide how to access objc types in a
- // c program
- Result += "#include <Objc/objc.h>\n";
// This is needed for use of offsetof
Result += "#include <stddef.h>\n";
More information about the cfe-commits
mailing list