aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-11-01 03:35:41 +0000
committerSteve Naroff <snaroff@apple.com>2007-11-01 03:35:41 +0000
commit6c6a2dbb4db96a69d6f1c2e3d322e4c3abd43814 (patch)
tree0ec63c9ac09299bc00c31666b4bc04b29fb6ed2a /Driver/RewriteTest.cpp
parent4ef8dd6e8736097bf9e3c387139c668565d89dca (diff)
Tweak RewriteInterfaceDecl() to generate a typedef (if one hasn't already been generated).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r--Driver/RewriteTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 999b0796a9..026c5d62c4 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -329,6 +329,17 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) {
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
std::string ResultStr;
+ if (!ObjcForwardDecls.count(ClassDecl)) {
+ // we haven't seen a forward decl - generate a typedef.
+ ResultStr += "typedef struct ";
+ ResultStr += ClassDecl->getName();
+ ResultStr += " ";
+ ResultStr += ClassDecl->getName();
+ ResultStr += ";";
+
+ // Mark this typedef as having been generated.
+ ObjcForwardDecls.insert(ClassDecl);
+ }
SynthesizeObjcInternalStruct(ClassDecl, ResultStr);
Rewrite.ReplaceText(LocStart, endBuf-startBuf,