Author: Sindhu Chittireddy Date: 2023-07-12T11:04:38-07:00 New Revision: e9877eca408e3c266ca7ba8f05f6a907087e9e82
URL: https://github.com/llvm/llvm-project/commit/e9877eca408e3c266ca7ba8f05f6a907087e9e82 DIFF: https://github.com/llvm/llvm-project/commit/e9877eca408e3c266ca7ba8f05f6a907087e9e82.diff LOG: [NFC] Initialize class member pointers to nullptr. Fix clang-format issues in surrounding code. Differential revision: https://reviews.llvm.org/D153892 Added: Modified: clang/lib/ARCMigrate/TransProperties.cpp clang/lib/AST/ExprConstant.cpp clang/lib/Frontend/ASTConsumers.cpp clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp Removed: ################################################################################ diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp index e5ccf1cf79b13a..6d1d950821a07c 100644 --- a/clang/lib/ARCMigrate/TransProperties.cpp +++ b/clang/lib/ARCMigrate/TransProperties.cpp @@ -45,7 +45,7 @@ namespace { class PropertiesRewriter { MigrationContext &MigrateCtx; MigrationPass &Pass; - ObjCImplementationDecl *CurImplD; + ObjCImplementationDecl *CurImplD = nullptr; enum PropActionKind { PropAction_None, diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 2da4eb772589f9..f0185d016d7163 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -583,7 +583,7 @@ namespace { /// LambdaCaptureFields - Mapping from captured variables/this to /// corresponding data members in the closure class. llvm::DenseMap<const ValueDecl *, FieldDecl *> LambdaCaptureFields; - FieldDecl *LambdaThisCaptureField; + FieldDecl *LambdaThisCaptureField = nullptr; CallStackFrame(EvalInfo &Info, SourceLocation CallLoc, const FunctionDecl *Callee, const LValue *This, diff --git a/clang/lib/Frontend/ASTConsumers.cpp b/clang/lib/Frontend/ASTConsumers.cpp index 96f5926c0d7edb..7b58eaa04df95a 100644 --- a/clang/lib/Frontend/ASTConsumers.cpp +++ b/clang/lib/Frontend/ASTConsumers.cpp @@ -183,21 +183,20 @@ std::unique_ptr<ASTConsumer> clang::CreateASTDeclNodeLister() { /// ASTViewer - AST Visualization namespace { - class ASTViewer : public ASTConsumer { - ASTContext *Context; - public: - void Initialize(ASTContext &Context) override { - this->Context = &Context; - } +class ASTViewer : public ASTConsumer { + ASTContext *Context = nullptr; - bool HandleTopLevelDecl(DeclGroupRef D) override { - for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) - HandleTopLevelSingleDecl(*I); - return true; - } +public: + void Initialize(ASTContext &Context) override { this->Context = &Context; } - void HandleTopLevelSingleDecl(Decl *D); - }; + bool HandleTopLevelDecl(DeclGroupRef D) override { + for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) + HandleTopLevelSingleDecl(*I); + return true; + } + + void HandleTopLevelSingleDecl(Decl *D); +}; } void ASTViewer::HandleTopLevelSingleDecl(Decl *D) { diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp index 80fd2e4d219496..abf9914f2ca4ed 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -29,7 +29,7 @@ namespace { class StackAddrEscapeChecker : public Checker<check::PreCall, check::PreStmt<ReturnStmt>, check::EndFunction> { - mutable IdentifierInfo *dispatch_semaphore_tII; + mutable IdentifierInfo *dispatch_semaphore_tII = nullptr; mutable std::unique_ptr<BuiltinBug> BT_stackleak; mutable std::unique_ptr<BuiltinBug> BT_returnstack; mutable std::unique_ptr<BuiltinBug> BT_capturedstackasync; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits