4 Commits

Author SHA1 Message Date
Piotr Zegar
a199d8fac0 [clang-tidy][NFC] Improve compilation time of IntegralLiteralExpressionMatcher
When using agressive inlining -Xclang -mllvm -Xclang -inline-threshold=500,
this file takes 10-18 min to compile. This is caused by in-direct recursion.
Looks like transforming code to use templates and lambdas instead of
std::function and member function pointer reduces this time to 0.5s.

Fixes: #59658
2023-08-31 19:22:17 +00:00
Carlos Galvez
7d2ea6c422 [clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folder
Fix applied by running:

run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces

Differential Revision: https://reviews.llvm.org/D141770
2023-01-14 18:51:39 +00:00
Richard
b418ef5cb9 [clang-tidy] Reject invalid enum initializers in C files
C requires that enum values fit into an int.  Scan the macro tokens
present in an initializing expression and reject macros that contain
tokens that have suffixes making them larger than int.

C forbids the comma operator in enum initializing expressions, so
optionally reject comma operator.

Differential Revision: https://reviews.llvm.org/D125622

Fixes #55467
2022-06-01 22:25:39 -06:00
Richard
5122738331 [clang-tidy] Support expressions of literals in modernize-macro-to-enum
Add a recursive descent parser to match macro expansion tokens against
fully formed valid expressions of integral literals.  Partial
expressions will not be matched -- they can't be valid initializing
expressions for an enum.

Differential Revision: https://reviews.llvm.org/D124500

Fixes #55055
2022-05-13 18:45:54 -06:00