[cfe-commits] r101370 - in /cfe/trunk: include/clang/Basic/LangOptions.h include/clang/Driver/CC1Options.td lib/Basic/TargetInfo.cpp lib/Frontend/CompilerInvocation.cpp

Daniel Dunbar daniel at zuster.org
Thu Apr 15 08:06:22 PDT 2010


Author: ddunbar
Date: Thu Apr 15 10:06:22 2010
New Revision: 101370

URL: http://llvm.org/viewvc/llvm-project?rev=101370&view=rev
Log:
clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.

Modified:
    cfe/trunk/include/clang/Basic/LangOptions.h
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=101370&r1=101369&r2=101370&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Apr 15 10:06:22 2010
@@ -100,6 +100,10 @@
   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 @@
     CatchUndefined = 0;
     DumpRecordLayouts = 0;
     DumpVtableLayouts = 0;
+    NoBitFieldTypeAlign = 0;
   }
 
   GCMode getGCMode() const { return (GCMode) GC; }

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=101370&r1=101369&r2=101370&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Apr 15 10:06:22 2010
@@ -415,6 +415,8 @@
   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

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=101370&r1=101369&r2=101370&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Thu Apr 15 10:06:22 2010
@@ -142,9 +142,10 @@
 /// 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;
-  }
 }
 
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=101370&r1=101369&r2=101370&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Apr 15 10:06:22 2010
@@ -526,6 +526,14 @@
   // 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 @@
   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.





More information about the cfe-commits mailing list