[cfe-commits] r151963 - /cfe/trunk/include/clang/Basic/LangOptions.h

Richard Smith richard-llvm at metafoo.co.uk
Fri Mar 2 16:52:40 PST 2012


Author: rsmith
Date: Fri Mar  2 18:52:40 2012
New Revision: 151963

URL: http://llvm.org/viewvc/llvm-project?rev=151963&view=rev
Log:
Factor bitfields of LangOptions out into a base class in order to make them
trivially-copyable. 50KiB reduction in clang binary size.

Modified:
    cfe/trunk/include/clang/Basic/LangOptions.h

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=151963&r1=151962&r2=151963&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Fri Mar  2 18:52:40 2012
@@ -21,9 +21,27 @@
 
 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 @@
     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;
   





More information about the cfe-commits mailing list