diff options
-rw-r--r-- | clang/include/clang/AST/DeclLookups.h | 10 | ||||
-rw-r--r-- | clang/include/clang/AST/DependentDiagnostic.h | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/include/clang/AST/DeclLookups.h b/clang/include/clang/AST/DeclLookups.h index d2016af89f1..eba2266724f 100644 --- a/clang/include/clang/AST/DeclLookups.h +++ b/clang/include/clang/AST/DeclLookups.h @@ -75,7 +75,10 @@ inline DeclContext::lookups_range DeclContext::lookups() const { if (StoredDeclsMap *Map = Primary->buildLookup()) return lookups_range(all_lookups_iterator(Map->begin(), Map->end()), all_lookups_iterator(Map->end(), Map->end())); - return lookups_range(); + + // Synthesize an empty range. This requires that two default constructed + // versions of these iterators form a valid empty range. + return lookups_range(all_lookups_iterator(), all_lookups_iterator()); } inline DeclContext::all_lookups_iterator DeclContext::lookups_begin() const { @@ -91,7 +94,10 @@ inline DeclContext::lookups_range DeclContext::noload_lookups() const { if (StoredDeclsMap *Map = Primary->getLookupPtr()) return lookups_range(all_lookups_iterator(Map->begin(), Map->end()), all_lookups_iterator(Map->end(), Map->end())); - return lookups_range(); + + // Synthesize an empty range. This requires that two default constructed + // versions of these iterators form a valid empty range. + return lookups_range(all_lookups_iterator(), all_lookups_iterator()); } inline diff --git a/clang/include/clang/AST/DependentDiagnostic.h b/clang/include/clang/AST/DependentDiagnostic.h index 63066797b3a..8e038c83c98 100644 --- a/clang/include/clang/AST/DependentDiagnostic.h +++ b/clang/include/clang/AST/DependentDiagnostic.h @@ -178,7 +178,8 @@ inline DeclContext::ddiag_range DeclContext::ddiags() const { = static_cast<DependentStoredDeclsMap*>(getPrimaryContext()->getLookupPtr()); if (!Map) - return ddiag_range(); + // Return an empty range using the always-end default constructor. + return ddiag_range(ddiag_iterator(), ddiag_iterator()); return ddiag_range(ddiag_iterator(Map->FirstDiagnostic), ddiag_iterator()); } |