r208299 - Suggest fix-it ':' when '=' used in for-range-declaration

Jordan Rose jordan_rose at apple.com
Thu May 8 09:17:48 PDT 2014


> Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=208299&r1=208298&r2=208299&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Thu May  8 06:28:25 2014
> @@ -204,6 +204,8 @@ def err_expected_semi_after_attribute_li
> def err_expected_semi_after_static_assert : Error<
>   "expected ';' after static_assert">;
> def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
> +def err_single_decl_assign_in_for_range : Error<
> +  "range based for statement requires ':' after range declaration">;
> def warn_missing_selector_name : Warning<
>   "%0 used as the name of the previous parameter rather than as part "
>   "of the selector">,

Wordsmithing suggestion: "range-based 'for' statement uses ':' , not '='".

The part I'm sure about is the hyphenation. Putting quotes around "for" is less important, but still seems like a good idea since "for" is a normal English word. The "after range declaration" isn't so great, though, because what's being declared is the element variable, not the range, and normally the "= <init>" is considered part of the declaration.

Jordan



More information about the cfe-commits mailing list