Debian Codegraph @

clang/test/Modules/precompiled-config-mismatch-diagnostics.c

raw
1 // Validate configuration mismatches from precompiled files are reported.
2
3 // RUN: rm -rf %t
4 // RUN: split-file %s %t
5
6 // RUN: %clang_cc1 -I%t/BuildDir -fimplicit-module-maps -fmodules \
7 // RUN: -fmodules-cache-path=%t/cache %t/h1.h -emit-pch -o %t/BuildDir/h1.h.pch
8
9 // Check command line diff that is reported uniquely.
10 // RUN: not %clang_cc1 -I%t/BuildDir -fimplicit-module-maps -fmodules \
11 // RUN: -O3 \
12 // RUN: -fmodules-cache-path=%t/cache -fsyntax-only -include-pch %t/BuildDir/h1.h.pch \
13 // RUN: %t/client.c 2>&1 | FileCheck %s --check-prefixes=OPTMODE,CONFIG
14
15 // Check command line difference that end up in the module hash, but is not
16 // uniquely reported as a mismatch.
17 // RUN: not %clang_cc1 -I%t/BuildDir -fimplicit-module-maps -fmodules \
18 // RUN: -dwarf-ext-refs -fmodule-format=obj \
19 // RUN: -debug-info-kind=standalone -dwarf-version=5 \
20 // RUN: -fmodules-cache-path=%t/cache -fsyntax-only -include-pch %t/BuildDir/h1.h.pch \
21 // RUN: %t/client.c 2>&1 | FileCheck %s --check-prefix=CONFIG
22
23 // Check that module cache path is uniquely reported.
24 // RUN: not %clang_cc1 -I%t/BuildDir -fimplicit-module-maps -fmodules \
25 // RUN: -fmodules-cache-path=%t/wrong/cache -fsyntax-only \
26 // RUN: -include-pch %t/BuildDir/h1.h.pch \
27 // RUN: %t/client.c 2>&1 | FileCheck %s --check-prefix=CACHEPATH
28
29 // OPTMODE: OptimizationLevel differs in precompiled file
30 // CONFIG: h1.h.pch' cannot be loaded due to a configuration mismatch
31 // CACHEPATH: h1.h.pch' was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}'
32
33 //--- BuildDir/A/module.modulemap
34 module A [system] {
35 umbrella "."
36 }
37
38 //--- BuildDir/A/A.h
39 typedef int A_t;
40
41 //--- h1.h
42 #include <A/A.h>
43 #if __OPTIMIZE__
44 A_t foo(void);
45 #endif
46
47 //--- client.c
48 typedef int foo_t;
49