r304568 - [Modules] Fix use after scope.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 2 10:30:24 PDT 2017
Author: d0k
Date: Fri Jun 2 12:30:24 2017
New Revision: 304568
URL: http://llvm.org/viewvc/llvm-project?rev=304568&view=rev
Log:
[Modules] Fix use after scope.
Found by asan.
Modified:
cfe/trunk/lib/Serialization/ASTWriter.cpp
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=304568&r1=304567&r2=304568&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Fri Jun 2 12:30:24 2017
@@ -1989,6 +1989,7 @@ void ASTWriter::WriteHeaderSearch(const
// 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<Module *, 16> Worklist(1, WritingModule);
while (!Worklist.empty()) {
@@ -2027,7 +2028,7 @@ void ASTWriter::WriteHeaderSearch(const
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.
More information about the cfe-commits
mailing list