<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63939>63939</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang Tidy][C++20 Modules] Clang Tidy too slow and buggy on modules
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aaronmondal
      </td>
    </tr>
</table>

<pre>
    Importing the `std` module seems to evaluate clang-tidy on the entire libcxx on every invocation. That's probably a bug since every file takes 10 years to evaluate, but it's also useful to test module compatibility :smile: 

The following snippet, built with C++23, crashes all warnings below, i.e. to run clang-tidy on code with `import std;` you'll currently have to disable (at least) all of these.

An outlier here is `misc-include-cleaner` which doesn't crash, but also doesn't detect that `std::` symbols come from `import std;`.

```cpp
import std;

auto main() -> int {
  constexpr std::string_view kExplanation =
      "Clang Tidy crashes a lot with modules :D";

  std::cout << std::format("{}, {}!\n{}", "Hello", "world", kExplanation)
 << '\n';
  return 0;
}
```
```
-bugprone-dangling-handle
-bugprone-fold-init-type
-bugprone-implicit-widening-of-multiplication-result
-bugprone-move-forwarding-reference
-bugprone-narrowing-conversions
-bugprone-shared-ptr-array-mismatch
-bugprone-string-integer-assignment
-bugprone-stringview-nullptr
-bugprone-swapped-arguments
-bugprone-unique-ptr-array-mismatch
-bugprone-use-after-move
-cppcoreguidelines-missing-std-forward
-cppcoreguidelines-narrowing-conversions
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-rvalue-reference-param-not-moved
-google-build-explicit-make-pair
-misc-const-correctness
-misc-include-cleaner (doesn't crash, but fails)
-misc-uniqueptr-reset-release
-modernize-make-shared
-modernize-make-unique
-modernize-use-nullptr
-modernize-use-transparent-functors
-performance-avoid-endl
-performance-inefficient-algorithm
-performance-inefficient-string-concatenation
-performance-move-const-arg
-performance-unnecessary-value-param
-portability-std-allocator-const
-readability-redundant-declaration
-readability-redundant-smartptr-get
-readability-redundant-string-cstr
-readability-redundant-string-init
-readability-uppercase-literal-suffix
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVk1z4ywS_jX4QpFSUCzbBx-SeFK7h73NfasNLYkdBNqmseP99VtIdpzYmXnflCoJ9NNfTzcNkJLrAuJWLF_EcreAzH2kLQDFMMRgwS_20Z62_xzGSOxCJ7lHKZoqsRVNJYdos0eZEIckOUo8gM_AKI2H0Cl29iRjmJQwsCOU3u3N-3vZxAPSSbpwiAbYxfAgf_bAQq-SHCnuYe9PEuQ-dzK5YPCMb51HyfALk3ys5AmBvjgW-lXuM0s3GwKfoswJ2-wLijHxJWYThxHY7Z13fJKifk6D8yjqZymqnaie598_e5Rt9D4eS_IpuHFEnp04z_LouJevQr8I_aLrsm8IUo_Fs5dHoOBCl-QefTwWqXvAhxII5XBDkYkWZ3OiqdxEtywk1y-F51PMQq-8lyYTYWB_kj0csJiyLsHeoxR6DSw9QmKhN5P_2BbmEz58zug5yJjZOyTZI6F0qXgcXDLKBeOzRWU8QkAqjo-9M720EVMQesVzeheSJ3avMouMhiX3wJcWqZ_L11QynYZ99KmwjrKlOHyX5pc4RVPNnxnHeecr_BMUMkc5gAtCr0vuStQ_pAssxeqMk9LEkBjfR5IfcSUmF7p_Hxwe5a8f76OHMDWiFPXuolZ-hNavpVbyZ6nVR4Glj-cGmDsqlSbaCa1vopNXjyZmlqJ-FfXrdbONNJS-XxfV1YtY7Qq_l_8exfI1XBZ6kmj9D_Q-XpfHSN6el58TEXpzDuHsU-jVZE6vPmKUkpAzBVldw17tbkrw7VLtczdSDKgshM670KkegvV4K26jt8oFx4pP453UDaN3xrE6OovluKjYqiF7dmV_ykMRpuz5VnOIh2KcjkC26BG2SBjMnYsARNMBViaGA1JyMaRbUOqB0KqRSQERnNTg0gBs-jvg1DbKBcYOSc0jdMBwF98MLO2lQvZ-ZLpDHGEc0SqgLhcLd0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