aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-10-09 22:38:36 +0000
committerDouglas Gregor <dgregor@apple.com>2011-10-09 22:38:36 +0000
commitac57f0b9097e04f70a631549383a2944f74ad844 (patch)
tree65de43b5481fcb0b85e0fdcbfb0011835576410c /lib/Sema/SemaAccess.cpp
parent6c73a2975ba9112787380abd878876336957b3f6 (diff)
The effective context of a friend function is its lexical
context. Fixes PR9103. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAccess.cpp')
-rw-r--r--lib/Sema/SemaAccess.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 14c8ebafe7..d322ebd410 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -103,7 +103,11 @@ struct EffectiveContext {
} else if (isa<FunctionDecl>(DC)) {
FunctionDecl *Function = cast<FunctionDecl>(DC)->getCanonicalDecl();
Functions.push_back(Function);
- DC = Function->getDeclContext();
+
+ if (Function->getFriendObjectKind())
+ DC = Function->getLexicalDeclContext();
+ else
+ DC = Function->getDeclContext();
} else if (DC->isFileContext()) {
break;
} else {