Implement simplify_type traits for redecl_iterator.

Based on Chandler Carruth's feedback on r155869.

llvm-svn: 155929
This commit is contained in:
David Blaikie 2012-05-01 19:49:42 +00:00
parent 6e9a8addcb
commit 2e4ae51fb4
2 changed files with 18 additions and 1 deletions

View File

@ -1632,6 +1632,23 @@ struct cast_convert_val< const ::clang::DeclContext, FromTy*, FromTy*> {
}
};
// simplify_type - Allow clients to treat redecl_iterators just like Decl
// pointers when using casting operators.
template<> struct simplify_type< ::clang::Decl::redecl_iterator> {
typedef ::clang::Decl *SimpleType;
static SimpleType getSimplifiedValue(const ::clang::Decl::redecl_iterator
&Val) {
return Val;
}
};
template<> struct simplify_type<const ::clang::Decl::redecl_iterator> {
typedef ::clang::Decl *SimpleType;
static SimpleType getSimplifiedValue(const ::clang::Decl::redecl_iterator
&Val) {
return Val;
}
};
} // end namespace llvm
#endif

View File

@ -1069,7 +1069,7 @@ static NamedDecl *getVisibleDecl(NamedDecl *D) {
for (Decl::redecl_iterator RD = D->redecls_begin(), RDEnd = D->redecls_end();
RD != RDEnd; ++RD) {
if (NamedDecl *ND = dyn_cast<NamedDecl>(&*RD)) {
if (NamedDecl *ND = dyn_cast<NamedDecl>(RD)) {
if (LookupResult::isVisible(ND))
return ND;
}