From e6889f961f2f29d10f6b4ce3e23fadb9309ddab7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 Oct 2007 18:54:50 +0000 Subject: [PATCH] shrinkify storage class to a bitfield, add a fixme about merging it in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43509 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index b8214a7120..923ea8a11b 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -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; }; -- 2.50.1