aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/RewriteModernObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-02-20 20:09:20 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-02-20 20:09:20 +0000
commitaf300298ab86752fa64e339ba34195888a830756 (patch)
treef8d4c12ffbcafd1c141d14629616f9d21b561f9b /lib/Rewrite/RewriteModernObjC.cpp
parentee18803f163c4ffcbc8f55a1aae48514d4f80521 (diff)
modern objc translator. Finish off first cut of the
modern meta-data translation by commenting out private ivar declarations in user source. Also, added several tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteModernObjC.cpp')
-rw-r--r--lib/Rewrite/RewriteModernObjC.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index abdb09b279..4ba55403cb 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -934,14 +934,17 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
// FIXME: handle category headers that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
-
+ if (CatDecl->getIvarLBraceLoc().isValid())
+ InsertText(CatDecl->getIvarLBraceLoc(), "// ");
for (ObjCCategoryDecl::ivar_iterator
I = CatDecl->ivar_begin(), E = CatDecl->ivar_end(); I != E; ++I) {
ObjCIvarDecl *Ivar = (*I);
SourceLocation LocStart = Ivar->getLocStart();
ReplaceText(LocStart, 0, "// ");
}
-
+ if (CatDecl->getIvarRBraceLoc().isValid())
+ InsertText(CatDecl->getIvarRBraceLoc(), "// ");
+
for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
E = CatDecl->prop_end(); I != E; ++I)
RewriteProperty(*I);
@@ -1153,12 +1156,16 @@ void RewriteModernObjC::RewriteImplementationDecl(Decl *OID) {
if (IMD) {
InsertText(IMD->getLocStart(), "// ");
- for (ObjCImplementationDecl::ivar_iterator
- I = IMD->ivar_begin(), E = IMD->ivar_end(); I != E; ++I) {
- ObjCIvarDecl *Ivar = (*I);
- SourceLocation LocStart = Ivar->getLocStart();
- ReplaceText(LocStart, 0, "// ");
+ if (IMD->getIvarLBraceLoc().isValid())
+ InsertText(IMD->getIvarLBraceLoc(), "// ");
+ for (ObjCImplementationDecl::ivar_iterator
+ I = IMD->ivar_begin(), E = IMD->ivar_end(); I != E; ++I) {
+ ObjCIvarDecl *Ivar = (*I);
+ SourceLocation LocStart = Ivar->getLocStart();
+ ReplaceText(LocStart, 0, "// ");
}
+ if (IMD->getIvarRBraceLoc().isValid())
+ InsertText(IMD->getIvarRBraceLoc(), "// ");
}
else
InsertText(CID->getLocStart(), "// ");