r204691 - Simplify: don't try to complete the list of decls twice when iterating over the
Richard Smith
richard-llvm at metafoo.co.uk
Mon Mar 24 17:27:18 PDT 2014
Author: rsmith
Date: Mon Mar 24 19:27:18 2014
New Revision: 204691
URL: http://llvm.org/viewvc/llvm-project?rev=204691&view=rev
Log:
Simplify: don't try to complete the list of decls twice when iterating over the
lookups for a DeclContext.
Modified:
cfe/trunk/include/clang/AST/DeclLookups.h
Modified: cfe/trunk/include/clang/AST/DeclLookups.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclLookups.h?rev=204691&r1=204690&r2=204691&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclLookups.h (original)
+++ cfe/trunk/include/clang/AST/DeclLookups.h Mon Mar 24 19:27:18 2014
@@ -69,45 +69,39 @@ public:
};
inline DeclContext::lookups_range DeclContext::lookups() const {
- return lookups_range(lookups_begin(), lookups_end());
-}
-
-inline DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
if (Primary->hasExternalVisibleStorage())
getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
if (StoredDeclsMap *Map = Primary->buildLookup())
- return all_lookups_iterator(Map->begin(), Map->end());
- return all_lookups_iterator();
+ return lookups_range(all_lookups_iterator(Map->begin(), Map->end()),
+ all_lookups_iterator(Map->end(), Map->end()));
+ return lookups_range();
+}
+
+inline DeclContext::all_lookups_iterator DeclContext::lookups_begin() const {
+ return lookups().begin();
}
inline DeclContext::all_lookups_iterator DeclContext::lookups_end() const {
- DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
- if (Primary->hasExternalVisibleStorage())
- getParentASTContext().getExternalSource()->completeVisibleDeclsMap(Primary);
- if (StoredDeclsMap *Map = Primary->buildLookup())
- return all_lookups_iterator(Map->end(), Map->end());
- return all_lookups_iterator();
+ return lookups().end();
}
inline DeclContext::lookups_range DeclContext::noload_lookups() const {
- return lookups_range(noload_lookups_begin(), noload_lookups_end());
+ DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
+ 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();
}
inline
DeclContext::all_lookups_iterator DeclContext::noload_lookups_begin() const {
- DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
- if (StoredDeclsMap *Map = Primary->getLookupPtr())
- return all_lookups_iterator(Map->begin(), Map->end());
- return all_lookups_iterator();
+ return noload_lookups().begin();
}
inline
DeclContext::all_lookups_iterator DeclContext::noload_lookups_end() const {
- DeclContext *Primary = const_cast<DeclContext*>(this)->getPrimaryContext();
- if (StoredDeclsMap *Map = Primary->getLookupPtr())
- return all_lookups_iterator(Map->end(), Map->end());
- return all_lookups_iterator();
+ return noload_lookups().end();
}
} // end namespace clang
More information about the cfe-commits
mailing list