[cfe-commits] r60368 - in /cfe/trunk: Driver/RewriteObjC.cpp include/clang/AST/DeclObjC.h lib/AST/DeclBase.cpp
Steve Naroff
snaroff at apple.com
Mon Dec 1 12:33:02 PST 2008
Author: snaroff
Date: Mon Dec 1 14:33:01 2008
New Revision: 60368
URL: http://llvm.org/viewvc/llvm-project?rev=60368&view=rev
Log:
-Add several ObjC types to Decl::getDeclKindName(), a useful debug hook.
-Start adding support for rewriting @synthesize.
Modified:
cfe/trunk/Driver/RewriteObjC.cpp
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=60368&r1=60367&r2=60368&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Mon Dec 1 14:33:01 2008
@@ -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
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=60368&r1=60367&r2=60368&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Dec 1 14:33:01 2008
@@ -1311,6 +1311,8 @@
Kind PK,
ObjCIvarDecl *ivarDecl);
+ SourceLocation getLocStart() const { return AtLoc; }
+
ObjCPropertyDecl *getPropertyDecl() const {
return PropertyDecl;
}
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=60368&r1=60367&r2=60368&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Mon Dec 1 14:33:01 2008
@@ -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";
More information about the cfe-commits
mailing list