xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/modules-with-same-name.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc// A from path 1
4*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path1/A -DDIRECT -DEXPECTED_PATH=1
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc// A from path 2
7*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path2/A -DDIRECT -DEXPECTED_PATH=2
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc// Confirm that we have two pcm files (one for each 'A').
10*0a6a1f1dSLionel Sambuc// RUN: find %t -name "A-*.pcm" | count 2
11*0a6a1f1dSLionel Sambuc
12*0a6a1f1dSLionel Sambuc// DependsOnA, using A from path 1
13*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -DEXPECTED_PATH=1
14*0a6a1f1dSLionel Sambuc
15*0a6a1f1dSLionel Sambuc// Confirm that we have three pcm files (one for each 'A', and one for 'DependsOnA')
16*0a6a1f1dSLionel Sambuc// RUN: find %t -name "*.pcm" | count 3
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel Sambuc// DependsOnA, using A from path 2
19*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -DEXPECTED_PATH=2
20*0a6a1f1dSLionel Sambuc
21*0a6a1f1dSLionel Sambuc// Confirm that we still have three pcm files, since DependsOnA will be rebuilt
22*0a6a1f1dSLionel Sambuc// RUN: find %t -name "*.pcm" | count 3
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc#ifdef DIRECT
25*0a6a1f1dSLionel Sambuc@import A;
26*0a6a1f1dSLionel Sambuc#else
27*0a6a1f1dSLionel Sambuc@import DependsOnA;
28*0a6a1f1dSLionel Sambuc#endif
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel Sambuc#if FROM_PATH != EXPECTED_PATH
31*0a6a1f1dSLionel Sambuc#error "Got the wrong module!"
32*0a6a1f1dSLionel Sambuc#endif
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc// expected-no-diagnostics
35