aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Headers/CMakeLists.txt1
-rw-r--r--lib/Headers/Makefile14
-rw-r--r--lib/Headers/module.map39
-rw-r--r--test/Modules/compiler_builtins.m12
4 files changed, 64 insertions, 2 deletions
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
index 4cb07e918f..78141a3d07 100644
--- a/lib/Headers/CMakeLists.txt
+++ b/lib/Headers/CMakeLists.txt
@@ -31,6 +31,7 @@ set(files
xmmintrin.h
cpuid.h
unwind.h
+ module.map
)
set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)
diff --git a/lib/Headers/Makefile b/lib/Headers/Makefile
index 91cc562bd3..42219c4082 100644
--- a/lib/Headers/Makefile
+++ b/lib/Headers/Makefile
@@ -32,8 +32,13 @@ $(HeaderDir)/arm_neon.h: $(BUILT_SOURCES) $(HeaderDir)/.dir
$(Verb) cp $< $@
$(Echo) Copying $(notdir $<) to build dir
+$(HeaderDir)/module.map: $(PROJ_SRC_DIR)/module.map $(HeaderDir)/.dir
+ $(Verb) cp $< $@
+ $(Echo) Copying $(notdir $<) to build dir
+
+
# Hook into the standard Makefile rules.
-all-local:: $(OBJHEADERS)
+all-local:: $(OBJHEADERS) $(HeaderDir)/module.map
PROJ_headers := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION)/include
@@ -47,7 +52,12 @@ $(INSTHEADERS): $(PROJ_headers)/%.h: $(HeaderDir)/%.h | $(PROJ_headers)
$(Verb) $(DataInstall) $< $(PROJ_headers)
$(Echo) Installing compiler include file: $(notdir $<)
-install-local:: $(INSTHEADERS)
+$(PROJ_headers)/module.map: $(HeaderDir)/module.map | $(PROJ_headers)
+ $(Verb) $(DataInstall) $< $(PROJ_headers)
+ $(Echo) Installing compiler module map file: $(notdir $<)
+
+
+install-local:: $(INSTHEADERS) $(PROJ_headers)/module.map
$(ObjDir)/arm_neon.h.inc.tmp : $(CLANG_LEVEL)/include/clang/Basic/arm_neon.td $(CLANG_TBLGEN) $(ObjDir)/.dir
$(Echo) "Building Clang arm_neon.h.inc with tblgen"
diff --git a/lib/Headers/module.map b/lib/Headers/module.map
new file mode 100644
index 0000000000..5ff2139760
--- /dev/null
+++ b/lib/Headers/module.map
@@ -0,0 +1,39 @@
+module __compiler_builtins [system] {
+ explicit module float_constants {
+ header "float.h"
+ }
+
+ explicit module iso646 {
+ header "iso646.h"
+ }
+
+ explicit module limits {
+ header "limits.h"
+ }
+
+ explicit module stdalign {
+ header "stdalign.h"
+ }
+
+ explicit module stdarg {
+ header "stdarg.h"
+ }
+
+ explicit module stdbool {
+ header "stdbool.h"
+ }
+
+ explicit module stddef {
+ header "stddef.h"
+ }
+
+ explicit module stdint {
+ header "stdint.h"
+ }
+
+ explicit module tgmath {
+ header "tgmath.h"
+ }
+
+ // FIXME: add various altivec, *intrin headers.
+}
diff --git a/test/Modules/compiler_builtins.m b/test/Modules/compiler_builtins.m
new file mode 100644
index 0000000000..3cf24142d3
--- /dev/null
+++ b/test/Modules/compiler_builtins.m
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -verify %s
+
+@import __compiler_builtins.float_constants;
+
+float getFltMax() { return FLT_MAX; }
+
+@import __compiler_builtins.limits;
+
+char getCharMax() { return CHAR_MAX; }
+
+size_t size; // expected-error{{unknown type name 'size_t'}}