[cfe-commits] r71481 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/cxx-friend.cpp
Anders Carlsson
andersca at mac.com
Mon May 11 15:25:04 PDT 2009
Author: andersca
Date: Mon May 11 17:25:03 2009
New Revision: 71481
URL: http://llvm.org/viewvc/llvm-project?rev=71481&view=rev
Log:
For friend class decls, always use TK_Reference so we'll try to look up existing class decls first.
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx-friend.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=71481&r1=71480&r2=71481&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon May 11 17:25:03 2009
@@ -455,7 +455,7 @@
Action::TagKind TK;
if (Tok.is(tok::l_brace) || (getLang().CPlusPlus && Tok.is(tok::colon)))
TK = Action::TK_Definition;
- else if (Tok.is(tok::semi))
+ else if (Tok.is(tok::semi) && !DS.isFriendSpecified())
TK = Action::TK_Declaration;
else
TK = Action::TK_Reference;
Modified: cfe/trunk/test/Parser/cxx-friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-friend.cpp?rev=71481&r1=71480&r2=71481&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-friend.cpp (original)
+++ cfe/trunk/test/Parser/cxx-friend.cpp Mon May 11 17:25:03 2009
@@ -3,3 +3,15 @@
class C {
friend class D;
};
+
+class A {
+public:
+ void f();
+};
+
+class B {
+ // 'A' here should refer to the declaration above.
+ friend class A;
+
+ void f(A *a) { a->f(); }
+};
More information about the cfe-commits
mailing list