Issue 172597
Summary [C++20] [Modules] Reduced BMI includes unnecessary internal constants used by inline functions
Labels new issue
Assignees
Reporter TroyKomodo
    ```bash
clang++ -std=c++20 -Brepro --precompile -fmodules-reduced-bmi \
    -Wno-builtin-macro-redefined -D__DATE__="" -D__TIME__="" -D__TIMESTAMP__="" \
 -fmodule-output=module.reduced.pcm \
    -o module.full.pcm module.cppm
```

```c++
export module mymodule;

constexpr int CONSTANT = 1;

namespace mynamespace {
class MyClass {
    int x;
public:
 MyClass(int x) : x(x) {}
    int getX() const { return x + CONSTANT; }
};
}
```

In this example the reduced bmi contains source information so changing the constant (1 -> 2) causes a different reduced bmi forcing recompiling of any dependencies. 

Something else to note is on my machine if i change it back (2 -> 1) the file hash of the module interface is different yet dumping it with `llvm-bcanalyzer --dump` is the same.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to