diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Modules/Inputs/System/usr/include/module.map | 21 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/System/usr/include/stdbool.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/System/usr/include/stdint.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/System/usr/include/stdio.h | 3 | ||||
| -rw-r--r-- | clang/test/Modules/compiler_builtins.m | 16 | ||||
| -rw-r--r-- | clang/test/Modules/cstd.m | 29 |
6 files changed, 55 insertions, 16 deletions
diff --git a/clang/test/Modules/Inputs/System/usr/include/module.map b/clang/test/Modules/Inputs/System/usr/include/module.map new file mode 100644 index 00000000000..884b59c80cd --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/module.map @@ -0,0 +1,21 @@ +module cstd [system] { + // Only in compiler support directory + module float_constants { + header "float.h" + } + + // Only in system headers directory + module stdio { + header "stdio.h" + } + + // In both directories (compiler support version wins, does not forward) + module stdbool { + header "stdbool.h" + } + + // In both directories (compiler support version wins, forwards) + module stdint { + header "stdint.h" + } +} diff --git a/clang/test/Modules/Inputs/System/usr/include/stdbool.h b/clang/test/Modules/Inputs/System/usr/include/stdbool.h new file mode 100644 index 00000000000..760d7dc48ef --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdbool.h @@ -0,0 +1 @@ +// Testing hack: does not define bool/true/false. diff --git a/clang/test/Modules/Inputs/System/usr/include/stdint.h b/clang/test/Modules/Inputs/System/usr/include/stdint.h new file mode 100644 index 00000000000..e8e50f90290 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdint.h @@ -0,0 +1 @@ +typedef int my_awesome_nonstandard_integer_type; diff --git a/clang/test/Modules/Inputs/System/usr/include/stdio.h b/clang/test/Modules/Inputs/System/usr/include/stdio.h new file mode 100644 index 00000000000..9a7b1063032 --- /dev/null +++ b/clang/test/Modules/Inputs/System/usr/include/stdio.h @@ -0,0 +1,3 @@ +typedef struct { int id; } FILE; +int fprintf(FILE*restrict, const char* restrict format, ...); + diff --git a/clang/test/Modules/compiler_builtins.m b/clang/test/Modules/compiler_builtins.m index 5ec2e978b3e..a4f1dc21328 100644 --- a/clang/test/Modules/compiler_builtins.m +++ b/clang/test/Modules/compiler_builtins.m @@ -1,22 +1,6 @@ // RUN: rm -rf %t // RUN: %clang -fsyntax-only -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify -@import _Builtin_stdlib.float_constants; - -float getFltMax() { return FLT_MAX; } - -@import _Builtin_stdlib.limits; - -char getCharMax() { return CHAR_MAX; } - -// MS limits.h provides size_t. -// XFAIL: win32 -size_t size; // expected-error{{unknown type name 'size_t'}} - -@import _Builtin_stdlib.stdint; - -intmax_t value; - #ifdef __SSE__ @import _Builtin_intrinsics.intel.sse; #endif diff --git a/clang/test/Modules/cstd.m b/clang/test/Modules/cstd.m new file mode 100644 index 00000000000..8bd5c92cff1 --- /dev/null +++ b/clang/test/Modules/cstd.m @@ -0,0 +1,29 @@ +// RUN: rm -rf %t +// RUN: %clang -fsyntax-only -isysroot %S/Inputs/System -fmodules -fmodule-cache-path %t -D__need_wint_t %s -Xclang -verify + +// Supplied by compiler, but referenced from the "/usr/include" module map. +@import cstd.float_constants; + +float getFltMax() { return FLT_MAX; } + +// Supplied by the "/usr/include" module map. +@import cstd.stdio; + +void test_fprintf(FILE *file) { + fprintf(file, "Hello, modules\n"); +} + +// Supplied by compiler, which forwards to the the "/usr/include" version. +@import cstd.stdint; + +my_awesome_nonstandard_integer_type value; + +// Supplied by the compiler; that version wins. +@import cstd.stdbool; + +#ifndef bool +# error "bool was not defined!" +#endif + + + |

