From e8cd04624e503ae063e925eb5609281a88716d83 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 12 May 2023 15:20:58 -0700 Subject: [PATCH] [AST] Initialize local counter I assume it's optional and ReadAST does not have to set the counter on success. Without the patch msan complains that we pass uninitialized value into noundef parameters of setCounterValue. Reviewed By: bnbarham, barannikov88 Differential Revision: https://reviews.llvm.org/D150492 --- clang/lib/Frontend/ASTUnit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index b1e7db1..14971da 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -822,7 +822,6 @@ std::unique_ptr ASTUnit::LoadFromASTFile( // Gather Info for preprocessor construction later on. HeaderSearch &HeaderInfo = *AST->HeaderInfo; - unsigned Counter; AST->PP = std::make_shared( AST->PPOpts, AST->getDiagnostics(), *AST->LangOpts, @@ -846,6 +845,7 @@ std::unique_ptr ASTUnit::LoadFromASTFile( /*isysroot=*/"", /*DisableValidationKind=*/disableValid, AllowASTWithCompilerErrors); + unsigned Counter = 0; AST->Reader->setListener(std::make_unique( *AST->PP, AST->Ctx.get(), *AST->HSOpts, *AST->PPOpts, *AST->LangOpts, AST->TargetOpts, AST->Target, Counter)); -- 2.7.4