blob: bf95104968a3043364bb84abf3c4eb68c238d893 [file] [log] [blame]
Ben Langmuirbeee15e2014-04-14 18:00:01 +00001// RUN: rm -rf %t
2
3// Build PCH using A from path 1
Richard Smith47972af2015-06-16 00:08:24 +00004// 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
Ben Langmuirbeee15e2014-04-14 18:00:01 +00005
6// Use the PCH with the same header search options; should be fine
Richard Smith47972af2015-06-16 00:08:24 +00007// 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
Ben Langmuirbeee15e2014-04-14 18:00:01 +00008
Ben Langmuirb92de022014-04-29 16:25:26 +00009// Different -W options are ok
Richard Smith47972af2015-06-16 00:08:24 +000010// 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
Ben Langmuirb92de022014-04-29 16:25:26 +000011
Ben Langmuirbeee15e2014-04-14 18:00:01 +000012// Use the PCH with no way to resolve DependsOnA
Richard Smith47972af2015-06-16 00:08:24 +000013// 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
Richard Smithe842a472014-10-22 02:05:46 +000014// CHECK-NODOA: module 'DependsOnA' in AST file '{{.*DependsOnA.*pcm}}' (imported by AST file '{{.*A.pch}}') is not defined in any loaded module map
Ben Langmuirbeee15e2014-04-14 18:00:01 +000015
16// Use the PCH with no way to resolve A
Richard Smith47972af2015-06-16 00:08:24 +000017// 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
Richard Smithe842a472014-10-22 02:05:46 +000018// CHECK-NOA: module 'A' in AST file '{{.*A.*pcm}}' (imported by AST file '{{.*DependsOnA.*pcm}}') is not defined in any loaded module map
Ben Langmuirbeee15e2014-04-14 18:00:01 +000019
Richard Smith223d3f22014-12-06 03:21:08 +000020// Use the PCH and have it resolve to the other A
Richard Smith47972af2015-06-16 00:08:24 +000021// 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
Richard Smith223d3f22014-12-06 03:21:08 +000022// 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}}'
Ben Langmuirbeee15e2014-04-14 18:00:01 +000023
24#ifndef HEADER
25#define HEADER
26@import DependsOnA;
27#endif