summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix some clang analysis tests passing arguments incorrectlyReid Kleckner2019-03-071-3/+3
| | | | llvm-svn: 355625
* [analyzer] handle modification of vars inside an expr with comma operatorPetar Jovanovic2019-03-071-0/+131
| | | | | | | | | | | | | | | | | We should track mutation of a variable within a comma operator expression. Current code in ExprMutationAnalyzer does not handle it. This will handle cases like: (a, b) ++ < == b is modified (a, b) = c < == b is modifed Patch by Djordje Todorovic. Differential Revision: https://reviews.llvm.org/D58894 llvm-svn: 355605
* [clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchersJonas Toth2019-01-211-0/+19
| | | | | | | | | | | | | | | | | Summary: This patch adds two unit-tests that are the result of reducing a crashing TU when running ExprMutAnalyzer over it. They are added only to ensure the regression that has been fixed with https://reviews.llvm.org/D56444 don't creep back. Reviewers: aaron.ballman, sammccall, rsmith, george.karpenkov Reviewed By: sammccall Subscribers: baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D56917 llvm-svn: 351743
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix use-after-free bug in Tooling.Alexander Kornienko2019-01-081-1/+4
| | | | | | | | | | | | | | | | | | | Summary: `buildASTFromCodeWithArgs()` was creating a memory buffer referencing a stack-allocated string. This diff changes the implementation to copy the code string into the memory buffer so that said buffer owns the memory. Patch by Yitzhak Mandelbaum. Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits, EricWF Differential Revision: https://reviews.llvm.org/D55765 llvm-svn: 350638
* [NFC] Declare instead of define non-void functions in unit tests.Shuai Wang2018-09-191-6/+6
| | | | llvm-svn: 342586
* [analyzer] Fix nullptr access when processing instantiated function in ↵Shuai Wang2018-09-191-0/+30
| | | | | | ExprMutationAnalyzer. llvm-svn: 342562
* [NFC] Fix uncompilable test cases of ExprMutationAnalyzer.Shuai Wang2018-09-191-311/+265
| | | | | | And ensure future test cases doesn't have compile errors. llvm-svn: 342525
* [analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.Shuai Wang2018-09-171-23/+115
| | | | | | | | | | | | | | | Summary: This is a follow up of D52008 and should make the analyzer being able to handle perfect forwardings in real world cases where forwardings are done through multiple layers of function calls with `std::forward`. Fixes PR38891. Reviewers: lebedev.ri, JonasToth, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D52120 llvm-svn: 342409
* [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.Shuai Wang2018-09-141-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We used to treat an `Expr` mutated whenever it's passed as non-const reference argument to a function. This results in false positives in cases like this: ``` int x; std::vector<int> v; v.emplace_back(x); // `x` is passed as non-const reference to `emplace_back` ``` In theory the false positives can be suppressed with `v.emplace_back(std::as_const(x))` but that's considered overly verbose, inconsistent with existing code and spammy as diags. This diff handles such cases by following into the function definition and see whether the argument is mutated inside. Reviewers: lebedev.ri, JonasToth, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D52008 llvm-svn: 342271
* [analyzer] Add ExprMutationAnalyzerShuai Wang2018-09-111-0/+943
Summary: This is 1/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis. This diff along simply copies the ExprMutationAnalyzer over with trivial modifications (e.g. include path, namespace) 2/2 will migrate existing usage of ExprMutationAnalyzer and remove the original copy inside clangtidy. Reviewers: george.karpenkov Subscribers: mgorny, xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits, JonasToth Differential Revision: https://reviews.llvm.org/D51948 llvm-svn: 341994
OpenPOWER on IntegriCloud