-Add several ObjC types to Decl::getDeclKindName(), a useful debug hook.
-Start adding support for rewriting @synthesize.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60368 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp
index 1c20ef1..6979736 100644
--- a/Driver/RewriteObjC.cpp
+++ b/Driver/RewriteObjC.cpp
@@ -169,6 +169,7 @@
void RewriteInclude();
void RewriteTabs();
void RewriteForwardClassDecl(ObjCClassDecl *Dcl);
+ void RewritePropertyImplDecl(ObjCPropertyImplDecl *PID);
void RewriteInterfaceDecl(ObjCInterfaceDecl *Dcl);
void RewriteImplementationDecl(NamedDecl *Dcl);
void RewriteObjCMethodDecl(ObjCMethodDecl *MDecl, std::string &ResultStr);
@@ -585,6 +586,10 @@
}
}
+void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID) {
+ SourceLocation startLoc = PID->getLocStart();
+ InsertText(startLoc, "// ", 3);
+}
void RewriteObjC::RewriteForwardClassDecl(ObjCClassDecl *ClassDecl) {
int numDecls = ClassDecl->getNumForwardDecls();
@@ -864,6 +869,12 @@
ReplaceText(LocStart, endBuf-startBuf,
ResultStr.c_str(), ResultStr.size());
}
+ for (ObjCCategoryImplDecl::propimpl_iterator
+ I = IMD ? IMD->propimpl_begin() : CID->propimpl_begin(),
+ E = IMD ? IMD->propimpl_end() : CID->propimpl_end(); I != E; ++I) {
+ RewritePropertyImplDecl(*I);
+ }
+
if (IMD)
InsertText(IMD->getLocEnd(), "// ", 3);
else
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index eda3e6d..43750c4 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -1311,6 +1311,8 @@
Kind PK,
ObjCIvarDecl *ivarDecl);
+ SourceLocation getLocStart() const { return AtLoc; }
+
ObjCPropertyDecl *getPropertyDecl() const {
return PropertyDecl;
}
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 2bfb5ae..5cb2a3e 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -72,9 +72,12 @@
case EnumConstant: return "EnumConstant";
case ObjCIvar: return "ObjCIvar";
case ObjCInterface: return "ObjCInterface";
+ case ObjCImplementation: return "ObjCImplementation";
case ObjCClass: return "ObjCClass";
case ObjCMethod: return "ObjCMethod";
case ObjCProtocol: return "ObjCProtocol";
+ case ObjCProperty: return "ObjCProperty";
+ case ObjCPropertyImpl: return "ObjCPropertyImpl";
case ObjCForwardProtocol: return "ObjCForwardProtocol";
case Record: return "Record";
case CXXRecord: return "CXXRecord";