[PATCH] D101790: [clang-tidy] Aliasing: Add support for passing the variable into a function by reference.

2021-05-04 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D101790#2734937 , @NoQ wrote: > +Adam, the original author of bugprone-redundant-branch-condition. Adam, do > you have any thoughts regarding the tests regressed by this patch? Are they > something we should absolu

[PATCH] D89380: [clang-tidy] Fix for cppcoreguidelines-prefer-member-initializer to handle classes declared in macros

2020-11-19 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-prefer-member-initializer.cpp:492 + +#define MACRO1 struct InMacro1 { int i; InMacro1() { i = 0; } }; +// CHECK

[PATCH] D90691: [analyzer] Add new checker for unchecked return value.

2020-11-06 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/UncheckedReturnValueChecker.cpp:41 +BugReporter &BR) const { +auto FoundCall = callExpr().bind("call"); +auto CallInCompound = compoundStmt(forEach(FoundCall));

[PATCH] D89380: [clang-tidy] Fix for cppcoreguidelines-prefer-member-initializer to handle classes declared in macros

2020-10-20 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added a comment. In D89380#2330076 , @alexfh wrote: > Thanks for the fix! However, I'm not sure it's possible to correctly rewrite > code in all cases where macros are involved. See a

[PATCH] D89380: [clang-tidy] Fix for cppcoreguidelines-prefer-member-initializer to handle classes declared in macros

2020-10-20 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 299378. baloghadamsoftware added a comment. Tests added, code reformatted. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D89380/new/ https://reviews.llvm.org/D89380 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInit

[PATCH] D89380: [clang-tidy] Fix for cppcoreguidelines-prefer-member-initializer to handle classes declared in macros

2020-10-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: aaron.ballman, gribozavr2. baloghadamsoftware added a project: clang-tools-extra. Herald added subscribers: martong, gamesh411, Szelethus, dkrupp, rnkovacs, kbarton, xazax.hun, whisperity, nemanjai. Herald added a projec

[PATCH] D88831: [clang-tidy] Remove obsolete checker google-runtime-references

2020-10-06 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd6c9dc3c17e4: [clang-tidy] Remove obsolete checker google-runtime-references (authored by baloghadamsoftware). Changed prior to commit: https://reviews.llvm.org/D88831?vs=296170&id=296416#toc Repositor

[PATCH] D88831: [clang-tidy] Remove obsolete checker google-runtime-references

2020-10-05 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D88831#2311802 , @lebedev.ri wrote: > In D88831#2311800 , @Eugene.Zelenko > wrote: > >> Does this check make sense in content of other style guides? > > I'd +1 to moving it to

[PATCH] D88831: [clang-tidy] Remove obsolete checker google-runtime-references

2020-10-05 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: alexfh, gribozavr2, aaron.ballman. baloghadamsoftware added a project: clang-tools-extra. Herald added subscribers: martong, Charusso, gamesh411, Szelethus, dkrupp, rnkovacs, xazax.hun, whisperity, mgorny. Herald added a

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware requested changes to this revision. baloghadamsoftware added a comment. This revision now requires changes to proceed. In D86743#2303922 , @NoQ wrote: > One slightly redeeming thing about this crash is that it's assertion-only. > When b

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. @vabridgers Please try to apply D69726 and check whether it solves this crash! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86743/new/ https://reviews.llvm.org/D86743

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D86743#2303910 , @NoQ wrote: >> The last comment for that bug is D69726 , >> but the bug is not closed to it seems to me that D69726 >> does not sol

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-29 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Yes, @NoQ is right. If the constraint manager cannot reason about a value, then then `ProgramState::assume()` will return the same state with the new assumption in the constraints. Whenever `ProgramState::assume()` returns `nullptr` it means that the assumpti

[PATCH] D87519: [analyzer][Liveness][NFC] Enqueue the CFGBlocks post-order

2020-09-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/Analysis/LiveVariables.cpp:522 - // FIXME: we should enqueue using post order. - for (const CFGBlock *B : cfg->nodes()) { + for (const CFGBlock *B : *AC.getAnalysis()) { worklist.enqueueBlock(B); --

[PATCH] D77229: [Analyzer][NFC] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Now I completely know what the source of our misunderstanding is. You thought that this patch will **fix** an issue, namely that we store iterator positions for both the iterator values and the locations of the iterator variables. While this is definitely a w

[PATCH] D87449: [clang-tidy] Add new check for SEI CERT rule SIG30-C.

2020-09-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/cert/SignalHandlerCheck.cpp:31 +static bool isSystemCall(const FunctionDecl *FD) { + // This check does not work with function calls in std namespace. + if (!FD->isGlobal() || FD->isInStdNamespac

[PATCH] D87146: [analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker

2020-09-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D87146#2294514 , @baloghadamsoftware wrote: > In D87146#2294423 , @ASDenysPetrov > wrote: > >> It would be nice if someone had time to look at this. Thanks. > > I am just loo

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-25 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. baloghadamsoftware marked an inline comment as done. Closed by commit rGfacad21b2983: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and… (authored by baloghadamsoftware). Changed prior to commi

[PATCH] D87146: [analyzer] Implement shared semantics checks for XNU functions in PthreadLockChecker

2020-09-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D87146#2294423 , @ASDenysPetrov wrote: > It would be nice if someone had time to look at this. Thanks. I am just looking, but I am not a `pthread` expert. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D8714

[PATCH] D77229: [Analyzer][NFC] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-25 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. @gamesh411, @whisperity, @martong and others, please suggest me new test cases if you think the current ones are not enough. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 ___

[PATCH] D77229: [Analyzer][NFC] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Oh, I think now what do you mean: iterators stored in containers, thus iterators iterating over iterators. Yes, the current working of the checker does not support it because it stores iterator positions for both the prvalues and the glvalues. This is so from

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 294156. baloghadamsoftware added a comment. Test coverage was hugely increased by rebasing this patch to D88216 . Two kind of tests failed. This last update addreses them: 1. Handle the assignment operator of iter

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(); + if (RetValUnderConstr.hasValue()) +return *

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(); + if (RetValUnderConstr.hasValue()) +return *

[PATCH] D88216: [Analyzer] Fix handling of pointer-based iterator increments and decrements

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added a reviewer: NoQ. baloghadamsoftware added a project: clang. Herald added subscribers: ASDenysPetrov, martong, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, w

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(); + if (RetValUnderConstr.hasValue()) +return *

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-22 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(); + if (RetValUnderConstr.hasValue()) +return *

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-22 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(); + if (RetValUnderConstr.hasValue()) +return *

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-09-22 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:330-336 +SVal getReturnIterator(const CallEvent &Call) { + Optional RetValUnderConstr = Call.getReturnValueUnderConstruction(

[PATCH] D76604: [Analyzer] Model `size()` member function of containers

2020-09-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 293183. baloghadamsoftware added a comment. New test cases added. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76604/new/ https://reviews.llvm.org/D76604 Files: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp clang/lib/Stati

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-21 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG4fc0214a1014: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer (authored by baloghadamsoftware). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.o

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Prerequeisite patch is committed, the check is tested now on the //LLVM Project//. @lebedev.ri, @aaron.ballman can I recommit it? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 __

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 293139. baloghadamsoftware added a comment. Updated according to the comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.tx

[PATCH] D77792: [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

2020-09-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 293111. baloghadamsoftware added a comment. Tests updated: some execution paths merged by refactoring assertions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77792/new/ https://reviews.llvm.org/D77792 Files: clang/include/clang/Stat

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-09-20 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D81272#2276342 , @sylvestre.ledru wrote: > Thanks for this checker. FYI, it found (at least) 3 defects in Firefox code > (fixed with the autofix): > https://hg.mozilla.org/mozilla-central/rev/651e68f628d0 > > https:

[PATCH] D77792: [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

2020-09-18 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:103-110 + enum class CompareResult { +unknown, +identical, +less, +less_equal, +greater, +greater_equal

[PATCH] D77792: [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

2020-09-18 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:814 +Optional RangeConstraintManager::tryAssumeSymSymOp( +ProgramStateRef State, BinaryOperator::Opcode Op, SymbolRef LHSSym, NoQ wrote: > I belie

[PATCH] D77792: [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

2020-09-18 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 292755. baloghadamsoftware added a comment. Crash fixed and new tests added. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77792/new/ https://reviews.llvm.org/D77792 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedC

[PATCH] D77792: [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

2020-09-18 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware commandeered this revision. baloghadamsoftware edited reviewers, added: steakhal; removed: baloghadamsoftware. baloghadamsoftware added a comment. Herald added a subscriber: gamesh411. We found use cases which can be solved using this improvement. That is why I commandeer this

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-16 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGdbd45b2db8e0: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl` (authored by baloghadamsoftware). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.or

[PATCH] D87683: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc

2020-09-16 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG779a2a2edcea: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc (authored by baloghadamsoftware). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-16 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 292170. baloghadamsoftware added a comment. Checker `modernize-use-equals-delete` adjusted. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87527/new/ https://reviews.llvm.org/D87527 Files: clang-tools-extra/clang-tidy/modernize/UseEqual

[PATCH] D87683: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc

2020-09-16 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 292151. baloghadamsoftware added a comment. `std::size_t` defined correctly in the tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87683/new/ https://reviews.llvm.org/D87683 Files: clang-tools-extra/clang-tidy/bugprone/MisplacedP

[PATCH] D87683: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc

2020-09-15 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D87683#2274569 , @njames93 wrote: > Please fix the test case first, can't call `operator new(unsigned long, > void*)` with an argument of type `void*` > The other failures the pre merge bot detected can safely be dis

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-15 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 291901. baloghadamsoftware added a comment. Created another matcher `hasAnyBody`, and updated the documentation of the matchers. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87527/new/ https://reviews.llvm.org/D87527 Files: clang/inc

[PATCH] D87683: [clang-tidy] Crash fix for bugprone-misplaced-pointer-arithmetic-in-alloc

2020-09-15 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: gribozavr2, aaron.ballman. baloghadamsoftware added a project: clang-tools-extra. Herald added subscribers: martong, steakhal, gamesh411, Szelethus, dkrupp, rnkovacs, xazax.hun, whisperity. Herald added a project: clang.

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 291562. baloghadamsoftware added a comment. No crash, no hang, no false positives on the LLVM Project. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 Files: clang-tools-extra/clang-tidy/cppcore

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. > Thank you for clarifying. I might nitpick that it's not "obviously wrong": > I'm actually writing code now that depends on exactly that behavior -- I > don't care where the method decl body is, as long as it's visible in the > current TU. That said, I thin

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D87527#2270939 , @ymandel wrote: > Can you expand on what is wrong currently for `FunctionDecl` descendants? > Would the new test `FindsBodyOfFunctionChildren` fail with the current > implementation? Yes, exactly.

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D87527#2268348 , @whisperity wrote: > What about http://clang.llvm.org/doxygen/classclang_1_1CXXConversionDecl.html > ? That is part of "etc.". It works for all current and future descendants of `FunctionDecl` now.

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. It looks like it was not entirely my fault: D87527 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 ___

[PATCH] D87527: [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl`

2020-09-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: klimek, sbenza. baloghadamsoftware added a project: clang. Herald added subscribers: martong, gamesh411, Szelethus, dkrupp, rnkovacs. baloghadamsoftware requested review of this revision. //AST Matcher// `hasBody` is a p

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. OK, I reversed the matcher expression now, it seems to work, but I will check it on the //LLVM/Clang// codebase first. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 __

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. I found the problem: `hasBody()` always returns true if the function has //somewhere// a body. This means that also the `hasBody` matcher matches forward declarations. However, I only need the definition. This far I could not find any method to achieve that:

[PATCH] D85424: [Analyzer] Crash fix for alpha.cplusplus.IteratorRange

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D85424#2258886 , @steakhal wrote: > void foo(int x) { > > int uninit; > x - uninit; // will-crash > > } This is not even related to the iterators. We could check first whether `LHS` is an iterator and early exit

[PATCH] D85424: [Analyzer] Crash fix for alpha.cplusplus.IteratorRange

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 290967. baloghadamsoftware added a comment. Test added. Thank you for the test @steakhal! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85424/new/ https://reviews.llvm.org/D85424 Files: clang/lib/StaticAnalyzer/Checkers/IteratorRangeCh

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D71199#2265594 , @lebedev.ri wrote: > So i've just reverted this in rGebf496d805521b53022a351f35854de977fee844 > . > > @aaron.ballman @baloghadamso

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:138-139 SVal ThisVal = State->getSVal(ThisPtr); + if (Init->isBaseInitializer() || Init->isDelegatingInitializer(

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-10 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 290917. baloghadamsoftware added a comment. Fix for base constructors, test extended. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85351/new/ https://reviews.llvm.org/D85351 Files: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp cla

[PATCH] D87388: [Analyzer] Model default constructors of containers

2020-09-09 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: NoQ, vsavchenko, gamesh411. baloghadamsoftware added a project: clang. Herald added subscribers: ASDenysPetrov, martong, steakhal, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xa

[PATCH] D76604: [Analyzer] Model `size()` member function of containers

2020-09-08 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:456 + SVal RetVal) const { + const auto *ContReg = Cont.getAsRegion(); + if (!ContReg) Szelethus wrote: > martong wro

[PATCH] D76604: [Analyzer] Model `size()` member function of containers

2020-09-08 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 290413. baloghadamsoftware added a comment. Fixes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76604/new/ https://reviews.llvm.org/D76604 Files: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp clang/lib/StaticAnalyzer/Check

[PATCH] D76590: [Analyzer] Model `empty()` member function of containers

2020-09-07 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:36 + void handleAssignment(CheckerContext &C, const Expr *CE, SVal Cont, +Optional = None) c

[PATCH] D76590: [Analyzer] Model `empty()` member function of containers

2020-09-07 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 290248. baloghadamsoftware added a comment. Wrong diff uploaded previously. (Accidentally compared to //master// instead of the prerequisite.) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76590/new/ https://reviews.llvm.org/D76590 File

[PATCH] D76590: [Analyzer] Model `empty()` member function of containers

2020-09-04 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 289981. baloghadamsoftware added a comment. `isIterator()` updated because it did not work perfectly with the refactored `handleBegin()` after rebase. (Why did it work before the rebase?) The problem was that it only looked for the necessary opera

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-03 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 289703. baloghadamsoftware added a comment. Tests separated. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85351/new/ https://reviews.llvm.org/D85351 Files: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp clang/unittests/StaticAnalyz

[PATCH] D85728: [Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker

2020-09-03 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. I was indeed on vacation, so thanks for committing it, @NoQ! I was waiting for agreement for the prerequisite patch then I forgot to notify you that I was going on vacation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.l

[PATCH] D86874: [analyzer] Fix ArrayBoundCheckerV2 false positive regarding size_t indexer

2020-09-02 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:226 + // No unsigned symbolic value can be less then a negative constant. + if (const auto SymbolicRoot = RootNonLoc.getAs()) +if (SymbolicRoot->getSymbol()->getT

[PATCH] D86743: [analyzer] Ignore VLASizeChecker case that could cause crash

2020-09-02 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. I agree here with @Szelethus. We should investigate first why the assumption fails. Then we can decide about the best possible fix. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86743/new/ https://reviews.llvm.o

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-02 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. @NoQ could you please take a look on this short fix? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85351/new/ https://reviews.llvm.org/D85351 ___ cfe-commits mailing l

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-09-02 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D85351#2247095 , @Szelethus wrote: > I think its a bad experience if you break something while developing. Instead > of getting a test failure for "delegating constructor initializers", you'll > have to deal with a

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-08-31 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG14dd0737822b: [Clang-Tidy] New check `bugprone-redundant-branch-condition` (authored by baloghadamsoftware). Changed prior to commit: https://reviews.llvm.org/D81272?vs=285656&id=288940#toc Repository:

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-08-31 Thread Balogh , Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf5fd7486d6c0: [clang-tidy] New check readability-prefer-member-initializer (authored by baloghadamsoftware). Changed prior to commit: https://reviews.llvm.org/D71199?vs=285657&id=288939#toc Repository:

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-08-31 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Herald added a subscriber: danielkiss. In D85351#2215547 , @Szelethus wrote: > Shouldn't we create a new test care for this, instead of expanding an > existing one? Btw, this looks great, but I lack the confidence to ac

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285657. baloghadamsoftware added a comment. Updated according to a comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71199/new/ https://reviews.llvm.org/D71199 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285656. baloghadamsoftware added a comment. Tests andd for not yet handled cases. Known limiatations included in the docs. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81272/new/ https://reviews.llvm.org/D81272 Files: clang-tools-extr

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D81272#2218050 , @aaron.ballman wrote: > Thanks to the new info, I think the check basically LGTM. Can you add some > negative tests and documentation wording to make it clear that the check > doesn't currently han

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285608. baloghadamsoftware added a comment. It seems that //release notes// were not renamed automatically. I updated it manually now. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81272/new/ https://reviews.llvm.org/D81272 Files: cla

[PATCH] D81272: [clang-tidy] New check `bugprone-redundant-branch-condition`

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285606. baloghadamsoftware retitled this revision from "[clang-tidy] New check `misc-redundant-condition`" to "[clang-tidy] New check `bugprone-redundant-branch-condition`". baloghadamsoftware edited the summary of this revision. baloghadamsoftware

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-14 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:46 +CheckFactories.registerCheck( +"misc-redundant-condition"); CheckFactories.registerCheck( aaron.ballman wrote: > baloghadamsoftware wro

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:46 +CheckFactories.registerCheck( +"misc-redundant-condition"); CheckFactories.registerCheck( aaron.ballman wrote: > baloghadamsoftware wro

[PATCH] D71199: [clang-tidy] New check cppcoreguidelines-prefer-member-initializer

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285366. baloghadamsoftware added a comment. Since no better idea cam to my mind, in this version I check whether `modernize-use-default-member-init` is enabled. If it is, then we issue a warning and suggest a fix that uses default member initializ

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:46 +CheckFactories.registerCheck( +"misc-redundant-condition"); CheckFactories.registerCheck( aaron.ballman wrote: > baloghadamsoftware wro

[PATCH] D85351: [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. @NoQ Could you please take a look on this one? It is a fix of my earlier work. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85351/new/ https://reviews.llvm.org/D85351 ___

[PATCH] D85728: [Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 2 inline comments as done. baloghadamsoftware added a comment. @NoQ Thank you for the review. Please also review D85752 after my update and tell me what I have to change there if it is not acceptable yet. This patch depends on that one.

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp:77 + unsigned ArgNum = 999; + gamesh411 wrote: > 999 seems a bit arbitrary here, consider usin

[PATCH] D77229: [Analyzer] Avoid handling of LazyCompundVals in IteratorModeling

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285326. baloghadamsoftware added a comment. Updated according to the latest comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cp

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 3 inline comments as done. baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:46 +CheckFactories.registerCheck( +"misc-redundant-condition"); CheckFactories.registerCheck( -

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-13 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285309. baloghadamsoftware added a comment. Updated according to the comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81272/new/ https://reviews.llvm.org/D81272 Files: clang-tools-extra/clang-tidy/misc/CMakeLists.txt clang-too

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-12 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/RedundantConditionCheck.cpp:73 + // If the variable has an alias then it can be changed by that alias as well. + // FIXME: Track pointers and references. + if (hasPtrOrReferenceInFunc(Func,

[PATCH] D85728: [Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker

2020-08-12 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 3 inline comments as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:270-272 +default: + llvm_unreachable("Invalid template argument for isa<> or " + "isa_a

[PATCH] D85728: [Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker

2020-08-12 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285047. baloghadamsoftware added a comment. Updated according to the comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85728/new/ https://reviews.llvm.org/D85728 Files: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp cla

[PATCH] D85752: [Analyzer] Store the pointed/referenced type for dynamic casts

2020-08-12 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/DynamicType.cpp:73 +Ty = STTPTy->getReplacementType(); + if (Ty->isPointerType()) +Ty = Ty->getPointeeType(); xazax.h

[PATCH] D85752: [Analyzer] Store the pointed/referenced type for dynamic casts

2020-08-12 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 285036. baloghadamsoftware added a comment. Updated according to the comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85752/new/ https://reviews.llvm.org/D85752 Files: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp cla

[PATCH] D85728: [Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 284801. baloghadamsoftware retitled this revision from "[Analyzer][WIP] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker" to "[Analyzer] Support for the new variadic isa<> and isa_and_not_null<> in CastValueChecker". ba

[PATCH] D85752: [Analyzer] Store the pointed/referenced type for dynamic casts

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: NoQ, Charusso. baloghadamsoftware added a project: clang. Herald added subscribers: ASDenysPetrov, martong, steakhal, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, kristof.beyls

[PATCH] D85728: [Analyzer][WIP] Support for the new variadic isa<> and isa_and_nod_null<> in CastValueChecker

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. My proposal is the following: do not store the casing info between pointers and references but the underlying types themselves. There are two ways to implement this: in the checkers using it (currently only this one) or behind the API of `DynamicCastInfo`. Ma

[PATCH] D85728: [Analyzer][WIP] Support for the new variadic isa<> and isa_and_nod_null<> in CastValueChecker

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. This patch intends to fix bug 47037 . It is still work in progress with lots of debug printouts. I described the issue with this patch at the bug report: //The variadic tests fail because the whole Dyanamic Type l

[PATCH] D85728: [Analyzer][WIP] Support for the new variadic isa<> and isa_and_nod_null<> in CastValueChecker

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added reviewers: NoQ, Charusso. baloghadamsoftware added a project: clang. Herald added subscribers: ASDenysPetrov, martong, steakhal, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, wh

[PATCH] D81272: [clang-tidy] New check `misc-redundant-condition`

2020-08-11 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. 6 findings in the //LLVM Project//. All of them confirmed as trues positives, 5 of them already fixed. Fix pending for the last one. D82555 , D8556 , D82557 , D

  1   2   3   4   5   6   7   8   9   10   >