[PATCH] D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3)

2019-02-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In D54399#1391975 , @lebedev.ri wrote: > In D54399#1391935 , @shuaiwang wrote: > > > Hi @rsmith what do you think of just get this in since Eric is not > > responding? Or do you think I s

[PATCH] D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3)

2019-02-09 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. Herald added a project: clang. Hi @rsmith what do you think of just get this in since Eric is not responding? Or do you think I should run certain test to verify? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54399/new/ https://reviews

[PATCH] D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3)

2019-01-23 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. Friendly ping @EricWF Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D54399/new/ https://reviews.llvm.org/D54399 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[PATCH] D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3)

2018-11-23 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D54399#1296317, @dblaikie wrote: > Could you fix the modulemap (might amount to reverting the change Eric made > in r342827? or maybe it's more involved than that) & validate that the > modules build is working with this change (probably un

[PATCH] D54400: Move ExprMutationAnalyzer to Tooling/Analysis (2/3)

2018-11-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: george.karpenkov, rsmith, dblaikie. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, Szelethus, a.sidorin, mgorny. shuaiwang added a dependency: D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3). Reference the new lo

[PATCH] D54399: Move ExprMutationAnalyzer to Tooling/Analysis (1/3)

2018-11-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, Szelethus, a.sidorin, mgorny. Herald added a reviewer: george.karpenkov. This just copies ExprMutationAnalyzer to Tooling/Analysis with minor tweaks around including path & namespaces. 2/3 will change exi

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-10-06 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 168578. shuaiwang marked 5 inline comments as done. shuaiwang added a comment. Resolved review comments. Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/ExprMutationAna

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-25 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 166947. shuaiwang marked 6 inline comments as done. shuaiwang added a comment. Addressed review comments. Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/ExprMutationAn

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-24 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 166710. shuaiwang added a comment. Added test case place holder for cases that should be supported in later patches. Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/Ex

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-22 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/Analysis/ExprMutationAnalyzerTest.cpp:156 EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.mf()")); + + AST = tooling::buildASTFromCode( JonasToth wrote: > shuaiwang wrote: > > JonasToth wrote: >

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-21 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 166595. shuaiwang marked 5 inline comments as done. shuaiwang added a comment. Addresses review comments. Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/ExprMutationAn

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-21 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang marked 10 inline comments as done. shuaiwang added inline comments. Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:86 +// - Pointer to non-const +// - Pointer-like type with `operator*` returning non-const reference +bool isPointeeMutable(const Expr *Exp, const ASTCo

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-20 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/Analysis/ExprMutationAnalyzerTest.cpp:67 +if (const auto *DRE = dyn_cast(E)) { + if (DRE->getNameInfo().getAsString()[0] == 'p') +Finder = PointeeMutationFinder; JonasToth wrote: > shuaiwang

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-19 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang marked 5 inline comments as done. shuaiwang added inline comments. Comment at: unittests/Analysis/ExprMutationAnalyzerTest.cpp:67 +if (const auto *DRE = dyn_cast(E)) { + if (DRE->getNameInfo().getAsString()[0] == 'p') +Finder = PointeeMutationFinder; --

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-18 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 166068. shuaiwang marked 7 inline comments as done. shuaiwang added a comment. [WIP] Addressed some of review comments. Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-18 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D52219#1238423, @JonasToth wrote: > Do you think it would be possible to the analysis for `>const?< int > ***`-cases? (recursively checking through the pointer levels) I think that should be possible, will do after single-layer pointee ana

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-18 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 166065. shuaiwang added a comment. Rebase Repository: rC Clang https://reviews.llvm.org/D52219 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/ExprMutationAnalyzer.cpp unittests/Analysis/ExprMutationAnalyzerTest.cpp In

[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: JonasToth, aaron.ballman. Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun. Herald added a reviewer: george.karpenkov. We handle pointee mutation for native pointers & pointer-like types (lo

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL342409: [analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer. (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC342409: [analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer. (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D52120?vs=165801&id=165813#toc R

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 165801. shuaiwang marked an inline comment as done. shuaiwang added a comment. Added test case with copy-ctor & assignment operator taking value as param. Repository: rC Clang https://reviews.llvm.org/D52120 Files: lib/Analysis/ExprMutationAnalyzer.c

[PATCH] D52157: [ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL342407: [ASTMatchers] Let isArrow also support UnresolvedMemberExpr… (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D52157

[PATCH] D52157: [ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 165799. shuaiwang marked an inline comment as done. shuaiwang added a comment. Addressed review comment. Repository: rC Clang https://reviews.llvm.org/D52157 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittes

[PATCH] D52158: [clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionParmMutationAnalyzer instead.

2018-09-17 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL342403: [clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use… (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.

[PATCH] D52158: [clang-tidy] Remove duplicated logic in UnnecessaryValueParamCheck and use FunctionParmMutationAnalyzer instead.

2018-09-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: alexfh, JonasToth. Herald added subscribers: cfe-commits, Szelethus, a.sidorin, chrib, kristof.beyls, xazax.hun. Herald added a reviewer: george.karpenkov. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52158 Files: c

[PATCH] D52157: [ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-09-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added a reviewer: aaron.ballman. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D52157 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersNarro

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 165684. shuaiwang marked an inline comment as done. shuaiwang added a comment. Added more test cases around std::move Repository: rC Clang https://reviews.llvm.org/D52120 Files: lib/Analysis/ExprMutationAnalyzer.cpp unittests/Analysis/ExprMutationA

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang marked 2 inline comments as done. shuaiwang added inline comments. Comment at: unittests/Analysis/ExprMutationAnalyzerTest.cpp:387 match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); - EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("std::

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. @lebedev.ri could you help test whether this fully resolves PR38891? Thanks! Repository: rC Clang https://reviews.llvm.org/D52120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mai

[PATCH] D52120: [analyzer] Treat std::{move, forward} as casts in ExprMutationAnalyzer.

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: lebedev.ri, JonasToth. Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun. Herald added a reviewer: george.karpenkov. This is a follow up of https://reviews.llvm.org/D52008 and should make the

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL342271: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer. (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D52008#1234828, @JonasToth wrote: > The `std::move` as cast is a follow up patch? Yes I'll send a follow up patch. Comment at: lib/Analysis/ExprMutationAnalyzer.cpp:381 +FunctionParmMutationAnalyzer::findMutation(const P

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 165552. shuaiwang marked 8 inline comments as done. shuaiwang added a comment. Addressed review comments. Repository: rC Clang https://reviews.llvm.org/D52008 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analysis/ExprMutationAn

[PATCH] D51946: [analyzer] Remove PseudoConstantAnalysis

2018-09-14 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL342246: Remove PseudoConstantAnalysis (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D51946 Files: cfe/trunk/include/cl

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-13 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D52008#1232923, @lebedev.ri wrote: > Thanks for working on this! I tried, and it appears to not fix the issue at > hand. > > - ``` struct C1 { C1(const C1* c, int num); }; > > int x = 0; auto y = std::make_unique(nullptr, x); // <- still

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-13 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 165420. shuaiwang marked 10 inline comments as done. shuaiwang added a comment. More test cases addressing review comments Repository: rC Clang https://reviews.llvm.org/D52008 Files: include/clang/Analysis/Analyses/ExprMutationAnalyzer.h lib/Analys

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-13 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. Just some quick comments, I'll take a deeper look into other comments later. This diff along unfortunately won't be able to handle `emplace_back` just yet, the reason (I believe, haven't fully tested) is that `std::forward` is not handled properly and almost all std f

[PATCH] D52008: [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

2018-09-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: lebedev.ri, JonasToth. Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun. Herald added a reviewer: george.karpenkov. We used to treat an `Expr` mutated whenever it's passed as non-const refer

[PATCH] D51950: [clangtidy] Remove old copy of ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE342006: [clangtidy] Remove old copy of ExprMutationAnalyzer (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D51950?vs=164977&id=164991#toc Repository: rCTE

[PATCH] D51950: [clangtidy] Remove old copy of ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: george.karpenkov, JonasToth. Herald added subscribers: cfe-commits, Szelethus, a.sidorin, mgorny. This is 2/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis. ExprMutationAnalyzer is moved to clang/Analysis in https://rev

[PATCH] D51948: [analyzer] Add ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC341994: [analyzer] Add ExprMutationAnalyzer (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D51948?vs=164969&id=164972#toc Repository: rL LLVM https://revie

[PATCH] D51948: [analyzer] Add ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL341994: [analyzer] Add ExprMutationAnalyzer (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D51948 Files: cfe/trunk/incl

[PATCH] D51948: [analyzer] Add ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added a reviewer: george.karpenkov. Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun, mgorny. This is 1/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis. This diff along simply copies the Ex

[PATCH] D51946: Remove PseudoConstantAnalysis

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added subscribers: cfe-commits, mgorny. It's not used anywhere for years. The last usage is removed in https://reviews.llvm.org/rL198476 in 2014. Repository: rC Clang https://reviews.llvm.org/D51946 Files: include/clang/Analysis/Analyses/PseudoConst

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL341986: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 164938. shuaiwang added a comment. More test cases: - Mutating pointers - Const values Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50953 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAnalyzerTes

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50953#1230138, @JonasToth wrote: > In https://reviews.llvm.org/D50953#1230003, @shuaiwang wrote: > > > In https://reviews.llvm.org/D50953#1229287, @JonasToth wrote: > > > > > What happens to pointers in a typedef (in the sense of `*` instead

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 164929. shuaiwang added a comment. more test cases Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50953 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAnalyzerTest.cpp Index: unittests/clang-tidy/Ex

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE341967: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D50883?vs=164810&id=164926#to

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. Yeah let's see what happens in the wild and decide whether we need further actions. In any case I think that deserves a separate diff. Is there other concerns about this diff? In https://reviews.llvm.org/D50883#1230805, @JonasToth wrote: > Your point is valid, that th

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/clang-tidy/ExprMutationAnalyzerTest.cpp:658 + "void f() { UniquePtr x; x->mf(); }"); + Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); + EXPECT_FALSE(isMutated(Results, AST.

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/clang-tidy/ExprMutationAnalyzerTest.cpp:658 + "void f() { UniquePtr x; x->mf(); }"); + Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext()); + EXPECT_FALSE(isMutated(Results, AST.

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 164810. shuaiwang marked an inline comment as done. shuaiwang added a comment. rebase & add test case Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50883 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutat

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50953#1229287, @JonasToth wrote: > What happens to pointers in a typedef (in the sense of `*` instead of `&`)? I checked around and I believe reference type is the only type we're explicitly matching right now. We'll need to handle carefu

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 164806. shuaiwang marked 2 inline comments as done. shuaiwang added a comment. more test cases. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50953 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAna

[PATCH] D51898: Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL341886: Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer" (authored by shuaiwang, committed by

[PATCH] D51898: Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 164773. shuaiwang added a comment. rebase Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51898 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAnalyzerTest.cpp Index: unittests/clang-tidy/ExprMutatio

[PATCH] D51898: Revert "[clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer"

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added subscribers: cfe-commits, Szelethus, a.sidorin, xazax.hun. Herald added a reviewer: george.karpenkov. Tests somehow break on windows (and only on windows) http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13003 http://lab.llvm.org:8011/buil

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50883#1229297, @JonasToth wrote: > > Different from std::vector::operator[] which has two overloads for const > > and non-const access, std::unique_ptr only has one const version of > > `operator->`. > > > > So for SmartPtr x; x->mf();

[PATCH] D51884: [clang-tidy] ExprMutationAnalyzer: construct from references. Fixes PR38888

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang accepted this revision. shuaiwang added a comment. This revision is now accepted and ready to land. LGTM :) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D51884 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http:

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE341848: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D50619?vs=160960&id=164704#toc Rep

[PATCH] D45679: [clang-tidy] Add ExprMutationAnalyzer, that analyzes whether an expression is mutated within a statement.

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. I have a rough idea about how `findPointeeMutation` would look like, I'm pretty sure I can use a lot of your help :) My current plan: - Finish the few existing pending changes - Move the analyzer to `clang/lib/Analysis` (likely remove `PseudoConstantAnalysis` there as

[PATCH] D45679: [clang-tidy] Add ExprMutationAnalyzer, that analyzes whether an expression is mutated within a statement.

2018-09-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D45679#1183116, @george.karpenkov wrote: > @aaron.ballman @alexfh @shuaiwang Would it be possible to move that code into > a matcher, or into a something which could be used from Clang? We would also > like to use similar functionality, but

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-09-09 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. Ping :) Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D50617: [ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-08-23 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC340547: [ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr… (authored by shuaiwang, committed by ). Changed prior to commit: https://reviews.llvm.org/D50617?vs=161830&id=162218#toc

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-21 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50619#1207785, @JonasToth wrote: > @shuaiwang Unfortunatly the analysis does not pass and fails on an assertion > > → ~/opt/llvm/build/bin/clang-tidy > -checks=-*,cppcoreguidelines-const-correctness ItaniumDemangle.cpp -- > clang-tidy:

[PATCH] D50617: [ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-08-21 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 161830. shuaiwang added a comment. Fix issue with implicit access. Repository: rC Clang https://reviews.llvm.org/D50617 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersNarrowingTes

[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

2018-08-19 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: aaron.ballman, alexfh. Herald added subscribers: cfe-commits, Szelethus, a.sidorin, xazax.hun. Herald added a reviewer: george.karpenkov. This handles cases like this: typedef int& IntRef; void mutate(IntRef); void f() { int x;

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-08-17 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50883#1203690, @JonasToth wrote: > I am suprised that this does not automatically follow from the general rules. > At the end, smartpointers cant do anything else then 'normal' classes. > > The `operator+/->` were not handled before? The mu

[PATCH] D50883: [clang-tidy] Handle unique owning smart pointers in ExprMutationAnalyzer

2018-08-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added a reviewer: hokein. Herald added subscribers: cfe-commits, Szelethus, a.sidorin, xazax.hun. Herald added a reviewer: george.karpenkov. For smart pointers like std::unique_ptr which uniquely owns the underlying object, treat the mutation of the point

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-16 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50619#1202135, @JonasToth wrote: > @shuaiwang i tried to apply this and check the clang-tidy part again, but it > does not compile (log attached). > I update clang to master, did you add a matcher or something like this? > > F6950472: erro

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-15 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160960. shuaiwang added a comment. Test case with non-type template Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50619 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAnalyzerTest.cpp Index: unitte

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-15 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/clang-tidy/ExprMutationAnalyzerTest.cpp:309 +TEST(ExprMutationAnalyzerTest, CallUnresolved) { + auto AST = JonasToth wrote: > I think we are missing tests for non-type template paramters (`template > `).

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-15 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160952. shuaiwang marked 3 inline comments as done. shuaiwang added a comment. More test cases Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50619 Files: clang-tidy/utils/ExprMutationAnalyzer.cpp unittests/clang-tidy/ExprMutationAnal

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-15 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: unittests/clang-tidy/ExprMutationAnalyzerTest.cpp:410 + match(withEnclosingCompound(declRefTo("y")), AST->getASTContext()); + EXPECT_THAT(mutatedBy(ResultsY, AST.get()), ElementsAre("y")); +} JonasToth wrote: > O

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-14 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160694. shuaiwang marked 2 inline comments as done. shuaiwang added a comment. Herald added a subscriber: Szelethus. - Fix a few cases overlooked previously - More test cases Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50619 Files: c

[PATCH] D50619: [clang-tidy] Handle unresolved expressions in ExprMutationAnalyzer

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added reviewers: aaron.ballman, JonasToth. Herald added subscribers: cfe-commits, a.sidorin, xazax.hun. Herald added a reviewer: george.karpenkov. - If a function is unresolved, assume it mutates its arguments - Follow unresolved member expressions for ne

[PATCH] D50605: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL339530: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llv

[PATCH] D50617: [ASTMatchers] Let hasObjectExpression also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. shuaiwang added a reviewer: aaron.ballman. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D50617 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersNarro

[PATCH] D50605: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160273. shuaiwang marked 3 inline comments as done. shuaiwang added a comment. arg_const_range -> const_arg_range Repository: rC Clang https://reviews.llvm.org/D50605 Files: docs/LibASTMatchersReference.html include/clang/AST/ExprCXX.h include/cl

[PATCH] D50605: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160265. shuaiwang added a comment. update ast matchers doc Repository: rC Clang https://reviews.llvm.org/D50605 Files: docs/LibASTMatchersReference.html include/clang/AST/ExprCXX.h include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/A

[PATCH] D50605: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang marked an inline comment as done. shuaiwang added inline comments. Comment at: include/clang/AST/ExprCXX.h:3436 using const_arg_iterator = const Expr* const *; + using arg_const_range = llvm::iterator_range; aaron.ballman wrote: > Please name this

[PATCH] D50606: [ASTMatchers] Add matchers unresolvedMemberExpr, cxxDependentScopeMemberExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL339522: [ASTMatchers] Add matchers unresolvedMemberExpr, cxxDependentScopeMemberExpr (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews

[PATCH] D50606: [ASTMatchers] Add matchers unresolvedMemberExpr, cxxDependentScopeMemberExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 160263. shuaiwang marked 2 inline comments as done. shuaiwang added a comment. undo unrelated changes in doc Repository: rC Clang https://reviews.llvm.org/D50606 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h lib

[PATCH] D50606: [ASTMatchers] Add matchers unresolvedMemberExpr, cxxDependentScopeMemberExpr

2018-08-12 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D50606 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h lib/ASTMatchers/ASTMatchersInternal.cpp lib/ASTMatchers/Dynamic/Registry.cpp

[PATCH] D50605: [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr

2018-08-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D50605 Files: include/clang/AST/ExprCXX.h include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersTraversalTest.cpp Index: unittests/ASTMatchers/ASTMa

[PATCH] D45444: [clang-tidy] implement new check for const-correctness

2018-08-11 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D45444#1196271, @JonasToth wrote: > Always the same with the templates ;) So uninstantiated templates should > just be ignored. > > I think it would be better to have it in the ExprMutAnalyzer, because > that part can not decide on const-ne

[PATCH] D50447: [clang-tidy] Omit cases where loop variable is not used in loop body in performance-for-range-copy.

2018-08-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50447#1194967, @JonasToth wrote: > Do you think it is a bad idea? If the variable is not used it is ok to > ignore it in this particular circumstance. Other warnings/check should > deal with such a situation IMHO. > > Am 10.08.2018 um 10:2

[PATCH] D45444: [clang-tidy] implement new check for const-correctness

2018-08-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D45444#1191874, @JonasToth wrote: > > Could you give a concrete example of this? > > vi llvm/lib/Demangle/ItaniumDemangle.cpp +1762 > > /home/jonas/opt/llvm/lib/Demangle/ItaniumDemangle.cpp:1762:7: warning: > variable 'num' of type 'char [Fl

[PATCH] D50447: [clang-tidy] Add a whitelistClasses option in performance-for-range-copy check.

2018-08-08 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D50447#1192393, @JonasToth wrote: > ... just check if the variable is dereferenced in the scope of the loop (any > declRefExpr exists). +1 And I would imagine it's very rare (as in categories not raw number of occurrences) for a loop vari

[PATCH] D45444: [clang-tidy] implement new check for const-correctness

2018-08-07 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. > - there seems to be a false positive with array-to-pointer decay. > ExprMutAnalyzer does think of it, but maybe there is a bug in it. Could you give a concrete example of this? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D45444 _

[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-08-03 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL338903: Use ExprMutationAnalyzer in performance-unnecessary-value-param (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D50

[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-08-03 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 159037. shuaiwang marked 2 inline comments as done. shuaiwang added a comment. Add comments explaining CXXCtorInitializer check Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50102 Files: clang-tidy/performance/UnnecessaryValueParamChec

[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-08-02 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 158856. shuaiwang marked 2 inline comments as done. shuaiwang added a comment. Update comments. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50102 Files: clang-tidy/performance/UnnecessaryValueParamCheck.cpp test/clang-tidy/performa

[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-08-02 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added inline comments. Comment at: clang-tidy/performance/UnnecessaryValueParamCheck.cpp:108 return; + if (const auto *Ctor = dyn_cast(Function)) { +for (const auto *Init : Ctor->inits()) { hokein wrote: > Is this a new fix or a special case

[PATCH] D50102: [clang-tidy] Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-07-31 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang updated this revision to Diff 158408. shuaiwang added a comment. Add test case Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50102 Files: clang-tidy/performance/UnnecessaryValueParamCheck.cpp test/clang-tidy/performance-unnecessary-value-param.cpp Index: test/cl

[PATCH] D50102: Use ExprMutationAnalyzer in performance-unnecessary-value-param

2018-07-31 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang created this revision. Herald added a reviewer: george.karpenkov. Herald added subscribers: cfe-commits, a.sidorin. This yields better recall as ExprMutationAnalyzer is more accurate. One common pattern this check is now able to catch is: void foo(std::vector v) { for (const auto

[PATCH] D45679: [clang-tidy] Add ExprMutationAnalyzer, that analyzes whether an expression is mutated within a statement.

2018-07-31 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang added a comment. In https://reviews.llvm.org/D45679#1183116, @george.karpenkov wrote: > @aaron.ballman @alexfh @shuaiwang Would it be possible to move that code into > a matcher, or into a something which could be used from Clang? We would also > like to use similar functionality, but

[PATCH] D48854: Use ExprMutationAnalyzer in performance-for-range-copy

2018-07-10 Thread Shuai Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. shuaiwang marked an inline comment as done. Closed by commit rL336737: Use ExprMutationAnalyzer in performance-for-range-copy (authored by shuaiwang, committed by ). Herald added a subscriber: llvm-commits. Repository: rL

[PATCH] D48854: Use ExprMutationAnalyzer in performance-for-range-copy

2018-07-10 Thread Shuai Wang via Phabricator via cfe-commits
shuaiwang marked an inline comment as done. shuaiwang added inline comments. Comment at: test/clang-tidy/performance-for-range-copy.cpp:120 +struct Point { + ~Point() {} JonasToth wrote: > I feel that `const` methods should be added as a test as well. const me

  1   2   >