Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: clang-tidy hangs #92662

Open
Dushistov opened this issue May 18, 2024 · 5 comments
Open

regression: clang-tidy hangs #92662

Dushistov opened this issue May 18, 2024 · 5 comments
Labels
clang-tidy hang Compiler hang (infinite loop) performance

Comments

@Dushistov
Copy link

Dushistov commented May 18, 2024

In attached file there is config and c++ file that depend only on standard C++ library.

If I run such command:

/opt/clang/19.0.0/bin/clang-tidy --config-file=path/to/clang-tidy-config --extra-arg-before=--driver-mode=g++ gen_qmlregister.cpp -- /usr/bin/clang++  -std=c++17  -c gen_qmlregister.cpp

it takes hours or two to complete.

19.0.0 build from 20240515 git snapshots.
clang-tidy from 15.0.7 works just fine, maximum several minutes.
17.0.6, 18.1.5, and git hangs (takes hours or two to complete).

test_data.zip

@PiotrZSL
Copy link
Member

"several minutes" is already too much.

@PiotrZSL
Copy link
Member

Can't reproduce:

===-------------------------------------------------------------------------===
                          clang-tidy checks profiling
===-------------------------------------------------------------------------===
  Total Execution Time: 15.0542 seconds (15.2963 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
   5.0411 ( 49.5%)   0.0639 (  1.3%)   5.1050 ( 33.9%)   5.1897 ( 33.9%)  bugprone-unchecked-optional-access
   0.1670 (  1.6%)   1.1836 ( 24.3%)   1.3506 (  9.0%)   1.3801 (  9.0%)  readability-identifier-naming
   0.3177 (  3.1%)   0.0086 (  0.2%)   0.3263 (  2.2%)   0.3423 (  2.2%)  bugprone-reserved-identifier
   0.3306 (  3.2%)   0.0045 (  0.1%)   0.3351 (  2.2%)   0.3387 (  2.2%)  cert-dcl51-cpp
   0.3219 (  3.2%)   0.0049 (  0.1%)   0.3268 (  2.2%)   0.3313 (  2.2%)  cert-dcl37-c
   0.1050 (  1.0%)   0.1038 (  2.1%)   0.2088 (  1.4%)   0.2099 (  1.4%)  misc-unused-using-decls
   0.1035 (  1.0%)   0.1013 (  2.1%)   0.2048 (  1.4%)   0.2067 (  1.4%)  google-upgrade-googletest-case
   0.1001 (  1.0%)   0.0935 (  1.9%)   0.1936 (  1.3%)   0.1953 (  1.3%)  bugprone-stringview-nullptr
   0.0929 (  0.9%)   0.0881 (  1.8%)   0.1809 (  1.2%)   0.1840 (  1.2%)  modernize-type-traits
   0.0980 (  1.0%)   0.0784 (  1.6%)   0.1764 (  1.2%)   0.1764 (  1.2%)  bugprone-use-after-move
   0.0863 (  0.8%)   0.0711 (  1.5%)   0.1574 (  1.0%)   0.1580 (  1.0%)  hicpp-invalid-access-moved
   0.0850 (  0.8%)   0.0720 (  1.5%)   0.1570 (  1.0%)   0.1574 (  1.0%)  bugprone-standalone-empty
   0.0658 (  0.6%)   0.0588 (  1.2%)   0.1246 (  0.8%)   0.1277 (  0.8%)  readability-non-const-parameter
   0.0589 (  0.6%)   0.0604 (  1.2%)   0.1193 (  0.8%)   0.1207 (  0.8%)  modernize-use-transparent-functors
   0.0612 (  0.6%)   0.0464 (  1.0%)   0.1076 (  0.7%)   0.1119 (  0.7%)  cppcoreguidelines-macro-to-enum
   0.0537 (  0.5%)   0.0547 (  1.1%)   0.1084 (  0.7%)   0.1095 (  0.7%)  hicpp-avoid-c-arrays

Takes 15s.
Please check with --enable-check-profile.

@firewave firewave added hang Compiler hang (infinite loop) performance labels May 18, 2024
@Dushistov
Copy link
Author

@PiotrZSL

Can't reproduce:

So, may be environment matters. I use Arch Linux with all updates installed.

Here is --enable-check-profile. It takes 1h24m49s to see results:

===-------------------------------------------------------------------------===
                          clang-tidy checks profiling
===-------------------------------------------------------------------------===
  Total Execution Time: 5076.0126 seconds (5083.8657 wall clock)
  
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
  5066.3928 ( 99.9%)   0.2574 (  9.9%)  5066.6502 ( 99.8%)  5074.4794 ( 99.8%)  bugprone-unchecked-optional-access
   0.1916 (  0.0%)   0.7092 ( 27.3%)   0.9008 (  0.0%)   0.9020 (  0.0%)  readability-identifier-naming
   0.5188 (  0.0%)   0.0066 (  0.3%)   0.5254 (  0.0%)   0.5261 (  0.0%)  bugprone-reserved-identifier
   0.5064 (  0.0%)   0.0033 (  0.1%)   0.5096 (  0.0%)   0.5103 (  0.0%)  cert-dcl51-cpp
   0.5041 (  0.0%)   0.0000 (  0.0%)   0.5041 (  0.0%)   0.5048 (  0.0%)  cert-dcl37-c
   0.1861 (  0.0%)   0.0624 (  2.4%)   0.2485 (  0.0%)   0.2487 (  0.0%)  google-upgrade-googletest-case
   0.1382 (  0.0%)   0.0400 (  1.5%)   0.1783 (  0.0%)   0.1785 (  0.0%)  bugprone-use-after-move
   0.1244 (  0.0%)   0.0430 (  1.7%)   0.1674 (  0.0%)   0.1673 (  0.0%)  misc-unused-using-decls
   0.1295 (  0.0%)   0.0356 (  1.4%)   0.1650 (  0.0%)   0.1650 (  0.0%)  hicpp-invalid-access-moved
   0.1220 (  0.0%)   0.0398 (  1.5%)   0.1619 (  0.0%)   0.1623 (  0.0%)  bugprone-stringview-nullptr
   0.1213 (  0.0%)   0.0334 (  1.3%)   0.1547 (  0.0%)   0.1548 (  0.0%)  bugprone-standalone-empty
   0.0920 (  0.0%)   0.0295 (  1.1%)   0.1215 (  0.0%)   0.1217 (  0.0%)  modernize-type-traits
   0.0956 (  0.0%)   0.0218 (  0.8%)   0.1174 (  0.0%)   0.1176 (  0.0%)  misc-const-correctness
   0.0775 (  0.0%)   0.0250 (  1.0%)   0.1024 (  0.0%)   0.1031 (  0.0%)  cppcoreguidelines-macro-to-enum
   0.0802 (  0.0%)   0.0189 (  0.7%)   0.0991 (  0.0%)   0.0992 (  0.0%)  concurrency-mt-unsafe
   0.0748 (  0.0%)   0.0224 (  0.9%)   0.0972 (  0.0%)   0.0982 (  0.0%)  readability-non-const-parameter
   0.0766 (  0.0%)   0.0196 (  0.8%)   0.0962 (  0.0%)   0.0963 (  0.0%)  readability-container-size-empty
   0.0709 (  0.0%)   0.0252 (  1.0%)   0.0961 (  0.0%)   0.0961 (  0.0%)  modernize-deprecated-ios-base-aliases
   0.0687 (  0.0%)   0.0243 (  0.9%)   0.0930 (  0.0%)   0.0932 (  0.0%)  modernize-use-transparent-functors
   0.0685 (  0.0%)   0.0209 (  0.8%)   0.0893 (  0.0%)   0.0896 (  0.0%)  cert-dcl16-c
   0.0604 (  0.0%)   0.0210 (  0.8%)   0.0814 (  0.0%)   0.0814 (  0.0%)  misc-confusable-identifiers
   0.0610 (  0.0%)   0.0173 (  0.7%)   0.0783 (  0.0%)   0.0785 (  0.0%)  bugprone-unused-return-value
   0.0572 (  0.0%)   0.0201 (  0.8%)   0.0772 (  0.0%)   0.0773 (  0.0%)  modernize-replace-auto-ptr
   0.0559 (  0.0%)   0.0200 (  0.8%)   0.0759 (  0.0%)   0.0763 (  0.0%)  hicpp-avoid-c-arrays
   0.0548 (  0.0%)   0.0205 (  0.8%)   0.0752 (  0.0%)   0.0754 (  0.0%)  cert-dcl58-cpp
   0.0582 (  0.0%)   0.0161 (  0.6%)   0.0743 (  0.0%)   0.0746 (  0.0%)  hicpp-ignored-remove-result
   0.0572 (  0.0%)   0.0159 (  0.6%)   0.0731 (  0.0%)   0.0732 (  0.0%)  cert-err33-c
   0.0564 (  0.0%)   0.0161 (  0.6%)   0.0725 (  0.0%)   0.0726 (  0.0%)  bugprone-suspicious-string-compare
   0.0566 (  0.0%)   0.0159 (  0.6%)   0.0725 (  0.0%)   0.0725 (  0.0%)  hicpp-move-const-arg
   0.0524 (  0.0%)   0.0193 (  0.7%)   0.0718 (  0.0%)   0.0720 (  0.0%)  google-runtime-int
   0.0507 (  0.0%)   0.0184 (  0.7%)   0.0691 (  0.0%)   0.0691 (  0.0%)  cppcoreguidelines-avoid-c-arrays
   0.0498 (  0.0%)   0.0172 (  0.7%)   0.0670 (  0.0%)   0.0669 (  0.0%)  misc-unconventional-assign-operator
   0.0512 (  0.0%)   0.0142 (  0.5%)   0.0654 (  0.0%)   0.0655 (  0.0%)  performance-move-const-arg
...

@PiotrZSL
Copy link
Member

try dump preprocessed file with -E, and attach it.

@Dushistov
Copy link
Author

Here is preprocessed file with clang++ -E:

preprocessed_file.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-tidy hang Compiler hang (infinite loop) performance
Projects
None yet
Development

No branches or pull requests

3 participants