diff options
Diffstat (limited to 'clang/test/Modules')
21 files changed, 107 insertions, 1 deletions
diff --git a/clang/test/Modules/Inputs/System/usr/include/stdbool.h b/clang/test/Modules/Inputs/System/usr/include/stdbool.h index 760d7dc48ef..50be7543c42 100644 --- a/clang/test/Modules/Inputs/System/usr/include/stdbool.h +++ b/clang/test/Modules/Inputs/System/usr/include/stdbool.h @@ -1 +1 @@ -// Testing hack: does not define bool/true/false. +#include_next <stdbool.h> diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/c++/math.h b/clang/test/Modules/Inputs/libc-libcxx/include/c++/math.h new file mode 100644 index 00000000000..890db371de6 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/c++/math.h @@ -0,0 +1,2 @@ +#include_next <math.h> +template<typename T> T abs(T t) { return (t < 0) ? -t : t; } diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/c++/module.modulemap b/clang/test/Modules/Inputs/libc-libcxx/include/c++/module.modulemap new file mode 100644 index 00000000000..fd15779e934 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/c++/module.modulemap @@ -0,0 +1,4 @@ +module "libc++" { + module math { header "math.h" export * } + module stdlib { header "stdlib.h" export * } +} diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/c++/stdlib.h b/clang/test/Modules/Inputs/libc-libcxx/include/c++/stdlib.h new file mode 100644 index 00000000000..6e736cbbaa0 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/c++/stdlib.h @@ -0,0 +1 @@ +#include_next "stdlib.h" diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/math.h b/clang/test/Modules/Inputs/libc-libcxx/include/math.h new file mode 100644 index 00000000000..380ab41ca0a --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/math.h @@ -0,0 +1 @@ +int abs(int); diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/module.modulemap b/clang/test/Modules/Inputs/libc-libcxx/include/module.modulemap new file mode 100644 index 00000000000..744f5450b11 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/module.modulemap @@ -0,0 +1,4 @@ +module libc [no_undeclared_includes] { + module math { header "math.h" export * } + module stdlib { header "stdlib.h" export * } +} diff --git a/clang/test/Modules/Inputs/libc-libcxx/include/stdlib.h b/clang/test/Modules/Inputs/libc-libcxx/include/stdlib.h new file mode 100644 index 00000000000..a84546e5bc8 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/include/stdlib.h @@ -0,0 +1 @@ +#include <math.h> diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/__config b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/__config new file mode 100644 index 00000000000..eacda484006 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/__config @@ -0,0 +1,6 @@ +#ifndef _LIBCPP_CONFIG +#define _LIBCPP_CONFIG + +#define __LIBCXX_CONFIG + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h new file mode 100644 index 00000000000..f761b910f3e --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h @@ -0,0 +1,7 @@ +#ifndef LIBCXX_MATH_H +#define LIBCXX_MATH_H + +#include_next <math.h> +template<typename T> T abs(T t) { return (t < 0) ? -t : t; } + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap new file mode 100644 index 00000000000..c352f4a6177 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap @@ -0,0 +1,7 @@ +module "libc++" { + module math { header "math.h" export * } + module stdlib { header "stdlib.h" export * } + module stddef { header "stddef.h" export * } + module stdio { textual header "stdio.h" export * } + module __config { header "__config" export * } +} diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h new file mode 100644 index 00000000000..bd42008e169 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h @@ -0,0 +1,6 @@ +#ifndef LIBCXX_STDDEF_H +#define LIBCXX_STDDEF_H + +#include <__config> + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdio.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdio.h new file mode 100644 index 00000000000..399fce17534 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdio.h @@ -0,0 +1,6 @@ +#ifndef LIBCXX_STDIO_H +#define LIBCXX_STDIO_H + +#include <__config> + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdlib.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdlib.h new file mode 100644 index 00000000000..5053e0581b0 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stdlib.h @@ -0,0 +1,6 @@ +#ifndef LIBCXX_STDLIB_H +#define LIBCXX_STDLIB_H + +#include_next "stdlib.h" + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/math.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/math.h new file mode 100644 index 00000000000..380ab41ca0a --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/math.h @@ -0,0 +1 @@ +int abs(int); diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap new file mode 100644 index 00000000000..b0ebe4b732e --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap @@ -0,0 +1,9 @@ +module libc [no_undeclared_includes] { + module math { header "math.h" export * } + module stdlib { header "stdlib.h" export * } + module stdatomic { header "stdatomic.h" export * } + module stddef { header "stddef.h" export * } + module stdint { header "stdint.h" export * } + module stdio { header "stdio.h" export * } + module util { header "util.h" export * } +} diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h new file mode 100644 index 00000000000..c211f99261e --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h @@ -0,0 +1,2 @@ +// stddef.h +#include_next "stddef.h" diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdint.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdint.h new file mode 100644 index 00000000000..8d6c6fe237d --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdint.h @@ -0,0 +1,22 @@ +typedef char int_least8_t; +typedef short int_least16_t; +typedef int int_least32_t; +typedef long long int int_least64_t; +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned int uint_least32_t; +typedef unsigned long long uint_least64_t; + +typedef char int_fast8_t; +typedef short int_fast16_t; +typedef int int_fast32_t; +typedef long long int int_fast64_t; +typedef unsigned char uint_fast8_t; +typedef unsigned short uint_fast16_t; +typedef unsigned int uint_fast32_t; +typedef unsigned long long uint_fast64_t; + +typedef int * intptr_t; +typedef unsigned int * uintptr_t; +typedef int intmax_t; +typedef unsigned int uintmax_t; diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdio.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdio.h new file mode 100644 index 00000000000..0b7bdeba9e1 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdio.h @@ -0,0 +1,4 @@ +#ifndef DARWIN_STDIO_H +#define DARWIN_STDIO_H + +#endif diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdlib.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdlib.h new file mode 100644 index 00000000000..a84546e5bc8 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stdlib.h @@ -0,0 +1 @@ +#include <math.h> diff --git a/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/util.h b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/util.h new file mode 100644 index 00000000000..22e95fcf9b6 --- /dev/null +++ b/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/util.h @@ -0,0 +1,6 @@ +#ifndef DARWIN_UTIL_H +#define DARWIN_UTIL_H + +#include <stdio.h> + +#endif diff --git a/clang/test/Modules/libc-libcxx.cpp b/clang/test/Modules/libc-libcxx.cpp new file mode 100644 index 00000000000..1f6a86b7782 --- /dev/null +++ b/clang/test/Modules/libc-libcxx.cpp @@ -0,0 +1,10 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -x c++ -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/libc-libcxx/include/c++ -I %S/Inputs/libc-libcxx/include %s -verify +// RUN: rm -rf %t +// RUN: %clang_cc1 -x c++ -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodules-local-submodule-visibility -nostdinc++ -isystem %S/Inputs/libc-libcxx/sysroot/usr/include/c++/v1 -isystem %S/Inputs/libc-libcxx/sysroot/usr/include -fsyntax-only %s -verify +// expected-no-diagnostics + +#include "math.h" + +int n = abs(0); +float f = abs<float>(0.f); |