]> granicus.if.org Git - clang/commitdiff
[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 21 Apr 2016 01:46:37 +0000 (01:46 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 21 Apr 2016 01:46:37 +0000 (01:46 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266945 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/xmmintrin.h
lib/Lex/PPMacroExpansion.cpp

index 2b3426099ad20cac0b19e44a48665b41749d918c..43f94229f164fa7ee4473a4bd48f9c1ce9e48c8d 100644 (file)
@@ -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
 
index 77c8c7e6c57ac8553c84c6c6e5098e580042bd41..0655c1f08e19e87cac893cd5d21962fbf3d3d5c0 100644 (file)
@@ -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