[clang-tools-extra] [clang-tidy][NFC] Devirtualize `GlobList` and don't heap allocate it (PR #164212)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 20 00:33:18 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h clang-tools-extra/clang-tidy/GlobList.h clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp b/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp
index d06d6c590..bcaf38c6a 100644
--- a/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp
+++ b/clang-tools-extra/clang-tidy/NoLintDirectiveHandler.cpp
@@ -80,7 +80,7 @@ public:
   NoLintToken(NoLintType Type, size_t Pos,
               const std::optional<StringRef> &Checks)
       : Type(Type), Pos(Pos), ChecksGlob(Checks.value_or("*"),
-                                  /*KeepNegativeGlobs=*/false) {
+                                         /*KeepNegativeGlobs=*/false) {
     if (Checks)
       this->Checks = trimWhitespace(*Checks);
   }
@@ -155,8 +155,7 @@ namespace {
 // Represents a source range within a pair of NOLINT(BEGIN/END) comments.
 class NoLintBlockToken {
 public:
-  NoLintBlockToken(size_t BeginPos, size_t EndPos,
-                   CachedGlobList ChecksGlob)
+  NoLintBlockToken(size_t BeginPos, size_t EndPos, CachedGlobList ChecksGlob)
       : BeginPos(BeginPos), EndPos(EndPos), ChecksGlob(std::move(ChecksGlob)) {}
 
   // Whether the provided diagnostic is within and is suppressible by this block

``````````

</details>


https://github.com/llvm/llvm-project/pull/164212


More information about the cfe-commits mailing list