xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/resolution-change.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc// Build PCH using A from path 1
4*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -emit-pch -o %t-A.pch %s
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc// Use the PCH with the same header search options; should be fine
7*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc// Different -W options are ok
10*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror -Wauto-import
11*0a6a1f1dSLionel Sambuc
12*0a6a1f1dSLionel Sambuc// Use the PCH with no way to resolve DependsOnA
13*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NODOA %s
14*0a6a1f1dSLionel Sambuc// CHECK-NODOA: module 'DependsOnA' in AST file '{{.*DependsOnA.*pcm}}' (imported by AST file '{{.*A.pch}}') is not defined in any loaded module map
15*0a6a1f1dSLionel Sambuc
16*0a6a1f1dSLionel Sambuc// Use the PCH with no way to resolve A
17*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NOA %s
18*0a6a1f1dSLionel Sambuc// CHECK-NOA: module 'A' in AST file '{{.*A.*pcm}}' (imported by AST file '{{.*DependsOnA.*pcm}}') is not defined in any loaded module map
19*0a6a1f1dSLionel Sambuc
20*0a6a1f1dSLionel Sambuc// Use the PCH and have it resolve to the other A
21*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-WRONGA %s
22*0a6a1f1dSLionel Sambuc// CHECK-WRONGA: module 'A' was built in directory '{{.*Inputs.modules-with-same-name.path1.A}}' but now resides in directory '{{.*Inputs.modules-with-same-name.path2.A}}'
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc#ifndef HEADER
25*0a6a1f1dSLionel Sambuc#define HEADER
26*0a6a1f1dSLionel Sambuc@import DependsOnA;
27*0a6a1f1dSLionel Sambuc#endif
28