From: Douglas Gregor Date: Sun, 29 Jan 2012 20:52:14 +0000 (+0000) Subject: Introduce a module map for (some of) the compiler-supplied X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e80d8ac921825436bd11d9b4017a0691584056b;p=clang Introduce a module map for (some of) the compiler-supplied headers. The remaining headers require more sophisticated requirements; they'll be handled separately. Part of . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149206 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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'}}