aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Driver/ToolChain.h6
-rw-r--r--lib/Driver/ToolChains.h7
-rw-r--r--lib/Driver/Tools.cpp6
3 files changed, 15 insertions, 4 deletions
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index dfd39bc594..f0012bd851 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -108,11 +108,15 @@ public:
/// 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; }
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 005597dccc..870621268e 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -176,6 +176,13 @@ public:
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.
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index d1d8873c3a..f3d2d4b88b 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1007,9 +1007,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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