]> granicus.if.org Git - clang/commitdiff
clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 15 Apr 2010 15:06:22 +0000 (15:06 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 15 Apr 2010 15:06:22 +0000 (15:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101370 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/LangOptions.h
include/clang/Driver/CC1Options.td
lib/Basic/TargetInfo.cpp
lib/Frontend/CompilerInvocation.cpp

index 1dfc7a1dfa80b094f71442aaa863d6ee4680c323..8a7d9d6ac60e9cd2281150413520e8ce7eb0b886 100644 (file)
@@ -100,6 +100,10 @@ public:
   unsigned CatchUndefined    : 1; // Generate code to check for undefined ops.
   unsigned DumpRecordLayouts : 1; /// Dump the layout of IRgen'd records.
   unsigned DumpVtableLayouts : 1; /// Dump the layouts of emitted vtables.
+
+  // FIXME: This is just a temporary option, for testing purposes.
+  unsigned NoBitFieldTypeAlign : 1;
+
 private:
   unsigned GC : 2;                // Objective-C Garbage Collection modes.  We
                                   // declare this enum as unsigned because MSVC
@@ -171,6 +175,7 @@ public:
     CatchUndefined = 0;
     DumpRecordLayouts = 0;
     DumpVtableLayouts = 0;
+    NoBitFieldTypeAlign = 0;
   }
 
   GCMode getGCMode() const { return (GCMode) GC; }
index 5f48bc60d6aa1c04efdee8d561bc3c2132c2fa59..27b13929ef3b6f18152c520452a0813ebad9d7e4 100644 (file)
@@ -415,6 +415,8 @@ def trigraphs : Flag<"-trigraphs">,
   HelpText<"Process trigraph sequences">;
 def fwritable_strings : Flag<"-fwritable-strings">,
   HelpText<"Store string literals as writable data">;
+def fno_bitfield_type_align : Flag<"-fno-bitfield-type-align">,
+  HelpText<"Ignore bit-field types when aligning structures">;
 
 //===----------------------------------------------------------------------===//
 // Header Search Options
index e03d5ac82839e635e76887c44fcd239c3e772d67..b259facbb7c28df3f49efae0138ce9560d15905c 100644 (file)
@@ -142,9 +142,10 @@ bool TargetInfo::isTypeSigned(IntType T) const {
 /// Apply changes to the target information with respect to certain
 /// language options which change the target configuration.
 void TargetInfo::setForcedLangOptions(LangOptions &Opts) {
-  if (Opts.ShortWChar) {
+  if (Opts.NoBitFieldTypeAlign)
+    UseBitFieldTypeAlignment = false;
+  if (Opts.ShortWChar)
     WCharType = UnsignedShort;
-  }
 }
 
 //===----------------------------------------------------------------------===//
index f51bad285db78855e7dd3c0aa6a90d6b1438a67b..4dfd9c2669b6279df89d3fa51967ae33bb4ecd3f 100644 (file)
@@ -526,6 +526,14 @@ static void LangOptsToArgs(const LangOptions &Opts,
   // OptimizeSize is implicit.
   if (Opts.Static)
     Res.push_back("-static-define");
+  if (Opts.DumpRecordLayouts)
+    Res.push_back("-fdump-record-layouts");
+  if (Opts.DumpVtableLayouts)
+    Res.push_back("-fdump-vtable-layouts");
+  if (Opts.NoBitFieldTypeAlign)
+    Res.push_back("-fno-bitfield-type-alignment");
+  if (Opts.SjLjExceptions)
+    Res.push_back("-fsjlj-exceptions");
   if (Opts.PICLevel) {
     Res.push_back("-pic-level");
     Res.push_back(llvm::utostr(Opts.PICLevel));
@@ -1219,6 +1227,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args,
   Opts.Static = Args.hasArg(OPT_static_define);
   Opts.DumpRecordLayouts = Args.hasArg(OPT_fdump_record_layouts);
   Opts.DumpVtableLayouts = Args.hasArg(OPT_fdump_vtable_layouts);
+  Opts.NoBitFieldTypeAlign = Args.hasArg(OPT_fno_bitfield_type_align);
   Opts.OptimizeSize = 0;
 
   // FIXME: Eliminate this dependency.