[clang] e5a62d4 - [StaticAnalyzer] Fix -Wunused-but-set-variable in ExprEngineCXX.cpp (NFC)

Jie Fu via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 15 03:07:11 PST 2024


Author: Jie Fu
Date: 2024-11-15T19:05:31+08:00
New Revision: e5a62d45fb1aa3b97ae47588cdc61d0d28f0c1a7

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

LOG: [StaticAnalyzer] Fix -Wunused-but-set-variable in ExprEngineCXX.cpp (NFC)

/llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:48:24:
error: variable 'ThisRD' set but not used [-Werror,-Wunused-but-set-variable]
  const CXXRecordDecl *ThisRD = nullptr;
                       ^
1 error generated.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 17ee1f7c945edd..f7020da2e6da20 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -45,7 +45,7 @@ void ExprEngine::performTrivialCopy(NodeBuilder &Bldr, ExplodedNode *Pred,
                                     const CallEvent &Call) {
   SVal ThisVal;
   bool AlwaysReturnsLValue;
-  const CXXRecordDecl *ThisRD = nullptr;
+  [[maybe_unused]] const CXXRecordDecl *ThisRD = nullptr;
   if (const CXXConstructorCall *Ctor = dyn_cast<CXXConstructorCall>(&Call)) {
     assert(Ctor->getDecl()->isTrivial());
     assert(Ctor->getDecl()->isCopyOrMoveConstructor());


        


More information about the cfe-commits mailing list