diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 10 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-left.h | 2 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-right.h | 2 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/namespaces-top.h | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 371aea8088a..cdd8487c555 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -1016,10 +1016,12 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { StoredDeclsMap *Map = NS->buildLookup(); SmallVector<std::pair<DeclarationName, DeclContext::lookup_result>, 16> LookupResults; - LookupResults.reserve(Map->size()); - for (auto &Entry : *Map) - LookupResults.push_back( - std::make_pair(Entry.first, Entry.second.getLookupResult())); + if (Map) { + LookupResults.reserve(Map->size()); + for (auto &Entry : *Map) + LookupResults.push_back( + std::make_pair(Entry.first, Entry.second.getLookupResult())); + } std::sort(LookupResults.begin(), LookupResults.end(), llvm::less_first()); for (auto &NameAndResult : LookupResults) { diff --git a/clang/test/Modules/Inputs/namespaces-left.h b/clang/test/Modules/Inputs/namespaces-left.h index 787fe753fba..5badf62764b 100644 --- a/clang/test/Modules/Inputs/namespaces-left.h +++ b/clang/test/Modules/Inputs/namespaces-left.h @@ -71,3 +71,5 @@ namespace N12 { } Foo *getFoo(); } + +namespace Empty {} diff --git a/clang/test/Modules/Inputs/namespaces-right.h b/clang/test/Modules/Inputs/namespaces-right.h index 77f54ead65a..dd2ac33f910 100644 --- a/clang/test/Modules/Inputs/namespaces-right.h +++ b/clang/test/Modules/Inputs/namespaces-right.h @@ -66,3 +66,5 @@ namespace N12 { } void consumeFoo(Foo*); } + +namespace Empty {} diff --git a/clang/test/Modules/Inputs/namespaces-top.h b/clang/test/Modules/Inputs/namespaces-top.h index 7bf5394f55b..006b53c8fd2 100644 --- a/clang/test/Modules/Inputs/namespaces-top.h +++ b/clang/test/Modules/Inputs/namespaces-top.h @@ -21,3 +21,5 @@ namespace N13 { namespace AddAndReexportBeforeImport { int S; } + +namespace Empty {} |

