[clang-tidy] Optimize misc-confusable-identifiers
authorPiotr Zegar <me@piotrzegar.pl>
Fri, 26 May 2023 16:03:39 +0000 (16:03 +0000)
committerPiotr Zegar <me@piotrzegar.pl>
Fri, 26 May 2023 17:46:13 +0000 (17:46 +0000)
commit2a84c635f2a1dcb4546a5d751a32eac24103c7e6
treec81c2d74938c7a48465d30944941a5e8339c2619
parent437ec156ef697e84d9e9e4c1f190d468dcee4096
[clang-tidy] Optimize misc-confusable-identifiers

Main performance issue in this check were caused by many
calls to getPrimaryContext and constant walk up to declaration
contexts using getParent. Also there were issue with forallBases
that is slow.

Profiled with perf and tested on open-source project Cataclysm-DDA.
Before changes check took 27320 seconds, after changes 3682 seconds.
That's 86.5% reduction. More optimizations are still possible in this
check.

Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D151051
clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp
clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.h