10 Commits

Author SHA1 Message Date
Victor Chernyakin
6a98171138
[clang-tidy] Speed up misc-header-include-cycle (#148757)
Performance optimization of misc-header-include-cycle 
based on clangd test on Sema.cpp. Check were slow due 
calls to SM.translateFile. Cost reduction (+-) from 11% to 3%.
2025-07-23 20:14:29 +02:00
Kazu Hirata
ba007a60d0
[clang-tidy] Remove unused includes (NFC) (#141420)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-05-25 10:55:36 -07:00
Congcong Cai
c5ff983fe4
[clang-tidy] refactor misc-header-include-cycle (#94697)
1. merge valid check
2. use range base loop
2024-06-07 13:32:18 +08:00
Congcong Cai
21f5ee014d
[clang-tidy]fix crashing when self include cycles for misc-header-include-cycle (#94636)
Fixes: #94634
2024-06-07 07:02:45 +08:00
Jan Svoboda
da95d926f6
[clang][lex] Always pass suggested module to InclusionDirective() callback (#81061)
This patch provides more information to the
`PPCallbacks::InclusionDirective()` hook. We now always pass the
suggested module, regardless of whether it was actually imported or not.
The extra `bool ModuleImported` parameter then denotes whether the
header `#include` will be automatically translated into import the the
module.

The main change is in `clang/lib/Lex/PPDirectives.cpp`, where we take
care to not modify `SuggestedModule` after it's been populated by
`LookupHeaderIncludeOrImport()`. We now exclusively use the `SM`
(`ModuleToImport`) variable instead, which has been equivalent to
`SuggestedModule` until now. This allows us to use the original
non-modified `SuggestedModule` for the callback itself.

(This patch turns out to be necessary for
https://github.com/apple/llvm-project/pull/8011).
2024-02-08 10:19:18 -08:00
Piotr Zegar
7f6e0052a9 [clang-tidy] Add misc-header-include-cycle check
Check detects cyclic #include dependencies between user-defined headers.

Reviewed By: njames93

Differential Revision: https://reviews.llvm.org/D144828
2023-06-24 11:00:13 +00:00
Piotr Zegar
071b129b64 Revert "[clang-tidy] Add misc-header-include-cycle check"
This reverts commit f3aa6cc0f5d56752242203c2a9231c1bc230c15e.
2023-06-24 08:41:52 +00:00
Piotr Zegar
f3aa6cc0f5 [clang-tidy] Add misc-header-include-cycle check
Check detects cyclic #include dependencies between user-defined headers.

Reviewed By: njames93

Differential Revision: https://reviews.llvm.org/D144828
2023-06-24 08:06:48 +00:00
Piotr Zegar
26e164fada Revert "[clang-tidy] Add misc-header-include-cycle check"
This reverts commit 9ece8753d5e6f49c31c2d988ef69225c036b25e0.
2023-04-15 13:16:43 +00:00
Piotr Zegar
9ece8753d5 [clang-tidy] Add misc-header-include-cycle check
Check detects cyclic #include dependencies between user-defined headers.

Reviewed By: njames93

Differential Revision: https://reviews.llvm.org/D144828
2023-04-15 12:43:22 +00:00