r181039 - Keep track of an @implementation's super class name location, if one was provided.

Jordan Rose jordan_rose at apple.com
Fri May 3 11:12:30 PDT 2013


Why is this in @implementation? It's not legal to provide a superclass name there, only in @interface, right?

Jordan


On May 3, 2013, at 11:05 , Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

> Author: akirtzidis
> Date: Fri May  3 13:05:44 2013
> New Revision: 181039
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=181039&view=rev
> Log:
> Keep track of an @implementation's super class name location, if one was provided.
> 
> Modified:
>    cfe/trunk/include/clang/AST/DeclObjC.h
>    cfe/trunk/lib/AST/ASTImporter.cpp
>    cfe/trunk/lib/AST/DeclObjC.cpp
>    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>    cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> 
> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> +++ cfe/trunk/include/clang/AST/DeclObjC.h Fri May  3 13:05:44 2013
> @@ -1798,6 +1798,8 @@ class ObjCImplementationDecl : public Ob
>   virtual void anchor();
>   /// Implementation Class's super class.
>   ObjCInterfaceDecl *SuperClass;
> +  SourceLocation SuperLoc;
> +
>   /// \@implementation may have private ivars.
>   SourceLocation IvarLBraceLoc;
>   SourceLocation IvarRBraceLoc;
> @@ -1818,10 +1820,11 @@ class ObjCImplementationDecl : public Ob
>                          ObjCInterfaceDecl *classInterface,
>                          ObjCInterfaceDecl *superDecl,
>                          SourceLocation nameLoc, SourceLocation atStartLoc,
> +                         SourceLocation superLoc = SourceLocation(),
>                          SourceLocation IvarLBraceLoc=SourceLocation(), 
>                          SourceLocation IvarRBraceLoc=SourceLocation())
>     : ObjCImplDecl(ObjCImplementation, DC, classInterface, nameLoc, atStartLoc),
> -       SuperClass(superDecl), IvarLBraceLoc(IvarLBraceLoc), 
> +       SuperClass(superDecl), SuperLoc(superLoc), IvarLBraceLoc(IvarLBraceLoc),
>        IvarRBraceLoc(IvarRBraceLoc),
>        IvarInitializers(0), NumIvarInitializers(0),
>        HasNonZeroConstructors(false), HasDestructors(false) {}
> @@ -1831,6 +1834,7 @@ public:
>                                         ObjCInterfaceDecl *superDecl,
>                                         SourceLocation nameLoc,
>                                         SourceLocation atStartLoc,
> +                                     SourceLocation superLoc = SourceLocation(),
>                                         SourceLocation IvarLBraceLoc=SourceLocation(), 
>                                         SourceLocation IvarRBraceLoc=SourceLocation());
> 
> @@ -1903,6 +1907,7 @@ public:
> 
>   const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }
>   ObjCInterfaceDecl *getSuperClass() { return SuperClass; }
> +  SourceLocation getSuperLoc() const { return SuperLoc; }
> 
>   void setSuperClass(ObjCInterfaceDecl * superCls) { SuperClass = superCls; }
> 
> 
> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
> +++ cfe/trunk/lib/AST/ASTImporter.cpp Fri May  3 13:05:44 2013
> @@ -3650,6 +3650,7 @@ Decl *ASTNodeImporter::VisitObjCImplemen
>                                           Iface, Super,
>                                           Importer.Import(D->getLocation()),
>                                           Importer.Import(D->getAtStartLoc()),
> +                                          Importer.Import(D->getSuperLoc()),
>                                           Importer.Import(D->getIvarLBraceLoc()),
>                                           Importer.Import(D->getIvarRBraceLoc()));
> 
> 
> Modified: cfe/trunk/lib/AST/DeclObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/DeclObjC.cpp (original)
> +++ cfe/trunk/lib/AST/DeclObjC.cpp Fri May  3 13:05:44 2013
> @@ -1648,12 +1648,13 @@ ObjCImplementationDecl::Create(ASTContex
>                                ObjCInterfaceDecl *SuperDecl,
>                                SourceLocation nameLoc,
>                                SourceLocation atStartLoc,
> +                               SourceLocation superLoc,
>                                SourceLocation IvarLBraceLoc,
>                                SourceLocation IvarRBraceLoc) {
>   if (ClassInterface && ClassInterface->hasDefinition())
>     ClassInterface = ClassInterface->getDefinition();
>   return new (C) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
> -                                        nameLoc, atStartLoc,
> +                                        nameLoc, atStartLoc, superLoc,
>                                         IvarLBraceLoc, IvarRBraceLoc);
> }
> 
> 
> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri May  3 13:05:44 2013
> @@ -1045,7 +1045,7 @@ Decl *Sema::ActOnStartClassImplementatio
> 
>   ObjCImplementationDecl* IMPDecl =
>     ObjCImplementationDecl::Create(Context, CurContext, IDecl, SDecl,
> -                                   ClassLoc, AtClassImplLoc);
> +                                   ClassLoc, AtClassImplLoc, SuperClassLoc);
> 
>   if (CheckObjCDeclScope(IMPDecl))
>     return ActOnObjCContainerStartDefinition(IMPDecl);
> 
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri May  3 13:05:44 2013
> @@ -849,6 +849,7 @@ void ASTDeclReader::VisitObjCCategoryImp
> void ASTDeclReader::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
>   VisitObjCImplDecl(D);
>   D->setSuperClass(ReadDeclAs<ObjCInterfaceDecl>(Record, Idx));
> +  D->SuperLoc = ReadSourceLocation(Record, Idx);
>   D->setIvarLBraceLoc(ReadSourceLocation(Record, Idx));
>   D->setIvarRBraceLoc(ReadSourceLocation(Record, Idx));
>   D->setHasNonZeroConstructors(Record[Idx++]);
> 
> Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=181039&r1=181038&r2=181039&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Fri May  3 13:05:44 2013
> @@ -613,6 +613,7 @@ void ASTDeclWriter::VisitObjCCategoryImp
> void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
>   VisitObjCImplDecl(D);
>   Writer.AddDeclRef(D->getSuperClass(), Record);
> +  Writer.AddSourceLocation(D->getSuperLoc(), Record);
>   Writer.AddSourceLocation(D->getIvarLBraceLoc(), Record);
>   Writer.AddSourceLocation(D->getIvarRBraceLoc(), Record);
>   Record.push_back(D->hasNonZeroConstructors());
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130503/e3c741f8/attachment.html>


More information about the cfe-commits mailing list