[cfe-commits] r110603 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseCXXInlineMethods.cpp test/Parser/cxx-default-args.cpp

Douglas Gregor dgregor at apple.com
Mon Aug 9 14:40:42 PDT 2010


On Aug 9, 2010, at 2:08 PM, Argyrios Kyrtzidis wrote:

> Author: akirtzidis
> Date: Mon Aug  9 16:08:13 2010
> New Revision: 110603
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=110603&view=rev
> Log:
> Change warning about incomplete parsing of C++ default arg to error and provide a test case; thanks Doug!
> 
> Modified:
>    cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
>    cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
>    cfe/trunk/test/Parser/cxx-default-args.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=110603&r1=110602&r2=110603&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Aug  9 16:08:13 2010
> @@ -271,8 +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">;
> +def err_default_arg_unparsed : Error<
> +  "unexpected end of default argument expression">;
> 
> // 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=110603&r1=110602&r2=110603&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Aug  9 16:08:13 2010
> @@ -145,12 +145,8 @@
>         else {
>           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);
> -          }
> +          else
> +            Diag(Tok.getLocation(), diag::err_default_arg_unparsed);

Shouldn't we be consuming all of the tokens up to the tok::cxx_defaultarg_end?

	- Doug





More information about the cfe-commits mailing list