]> granicus.if.org Git - clang/commitdiff
Factor bitfields of LangOptions out into a base class in order to make them
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 3 Mar 2012 00:52:40 +0000 (00:52 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 3 Mar 2012 00:52:40 +0000 (00:52 +0000)
trivially-copyable. 50KiB reduction in clang binary size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151963 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.h

index 6a77ea6abcf92088518a17687592a6e938cc8e81..ce4ff063c628242b7586ebc470d66b491a094518 100644 (file)
 
 namespace clang {
 
+/// Bitfields of LangOptions, split out from LangOptions in order to ensure that
+/// this large collection of bitfields is a trivial class type.
+class LangOptionsBase {
+public:
+  // Define simple language options (with no accessors).
+#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
+#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
+#include "clang/Basic/LangOptions.def"
+
+protected:
+  // Define language options of enumeration type. These are private, and will
+  // have accessors (below).
+#define LANGOPT(Name, Bits, Default, Description)
+#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
+  unsigned Name : Bits;
+#include "clang/Basic/LangOptions.def"
+};
+
 /// LangOptions - This class keeps track of the various options that can be
 /// enabled, which controls the dialect of C that is accepted.
-class LangOptions : public RefCountedBase<LangOptions> {
+class LangOptions : public RefCountedBase<LangOptions>, public LangOptionsBase {
 public:
   typedef clang::Visibility Visibility;
   
@@ -36,19 +54,6 @@ public:
     SOB_Trapping    // -ftrapv
   };
 
-  // Define simple language options (with no accessors).
-#define LANGOPT(Name, Bits, Default, Description) unsigned Name : Bits;
-#define ENUM_LANGOPT(Name, Type, Bits, Default, Description)
-#include "clang/Basic/LangOptions.def"
-  
-private:
-  // Define language options of enumeration type. These are private, and will
-  // have accessors (below).
-#define LANGOPT(Name, Bits, Default, Description) 
-#define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \
-  unsigned Name : Bits;
-#include "clang/Basic/LangOptions.def"
-  
 public:
   std::string ObjCConstantStringClass;