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

2019-11-19 Thread Mitchell via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG1315f4e009b0: [clang-tidy] Fix readability-redundant-string-init for c++17/c++2a (authored by mitchell-stellar). Changed prior to commit: https://reviews.llvm.org/D69238?vs=229651=230039#toc

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

2019-11-19 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar reopened this revision. mitchell-stellar added a comment. This revision is now accepted and ready to land. Reopening in order to correct the accidentally swapped commits between this ticket and https://reviews.llvm.org/D70165. Repository: rG LLVM Github Monorepo CHANGES

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

2019-11-16 Thread Mitchell via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG06f3dabe4a2e: [clang-tidy] Fix readability-redundant-string-init for c++17/c++2a (authored by mitchell-stellar). Changed prior to commit: https://reviews.llvm.org/D69238?vs=228556=229651#toc

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

2019-11-11 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment. In D69238#1740914 , @gribozavr2 wrote: > Thanks! Do you have commit access or do you need me to commit for you? I don't have commit access, if you could commit it for me that would be great. Thanks! Repository: rCTE Clang

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

2019-11-11 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision. gribozavr2 added a comment. This revision is now accepted and ready to land. Thanks! Do you have commit access or do you need me to commit for you? Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69238/new/

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

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment. In D69238#1739627 , @NoQ wrote: > Clang's `-ast-dump` > . Wow. That makes this so much easier... Thank you so much! Looking at the AST showed that the

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

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc updated this revision to Diff 228556. poelmanc edited the summary of this revision. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69238/new/ https://reviews.llvm.org/D69238 Files:

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

2019-11-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D69238#1739618 , @poelmanc wrote: > Is there a tool to print the AST? That would show whether the AST already has > some expression with the right SourceRange. Clang's `-ast-dump`

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

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment. In D69238#1739429 , @gribozavr2 wrote: > If it is indeed the extra AST node for the elidable constructor, see if you > can use the `ignoringElidableConstructorCall` AST matcher to ignore it, > therefore smoothing over AST

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

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment. In D69238#1736365 , @NoQ wrote: > 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

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

2019-11-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. If it is indeed the extra AST node for the elidable constructor, see if you can use the `ignoringElidableConstructorCall` AST matcher to ignore it, therefore smoothing over AST differences between language modes. Repository: rCTE Clang Tools Extra CHANGES SINCE

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

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment. Just documenting here that I sent the following email to cfe-...@lists.llvm.org: > When parsing a named declaration with an equals sign with clang -std > c++11/14, clang builds an initializer expression whose SourceRange covers > from the variable name through the end

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

2019-11-06 Thread Artem Dergachev via Phabricator via cfe-commits
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

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

2019-10-31 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:67-70 +// With -std c++14 or earlier (!LangOps.CPlusPlus17), it was sufficient to +// return CtorExpr->getSourceRange(). However, starting with c++17, parsing

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

2019-10-31 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:67-70 +// With -std c++14 or earlier (!LangOps.CPlusPlus17), it was sufficient to +// return CtorExpr->getSourceRange(). However, starting with c++17, parsing +//

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

2019-10-29 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc marked 2 inline comments as done. poelmanc added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:67-70 +// With -std c++14 or earlier (!LangOps.CPlusPlus17), it was sufficient to +// return CtorExpr->getSourceRange().

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

2019-10-29 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:67-70 +// With -std c++14 or earlier (!LangOps.CPlusPlus17), it was sufficient to +// return CtorExpr->getSourceRange(). However, starting with c++17, parsing

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

2019-10-28 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc marked 3 inline comments as done. poelmanc added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:50 varDecl(hasType(hasUnqualifiedDesugaredType(recordType(

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

2019-10-28 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:50 varDecl(hasType(hasUnqualifiedDesugaredType(recordType( hasDeclaration(cxxRecordDecl(hasName("basic_string")),

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

2019-10-28 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc marked 5 inline comments as done. poelmanc added a comment. Thanks for the feedback, the new patch removes the extra `const`, `clang::`, and braces on one-line `if` statements, and now explains the regex in readability-redundant-string-init.cpp. Comment at:

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

2019-10-28 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc updated this revision to Diff 226695. poelmanc added a comment. Remove extra `const`, braces for one-line `if` statements, and `clang::`. Added a comment explaining the need for a regex on a warning test line. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION

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

2019-10-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:75 +// and if found, extend the SourceRange to start at 'Name'. +std::pair +CtorSourceRange(const MatchFinder::MatchResult , You can drop the

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

2019-10-21 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc marked 2 inline comments as done. poelmanc added a comment. Thanks for the quick feedback, fixed. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69238/new/ https://reviews.llvm.org/D69238 ___

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

2019-10-21 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc updated this revision to Diff 225894. poelmanc added a comment. Removed the two uses of auto where the type was not an iterator or clear from the right-hand-side. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D69238/new/

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

2019-10-21 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:78 +const clang::NamedDecl *Decl, const clang::Expr *CtorExpr) { + const auto = *Result.SourceManager; + const StringRef Name =

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

2019-10-21 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc created this revision. poelmanc added reviewers: gribozavr, etienneb, alexfh. Herald added subscribers: cfe-commits, mgehre, dylanmckay. Herald added a project: clang. `readability-redundant-string-init` was one of several clang-tidy checks documented as failing for C++17 by