aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-06-01 04:14:20 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-06-01 04:14:20 +0000
commitb4746036322385bf27d33ec1fc3c82a8bb3d1e58 (patch)
treefdcad055d0264dd3a517a0c686239224d1c2796f /lib/Sema/SemaDecl.cpp
parent7264ab76f2039403bac61f503a99720f516e4d60 (diff)
Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 5a3f6328ca..f5b642191c 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -7016,8 +7016,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
// for the consumer of this Decl to know it doesn't own it.
// For our current ASTs this shouldn't be a problem, but will
// need to be changed with DeclGroups.
- if ((TUK == TUK_Reference && !PrevTagDecl->getFriendObjectKind()) ||
- TUK == TUK_Friend)
+ if ((TUK == TUK_Reference && (!PrevTagDecl->getFriendObjectKind() ||
+ getLangOptions().Microsoft)) || TUK == TUK_Friend)
return PrevTagDecl;
// Diagnose attempts to redefine a tag.
@@ -7259,8 +7259,12 @@ CreateNewDecl:
New->setLexicalDeclContext(CurContext);
// Mark this as a friend decl if applicable.
+ // In Microsoft mode, a friend declaration also acts as a forward
+ // declaration so we always pass true to setObjectOfFriendDecl to make
+ // the tag name visible.
if (TUK == TUK_Friend)
- New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty());
+ New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty() ||
+ getLangOptions().Microsoft);
// Set the access specifier.
if (!Invalid && SearchDC->isRecord())