[PATCH] D72448: [clang-tidy] readability-redundant-string-init now flags redundant initialisation in Field Decls and Constructor Initialisers

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 9 06:27:51 PST 2020


njames93 created this revision.
njames93 added reviewers: aaron.ballman, alexfh, hokein.
njames93 added projects: clang, clang-tools-extra.
Herald added a subscriber: xazax.hun.
njames93 marked an inline comment as done.
njames93 added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp:244
+  // CHECK-MESSAGES: [[@LINE-1]]:11: warning: redundant string initialization
+  // CHECK-FIXES:  Foo()  {}
+
----------------
I'm aware the extra space between the Foo() and the braces is unsightly, but its something that clang-format would fix. Same goes for all other lines


The original behaviour of this check only looked at VarDecls with strings that had an empty string initializer. This has been improved to check for FieldDecls with an in class initializer as well as constructor initializers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72448

Files:
  clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72448.237055.patch
Type: text/x-patch
Size: 7587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200109/cacbcaf3/attachment.bin>


More information about the cfe-commits mailing list