summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/DependentDiagnostic.h
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-01-11 01:43:06 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-01-11 01:43:06 +0000
commit04957ceb0bd158b25aa536d293e798928a9fa846 (patch)
treefb09f4817773ba5ac3214cf9c5d689f621c4b08e /include/clang/AST/DependentDiagnostic.h
parent0c50e1a203c66774d91742b69654576bb65defd6 (diff)
Don't rely on the default constructor default constructing a begin and
end iterator for iterator_range<>. I removed this constructor because for some iterators (notably pointers) it left begin and end uninitialized. It also is an usual constraint that an iterator default constructs to a valid end iterator such that the pair of them for a valid range. In the three places where this was used in Clang, explicitly build the empty range from the iterators and comment on why default constructed iterators make sense here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225594 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/DependentDiagnostic.h')
-rw-r--r--include/clang/AST/DependentDiagnostic.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/clang/AST/DependentDiagnostic.h b/include/clang/AST/DependentDiagnostic.h
index 63066797b3..8e038c83c9 100644
--- a/include/clang/AST/DependentDiagnostic.h
+++ b/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());
}