[llvm-branch-commits] [cfe-branch] r86078 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Wed Nov 4 16:05:39 PST 2009
Author: snaroff
Date: Wed Nov 4 18:05:38 2009
New Revision: 86078
URL: http://llvm.org/viewvc/llvm-project?rev=86078&view=rev
Log:
Handle classes with no ivars (related to <rdar://problem/6675450>).
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=86078&r1=86077&r2=86078&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Wed Nov 4 18:05:38 2009
@@ -2889,11 +2889,21 @@
InsertText(LocEnd.getFileLocWithOffset(1), Result.c_str(), Result.size());
} else { // we don't have any instance variables - insert super struct.
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
- Result += " {\n ";
+ Result += "{\n ";
Result += RCDecl->getNameAsString();
Result += "_IMPL ";
Result += RCDecl->getNameAsString();
- Result += "_IVARS;\n};\n";
+ Result += "_IVARS;\n} ";
+ // Don't forget to add the typedef name and a ';'!!
+ Result += CDecl->getNameAsString();
+ Result += "_IMPL;";
+ // Now generate a typedef for the pointer to the "IMPL". For some reason,
+ // The Microsoft compiler want to see this in a separate declaration.
+ Result += "\ntypedef ";
+ Result += CDecl->getNameAsString();
+ Result += "_IMPL *p";
+ Result += CDecl->getNameAsString();
+ Result += "_IMPL;";
ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size());
}
// Mark this struct as having been generated.
More information about the llvm-branch-commits
mailing list