]> granicus.if.org Git - clang/commitdiff
Introduce a module map for (some of) the compiler-supplied
authorDouglas Gregor <dgregor@apple.com>
Sun, 29 Jan 2012 20:52:14 +0000 (20:52 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 29 Jan 2012 20:52:14 +0000 (20:52 +0000)
headers. The remaining headers require more sophisticated
requirements; they'll be handled separately. Part of
<rdar://problem/10710060>.

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

lib/Headers/CMakeLists.txt
lib/Headers/Makefile
lib/Headers/module.map [new file with mode: 0644]
test/Modules/compiler_builtins.m [new file with mode: 0644]

index 4cb07e918f3602ba024372a205030fee78befdbb..78141a3d07fff671aa8418c9605ab2b26257fed4 100644 (file)
@@ -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)
index 91cc562bd355d1926f1ed18ba41081cb9f4de9e1..42219c4082be839fb08817d107464d49d4778ddc 100644 (file)
@@ -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 (file)
index 0000000..5ff2139
--- /dev/null
@@ -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 (file)
index 0000000..3cf2414
--- /dev/null
@@ -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'}}