[cfe-commits] r43942 - /cfe/trunk/Driver/RewriteTest.cpp
Steve Naroff
snaroff at apple.com
Fri Nov 9 04:50:28 PST 2007
Author: snaroff
Date: Fri Nov 9 06:50:28 2007
New Revision: 43942
URL: http://llvm.org/viewvc/llvm-project?rev=43942&view=rev
Log:
- add typedef guards.
- tweak scanForProtocolRefs heuristic.
- disable RewriteInclude() for now.
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=43942&r1=43941&r2=43942&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Fri Nov 9 06:50:28 2007
@@ -177,7 +177,7 @@
// Otherwise, see if there is a #import in the main file that should be
// rewritten.
- RewriteInclude(Loc);
+ //RewriteInclude(Loc);
}
/// HandleDeclInMainFile - This is called for each top-level decl defined in the
@@ -299,10 +299,15 @@
ObjcInterfaceDecl *ForwardDecl = ForwardDecls[i];
if (ObjcForwardDecls.count(ForwardDecl))
continue;
+ typedefString += "#ifndef _REWRITER_typedef_";
+ typedefString += ForwardDecl->getName();
+ typedefString += "\n";
+ typedefString += "#define _REWRITER_typedef_";
+ typedefString += ForwardDecl->getName();
+ typedefString += "\n";
typedefString += "typedef struct objc_object ";
typedefString += ForwardDecl->getName();
- typedefString += ";\n";
-
+ typedefString += ";\n#endif\n";
// Mark this typedef as having been generated.
if (!ObjcForwardDecls.insert(ForwardDecl))
assert(false && "typedef already output");
@@ -377,9 +382,15 @@
std::string ResultStr;
if (!ObjcForwardDecls.count(ClassDecl)) {
// we haven't seen a forward decl - generate a typedef.
+ ResultStr += "#ifndef _REWRITER_typedef_";
+ ResultStr += ClassDecl->getName();
+ ResultStr += "\n";
+ ResultStr += "#define _REWRITER_typedef_";
+ ResultStr += ClassDecl->getName();
+ ResultStr += "\n";
ResultStr += "typedef struct objc_object ";
ResultStr += ClassDecl->getName();
- ResultStr += ";";
+ ResultStr += ";\n#endif\n";
// Mark this typedef as having been generated.
ObjcForwardDecls.insert(ClassDecl);
@@ -671,9 +682,11 @@
if (*startBuf == '<')
startRef = startBuf; // mark the start.
if (*startBuf == '>') {
- assert((startRef && *startRef == '<') && "rewrite scanning error");
- endRef = startBuf; // mark the end.
- return true;
+ if (startRef && *startRef == '<') {
+ endRef = startBuf; // mark the end.
+ return true;
+ }
+ return false;
}
startBuf++;
}
More information about the cfe-commits
mailing list