llvm-project
49093c4a - [clang-tidy] Fix performance-trivially-destructible with C++20 modules (#178471)

Commit
6 days ago
[clang-tidy] Fix performance-trivially-destructible with C++20 modules (#178471) When a class definition is seen through both a header include and a C++20 module import, destructors may appear multiple times in the AST's redeclaration chain. The original matcher used `isFirstDecl()` which fails in this scenario because the same declaration can appear as both first and non-first depending on the view. Replace `unless(isFirstDecl())` with `isOutOfLine()` which correctly identifies out-of-line definitions by checking whether the lexical context differs from the semantic context. Also update clang-tools-extra's lit.cfg.py to call `use_clang()` instead of `clang_setup()` to make the `%clang` substitution available for tests. Fixes #178102 Co-authored-by: Chuanqi Xu <yedeng.yd@linux.alibaba.com>
Author
Parents
Loading