summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/docs/Modules.rst3
-rw-r--r--clang/lib/Basic/Module.cpp1
-rw-r--r--clang/lib/Headers/module.modulemap1
-rw-r--r--clang/test/Modules/compiler_builtins_x86.c6
4 files changed, 11 insertions, 0 deletions
diff --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst
index e11145ed71c..ad71a95420b 100644
--- a/clang/docs/Modules.rst
+++ b/clang/docs/Modules.rst
@@ -413,6 +413,9 @@ cplusplus
cplusplus11
C++11 support is available.
+freestanding
+ A freestanding environment is available.
+
gnuinlineasm
GNU inline ASM is available.
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index b37deb12228..8578947db82 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -64,6 +64,7 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
.Case("blocks", LangOpts.Blocks)
.Case("cplusplus", LangOpts.CPlusPlus)
.Case("cplusplus11", LangOpts.CPlusPlus11)
+ .Case("freestanding", LangOpts.Freestanding)
.Case("gnuinlineasm", LangOpts.GNUAsm)
.Case("objc", LangOpts.ObjC1)
.Case("objc_arc", LangOpts.ObjCAutoRefCount)
diff --git a/clang/lib/Headers/module.modulemap b/clang/lib/Headers/module.modulemap
index 4654b3de298..11ef2f90294 100644
--- a/clang/lib/Headers/module.modulemap
+++ b/clang/lib/Headers/module.modulemap
@@ -63,6 +63,7 @@ module _Builtin_intrinsics [system] [extern_c] {
textual header "mwaitxintrin.h"
explicit module mm_malloc {
+ requires !freestanding
header "mm_malloc.h"
export * // note: for <stdlib.h> dependency
}
diff --git a/clang/test/Modules/compiler_builtins_x86.c b/clang/test/Modules/compiler_builtins_x86.c
new file mode 100644
index 00000000000..f24bbafbd13
--- /dev/null
+++ b/clang/test/Modules/compiler_builtins_x86.c
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// expected-no-diagnostics
+
+#include<x86intrin.h>
+
OpenPOWER on IntegriCloud