]> granicus.if.org Git - clang/commitdiff
shrinkify storage class to a bitfield, add a fixme about merging it in the future.
authorChris Lattner <sabre@nondot.org>
Tue, 30 Oct 2007 18:54:50 +0000 (18:54 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Oct 2007 18:54:50 +0000 (18:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43509 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h

index b8214a7120caa261f780ee314fd16320ab2572a5..923ea8a11bc20294fc5f03e8ec3baab696d89f47 100644 (file)
@@ -243,7 +243,7 @@ public:
   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 @@ public:
   //  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 @@ public:
   //  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 @@ protected:
           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;
 };