[cfe-commits] r43509 - /cfe/trunk/include/clang/AST/Decl.h

Chris Lattner sabre at nondot.org
Tue Oct 30 11:54:51 PDT 2007


Author: lattner
Date: Tue Oct 30 13:54:50 2007
New Revision: 43509

URL: http://llvm.org/viewvc/llvm-project?rev=43509&view=rev
Log:
shrinkify storage class to a bitfield, add a fixme about merging it in the future.

Modified:
    cfe/trunk/include/clang/AST/Decl.h

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=43509&r1=43508&r2=43509&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Tue Oct 30 13:54:50 2007
@@ -243,7 +243,7 @@
   enum StorageClass {
     None, Extern, Static, Auto, Register
   };
-  StorageClass getStorageClass() const { return SClass; }
+  StorageClass getStorageClass() const { return (StorageClass)SClass; }
 
   const Expr *getInit() const { return Init; }
   Expr *getInit() { return Init; }
@@ -255,7 +255,8 @@
   //  implicitly "auto", but are represented internally with a storage
   //  class of None.
   bool hasAutoStorage() const {
-    return SClass == Auto || (SClass == None && getKind() != FileVar);
+    return getStorageClass() == Auto ||
+          (getStorageClass() == None && getKind() != FileVar);
   }
 
   // hasStaticStorage - Returns true if either the implicit or
@@ -264,12 +265,15 @@
   //  function) that lack a storage keyword are implicitly "static,"
   //  but are represented internally with a storage class of "None".
   bool hasStaticStorage() const {
-    return SClass == Static || (SClass == None && getKind() == FileVar);
+    return getStorageClass() == Static ||
+          (getStorageClass() == None && getKind() == FileVar);
   }
       
   // hasLocalStorage - Returns true if a variable with function scope
   //  is a non-static local variable.
-  bool hasLocalStorage() const { return hasAutoStorage() || SClass == Register;}
+  bool hasLocalStorage() const {
+    return hasAutoStorage() || getStorageClass() == Register;
+  }
 
   // hasGlobalStorage - Returns true for all variables that do not
   //  have local storage.  This includs all global variables as well
@@ -286,8 +290,9 @@
           StorageClass SC, ScopedDecl *PrevDecl)
     : ValueDecl(DK, L, Id, T, PrevDecl), Init(0) { SClass = SC; }
 private:
-  StorageClass SClass;
-  Expr *Init;  
+  Expr *Init;
+  // FIXME: This can be packed into the bitfields in Decl.
+  unsigned SClass : 3;
   friend class StmtIteratorBase;
 };
 





More information about the cfe-commits mailing list