xref: /llvm-project/clang/test/Modules/submodules-preprocess.cpp (revision 47972afd102f557553d7c6555240bd80982afdd1)
1cf68c58aSDouglas Gregor // RUN: rm -rf %t
2*47972afdSRichard Smith // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -Eonly -fmodules-cache-path=%t -I %S/Inputs/submodules %s -verify
3da82e703SDouglas Gregor // FIXME: When we have a syntax for modules in C++, use that.
4cf68c58aSDouglas Gregor 
5c50d4924SDouglas Gregor @import std.vector;
6cf68c58aSDouglas Gregor 
77b8e4bc8SDouglas Gregor #ifndef HAVE_VECTOR
87b8e4bc8SDouglas Gregor #  error HAVE_VECTOR macro is not available (but should be)
97b8e4bc8SDouglas Gregor #endif
107b8e4bc8SDouglas Gregor 
117b8e4bc8SDouglas Gregor #ifdef HAVE_TYPE_TRAITS
127b8e4bc8SDouglas Gregor #  error HAVE_TYPE_TRAITS_MAP macro is available (but shouldn't be)
137b8e4bc8SDouglas Gregor #endif
147b8e4bc8SDouglas Gregor 
157b8e4bc8SDouglas Gregor #ifdef HAVE_HASH_MAP
167b8e4bc8SDouglas Gregor #  error HAVE_HASH_MAP macro is available (but shouldn't be)
177b8e4bc8SDouglas Gregor #endif
18cf68c58aSDouglas Gregor 
19c50d4924SDouglas Gregor @import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
20cf68c58aSDouglas Gregor 
217b8e4bc8SDouglas Gregor #ifndef HAVE_VECTOR
227b8e4bc8SDouglas Gregor #  error HAVE_VECTOR macro is not available (but should be)
237b8e4bc8SDouglas Gregor #endif
247b8e4bc8SDouglas Gregor 
257b8e4bc8SDouglas Gregor #ifndef HAVE_TYPE_TRAITS
267b8e4bc8SDouglas Gregor #  error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
277b8e4bc8SDouglas Gregor #endif
287b8e4bc8SDouglas Gregor 
297b8e4bc8SDouglas Gregor #ifdef HAVE_HASH_MAP
307b8e4bc8SDouglas Gregor #  error HAVE_HASH_MAP macro is available (but shouldn't be)
317b8e4bc8SDouglas Gregor #endif
32cf68c58aSDouglas Gregor 
33c50d4924SDouglas Gregor @import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
347b8e4bc8SDouglas Gregor 
35c50d4924SDouglas Gregor @import std; // import everything in 'std'
367b8e4bc8SDouglas Gregor 
377b8e4bc8SDouglas Gregor #ifndef HAVE_VECTOR
387b8e4bc8SDouglas Gregor #  error HAVE_VECTOR macro is not available (but should be)
397b8e4bc8SDouglas Gregor #endif
407b8e4bc8SDouglas Gregor 
417b8e4bc8SDouglas Gregor #ifndef HAVE_TYPE_TRAITS
427b8e4bc8SDouglas Gregor #  error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
437b8e4bc8SDouglas Gregor #endif
447b8e4bc8SDouglas Gregor 
457b8e4bc8SDouglas Gregor #ifdef HAVE_HASH_MAP
467b8e4bc8SDouglas Gregor #  error HAVE_HASH_MAP macro is available (but shouldn't be)
477b8e4bc8SDouglas Gregor #endif
487b8e4bc8SDouglas Gregor 
49c50d4924SDouglas Gregor @import std.hash_map;
507b8e4bc8SDouglas Gregor 
517b8e4bc8SDouglas Gregor #ifndef HAVE_VECTOR
527b8e4bc8SDouglas Gregor #  error HAVE_VECTOR macro is not available (but should be)
537b8e4bc8SDouglas Gregor #endif
547b8e4bc8SDouglas Gregor 
557b8e4bc8SDouglas Gregor #ifndef HAVE_TYPE_TRAITS
567b8e4bc8SDouglas Gregor #  error HAVE_TYPE_TRAITS_MAP macro is not available (but should be)
577b8e4bc8SDouglas Gregor #endif
587b8e4bc8SDouglas Gregor 
597b8e4bc8SDouglas Gregor #ifndef HAVE_HASH_MAP
607b8e4bc8SDouglas Gregor #  error HAVE_HASH_MAP macro is not available (but should be)
617b8e4bc8SDouglas Gregor #endif
62