summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-04-21 01:46:37 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-04-21 01:46:37 +0000
commite0fa4c83b2256337248cbe4c8bee6b0e4de9120f (patch)
tree1938c9e0517926e51ebf1419dacff14ebc4cf5e2 /clang
parent0d6a90dfc3ce76e318793b055b1923da6d8a1b01 (diff)
downloadbcm5719-llvm-e0fa4c83b2256337248cbe4c8bee6b0e4de9120f.tar.gz
bcm5719-llvm-e0fa4c83b2256337248cbe4c8bee6b0e4de9120f.zip
[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
xmmintrin.h a bit more directed. If for whatever reason modules are enabled but we textually include one of these headers, don't deploy the special case for modules. To make this work cleanly, extend __building_module to be defined even when modules is disabled. llvm-svn: 266945
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Headers/xmmintrin.h2
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp15
2 files changed, 5 insertions, 12 deletions
diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h
index 2b3426099ad..43f94229f16 100644
--- a/clang/lib/Headers/xmmintrin.h
+++ b/clang/lib/Headers/xmmintrin.h
@@ -1946,7 +1946,7 @@ do { \
#undef __DEFAULT_FN_ATTRS
/* Ugly hack for backwards-compatibility (compatible with gcc) */
-#if defined(__SSE2__) && !__has_feature(modules)
+#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics)
#include <emmintrin.h>
#endif
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 77c8c7e6c57..0655c1f08e1 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -330,18 +330,11 @@ void Preprocessor::RegisterBuiltinMacros() {
Ident__is_identifier = RegisterBuiltinMacro(*this, "__is_identifier");
// Modules.
- if (LangOpts.Modules) {
- Ident__building_module = RegisterBuiltinMacro(*this, "__building_module");
-
- // __MODULE__
- if (!LangOpts.CurrentModule.empty())
- Ident__MODULE__ = RegisterBuiltinMacro(*this, "__MODULE__");
- else
- Ident__MODULE__ = nullptr;
- } else {
- Ident__building_module = nullptr;
+ Ident__building_module = RegisterBuiltinMacro(*this, "__building_module");
+ if (!LangOpts.CurrentModule.empty())
+ Ident__MODULE__ = RegisterBuiltinMacro(*this, "__MODULE__");
+ else
Ident__MODULE__ = nullptr;
- }
}
/// isTrivialSingleTokenExpansion - Return true if MI, which has a single token
OpenPOWER on IntegriCloud