[PATCH] D69238: Fix clang-tidy readability-redundant-string-init for c++17/c++2a

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 15:57:12 PST 2019


NoQ added a comment.

I suspect that it's not just the source range, but the whole AST for the initializer is different, due to C++17 mandatory copy elision in the equals-initializer syntax. Like, before C++17 it was a temporary constructor, a temporary materialization (ironic!), and a copy constructor, but in C++17 and after it's a single direct constructor which looks exactly like the old temporary constructor (except not being a `CXXTemporaryObjectExpr`). You're most likely talking about //different construct-expressions// in different language modes.

That said, it should probably be possible to change the source range anyway somehow.

Also i don't see any tests for multiple declarations in a single `DeclStmt`, i.e.

  string A = "a", B = "b";

... - which source range do you expect to have if you warn on `B`?


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69238/new/

https://reviews.llvm.org/D69238





More information about the cfe-commits mailing list