summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-08-06 02:15:43 +0000
committerJohn McCall <rjmccall@apple.com>2009-08-06 02:15:43 +0000
commit07e91c04ba33974b00e91c4b468d61d7f0f5a238 (patch)
tree8ba331aae7bcf0dfdf382b4db58b626ca25b1d3e /clang/lib/Sema/SemaLookup.cpp
parent51eeb36c8c62a07af8eea94303cb8a9dd77b14da (diff)
downloadbcm5719-llvm-07e91c04ba33974b00e91c4b468d61d7f0f5a238.tar.gz
bcm5719-llvm-07e91c04ba33974b00e91c4b468d61d7f0f5a238.zip
First pass at friend semantics.
llvm-svn: 78274
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 788111c5dd2..43494cf4aaa 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud