[clang-tools-extra] df79c40 - [clang-tidy Fix a warning

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 25 10:14:40 PDT 2025


Author: Kazu Hirata
Date: 2025-06-25T10:14:34-07:00
New Revision: df79c40c988a707d8458952df04afe82f77ffb0f

URL: https://github.com/llvm/llvm-project/commit/df79c40c988a707d8458952df04afe82f77ffb0f
DIFF: https://github.com/llvm/llvm-project/commit/df79c40c988a707d8458952df04afe82f77ffb0f.diff

LOG: [clang-tidy Fix a warning

This patch fixes:

  clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp:371:26:
  error: variable 'E' set but not used
  [-Werror,-Wunused-but-set-variable]

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
index e9ef0afc5ed67..88d2f2c388d07 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
@@ -368,7 +368,7 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
     diag(E->getBeginLoc(),
          "suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?")
         << E->getSourceRange();
-  } else if (const auto *E = Result.Nodes.getNodeAs<Stmt>("loop-expr")) {
+  } else if (Result.Nodes.getNodeAs<Stmt>("loop-expr")) {
     auto *SizeofArgTy = Result.Nodes.getNodeAs<Type>("sizeof-arg-type");
     if (const auto member = dyn_cast<MemberPointerType>(SizeofArgTy))
       SizeofArgTy = member->getPointeeType().getTypePtr();


        


More information about the cfe-commits mailing list