xref: /llvm-project/clang/test/Modules/no-local-decl-in-reduced-bmi.cppm (revision 235d6841601a9dbea293b8e82b0c994f91f42d76)
1// Test that we won't record local declarations by default in reduced BMI.
2
3// RUN: rm -rf %t
4// RUN: split-file %s %t
5// RUN: cd %t
6//
7// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
8// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/a.pcm > %t/a.dump
9// RUN: cat %t/a.dump | FileCheck %t/a.cppm
10//
11// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm
12// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/b.pcm > %t/b.dump
13// RUN: cat %t/b.dump | FileCheck %t/b.cppm
14
15//--- a.cppm
16export module a;
17export int func() {
18    int v = 43;
19    return 43;
20}
21
22// Test that the variable declaration is not recorded completely.
23// CHECK-NOT: <DECL_VAR
24
25//--- b.cppm
26export module b;
27export inline int func() {
28    int v = 43;
29    return v;
30}
31
32// Check that we still records the declaration from inline functions.
33// CHECK: <DECL_VAR
34