[clang] 5942ae8 - [NFC] Initialize class member pointers to nullptr.
Sindhu Chittireddy via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 10 11:40:02 PDT 2023
Author: Sindhu Chittireddy
Date: 2023-07-10T11:38:55-07:00
New Revision: 5942ae8681db20822ac3e0b94cf8089d30647a39
URL: https://github.com/llvm/llvm-project/commit/5942ae8681db20822ac3e0b94cf8089d30647a39
DIFF: https://github.com/llvm/llvm-project/commit/5942ae8681db20822ac3e0b94cf8089d30647a39.diff
LOG: [NFC] Initialize class member pointers to nullptr.
Reviewed here: https://reviews.llvm.org/D153926
Added:
Modified:
clang/include/clang/AST/RawCommentList.h
clang/include/clang/AST/Redeclarable.h
clang/include/clang/CodeGen/CodeGenAction.h
clang/include/clang/Sema/HLSLExternalSemaSource.h
clang/include/clang/Sema/Sema.h
clang/include/clang/Serialization/ModuleFile.h
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Format/SortJavaScriptImports.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/RawCommentList.h b/clang/include/clang/AST/RawCommentList.h
index a293e219e25020..2f44a77d4503d3 100644
--- a/clang/include/clang/AST/RawCommentList.h
+++ b/clang/include/clang/AST/RawCommentList.h
@@ -173,7 +173,7 @@ class RawComment {
SourceRange Range;
mutable StringRef RawText;
- mutable const char *BriefText;
+ mutable const char *BriefText = nullptr;
mutable bool RawTextValid : 1; ///< True if RawText is valid
mutable bool BriefTextValid : 1; ///< True if BriefText is valid
diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h
index 58ec07973920cb..091bb886f2d496 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -240,7 +240,7 @@ class Redeclarable {
class redecl_iterator {
/// Current - The current declaration.
decl_type *Current = nullptr;
- decl_type *Starter;
+ decl_type *Starter = nullptr;
bool PassedFirst = false;
public:
diff --git a/clang/include/clang/CodeGen/CodeGenAction.h b/clang/include/clang/CodeGen/CodeGenAction.h
index 821e80919fc849..7ad2988e589eb2 100644
--- a/clang/include/clang/CodeGen/CodeGenAction.h
+++ b/clang/include/clang/CodeGen/CodeGenAction.h
@@ -83,7 +83,7 @@ class CodeGenAction : public ASTFrontendAction {
CodeGenerator *getCodeGenerator() const;
- BackendConsumer *BEConsumer;
+ BackendConsumer *BEConsumer = nullptr;
};
class EmitAssemblyAction : public CodeGenAction {
diff --git a/clang/include/clang/Sema/HLSLExternalSemaSource.h b/clang/include/clang/Sema/HLSLExternalSemaSource.h
index 8531609bb9e0d6..4b6bc96f72e225 100644
--- a/clang/include/clang/Sema/HLSLExternalSemaSource.h
+++ b/clang/include/clang/Sema/HLSLExternalSemaSource.h
@@ -23,7 +23,7 @@ class Sema;
class HLSLExternalSemaSource : public ExternalSemaSource {
Sema *SemaPtr = nullptr;
NamespaceDecl *HLSLNamespace = nullptr;
- CXXRecordDecl *ResourceDecl;
+ CXXRecordDecl *ResourceDecl = nullptr;
using CompletionFunction = std::function<void(CXXRecordDecl *)>;
llvm::DenseMap<CXXRecordDecl *, CompletionFunction> Completions;
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 6f413d1c9a6fa3..dbc071bf5cd838 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -943,7 +943,7 @@ class Sema final {
class DelayedDiagnostics;
class DelayedDiagnosticsState {
- sema::DelayedDiagnosticPool *SavedPool;
+ sema::DelayedDiagnosticPool *SavedPool = nullptr;
friend class Sema::DelayedDiagnostics;
};
typedef DelayedDiagnosticsState ParsingDeclState;
diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h
index e96f3ce06c2ceb..b632b4e3e7a7ce 100644
--- a/clang/include/clang/Serialization/ModuleFile.h
+++ b/clang/include/clang/Serialization/ModuleFile.h
@@ -196,7 +196,7 @@ class ModuleFile {
/// The memory buffer that stores the data associated with
/// this AST file, owned by the InMemoryModuleCache.
- llvm::MemoryBuffer *Buffer;
+ llvm::MemoryBuffer *Buffer = nullptr;
/// The size of this file, in bits.
uint64_t SizeInBits = 0;
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index e52f44b61a9464..1debbbf57fe6b9 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -318,10 +318,10 @@ class CodeGenFunction : public CodeGenTypeCache {
/// CurFuncDecl - Holds the Decl for the current outermost
/// non-closure context.
- const Decl *CurFuncDecl;
+ const Decl *CurFuncDecl = nullptr;
/// CurCodeDecl - This is the inner-most code context, which includes blocks.
- const Decl *CurCodeDecl;
- const CGFunctionInfo *CurFnInfo;
+ const Decl *CurCodeDecl = nullptr;
+ const CGFunctionInfo *CurFnInfo = nullptr;
QualType FnRetTy;
llvm::Function *CurFn = nullptr;
@@ -748,11 +748,11 @@ class CodeGenFunction : public CodeGenTypeCache {
/// An i1 variable indicating whether or not the @finally is
/// running for an exception.
- llvm::AllocaInst *ForEHVar;
+ llvm::AllocaInst *ForEHVar = nullptr;
/// An i8* variable into which the exception pointer to rethrow
/// has been saved.
- llvm::AllocaInst *SavedExnVar;
+ llvm::AllocaInst *SavedExnVar = nullptr;
public:
void enter(CodeGenFunction &CGF, const Stmt *Finally,
diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp
index e24fe051a26ceb..3ba649d07964ab 100644
--- a/clang/lib/Format/SortJavaScriptImports.cpp
+++ b/clang/lib/Format/SortJavaScriptImports.cpp
@@ -217,8 +217,8 @@ class JavaScriptImportSorter : public TokenAnalyzer {
}
private:
- FormatToken *Current;
- FormatToken *LineEnd;
+ FormatToken *Current = nullptr;
+ FormatToken *LineEnd = nullptr;
FormatToken invalidToken;
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index fe752eaa0f9192..10c92f8d214941 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -476,9 +476,8 @@ namespace {
/// Iterator over the redeclarations of a declaration that have already
/// been merged into the same redeclaration chain.
-template<typename DeclT>
-class MergedRedeclIterator {
- DeclT *Start;
+template <typename DeclT> class MergedRedeclIterator {
+ DeclT *Start = nullptr;
DeclT *Canonical = nullptr;
DeclT *Current = nullptr;
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index bf911e3de65dcd..bd6655cc1e3fa3 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -754,7 +754,7 @@ bool ObjCDeallocChecker::diagnoseMistakenDealloc(SymbolRef DeallocedValue,
ObjCDeallocChecker::ObjCDeallocChecker()
: NSObjectII(nullptr), SenTestCaseII(nullptr), XCTestCaseII(nullptr),
- CIFilterII(nullptr) {
+ Block_releaseII(nullptr), CIFilterII(nullptr) {
MissingReleaseBugType.reset(
new BugType(this, "Missing ivar release (leak)",
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
index 004b0b9d398b91..a226a01ec0a579 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp
@@ -25,7 +25,7 @@ class UncountedLambdaCapturesChecker
private:
BugType Bug{this, "Lambda capture of uncounted variable",
"WebKit coding guidelines"};
- mutable BugReporter *BR;
+ mutable BugReporter *BR = nullptr;
public:
void checkASTDecl(const TranslationUnitDecl *TUD, AnalysisManager &MGR,
More information about the cfe-commits
mailing list