diff options
Diffstat (limited to 'clang/lib/Sema/Lookup.h')
-rw-r--r-- | clang/lib/Sema/Lookup.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/Lookup.h b/clang/lib/Sema/Lookup.h index 10cc818b8ba..6366a4c8546 100644 --- a/clang/lib/Sema/Lookup.h +++ b/clang/lib/Sema/Lookup.h @@ -280,6 +280,12 @@ public: /// ambiguous and overloaded lookups. NamedDecl *getAsSingleDecl(ASTContext &Context) const; + template <class DeclClass> + DeclClass *getAsSingle() const { + if (getResultKind() != Found) return 0; + return dyn_cast<DeclClass>(getFoundDecl()); + } + /// \brief Fetch the unique decl found by this lookup. Asserts /// that one was found. /// |