summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElad Cohen <elad2.cohen@intel.com>2016-09-04 06:00:42 +0000
committerElad Cohen <elad2.cohen@intel.com>2016-09-04 06:00:42 +0000
commitfb6358d2b5b25601a3172011238e229995f1b1a4 (patch)
tree90a22a43af6bffc06948028c1268069bcf85bf05
parent8e571b551ef58e58b4229de5ce18a65406e70082 (diff)
downloadbcm5719-llvm-fb6358d2b5b25601a3172011238e229995f1b1a4.tar.gz
bcm5719-llvm-fb6358d2b5b25601a3172011238e229995f1b1a4.zip
[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
This adds support for modules that require (non-)freestanding environment, such as the compiler builtin mm_malloc submodule. Differential Revision: https://reviews.llvm.org/D23871 llvm-svn: 280613
-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