[clang-tools-extra] [clang-tidy] Move `ClassifiedToken` to cpp file (PR #196820)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 10 10:42:44 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: David Stone (davidstone)
<details>
<summary>Changes</summary>
`ClassifiedToken` is used in only the implementation of `UseTrailingReturnTypeCheck`. Move it into the unnamed namespace of the cpp file instead of it being in the header.
---
Full diff: https://github.com/llvm/llvm-project/pull/196820.diff
2 Files Affected:
- (modified) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp (+10)
- (modified) clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h (-6)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
index ea43cd6c42222..8bc06afaeb33c 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
@@ -205,6 +205,16 @@ static bool isSpecifier(Token T) {
tok::kw_static, tok::kw_friend, tok::kw_virtual);
}
+namespace {
+
+struct ClassifiedToken {
+ Token T;
+ bool IsQualifier;
+ bool IsSpecifier;
+};
+
+} // namespace
+
static std::optional<ClassifiedToken>
classifyToken(const FunctionDecl &F, Preprocessor &PP, Token Tok) {
ClassifiedToken CT;
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h
index 4aa1adaf30db5..05a8952f03700 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h
+++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.h
@@ -14,12 +14,6 @@
namespace clang::tidy::modernize {
-struct ClassifiedToken {
- Token T;
- bool IsQualifier;
- bool IsSpecifier;
-};
-
/// Rewrites function signatures to use a trailing return type.
///
/// For the user-facing documentation see:
``````````
</details>
https://github.com/llvm/llvm-project/pull/196820
More information about the cfe-commits
mailing list