diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-24 07:46:06 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-24 07:46:06 +0000 |
| commit | 816d75b7012ac9fabbe134579ba1a1dba80a5f4f (patch) | |
| tree | a939a4e8c44adcbb7753c84df1396ccce0fe2509 /clang/lib/Sema/SemaAccess.cpp | |
| parent | d6bc5e6bbc57707a0f6dd9a6af6a42a5e25cc92e (diff) | |
| download | bcm5719-llvm-816d75b7012ac9fabbe134579ba1a1dba80a5f4f.tar.gz bcm5719-llvm-816d75b7012ac9fabbe134579ba1a1dba80a5f4f.zip | |
Support friend function specializations.
llvm-svn: 99389
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaAccess.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index e74c8f60c38..5b1a9d880a9 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -53,10 +53,11 @@ bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl, namespace { struct EffectiveContext { - EffectiveContext() : Function(0), Dependent(false) {} + EffectiveContext() : Inner(0), Function(0), Dependent(false) {} - explicit EffectiveContext(DeclContext *DC) { - Dependent = DC->isDependentContext(); + explicit EffectiveContext(DeclContext *DC) + : Inner(DC), + Dependent(DC->isDependentContext()) { if (isa<FunctionDecl>(DC)) { Function = cast<FunctionDecl>(DC)->getCanonicalDecl(); @@ -86,14 +87,15 @@ struct EffectiveContext { != Records.end(); } - DeclContext *getPrimaryContext() const { - assert((Function || !Records.empty()) && "context has no primary context"); - if (Function) return Function; - return Records[0]; + /// Retrieves the innermost "useful" context. Can be null if we're + /// doing access-control without privileges. + DeclContext *getInnerContext() const { + return Inner; } typedef llvm::SmallVectorImpl<CXXRecordDecl*>::const_iterator record_iterator; + DeclContext *Inner; llvm::SmallVector<CXXRecordDecl*, 4> Records; FunctionDecl *Function; bool Dependent; @@ -636,7 +638,7 @@ static void DelayAccess(Sema &S, SourceLocation Loc, const Sema::AccessedEntity &Entity) { assert(EC.isDependent() && "delaying non-dependent access"); - DeclContext *DC = EC.getPrimaryContext(); + DeclContext *DC = EC.getInnerContext(); assert(DC->isDependentContext() && "delaying non-dependent access"); DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access, Loc, |

