[cfe-commits] r148072 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/DeclSpec.h include/clang/Sema/Sema.h lib/Parse/ParseDecl.cpp lib/Parse/ParseDeclCXX.cpp lib/Parse/Parser.cpp lib/Sema/AnalysisBasedWarnings.cpp l

Matt Beaumont-Gay matthewbg at google.com
Thu Jan 12 16:13:28 PST 2012


On Thu, Jan 12, 2012 at 15:53, Richard Smith <richard-llvm at metafoo.co.uk> wrote:
> Author: rsmith
> Date: Thu Jan 12 17:53:29 2012
> New Revision: 148072
>
> URL: http://llvm.org/viewvc/llvm-project?rev=148072&view=rev
> Log:
> Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:
>
>  - If the declarator is at the start of a line, and the previous line contained
>   another declarator and ended with a comma, then that comma was probably a
>   typo for a semicolon:
>
>   int n = 0, m = 1, l = 2, // k = 5;
>   myImportantFunctionCall(); // oops!
>
>  - If removing the parentheses would correctly initialize the object, then
>   produce a note suggesting that fix.
>
>  - Otherwise, if there is a simple initializer we can suggest which performs
>   value-initialization, then provide a note suggesting a correction to that
>   initializer.

These are great, but we should probably also have a note which
suggests a way to just silence the warning, in the (however unlikely)
case that the user did in fact want to declare a function.

-Matt




More information about the cfe-commits mailing list