diff options
author | Steve Naroff <snaroff@apple.com> | 2008-12-01 20:33:01 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-12-01 20:33:01 +0000 |
commit | d40910b581b09c937a8c1fdcde9b8ec724398fb9 (patch) | |
tree | 31d1ae7e1e8519277ab7dcccedf40485eef0d5b9 | |
parent | b65f2425e9847d30bae499323a2d5cc29808d0b5 (diff) |
-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
-rw-r--r-- | Driver/RewriteObjC.cpp | 11 | ||||
-rw-r--r-- | include/clang/AST/DeclObjC.h | 2 | ||||
-rw-r--r-- | lib/AST/DeclBase.cpp | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 1c20ef1b89..6979736659 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -169,6 +169,7 @@ namespace { 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::RewriteTabs() { } } +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 @@ void RewriteObjC::RewriteImplementationDecl(NamedDecl *OID) { 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 eda3e6db7d..43750c4474 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -1311,6 +1311,8 @@ public: 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 2bfb5ae607..5cb2a3e64f 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -72,9 +72,12 @@ const char *Decl::getDeclKindName() const { 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"; |