[clang] cd3e71f - [NFC][clang][analyzer] Initialize pointer field in StreamOperationEvaluator (#89837)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 08:31:49 PDT 2024


Author: Mike Rice
Date: 2024-04-24T08:31:45-07:00
New Revision: cd3e71fb7a5fed9a7e5ee54a2f956ce33b90b90c

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

LOG: [NFC][clang][analyzer] Initialize pointer field in StreamOperationEvaluator (#89837)

Add an initializer for StreamSym, which is a pointer. The pointers in
this class are set in the Init function, but all should be initialized
in the constructor to avoid confusion and static verifier hits.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index bd495cd0f9710d..a0aa2316a7b45d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -600,7 +600,7 @@ struct StreamOperationEvaluator {
   SValBuilder &SVB;
   const ASTContext &ACtx;
 
-  SymbolRef StreamSym;
+  SymbolRef StreamSym = nullptr;
   const StreamState *SS = nullptr;
   const CallExpr *CE = nullptr;
   StreamErrorState NewES;


        


More information about the cfe-commits mailing list