[cfe-commits] r43534 - in /cfe/trunk: Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/AST/Decl.h include/clang/AST/DeclObjC.h

Chris Lattner clattner at apple.com
Tue Dec 11 22:05:22 PST 2007


On Oct 30, 2007, at 5:12 PM, Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Tue Oct 30 19:12:35 2007
> New Revision: 43534
>
> Added new type and bitfield fields in some decl types in preparation  
> for objective-c's type qualifiers.
> Added initialization of Class/SEMA types.

Hi Fariborz,

This patch adds ObjcDeclQualifier to VarDecl.  Doesn't it make more  
sense for them to be on ParmVarDecl?

-Chris

> +  /// ObjcDeclQualifier - Qualifier used on types in method  
> declarations
> +  /// for remote messaging. They are meant for the arguments though  
> and
> +  /// applied to the Decls (ObjcMethodDecl and ParmVarDecl).
> +  enum ObjcDeclQualifier {
> +    OBJC_TQ_None = 0x0,
> +    OBJC_TQ_In = 0x1,
> +    OBJC_TQ_Inout = 0x2,
> +    OBJC_TQ_Out = 0x4,
> +    OBJC_TQ_Bycopy = 0x8,
> +    OBJC_TQ_Byref = 0x10,
> +    OBJC_TQ_Oneway = 0x20
> +  };
> +
> private:
>   /// Loc - The location that this decl.
>   SourceLocation Loc;
> @@ -280,6 +293,8 @@
>   //  as static variables declared within a function.
>   bool hasGlobalStorage() const { return !hasAutoStorage(); }
>
> +  ObjcDeclQualifier getObjcDeclQualifier() const { return  
> objcDeclQualifier; }
> +
>   // Implement isa/cast/dyncast/etc.
>   static bool classof(const Decl *D) {
>     return D->getKind() >= VarFirst && D->getKind() <= VarLast;
> @@ -288,11 +303,16 @@
> protected:
>   VarDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T,
>           StorageClass SC, ScopedDecl *PrevDecl)
> -    : ValueDecl(DK, L, Id, T, PrevDecl), Init(0) { SClass = SC; }
> +    : ValueDecl(DK, L, Id, T, PrevDecl), Init(0),
> +      objcDeclQualifier(OBJC_TQ_None) { SClass = SC; }
> private:
>   Expr *Init;
>   // FIXME: This can be packed into the bitfields in Decl.
>   unsigned SClass : 3;
> +  /// FIXME: Also can be paced into the bitfields in Decl.
> +  /// in, inout, etc.
> +  ObjcDeclQualifier objcDeclQualifier : 6;
> +
>   friend class StmtIteratorBase;
> };
>
>
> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=43534&r1=43533&r2=43534&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> +++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Oct 30 19:12:35 2007
> @@ -218,6 +218,9 @@
>   /// @required/@optional
>   ImplementationControl DeclImplementation : 2;
>
> +  /// in, inout, etc.
> +  ObjcDeclQualifier objcDeclQualifier : 6;
> +
>   // A unigue name for this method.
>   Selector SelName;
>
> @@ -241,11 +244,14 @@
>                  Decl *PrevDecl = 0)
>     : Decl(ObjcMethod, beginLoc),
>       IsInstance(isInstance), DeclImplementation(impControl),
> +      objcDeclQualifier(OBJC_TQ_None),
>       SelName(SelInfo), MethodDeclType(T),
>       ParamInfo(paramInfo), NumMethodParams(numParams),
>       MethodAttrs(M), EndLoc(endLoc) {}
>   virtual ~ObjcMethodDecl();
>
> +  ObjcDeclQualifier getObjcDeclQualifier() const { return  
> objcDeclQualifier; }
> +
>   // Location information, modeled after the Stmt API.
>   SourceLocation getLocStart() const { return getLocation(); }
>   SourceLocation getLocEnd() const { return EndLoc; }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list