================
@@ -179,12 +183,14 @@ void IncludeCleanerCheck::check(const 
MatchFinder::MatchResult &Result) {
       if (getCurrentMainFile().endswith(PHeader))
         continue;
     }
-
-    if (llvm::none_of(
-            IgnoreHeadersRegex,
-            [Resolved = (*I.Resolved).getFileEntry().tryGetRealPathName()](
-                const llvm::Regex &R) { return R.match(Resolved); }))
-      Unused.push_back(&I);
+    auto StdHeader = tooling::stdlib::Header::named(
----------------
VitaNuo wrote:

Ok, thanks, then what about something like (apologies for small mistakes, just 
typing into the comment window):

```
include_cleaner::Header getHeader(include_cleaner::Include I) {
    auto StdHeader = tooling::stdlib::Header::named(I.quote(), 
PP->getLangOpts().CPlusPlus ? tooling::stdlib::Lang::CXX :  
tooling::stdlib::Lang::C);

   if (StdHeader) 
      return include_cleaner::Header(*StdHeader);
   return include_cleaner::Header(I.Resolved);
}

auto Header = getHeader(I);
if (shouldIgnore(Header))
 continue;

```

I'm trying to simplify the flow in the `check` method, as it seems like it's 
getting bogged down in implementation details. WDYT?

https://github.com/llvm/llvm-project/pull/68185
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to