Skip to content

Commit

Permalink
[CLANG] Fix uninitialized scalar field issues
Browse files Browse the repository at this point in the history
Reviewed By: erichkeane, steakhal, tahonermann, shafik

Differential Revision: https://reviews.llvm.org/D150744
  • Loading branch information
smanna12 committed Jun 22, 2023
1 parent 51717c9 commit 5e12f5a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Analysis/Analyses/Consumed.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace consumed {
ConsumedBlockInfo BlockInfo;
std::unique_ptr<ConsumedStateMap> CurrStates;

ConsumedState ExpectedReturnState;
ConsumedState ExpectedReturnState = CS_None;

void determineExpectedReturnState(AnalysisDeclContext &AC,
const FunctionDecl *D);
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ class Parser : public CodeCompletionHandler {
/// 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;

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ namespace {
class SpeculativeEvaluationRAII {
EvalInfo *Info = nullptr;
Expr::EvalStatus OldStatus;
unsigned OldSpeculativeEvaluationDepth;
unsigned OldSpeculativeEvaluationDepth = 0;

void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
Info = Other.Info;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGOpenMPRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class CGOpenMPRuntime {
/// as those marked as `omp declare target`.
class DisableAutoDeclareTargetRAII {
CodeGenModule &CGM;
bool SavedShouldMarkAsGlobal;
bool SavedShouldMarkAsGlobal = false;

public:
DisableAutoDeclareTargetRAII(CodeGenModule &CGM);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/ConstantEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ConstantEmitter {

/// 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;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace clang {
using RecordData = ASTReader::RecordData;

TypeID DeferredTypeID = 0;
unsigned AnonymousDeclNumber;
unsigned AnonymousDeclNumber = 0;
GlobalDeclID NamedDeclForTagDecl = 0;
IdentifierInfo *TypedefNameForLinkage = nullptr;

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class MoveChecker
bool Found;
};

AggressivenessKind Aggressiveness;
AggressivenessKind Aggressiveness = AK_KnownsAndLocals;

public:
void setAggressiveness(StringRef Str, CheckerManager &Mgr) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class STLAlgorithmModeling : public Checker<eval::Call> {
public:
STLAlgorithmModeling() = default;

bool AggressiveStdFindModeling;
bool AggressiveStdFindModeling = false;

bool evalCall(const CallEvent &Call, CheckerContext &C) const;
}; //
Expand Down

0 comments on commit 5e12f5a

Please sign in to comment.