aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-03-23 20:39:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-03-23 20:39:06 +0000
commitfd55fc86edc952ef2b6ac61996425d06af9dd2d2 (patch)
treee32a5c71299341e8745cce2db86580ac485bae17 /clang/lib/Sema/SemaAccess.cpp
parent2112b2c07d4ec73ef091f1b64fd6d7eec523e763 (diff)
downloadllvm-fd55fc86edc952ef2b6ac61996425d06af9dd2d2.zip
llvm-fd55fc86edc952ef2b6ac61996425d06af9dd2d2.tar.gz
llvm-fd55fc86edc952ef2b6ac61996425d06af9dd2d2.tar.bz2
Make SemaAccess smarter about determining when a dependent class might
instantiate to match a friend class declaration. It's still pretty dumb, though. llvm-svn: 264189
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 4bca2808..28ecc0e 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -291,9 +291,10 @@ static AccessResult IsDerivedFromInclusive(const CXXRecordDecl *Derived,
SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack
while (true) {
- if (Derived->isDependentContext() && !Derived->hasDefinition())
+ if (Derived->isDependentContext() && !Derived->hasDefinition() &&
+ !Derived->isLambda())
return AR_dependent;
-
+
for (const auto &I : Derived->bases()) {
const CXXRecordDecl *RD;
@@ -410,14 +411,8 @@ static AccessResult MatchesFriend(Sema &S,
return AR_accessible;
if (EC.isDependent()) {
- CanQualType FriendTy
- = S.Context.getCanonicalType(S.Context.getTypeDeclType(Friend));
-
- for (EffectiveContext::record_iterator
- I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
- CanQualType ContextTy
- = S.Context.getCanonicalType(S.Context.getTypeDeclType(*I));
- if (MightInstantiateTo(S, ContextTy, FriendTy))
+ for (const CXXRecordDecl *Context : EC.Records) {
+ if (MightInstantiateTo(Context, Friend))
return AR_dependent;
}
}