<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124153>124153</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clangd] `PrerequisiteModulesTests` Generating Unexpected Error when Scanning for Dependencies on macOS
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clangd
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
qiongsiwu
</td>
</tr>
</table>
<pre>
`clangd`'s `PrerequisiteModulesTests` are passing on macOS, but produces unexpected diagnostic errors. This is reproducible using commit `bb6e94a05d15d289e3685c5599f0eb905dc46925`.
For example
```
$ ./tools/clang/tools/extra/clangd/unittests/ClangdTests --gtest_filter="PrerequisiteModulesTests.*"
Note: Google Test filter = PrerequisiteModulesTests.*
[==========] Running 8 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 8 tests from PrerequisiteModulesTests
[ RUN ] PrerequisiteModulesTests.NonModularTest
[ OK ] PrerequisiteModulesTests.NonModularTest (10 ms)
[ RUN ] PrerequisiteModulesTests.ModuleWithoutDepTest
[ OK ] PrerequisiteModulesTests.ModuleWithoutDepTest (2 ms)
[ RUN ] PrerequisiteModulesTests.ModuleWithDepTest
Scanning modules dependencies for foo.h failed: error: invalid argument '-std=c++20' not allowed with 'C'
Scanning modules dependencies for foo.h failed: error: invalid argument '-std=c++20' not allowed with 'C'
Ignored diagnostic. argument unused during compilation: '-c'
Built module N:Part to /var/folders/50/tcq20qrs2wj563qz76hymwlc0000gn/T/clangd/module_files/N-part.cppm2503448646646106135-79-eb-1a-03-e9-78/N-Part.pcm
Scanning modules dependencies for foo.h failed: error: invalid argument '-std=c++20' not allowed with 'C'
Scanning modules dependencies for foo.h failed: error: invalid argument '-std=c++20' not allowed with 'C'
Ignored diagnostic. argument unused during compilation: '-c'
Built module M to /var/folders/50/tcq20qrs2wj563qz76hymwlc0000gn/T/clangd/module_files/M.cppm5130802603315192334-a5-3f-5b-38-18-91/M.pcm
...
```
@ChuanqiXu9 pointed out that the errors should be fixed in `clangd` (https://github.com/llvm/llvm-project/pull/66462#issuecomment-2608685410) instead of updating the tests.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVltv2zYU_jX0y4EE6lCUpQc_OPFcDEPTohdsbwMlHdssaFLhJUn36wdKTpsObYdgGzpBSEyK5-N3-PFcVAj6aIk2TF4xuVupFE_Ob261s8eg79Oqd-PHDWv4YJQ9jqzhDNcBWMNfe_J0m3TQkV66MRkK7yjEwBoOyhNMGdoewVk4q-HVW4bX0KcIk3djGihAsvQw0RBphFGro3Uh6gHIe-dDCe9OOoAO4Gkx0L0hSDPi4M5nHTOHvm-oqxWXYyVHbDsSTSsHKbvuwKnvuByHuulQsoaXwPiW8e3eeaAHdZ4M5YmGX16-ZVhDyXAfnTOB4X72-MmYHqJXj_Mjw32yOsbZZdxfz5PzAUBRHPP07wdtInkmdgzxW6dVMtwyxEzuxkViYgsvnDsagvwZFghgYgffReDbrJ_Yfe-VO3iTrM0n2MLMGw7enaGaBxCSjlQuSMWnJ1u9MK5XZllF9k57Z89kIwSKRZq-avLFBt-8KbMhvHl_A_OTDb_p5Y2z81j5PL6YLs-rX55jCgzbisM5MOyexWAZ_KrjyaW4o-nZPL4GkNngPyLzmcnbQS3ynpeVMNJEdiQ7aApwcB4OzpUnOChtaMxXbQ62_EPbO2X0CMof06wtw3UR4sjEbmB4xfAKc-CDdRGUMe6eRrjX8ZTXXTNcL7H1wwn8fLTOf5FPys-IyaaQvyV_SSKTNipqZ_P-ebthwblK2sSLC3DDxPa18hGiA4b7O-UZ7g_OjORz2EueE8Rwi_zWB7z_IBtx-8e6OX0835uBc86PluH-3dOssQDn5EAZ4aaYlI_lME1nlFzUddvUTVM3FW8qIYt1V1BfVKrgoqCuWLezSWZUTsP5_3DmP5zAvy_6y_9M7Zez0LISvOXYcCEqWXUoRF0oWYhDIftCtEXVFl01r140Lsvyr7WKb1nNr09J2Vv9W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