[cfe-commits] r124848 - in /cfe/trunk: include/clang/Driver/ToolChain.h lib/Driver/ToolChains.h lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Thu Feb 3 18:20:39 PST 2011


Author: ddunbar
Date: Thu Feb  3 20:20:39 2011
New Revision: 124848

URL: http://llvm.org/viewvc/llvm-project?rev=124848&view=rev
Log:
build: Add support for DISABLE_DEFAULT_STRICT_ALIASING, which does what one
might expect.

Modified:
    cfe/trunk/include/clang/Driver/ToolChain.h
    cfe/trunk/lib/Driver/ToolChains.h
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=124848&r1=124847&r2=124848&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Thu Feb  3 20:20:39 2011
@@ -108,11 +108,15 @@
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }
-  
+
   /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
   /// by default.
   virtual bool IsIntegratedAssemblerDefault() const { return false; }
 
+  /// IsStrictAliasingDefault - Does this tool chain use -fstrict-aliasing by
+  /// default.
+  virtual bool IsStrictAliasingDefault() const { return true; }
+
   /// IsObjCDefaultSynthPropertiesDefault - Does this tool chain enable
   /// -fobjc-default-synthesize-properties by default.
   virtual bool IsObjCDefaultSynthPropertiesDefault() const { return false; }

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=124848&r1=124847&r2=124848&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Thu Feb  3 20:20:39 2011
@@ -176,6 +176,13 @@
             getTriple().getArch() == llvm::Triple::x86_64);
 #endif
   }
+  virtual bool IsStrictAliasingDefault() const {
+#ifdef DISABLE_DEFAULT_STRICT_ALIASING
+    return false;
+#else
+    return ToolChain::IsStrictAliasingDefault();
+#endif
+  }
   
   virtual bool IsObjCDefaultSynthPropertiesDefault() const {
     // Always allow default synthesized properties on Darwin.

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=124848&r1=124847&r2=124848&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Feb  3 20:20:39 2011
@@ -1007,9 +1007,9 @@
   if (!Args.hasFlag(options::OPT_fzero_initialized_in_bss,
                     options::OPT_fno_zero_initialized_in_bss))
     CmdArgs.push_back("-mno-zero-initialized-in-bss");
-  if (Args.hasFlag(options::OPT_fno_strict_aliasing,
-                   options::OPT_fstrict_aliasing,
-                   false))
+  if (!Args.hasFlag(options::OPT_fstrict_aliasing,
+                    options::OPT_fno_strict_aliasing,
+                    getToolChain().IsStrictAliasingDefault()))
     CmdArgs.push_back("-relaxed-aliasing");
 
   // Decide whether to use verbose asm. Verbose assembly is the default on





More information about the cfe-commits mailing list