summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-06-02 17:30:24 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-06-02 17:30:24 +0000
commitee021d54d7bba1e5f4481d530d6b5ad977a83b50 (patch)
treef4ba33f19ae629f8b93bd29206ac7859248f594e /clang
parent9277a86f032911ee8dcd155d24b8839efdb08899 (diff)
downloadbcm5719-llvm-ee021d54d7bba1e5f4481d530d6b5ad977a83b50.tar.gz
bcm5719-llvm-ee021d54d7bba1e5f4481d530d6b5ad977a83b50.zip
[Modules] Fix use after scope.
Found by asan. llvm-svn: 304568
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index f9e908e790f..044a26433a9 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/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<Module *, 16> 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.
OpenPOWER on IntegriCloud