Add tests that build modules for our builtin headers, and fix two buglets exposed by doing so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Headers/cpuid.h b/lib/Headers/cpuid.h
index 6d7d61d..7b01238 100644
--- a/lib/Headers/cpuid.h
+++ b/lib/Headers/cpuid.h
@@ -25,9 +25,9 @@
 #error this header is for x86 only
 #endif
 
-static inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
-                               unsigned int *__ebx, unsigned int *__ecx,
-                               unsigned int *__edx) {
+static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
+                                 unsigned int *__ebx, unsigned int *__ecx,
+                                 unsigned int *__edx) {
     __asm("cpuid" : "=a"(*__eax), "=b" (*__ebx), "=c"(*__ecx), "=d"(*__edx)
                   : "0"(__level));
     return 1;
diff --git a/lib/Headers/module.map b/lib/Headers/module.map
index 1b476a5..aa219cb 100644
--- a/lib/Headers/module.map
+++ b/lib/Headers/module.map
@@ -17,6 +17,7 @@
     }
 
     explicit module cpuid {
+      requires x86
       header "cpuid.h"
     }
 
diff --git a/test/Headers/c11.c b/test/Headers/c11.c
index 24a1c2a..f65164d 100644
--- a/test/Headers/c11.c
+++ b/test/Headers/c11.c
@@ -1,4 +1,5 @@
 // RUN: %clang -fsyntax-only -Xclang -verify -std=c11 %s
+// RUN: %clang -fsyntax-only -Xclang -verify -std=c11 -fmodules %s
 
 noreturn int f(); // expected-error 1+{{}}
 
diff --git a/test/Headers/c89.c b/test/Headers/c89.c
index acf01b4..95f692b 100644
--- a/test/Headers/c89.c
+++ b/test/Headers/c89.c
@@ -1,4 +1,5 @@
 // RUN: %clang -target i386-apple-darwin10 -fsyntax-only -Xclang -verify -std=c89 %s
+// RUN: %clang -target i386-apple-darwin10 -fsyntax-only -Xclang -verify -std=c89 -fmodules %s
 // expected-no-diagnostics
 
 // FIXME: Disable inclusion of mm_malloc.h, our current implementation is broken
diff --git a/test/Headers/cxx11.cpp b/test/Headers/cxx11.cpp
index 995fc65..41bdc76 100644
--- a/test/Headers/cxx11.cpp
+++ b/test/Headers/cxx11.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang -fsyntax-only -std=c++11 %s
+// RUN: %clang -fsyntax-only -std=c++11 -fmodules %s
 
 #include <stdalign.h>