[cfe-commits] r166645 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/recovery.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Wed Oct 24 17:00:54 PDT 2012
Author: rsmith
Date: Wed Oct 24 19:00:53 2012
New Revision: 166645
URL: http://llvm.org/viewvc/llvm-project?rev=166645&view=rev
Log:
'constexpr' and 'friend' are both declaration specifiers. Teach the parser this, for better error recovery.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/recovery.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=166645&r1=166644&r2=166645&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Oct 24 19:00:53 2012
@@ -3771,6 +3771,9 @@
case tok::kw_virtual:
case tok::kw_explicit:
+ // friend keyword.
+ case tok::kw_friend:
+
// static_assert-declaration
case tok::kw__Static_assert:
@@ -3779,11 +3782,10 @@
// GNU attributes.
case tok::kw___attribute:
- return true;
- // C++0x decltype.
+ // C++11 decltype and constexpr.
case tok::annot_decltype:
- return true;
+ case tok::kw_constexpr:
// C11 _Atomic()
case tok::kw__Atomic:
Modified: cfe/trunk/test/Parser/recovery.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/recovery.cpp?rev=166645&r1=166644&r2=166645&view=diff
==============================================================================
--- cfe/trunk/test/Parser/recovery.cpp (original)
+++ cfe/trunk/test/Parser/recovery.cpp Wed Oct 24 19:00:53 2012
@@ -23,12 +23,15 @@
struct S {
int a, b, c;
S();
+ int x // expected-error {{expected ';'}}
+ friend void f()
};
8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}}
return;
}
int k;
-int l = k;
+int l = k // expected-error {{expected ';'}}
+constexpr int foo();
5int m = { l }, n = m; // expected-error {{unqualified-id}}
More information about the cfe-commits
mailing list