[PATCH] Suggest fix-it ':' when '=' used in for-range-declaration while initializing an auto

Ismail Pazarbasi ismail.pazarbasi at gmail.com
Wed May 7 13:56:46 PDT 2014


Richard,

thank you for feedback. Briefly, changes since last revision:
* Replaced warning with an error. This is going to be the only diagnostics emitted for this case.
* TypeContainsAuto is removed from check; I thought `auto` (strongly) suggests that this is a range-based for, while an `int`, for example, is not that strong.
* Pass `ForRangeInit` down to `ParseDeclarationAfterDeclaratorAndAttributes` to set `ForRangeInit::ColonLoc`; this tells parser to treat a `for` statement as a "range-based for".
* Fix-it uses spelling location for replacement to handle macro expansions

http://reviews.llvm.org/D3370

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Parse/Parser.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseStmt.cpp
  test/Parser/cxx0x-for-range.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3370.9188.patch
Type: text/x-patch
Size: 7251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140507/c1721db4/attachment.bin>


More information about the cfe-commits mailing list