[cfe-commits] r149206 - in /cfe/trunk: lib/Headers/CMakeLists.txt lib/Headers/Makefile lib/Headers/module.map test/Modules/compiler_builtins.m

Douglas Gregor dgregor at apple.com
Sun Jan 29 12:52:14 PST 2012


Author: dgregor
Date: Sun Jan 29 14:52:14 2012
New Revision: 149206

URL: http://llvm.org/viewvc/llvm-project?rev=149206&view=rev
Log:
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
<rdar://problem/10710060>.

Added:
    cfe/trunk/lib/Headers/module.map
    cfe/trunk/test/Modules/compiler_builtins.m
Modified:
    cfe/trunk/lib/Headers/CMakeLists.txt
    cfe/trunk/lib/Headers/Makefile

Modified: cfe/trunk/lib/Headers/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/CMakeLists.txt?rev=149206&r1=149205&r2=149206&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/CMakeLists.txt (original)
+++ cfe/trunk/lib/Headers/CMakeLists.txt Sun Jan 29 14:52:14 2012
@@ -31,6 +31,7 @@
   xmmintrin.h
   cpuid.h
   unwind.h
+  module.map
   )
 
 set(output_dir ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION}/include)

Modified: cfe/trunk/lib/Headers/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Makefile?rev=149206&r1=149205&r2=149206&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/Makefile (original)
+++ cfe/trunk/lib/Headers/Makefile Sun Jan 29 14:52:14 2012
@@ -32,8 +32,13 @@
 	$(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 @@
 	$(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"

Added: cfe/trunk/lib/Headers/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/module.map?rev=149206&view=auto
==============================================================================
--- cfe/trunk/lib/Headers/module.map (added)
+++ cfe/trunk/lib/Headers/module.map Sun Jan 29 14:52:14 2012
@@ -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.
+}

Added: cfe/trunk/test/Modules/compiler_builtins.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins.m?rev=149206&view=auto
==============================================================================
--- cfe/trunk/test/Modules/compiler_builtins.m (added)
+++ cfe/trunk/test/Modules/compiler_builtins.m Sun Jan 29 14:52:14 2012
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -verify %s
+
+ at import __compiler_builtins.float_constants;
+
+float getFltMax() { return FLT_MAX; }
+
+ at import __compiler_builtins.limits;
+
+char getCharMax() { return CHAR_MAX; }
+
+size_t size; // expected-error{{unknown type name 'size_t'}}





More information about the cfe-commits mailing list