objective-C modern translator. Fixes a trivial

rewriting bug where #ifdef ended up on the same
line as the attribute declaration.

llvm-svn: 174719
This commit is contained in:
Fariborz Jahanian 2013-02-08 17:15:07 +00:00
parent 8360a86c8c
commit e8730a3558
2 changed files with 23 additions and 3 deletions

View File

@ -1043,7 +1043,7 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
static void RewriteOneForwardClassDecl(ObjCInterfaceDecl *ForwardDecl,
std::string &typedefString) {
typedefString += "#ifndef _REWRITER_typedef_";
typedefString += "\n#ifndef _REWRITER_typedef_";
typedefString += ForwardDecl->getNameAsString();
typedefString += "\n";
typedefString += "#define _REWRITER_typedef_";
@ -1076,7 +1076,7 @@ void RewriteModernObjC::RewriteForwardClassDecl(DeclGroupRef D) {
// as a comment.
typedefString += "// @class ";
typedefString += ForwardDecl->getNameAsString();
typedefString += ";\n";
typedefString += ";";
}
RewriteOneForwardClassDecl(ForwardDecl, typedefString);
}
@ -1092,7 +1092,7 @@ void RewriteModernObjC::RewriteForwardClassDecl(
if (i == 0) {
typedefString += "// @class ";
typedefString += ForwardDecl->getNameAsString();
typedefString += ";\n";
typedefString += ";";
}
RewriteOneForwardClassDecl(ForwardDecl, typedefString);
}

View File

@ -98,3 +98,23 @@ int f2(A* a) {
int f3(A *a) {
return a->ivar_d + a->ivar_ext2_a + a->ivar_ext_a + a->ivar_a;
}
__attribute__((objc_root_class)) @interface Base
{
struct objc_class *isa;
int full;
int full2: 32;
int _refs: 8;
int field2: 3;
unsigned f3: 8;
short cc;
unsigned g: 16;
int r2: 8;
int r3: 8;
int r4: 2;
int r5: 8;
char c;
}
@end
@implementation Base @end