Add PR check to suggest alternatives to using undef (#118506)
[llvm-project.git] / clang / test / Modules / submodules-preprocess.cpp
blobc9fad10d5e51041d24d911ab071e3a1e365f7c30
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -Eonly -fmodules-cache-path=%t -I %S/Inputs/submodules %s -verify
3 // FIXME: When we have a syntax for modules in C++, use that.
5 @import std.vector;
7 #ifndef HAVE_VECTOR
8 # error HAVE_VECTOR macro is not available (but should be)
9 #endif
11 #ifdef HAVE_TYPE_TRAITS
12 # error HAVE_TYPE_TRAITS_MAP macro is available (but shouldn't be)
13 #endif
15 #ifdef HAVE_HASH_MAP
16 # error HAVE_HASH_MAP macro is available (but shouldn't be)
17 #endif
19 @import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
21 #ifndef HAVE_VECTOR
22 # error HAVE_VECTOR macro is not available (but should be)
23 #endif
25 #ifndef HAVE_TYPE_TRAITS
26 # error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
27 #endif
29 #ifdef HAVE_HASH_MAP
30 # error HAVE_HASH_MAP macro is available (but shouldn't be)
31 #endif
33 @import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
35 @import std; // import everything in 'std'
37 #ifndef HAVE_VECTOR
38 # error HAVE_VECTOR macro is not available (but should be)
39 #endif
41 #ifndef HAVE_TYPE_TRAITS
42 # error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
43 #endif
45 #ifdef HAVE_HASH_MAP
46 # error HAVE_HASH_MAP macro is available (but shouldn't be)
47 #endif
49 @import std.hash_map;
51 #ifndef HAVE_VECTOR
52 # error HAVE_VECTOR macro is not available (but should be)
53 #endif
55 #ifndef HAVE_TYPE_TRAITS
56 # error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
57 #endif
59 #ifndef HAVE_HASH_MAP
60 # error HAVE_HASH_MAP macro is not available (but should be)
61 #endif