[cfe-commits] r110568 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseCXXInlineMethods.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Aug 9 03:54:26 PDT 2010
Author: akirtzidis
Date: Mon Aug 9 05:54:26 2010
New Revision: 110568
URL: http://llvm.org/viewvc/llvm-project?rev=110568&view=rev
Log:
Replace a parser assertion with a warning, suggestion by Doug.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=110568&r1=110567&r2=110568&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Aug 9 05:54:26 2010
@@ -271,6 +271,8 @@
"expected a class name after '~' to name a destructor">;
def err_destructor_template_id : Error<
"destructor name %0 does not refer to a template">;
+def warn_default_arg_unparsed : Warning<
+ "parsing of default argument is incomplete">;
// C++ derived classes
def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=110568&r1=110567&r2=110568&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Aug 9 05:54:26 2010
@@ -143,9 +143,14 @@
if (DefArgResult.isInvalid())
Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param);
else {
- assert(Tok.is(tok::cxx_defaultarg_end) &&
- "We didn't parse the whole default arg!");
- ConsumeToken(); // Consume tok::cxx_defaultarg_end.
+ if (Tok.is(tok::cxx_defaultarg_end))
+ ConsumeToken();
+ else {
+ // Warn that there are tokens from the default arg that we left
+ // unparsed. This actually indicates a bug in clang but we avoid
+ // asserting because we want the parser robust.
+ Diag(Tok.getLocation(), diag::warn_default_arg_unparsed);
+ }
Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
move(DefArgResult));
}
More information about the cfe-commits
mailing list