<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56899>56899</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[C++20] [Modules] The macro of headers doesn't get processed as expected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:modules
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
According to http://eel.is/c++draft/cpp.import#5 and the example http://eel.is/c++draft/cpp.import#5, we could know that the point of undefinition should be exported too.
For example:
```C++
// foo.h
#define D 45
// bar.h
#define D 45
#undef D
// use.cpp
#include <iostream>
import "foo.h"; // point of definition for `D`
import "bar.h"; // point of undefinition for `D`
int main() {
#ifdef D
std::cout << "Macro Value: " << D << "\n";
#else
std::cout << "Not defined.\n";
#endif
}
```
So the result should be "Not defined.\n". But the current result is "Macro Value: 45".
The reproducing command is:
```
clang++ -std=c++20 -xc++-user-header --precompile foo.h -o foo.pcm
clang++ -std=c++20 -xc++-user-header --precompile bar.h -o bar.pcm
clang++ -std=c++20 -fmodule-file=foo.pcm -fmodule-file=bar.pcm use.cpp
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVE2P0zAQ_TXOxUqUOk3bHHJoG_a2XECIqxtPGoMTB3-w8O8ZO23J0goQYmVtPfbkzZs3Mz5p8b3et602Qo5n6jTtnZtIsSfsCReAyqTFTUvYAZcwvHPBnKZMDpM2aBQl5aOgrgcK3_gwKfgXDMKO9AVoq70S9POoXxCQu4g6aTk6qjvqRwGdHKWTeqS2j66nEDWAAFLQOiN5Q_L9_P9JmyulwGa-2eTzOs5sLqeRKe0QoJ9PKEVWMRzQhq7LJW64i_4nbn7vH08jbdo8RPAWMhRi4S3HVnkBlBRHqa0zwAdSvLk6zIKhH5u5MkaKwxXsJtRCpg41wGybkPQdxsz_McYrse9QbljoPHA5ErYjrKJke1im0i0Sp_hnnQiFKPZYZhcyxBV4PPPWaPqBKx8KFU6ul83Ci5THcSa7iAHKwp8DvNVuFgVE9hhmFLK72dvml2ZZJv1Ox640YL1yizZ8HCajBz-3ceuNAZTr8qG0DzLHvgmfLMO9j7Emo4Vvw4i2ehjCvOFI3fX0bLaKj-e5u2kaFWkuo8dymn677FNsPZP2wAUYmqaTAUSeJE5v7Cya6riZ2uH_oMZeC6hh85eo3YBZK0g7GSa4ufC5O78gvh6mh7VLoF5tyqpclbt1mYi6EFVR8cRJp6Am5eF4jU1K7Lzy8Bzj2GCFOgyxWjgcc4KWCg0Wq7x19AyOYpFasBZfIm7DqwQtvkqJN6oOD6K9vYhn6Xp_ylAZNJT6ev1BufQn_AhNaa2H8GiWm11VJX29ZgVvWbne8Krb8NMub1nBOqhgW5xEmW8SxU84CyEJbKFZ1mI_XPiH4WkSWbOcsXyXF_mu2LIyW7Vl14lVtcm36221YmSdA06zygKbTJtzYupI7OTPFi-VtM7-vOTWyvMIUbmAz73rtamPvefjF_nRV0lMo445_AAAQN07">