
See the added test for the motivation example. In that example, we add a new function declaration in `a.cppm` and this is not used in the reduced BMI of `b.cppm`. We expect that the change won't affect the BMI of `b.cppm`. But it is the not the case. There are 2 reason for unexpected result: 1. We would register the interesting identifiers in a pretty late phase. This may cause some some predefined identifier ID change due to we insert other identifiers during emitting decls and types. 2. In `GenerateNameLookup`, we would generate information for predefined decls. This may not be intended. Since every predefined decl doesn't belong to any module. And this patch solves the first issue by registering the identifiers in the very early posititon to make sure the ID won't get affected by the process to emit decls and types. And we solve the second question by filtering predefined decls simply.
29 lines
803 B
C++
29 lines
803 B
C++
// Test that adding a new identifier within reduced BMI may not produce a transitive change.
|
|
//
|
|
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
//
|
|
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/A.cppm -o %t/A.pcm
|
|
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/B.cppm -o %t/B.pcm \
|
|
// RUN: -fmodule-file=A=%t/A.pcm
|
|
//
|
|
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/A.v1.cppm -o %t/A.v1.pcm
|
|
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/B.cppm -o %t/B.v1.pcm \
|
|
// RUN: -fmodule-file=A=%t/A.v1.pcm
|
|
//
|
|
// RUN: diff %t/B.pcm %t/B.v1.pcm &> /dev/null
|
|
|
|
//--- A.cppm
|
|
export module A;
|
|
export int a();
|
|
|
|
//--- A.v1.cppm
|
|
export module A;
|
|
export int a();
|
|
export int a2();
|
|
|
|
//--- B.cppm
|
|
export module B;
|
|
import A;
|
|
export int b() { return a(); }
|