[cfe-commits] r61866 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 7 10:06:58 PST 2009
On Jan 7, 2009, at 9:57 AM, Steve Naroff wrote:
> Author: snaroff
> Date: Wed Jan 7 11:57:40 2009
> New Revision: 61866
>
> URL: http://llvm.org/viewvc/llvm-project?rev=61866&view=rev
> Log:
> ObjC AST cleanups/simplifications (phase 1).
> Add ObjCContainerDecl class and have ObjCInterfaceDecl/
> ObjCCategoryDecl/ObjCProtocolDecl inherit from it.
>
> Modified:
> cfe/trunk/include/clang/AST/DeclBase.h
> cfe/trunk/include/clang/AST/DeclObjC.h
> cfe/trunk/lib/AST/DeclObjC.cpp
>
> Modified: cfe/trunk/include/clang/AST/DeclBase.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=61866&r1=61865&r2=61866&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/AST/DeclBase.h (original)
> +++ cfe/trunk/include/clang/AST/DeclBase.h Wed Jan 7 11:57:40 2009
> @@ -49,12 +49,14 @@
> // Decl
> TranslationUnit, // [DeclContext]
> // NamedDecl
> + // ObjCContainerDecl
> + ObjCCategory,
> + ObjCProtocol,
> + ObjCInterface, // [DeclContext]
> OverloadedFunction,
> - ObjCCategory,
> ObjCCategoryImpl,
> ObjCImplementation,
> ObjCMethod, // [DeclContext]
> - ObjCProtocol,
> ObjCProperty,
> // ScopedDecl
> Field,
> @@ -82,7 +84,6 @@
> OriginalParmVar,
> NonTypeTemplateParm,
> LinkageSpec, // [DeclContext]
> - ObjCInterface, // [DeclContext]
> ObjCCompatibleAlias,
> ObjCClass,
> ObjCForwardProtocol,
>
> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=61866&r1=61865&r2=61866&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> +++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Jan 7 11:57:40 2009
> @@ -249,7 +249,73 @@
> return static_cast<ObjCMethodDecl *>(const_cast<DeclContext*>
> (DC));
> }
> };
> +
> +/// ObjCContainerDecl - Represents a container for method
> declarations.
> +/// Current sub-classes are ObjCInterfaceDecl, ObjCCategoryDecl, and
> +/// ObjCProtocolDecl. FIXME: Use for ObjC implementation decls.
> +/// STILL UNDER CONSTRUCTION...
> +///
> +class ObjCContainerDecl : public NamedDecl {
Would it make sense for ObjCContainerDecl to be a DeclContext? The
DeclContext could store both instance methods and class methods (in
the normal list of declarations). We would get DeclContext's faster
name-lookup routines (rather than the linear walks employed by
getInstanceMethod and getClassMethod), and we'd get some unification
with the other parts of the compiler that use DeclContexts.
- Doug
More information about the cfe-commits
mailing list