diff options
author | John McCall <rjmccall@apple.com> | 2009-08-06 02:15:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-08-06 02:15:43 +0000 |
commit | 67d1a67f3db2f1aa69083c5c94164d6e0ee05b32 (patch) | |
tree | 7a033d2138cdd888dc7e6c88b60bd6ae8b43f8bf /lib/Sema/SemaLookup.cpp | |
parent | 32d96b08dbfb6fbe88d74a9a85aad200ceae656a (diff) |
First pass at friend semantics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 788111c5dd..43494cf4aa 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -1677,6 +1677,26 @@ ObjCCategoryImplDecl *Sema::LookupObjCCategoryImpl(IdentifierInfo *II) { return cast_or_null<ObjCCategoryImplDecl>(D); } +// Attempts to find a declaration in the given declaration context +// with exactly the given type. Returns null if no such declaration +// was found. +Decl *Sema::LookupQualifiedNameWithType(DeclContext *DC, + DeclarationName Name, + QualType T) { + LookupResult result = + LookupQualifiedName(DC, Name, LookupOrdinaryName, true); + + CanQualType CQT = Context.getCanonicalType(T); + + for (LookupResult::iterator ir = result.begin(), ie = result.end(); + ir != ie; ++ir) + if (FunctionDecl *CurFD = dyn_cast<FunctionDecl>(*ir)) + if (Context.getCanonicalType(CurFD->getType()) == CQT) + return CurFD; + + return NULL; +} + void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, QualType T1, QualType T2, FunctionSet &Functions) { |