1*67e74705SXin Li// RUN: rm -rf %t 2*67e74705SXin Li 3*67e74705SXin Li// Build PCH using A from path 1 4*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -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*67e74705SXin Li 6*67e74705SXin Li// Use the PCH with the same header search options; should be fine 7*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -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*67e74705SXin Li 9*67e74705SXin Li// Different -W options are ok 10*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -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*67e74705SXin Li 12*67e74705SXin Li// Use the PCH with no way to resolve DependsOnA 13*67e74705SXin Li// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NODOA %s 14*67e74705SXin Li// CHECK-NODOA: module 'DependsOnA' in AST file '{{.*DependsOnA.*pcm}}' (imported by AST file '{{.*A.pch}}') is not defined in any loaded module map 15*67e74705SXin Li 16*67e74705SXin Li// Use the PCH with no way to resolve A 17*67e74705SXin Li// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -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*67e74705SXin Li// CHECK-NOA: module 'A' in AST file '{{.*A.*pcm}}' (imported by AST file '{{.*DependsOnA.*pcm}}') is not defined in any loaded module map 19*67e74705SXin Li 20*67e74705SXin Li// Use the PCH and have it resolve to the other A 21*67e74705SXin Li// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -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*67e74705SXin Li// 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*67e74705SXin Li 24*67e74705SXin Li#ifndef HEADER 25*67e74705SXin Li#define HEADER 26*67e74705SXin Li@import DependsOnA; 27*67e74705SXin Li#endif 28