[clang][modules] BMI output changes more often than it should
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The following two translation units
```c++
export module a;
auto a() -> void {
}
```
and
```c++
export module a;
auto a() -> void {
}
```
produce a different pcm file when compiled with `clang++ -std=c++20 -x c++-module --precompile-reduced-bmi a.cpp -o build/a.pcm` as of commit 4070621c866fb4156f7c7d15039d12a4295f46c2 from last week.
Am I wrong to expect the same pcm output for this change? It's a pure whitespace change (in an unexported function no less). My understanding is that with the reduced BMI, the output changes only when interface-relevant changes are made, which I think of as approximately the following:
* the signature of an exported function
* the body of an exported inline function
* the signature of a public member function of a reachable type
* the body of a public inline member function of a reachable type
* the type layout (data member, any virtual function...) of a reachable type
* the value of exported constants
* whether an entity is exported
and probably a few other things. I don't expect whitespace to change the output of a reduced BMI.
To be honest, I would even be surprised if whitespace changed a non-reduced BMI, but maybe that's needed for some later diagnostic correctness.
Contributor guide
Research direction
Reproduce the issue with clang++ using the two translation units and the --precompile-reduced-bmi command shown in the report, then compare the resulting PCM files. Trace the reduced-BMI module serialization path to determine why an unexported function's whitespace is retained. Done means whitespace-only changes produce identical reduced BMIs while interface-relevant changes still alter them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100