[PATCH] D150744: [NFC][CLANG] Fix uninitialized scalar field issues with Coverity
Soumi Manna via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 16 18:23:25 PDT 2023
Manna created this revision.
Herald added a reviewer: NoQ.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D150744
Files:
clang/include/clang/Analysis/Analyses/Consumed.h
clang/include/clang/Parse/Parser.h
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/ConstantEmitter.h
clang/lib/Serialization/ASTReaderDecl.cpp
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -89,7 +89,7 @@
using RecordData = ASTReader::RecordData;
TypeID DeferredTypeID = 0;
- unsigned AnonymousDeclNumber;
+ unsigned AnonymousDeclNumber = 0;
GlobalDeclID NamedDeclForTagDecl = 0;
IdentifierInfo *TypedefNameForLinkage = nullptr;
Index: clang/lib/CodeGen/ConstantEmitter.h
===================================================================
--- clang/lib/CodeGen/ConstantEmitter.h
+++ clang/lib/CodeGen/ConstantEmitter.h
@@ -42,7 +42,7 @@
/// The AST address space where this (non-abstract) initializer is going.
/// Used for generating appropriate placeholders.
- LangAS DestAddressSpace;
+ LangAS DestAddressSpace = LangAS::Default;
llvm::SmallVector<std::pair<llvm::Constant *, llvm::GlobalVariable*>, 4>
PlaceholderAddresses;
Index: clang/lib/CodeGen/CGOpenMPRuntime.h
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.h
+++ clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -232,7 +232,7 @@
/// as those marked as `omp declare target`.
class DisableAutoDeclareTargetRAII {
CodeGenModule &CGM;
- bool SavedShouldMarkAsGlobal;
+ bool SavedShouldMarkAsGlobal = FALSE;
public:
DisableAutoDeclareTargetRAII(CodeGenModule &CGM);
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -1294,7 +1294,7 @@
class SpeculativeEvaluationRAII {
EvalInfo *Info = nullptr;
Expr::EvalStatus OldStatus;
- unsigned OldSpeculativeEvaluationDepth;
+ unsigned OldSpeculativeEvaluationDepth = 0;
void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
Info = Other.Info;
Index: clang/include/clang/Parse/Parser.h
===================================================================
--- clang/include/clang/Parse/Parser.h
+++ clang/include/clang/Parse/Parser.h
@@ -1188,7 +1188,7 @@
/// RAII object used to modify the scope flags for the current scope.
class ParseScopeFlags {
Scope *CurScope;
- unsigned OldFlags;
+ unsigned OldFlags = 0;
ParseScopeFlags(const ParseScopeFlags &) = delete;
void operator=(const ParseScopeFlags &) = delete;
Index: clang/include/clang/Analysis/Analyses/Consumed.h
===================================================================
--- clang/include/clang/Analysis/Analyses/Consumed.h
+++ clang/include/clang/Analysis/Analyses/Consumed.h
@@ -240,7 +240,7 @@
ConsumedBlockInfo BlockInfo;
std::unique_ptr<ConsumedStateMap> CurrStates;
- ConsumedState ExpectedReturnState;
+ ConsumedState ExpectedReturnState = CS_None;
void determineExpectedReturnState(AnalysisDeclContext &AC,
const FunctionDecl *D);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150744.522872.patch
Type: text/x-patch
Size: 3010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230517/f70d387c/attachment.bin>
More information about the cfe-commits
mailing list