xref: /llvm-project/clang/test/Modules/no-external-identifier-id.cppm (revision fa20184a8f336e4154f2ffeeeb8a538dc9462d9a)
1// Testing that we won't record the identifier ID from external modules.
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-module-interface -o %t/a.pcm
8// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
9// RUN:     -fmodule-file=a=%t/a.pcm
10// RUN: llvm-bcanalyzer --dump --disable-histogram %t/b.pcm | FileCheck %t/b.cppm
11//
12// RUN: %clang_cc1 -std=c++20 %t/a.v1.cppm -emit-module-interface -o %t/a.v1.pcm
13// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.v1.pcm \
14// RUN:     -fmodule-file=a=%t/a.v1.pcm
15// RUN: diff %t/b.pcm %t/b.v1.pcm &> /dev/null
16
17//--- a.cppm
18export module a;
19export inline int a() {
20    int foo = 43;
21    return foo;
22}
23
24//--- b.cppm
25export module b;
26import a;
27export inline int b() {
28    int foo = 43;
29    return foo;
30}
31
32// CHECK: <DECL_VAR {{.*}} op5=4
33
34//--- a.v1.cppm
35// We remove the unused the function and testing if the format of the BMI of B will change.
36export module a;
37
38