Clang Project

clang_source_code/test/Modules/Rmodule-import.m
1// RUN: rm -rf %t1 %t2
2
3// Run with -verify, which onliy gets remarks from the main TU.
4//
5// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t1 \
6// RUN:     -fdisable-module-hash -fsyntax-only -I%S/Inputs/Rmodule-import \
7// RUN:     -Rmodule-build -Rmodule-import -verify %s
8
9// Run again, using FileCheck to check remarks from the module builds.
10//
11// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t2 \
12// RUN:     -fdisable-module-hash -fsyntax-only -I%S/Inputs/Rmodule-import \
13// RUN:     -Rmodule-build -Rmodule-import %s 2>&1 |\
14// RUN: FileCheck %s -implicit-check-not "remark:"
15
16#include "A.h" // \
17   expected-remark-re{{building module 'A' as '{{.*[/\\]}}A.pcm'}} \
18   expected-remark{{finished building module 'A'}} \
19   expected-remark-re{{importing module 'A' from '{{.*[/\\]}}A.pcm'}} \
20   expected-remark-re{{importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'}} \
21   expected-remark-re{{importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'}}
22// CHECK: remark: building module 'A'
23// CHECK: remark: building module 'B'
24// CHECK: remark: building module 'C'
25// CHECK: remark: finished building module 'C'
26// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
27// CHECK: remark: finished building module 'B'
28// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
29// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
30// CHECK: remark: finished building module 'A'
31// CHECK: remark: importing module 'A' from '{{.*[/\\]}}A.pcm'
32// CHECK: remark: importing module 'B' into 'A' from '{{.*[/\\]}}B.pcm'
33// CHECK: remark: importing module 'C' into 'B' from '{{.*[/\\]}}C.pcm'
34#include "B.h" // \
35   expected-remark-re{{importing module 'B' from '{{.*[/\\]}}B.pcm'}}
36// CHECK: remark: importing module 'B' from '{{.*[/\\]}}B.pcm'
37#include "C.h" // \
38   expected-remark-re{{importing module 'C' from '{{.*[/\\]}}C.pcm'}}
39// CHECK: remark: importing module 'C' from '{{.*[/\\]}}C.pcm'
40@import D; // \
41   expected-remark-re{{building module 'D' as '{{.*[/\\]}}D.pcm'}} \
42   expected-remark{{finished building module 'D'}} \
43   expected-remark-re{{importing module 'D' from '{{.*[/\\]}}D.pcm'}}
44// CHECK: remark: building module 'D'
45// CHECK: remark: finished building module 'D'
46// CHECK: remark: importing module 'D' from '{{.*[/\\]}}D.pcm'
47