Skip to content

[clang-tidy][NFC] clean readability-use-std-min-max #122288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

HerrCai0907
Copy link
Contributor

  1. add static for internal linkage functions
  2. remove clang prefix for QualType

Copy link
Contributor Author

HerrCai0907 commented Jan 9, 2025

@HerrCai0907 HerrCai0907 marked this pull request as ready for review January 9, 2025 15:05
@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2025

@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clang-tidy

Author: Congcong Cai (HerrCai0907)

Changes
  1. add static for internal linkage functions
  2. remove clang prefix for QualType

Full diff: https://github.com/llvm/llvm-project/pull/122288.diff

1 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp (+10-10)
diff --git a/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp
index 9c5c2f3939c99b..179173502a8d01 100644
--- a/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/UseStdMinMaxCheck.cpp
@@ -59,7 +59,7 @@ static bool maxCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs,
   return false;
 }
 
-QualType getNonTemplateAlias(QualType QT) {
+static QualType getNonTemplateAlias(QualType QT) {
   while (true) {
     // cast to a TypedefType
     if (const TypedefType *TT = dyn_cast<TypedefType>(QT)) {
@@ -92,15 +92,15 @@ static std::string createReplacement(const Expr *CondLhs, const Expr *CondRhs,
   const llvm::StringRef AssignLhsStr = Lexer::getSourceText(
       Source.getExpansionRange(AssignLhs->getSourceRange()), Source, LO);
 
-  clang::QualType GlobalImplicitCastType;
-  clang::QualType LhsType = CondLhs->getType()
-                                .getCanonicalType()
-                                .getNonReferenceType()
-                                .getUnqualifiedType();
-  clang::QualType RhsType = CondRhs->getType()
-                                .getCanonicalType()
-                                .getNonReferenceType()
-                                .getUnqualifiedType();
+  QualType GlobalImplicitCastType;
+  QualType LhsType = CondLhs->getType()
+                         .getCanonicalType()
+                         .getNonReferenceType()
+                         .getUnqualifiedType();
+  QualType RhsType = CondRhs->getType()
+                         .getCanonicalType()
+                         .getNonReferenceType()
+                         .getUnqualifiedType();
   if (LhsType != RhsType) {
     GlobalImplicitCastType = getNonTemplateAlias(BO->getLHS()->getType());
   }

1. add `static` for internal linkage functions
2. remove `clang` prefix for `QualType`
@HerrCai0907 HerrCai0907 force-pushed the users/ccc01-09-_clang-tidy_nfc_clean_readability-use-std-min-max branch from e123790 to 2a09266 Compare January 9, 2025 15:28
Copy link
Contributor Author

HerrCai0907 commented Jan 9, 2025

Merge activity

  • Jan 9, 6:34 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 9, 6:35 PM EST: A user merged this pull request with Graphite.

@HerrCai0907 HerrCai0907 merged commit 504f6ce into main Jan 9, 2025
8 checks passed
@HerrCai0907 HerrCai0907 deleted the users/ccc01-09-_clang-tidy_nfc_clean_readability-use-std-min-max branch January 9, 2025 23:35
BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
1. add `static` for internal linkage functions
2. remove `clang` prefix for `QualType`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants