[cfe-commits] r123835 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/cxx-class.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 19 08:41:58 PST 2011
Author: dgregor
Date: Wed Jan 19 10:41:58 2011
New Revision: 123835
URL: http://llvm.org/viewvc/llvm-project?rev=123835&view=rev
Log:
Parse the optional semicolon after a C++ in-class member function
definition, rather than complaining about it. Problem reported by
Marshall Clow.
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx-class.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=123835&r1=123834&r2=123835&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Jan 19 10:41:58 2011
@@ -1489,6 +1489,10 @@
Diag(Tok, diag::err_func_def_no_params);
ConsumeBrace();
SkipUntil(tok::r_brace, true);
+
+ // Consume the optional ';'
+ if (Tok.is(tok::semi))
+ ConsumeToken();
return;
}
@@ -1499,10 +1503,18 @@
// assumes the declarator represents a function, not a typedef.
ConsumeBrace();
SkipUntil(tok::r_brace, true);
+
+ // Consume the optional ';'
+ if (Tok.is(tok::semi))
+ ConsumeToken();
return;
}
ParseCXXInlineMethodDef(AS, DeclaratorInfo, TemplateInfo);
+ // Consume the optional ';'
+ if (Tok.is(tok::semi))
+ ConsumeToken();
+
return;
}
}
Modified: cfe/trunk/test/Parser/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=123835&r1=123834&r2=123835&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-class.cpp (original)
+++ cfe/trunk/test/Parser/cxx-class.cpp Wed Jan 19 10:41:58 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
class C;
class C {
public:
@@ -14,7 +14,11 @@
public:
void m() {
int l = 2;
- }
+ };
+
+ template<typename T> void mt(T) { };
+ ; // expected-warning{{extra ';' inside a class}}
+
virtual int vf() const volatile = 0;
private:
More information about the cfe-commits
mailing list