From d9cc152d851f682344a4db8070d9542f1913731c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 2 Jun 2017 17:30:24 +0000 Subject: [PATCH] [Modules] Fix use after scope. Found by asan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304568 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Serialization/ASTWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index f9e908e790..044a26433a 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -1989,6 +1989,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) { // have resolved them before we get here, but not necessarily: we might be // compiling a preprocessed module, where there is no requirement for the // original files to exist any more. + const HeaderFileInfo Empty; // So we can take a reference. if (WritingModule) { llvm::SmallVector Worklist(1, WritingModule); while (!Worklist.empty()) { @@ -2027,7 +2028,7 @@ void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS) { FilenameDup, *U.Size, IncludeTimestamps ? *U.ModTime : 0 }; HeaderFileInfoTrait::data_type Data = { - {}, {}, {M, ModuleMap::headerKindToRole(U.Kind)} + Empty, {}, {M, ModuleMap::headerKindToRole(U.Kind)} }; // FIXME: Deal with cases where there are multiple unresolved header // directives in different submodules for the same header. -- 2.40.0