[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / context-hash.c
blobde3303a9b0b64ea7cc7deea3673eab872eaff70b
1 // This test verifies that only strict hashing includes search paths and
2 // diagnostics in the module context hash.
4 // RUN: rm -rf %t
5 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
6 // RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
7 // RUN: -fbuiltin-headers-in-system-modules -fmodules-cache-path=%t %s \
8 // RUN: -Rmodule-build 2> %t1
9 // RUN: rm -rf %t
10 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
11 // RUN: %S/Inputs/System/usr/include -internal-isystem %S -fmodules \
12 // RUN: -fbuiltin-headers-in-system-modules -fimplicit-module-maps \
13 // RUN: -fmodules-cache-path=%t %s -Rmodule-build 2> %t2
14 // RUN: rm -rf %t
15 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
16 // RUN: %S/Inputs/System/usr/include -internal-isystem %S -fmodules \
17 // RUN: -fbuiltin-headers-in-system-modules -fimplicit-module-maps \
18 // RUN: -fmodules-cache-path=%t %s -fmodules-strict-context-hash \
19 // RUN: -Rmodule-build 2> %t3
20 // RUN: rm -rf %t
21 // RUN: %clang_cc1 -fsyntax-only -Weverything -internal-isystem \
22 // RUN: %S/Inputs/System/usr/include -fmodules -fmodules-strict-context-hash \
23 // RUN: -fbuiltin-headers-in-system-modules -fimplicit-module-maps \
24 // RUN: -fmodules-cache-path=%t %s -Rmodule-build 2> %t4
25 // RUN: echo %t > %t.path
26 // RUN: cat %t.path %t1 %t2 %t3 %t4 | FileCheck %s
28 // This tests things verified by ASTReader::checkLanguageOptions that are not
29 // part of LangOpts.def.
31 // RUN: rm -rf %t
32 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
33 // RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
34 // RUN: -fbuiltin-headers-in-system-modules -fmodules-cache-path=%t \
35 // RUN: -x objective-c %s -Rmodule-build 2> %t1
36 // RUN: rm -rf %t
37 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
38 // RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
39 // RUN: -fbuiltin-headers-in-system-modules -fobjc-runtime=macosx-1.0.0.0 \
40 // RUN: -fmodules-cache-path=%t -x objective-c %s -Rmodule-build 2> %t2
41 // RUN: rm -rf %t
42 // RUN: %clang_cc1 -fsyntax-only -internal-isystem \
43 // RUN: %S/Inputs/System/usr/include -fmodules -fimplicit-module-maps \
44 // RUN: -fbuiltin-headers-in-system-modules -fcomment-block-commands=lp,bj \
45 // RUN: -fmodules-cache-path=%t -x objective-c %s -Rmodule-build 2> %t3
46 // RUN: echo %t > %t.path
47 // RUN: cat %t.path %t1 %t2 %t3 | FileCheck --check-prefix=LANGOPTS %s
49 #include <stdio.h>
51 // CHECK: [[PREFIX:(.*[/\\])+[a-zA-Z0-9.-]+]]
52 // CHECK: building module 'cstd' as '[[PREFIX]]{{[/\\]}}[[CONTEXT_HASH:[A-Z0-9]+]]{{[/\\]}}cstd-[[AST_HASH:[A-Z0-9]+]].pcm'
53 // CHECK: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}cstd-[[AST_HASH]].pcm'
54 // CHECK-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
55 // CHECK: cstd-[[AST_HASH]].pcm'
56 // CHECK-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
57 // CHECK: cstd-[[AST_HASH]].pcm'
59 // LANGOPTS: [[PREFIX:(.*[/\\])+[a-zA-Z0-9.-]+]]
60 // LANGOPTS: building module 'cstd' as '[[PREFIX]]{{[/\\]}}[[CONTEXT_HASH:[A-Z0-9]+]]{{[/\\]}}cstd-[[AST_HASH:[A-Z0-9]+]].pcm'
61 // LANGOPTS-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
62 // LANGOPTS: cstd-[[AST_HASH]].pcm'
63 // LANGOPTS-NOT: building module 'cstd' as '{{.*[/\\]}}[[CONTEXT_HASH]]{{[/\\]}}
64 // LANGOPTS: cstd-[[AST_HASH]].pcm'