Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2016-03-23 Thread Artem Dergachev via cfe-commits
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:84 @@ +83,3 @@ +// Can E value be greater or equal than Val? +static bool canBeGreaterEqual(CheckerContext &C, const Expr *E, + unsigned long long Val) { -

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2015-12-28 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 43683. NoQ marked an inline comment as done. NoQ added a comment. An attempt on the .def-files. The next step would probably be the `VisitChildren()` thing, and I'll see if it allows to refactor and simplify some code. __ Forgot to answer: I guess there ar

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-06 Thread Artem Dergachev via cfe-commits
NoQ added inline comments. Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/Regions.def:31 @@ +30,3 @@ +// is both instantiated and derived from. +// Additionally, its kind is not its name with "Kind" suffix, +// unlike all other regions. zaks.anna wrot

[PATCH] D16062: [analyzer] Rename kind-enumeration values of SVal, SymExpr, MemRegion classes, for consistency.

2016-01-11 Thread Artem Dergachev via cfe-commits
NoQ created this revision. NoQ added reviewers: zaks.anna, dcoughlin. NoQ added a subscriber: cfe-commits. Based on discussion in D15448. - For every sub-class `C`, its kind in the relevant enumeration is `CKind` (or `C##Kind` in preprocessor-ish terms), eg: `MemRegionKind` -> `MemRegionValKin

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-11 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 44475. NoQ marked 5 inline comments as done. NoQ added a comment. Renamed the kinds for consistency (review http://reviews.llvm.org/D16062), this diff is updated to use the new naming convention. The 'kind' column gets removed from the def-files. http://review

Re: [PATCH] D16062: [analyzer] Rename kind-enumeration values of SVal, SymExpr, MemRegion classes, for consistency.

2016-01-12 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 44628. NoQ marked 2 inline comments as done. NoQ added a comment. Good point! Removed the friend-class directive here, and also in `NonStaticGlobalSpaceRegion`, which is also abstract. Agreed and renamed text regions to code regions. http://reviews.llvm.org/D1

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-12 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 44629. NoQ added a comment. Another rebase on top of http://reviews.llvm.org/D16062. http://reviews.llvm.org/D15448 Files: docs/analyzer/DebugChecks.rst include/clang/StaticAnalyzer/Checkers/SValExplainer.h include/clang/StaticAnalyzer/Core/PathSensitive/

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-13 Thread Artem Dergachev via cfe-commits
NoQ updated this revision to Diff 44734. NoQ added a comment. Rebase on top of http://reviews.llvm.org/D12901 - support `SymbolCast` in the explainer, as it finally appears in the wild. http://reviews.llvm.org/D15448 Files: docs/analyzer/DebugChecks.rst include/clang/StaticAnalyzer/Checker

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-13 Thread Artem Dergachev via cfe-commits
NoQ added a comment. Nope, will commit without `SymbolCast` support for now, encountered some issues with http://reviews.llvm.org/D12901 that would probably be worth a separate commit. http://reviews.llvm.org/D15448 ___ cfe-commits mailing list cf

r257598 - [analyzer] Fix SVal/SymExpr/MemRegion class and enum names for consistency.

2016-01-13 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Wed Jan 13 07:49:29 2016 New Revision: 257598 URL: http://llvm.org/viewvc/llvm-project?rev=257598&view=rev Log: [analyzer] Fix SVal/SymExpr/MemRegion class and enum names for consistency. The purpose of these changes is to simplify introduction of definition files for the

r257605 - [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion.

2016-01-13 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Wed Jan 13 09:13:48 2016 New Revision: 257605 URL: http://llvm.org/viewvc/llvm-project?rev=257605&view=rev Log: [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion. Provide separate visitor templates for the three hierarchies, and also the `FullSValVisito

r257608 - Revert "[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion."

2016-01-13 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Wed Jan 13 09:52:25 2016 New Revision: 257608 URL: http://llvm.org/viewvc/llvm-project?rev=257608&view=rev Log: Revert "[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion." This reverts commit r257605. The test fails on architectures that use unsigned i

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-13 Thread Artem Dergachev via cfe-commits
NoQ removed rL LLVM as the repository for this revision. NoQ updated this revision to Diff 44758. NoQ added a comment. Reverted the patch due to a few issues. This revision should fix these issues. The explain-svals test is fixed to target a specific target, in order to make sure that the defini

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-13 Thread Artem Dergachev via cfe-commits
NoQ added a reviewer: rsmith. NoQ added a comment. Richard: excuse me, adding you because you are an expert on the `modulemap`, could you have a quick look at the proposed changes here and probably point me in the right direction, because i'm not quite sure how to test the modules-enabled build

[PATCH] D16178: [analyzer] A quick fix on top of D12901/r257464

2016-01-14 Thread Artem Dergachev via cfe-commits
NoQ created this revision. NoQ added reviewers: pgousseau, zaks.anna, dcoughlin, xazax.hun. NoQ added a subscriber: cfe-commits. Sorry for being a bit slow, i should have had a look at the review earlier; i noticed some stuff after the recent patch by Pierre Gousseau was committed. 1. There's an

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2016-01-15 Thread Artem Dergachev via cfe-commits
NoQ added a comment. Managed to reproduce the build error with `-fmodules` on my machine. Committed the updated patch as r257893, the buildbot seems happy. I hope this review is actually closed now :) http://reviews.llvm.org/D15448 ___ cfe-commits m

r257893 - [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.

2016-01-15 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Fri Jan 15 09:22:05 2016 New Revision: 257893 URL: http://llvm.org/viewvc/llvm-project?rev=257893&view=rev Log: [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2. Provide separate visitor templates for the three hierarchies, and also the `FullSValVi

r258039 - [analyzer] Fix an off-by-one in evalIntegralCast()

2016-01-18 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Mon Jan 18 04:17:16 2016 New Revision: 258039 URL: http://llvm.org/viewvc/llvm-project?rev=258039&view=rev Log: [analyzer] Fix an off-by-one in evalIntegralCast() Make sure that we do not add SymbolCast at the very boundary of the range in which the cast would not certainl

Re: [PATCH] D16317: [Analyzer] Fix for PR23790: bind real value returned from strcmp when modelling strcmp.

2016-01-19 Thread Artem Dergachev via cfe-commits
NoQ added a subscriber: NoQ. NoQ added a comment. Hmm. If we want to catch bugs resulting from alternative `strcmp()` implementations, then probably a test case that demonstrates the improvement would be worth it, eg.: int x = strcmp("foo", "bar")); if (x == 1 || x == -1) clang_analyzer

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-11-25 Thread Artem Dergachev via cfe-commits
NoQ added a subscriber: NoQ. NoQ added a comment. In http://reviews.llvm.org/D13126#291763, @danielmarjamaki wrote: > I have problems with the "default" handling of expressions. > > I want to warn about loss of precision for such code: > > unsigned int x = 256; > unsigned char c; > c = x; >

Re: [PATCH] D15007: [analyzer] Improve modelling of nullptr_t in the analyzer. Fix PR25414.

2015-11-26 Thread Artem Dergachev via cfe-commits
NoQ added a subscriber: NoQ. NoQ added a comment. Wow, useful stuff! There's a little problem with the `shouldNotCrash()` test: the first warning on `invokeF()` on line 107 generates a sink, and the rest of the function never gets executed. It's probably a good idea to split it into three separ

Re: [Static Analyzer] New checker hook: checkInitialState

2015-11-30 Thread Artem Dergachev via cfe-commits
Hmm. I once thought about creating a 'checkBeginAnalysis()' callback to match 'checkEndAnalysis()'; this one's more powerful, and matches 'checkEndFunction()' in a similar manner. At a glance, I wonder if it's worth it to provide a CheckerContext inside this callback and then handle transition

Re: [PATCH] D15090: [Static Analyzer] New checker hook: checkInitialState

2015-12-01 Thread Artem Dergachev via cfe-commits
NoQ added a subscriber: NoQ. NoQ added a comment. Yeah, that's what i had in mind. Additionally, `Decl` can be obtained as `Context.getStackFrame().getDecl()` (and in fact the `getStackFrame()` thing itself is of interest as well), so there's no need to pass it as an extra argument. On the othe

Re: [PATCH] D12726: [analyzer] A fix for symbolic element region index lifetime.

2015-12-07 Thread Artem Dergachev via cfe-commits
NoQ added a comment. In http://reviews.llvm.org/D12726#303122, @zaks.anna wrote: > > So the real question is whether (or rather how) the Store should maintain > > correct region liveness information > > > after completing its internal garbage collection pass, because there are, > > in fact, o

r255236 - [analyzer] Fix symbolic element index lifetime.

2015-12-10 Thread Artem Dergachev via cfe-commits
Author: dergachev Date: Thu Dec 10 03:28:06 2015 New Revision: 255236 URL: http://llvm.org/viewvc/llvm-project?rev=255236&view=rev Log: [analyzer] Fix symbolic element index lifetime. SymbolReaper was destroying the symbol too early when it was referenced only from an index SVal of a live Element

[PATCH] D15448: [analyzer] SVal Visitor.

2015-12-11 Thread Artem Dergachev via cfe-commits
NoQ created this revision. NoQ added reviewers: zaks.anna, dcoughlin, xazax.hun. NoQ added a subscriber: cfe-commits. It seems that in several places in the code Clang Static Analyzer tries to recursively traverse the `SVal` hierarchy, so i made a visitor for `SVal`, `SymExpr`, and `MemRegion` h

Re: [PATCH] D15448: [analyzer] SVal Visitor.

2015-12-16 Thread Artem Dergachev via cfe-commits
NoQ added a comment. Good point, will try to make a .def file. There's a tiny inconsistency with `SVal` naming that would most likely need to be fixed in this approach: nonloc::SymbolVal => SymbolValKind loc::MemRegionVal => MemRegionKind // no "Val"! Hmm, maybe make a .def file for symbol

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Artem Dergachev via cfe-commits
NoQ added a comment. I've got a few minor code comments. I really wish to have a look at false positives on which > the value analysis fails and then there is not much my checker could do either in a form of FIXME tests, or as preprocessed code samples, because i'm currently digging the topic

Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-12-17 Thread Artem Dergachev via cfe-commits
NoQ added a comment. Hmm, just noticed the related work on casts in http://reviews.llvm.org/D12901, which seems to be directly related to my hand-waving above. It might accidentally be useful for reducing FPs of this checker as well. http://reviews.llvm.org/D13126 __

[clang] [alpha.webkit.UncountedCallArgsChecker] Add a few more safe functions to call. (PR #81532)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. https://github.com/llvm/llvm-project/pull/81532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Fixits for unsafe arguments of function pointer calls (PR #80358)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -282,8 +282,8 @@ isInUnspecifiedPointerContext(internal::Matcher InnerMatcher) { //(i.e., computing the distance between two pointers); or ... auto CallArgMatcher = - callExpr(forEachArgumentWithParam(InnerMatcher, - hasPointerType() /* array

[clang] [-Wunsafe-buffer-usage] Fixits for unsafe arguments of function pointer calls (PR #80358)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. https://github.com/llvm/llvm-project/pull/80358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Check the safety of the object argument in a member function call. (PR #81400)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ closed https://github.com/llvm/llvm-project/pull/81400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Add a few more safe functions to call. (PR #81532)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ closed https://github.com/llvm/llvm-project/pull/81532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Detect a return value of Ref & RefPtr (PR #81580)

2024-02-14 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Ok this needs a rebase after the other two PRs landed. https://github.com/llvm/llvm-project/pull/81580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Detect a return value of Ref & RefPtr (PR #81580)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ closed https://github.com/llvm/llvm-project/pull/81580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/81808 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: LGTM! Just one nitpick. https://github.com/llvm/llvm-project/pull/81808 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -222,4 +223,210 @@ bool isPtrConversion(const FunctionDecl *F) { return false; } +bool isSingleton(const FunctionDecl *F) { + assert(F); + // FIXME: check # of params == 1 + if (auto *MethodDecl = dyn_cast(F)) { +if (!MethodDecl->isStatic()) + return false; +

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -222,4 +223,210 @@ bool isPtrConversion(const FunctionDecl *F) { return false; } +bool isSingleton(const FunctionDecl *F) { + assert(F); + // FIXME: check # of params == 1 + if (auto *MethodDecl = dyn_cast(F)) { +if (!MethodDecl->isStatic()) + return false; +

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -598,16 +623,16 @@ class ArraySubscriptGadget : public WarningGadget { } static Matcher matcher() { -// FIXME: What if the index is integer literal 0? Should this be -// a safe gadget in this case? - // clang-format off +// clang-format off retur

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/80504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (PR #80504)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -406,6 +406,39 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { } return false; } + +AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) { + // FIXME: Proper solution: + // - refactor Sema::CheckArrayAccess + //- split safe/OOB/unknown decision

[clang] [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (PR #81343)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -848,6 +852,60 @@ class PointerAssignmentGadget : public FixableGadget { } }; +/// An assignment expression of the form: +/// \code +/// ptr = array; +/// \endcode +/// where `p` is a pointer and `array` is a constant size array. +class CArrayToPtrAssignmentGadget : pu

[clang] [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (PR #81343)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -1490,6 +1548,26 @@ PointerAssignmentGadget::getFixits(const FixitStrategy &S) const { return std::nullopt; } +/// \returns fixit that adds .data() call after \DRE. +static inline std::optional createDataFixit(const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (PR #81343)

2024-02-14 Thread Artem Dergachev via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \ +// RUN:-fsafe-buffer-usage-suggestions \ +// RUN:-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s + +void safe_array_assigned_to_safe_ptr(unsigned idx) { + int buffer[10]; + //

[clang] [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (PR #81343)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: LGTM! I have a couple minor nitpicks. https://github.com/llvm/llvm-project/pull/81343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Looks great now! https://github.com/llvm/llvm-project/pull/81808 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ closed https://github.com/llvm/llvm-project/pull/81808 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (PR #81343)

2024-02-14 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM let's land! https://github.com/llvm/llvm-project/pull/81343 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] dcbb574 - [analyzer] Teach scan-build to filter reports by file.

2024-02-14 Thread Artem Dergachev via cfe-commits
Author: Brianna Fan Date: 2024-02-14T19:08:07-08:00 New Revision: dcbb574cfc3445251ff1c751f27b52ed6503bead URL: https://github.com/llvm/llvm-project/commit/dcbb574cfc3445251ff1c751f27b52ed6503bead DIFF: https://github.com/llvm/llvm-project/commit/dcbb574cfc3445251ff1c751f27b52ed6503bead.diff L

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-15 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Oh, this sort of stuff usually happens because the default target triple in the test is the target triple for the host machine, so you'll get different target-specific compiler behavior on different buildbots, in particular `sizeof(unsigned long)` may be different. You can add eg

[clang] Fix uncounted-obj-arg.cpp for Windows. (PR #81903)

2024-02-15 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. This probably works thanks! https://github.com/llvm/llvm-project/pull/81903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix uncounted-obj-arg.cpp for Windows. (PR #81903)

2024-02-15 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ closed https://github.com/llvm/llvm-project/pull/81903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect & ignore trivial function calls. (PR #81808)

2024-02-15 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Fix merged, thanks! https://github.com/llvm/llvm-project/pull/81808 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Detect more trivial functions (PR #81829)

2024-02-15 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. https://github.com/llvm/llvm-project/pull/81829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Fix fixits for span initialized from const size array (PR #81927)

2024-02-16 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/81927 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow ASSERT and atomic operations in a trivial function (PR #82063)

2024-02-19 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/82063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow ASSERT and atomic operations in a trivial function (PR #82063)

2024-02-19 Thread Artem Dergachev via cfe-commits
@@ -356,6 +364,14 @@ class TrivialFunctionAnalysisVisitor return TrivialFunctionAnalysis::isTrivialImpl(Callee, Cache); } + bool VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *E) { haoNoQ wrote: In theory this may need to be cached because it may caus

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow ASSERT and atomic operations in a trivial function (PR #82063)

2024-02-19 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM thanks! https://github.com/llvm/llvm-project/pull/82063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Ignore calls to WTF's container methods (PR #82156)

2024-02-19 Thread Artem Dergachev via cfe-commits
@@ -25,6 +25,11 @@ using namespace ento; namespace { +bool stringEndsWith(const std::string &str, const std::string &suffix) { + auto index = str.rfind(suffix); + return index != std::string::npos && str.size() - suffix.size() == index; +} haoNoQ wrote: Co

[clang] [alpha.webkit.UncountedCallArgsChecker] Ignore calls to WTF's container methods (PR #82156)

2024-02-19 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/82156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [attributes][analyzer] Generalize [[clang::suppress]] to declarations. (PR #80371)

2024-02-20 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Hmm, no, I landed it because I made an assumption that there's simply not that much interest in this work (I'm quite depressed about this in general lately) so as a code owner I just made a call that it's probably good enough to go and rely on post-commit review. Now that you bri

[clang] [attributes][analyzer] Generalize [[clang::suppress]] to declarations. (PR #80371)

2024-02-20 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Ok gotcha thanks! In any case, I'll do my best to handle this more gracefully in the future. Your advice is always appreciated! https://github.com/llvm/llvm-project/pull/80371 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [alpha.webkit.UncountedCallArgsChecker] Ignore calls to WTF's container methods (PR #82156)

2024-02-20 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Ooo this is much cleaner! https://github.com/llvm/llvm-project/pull/82156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Analyzer] Support RefAllowingPartiallyDestroyed and RefPtrAllowingPartiallyDestroyed (PR #82209)

2024-02-20 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/82209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Analyzer] Support RefAllowingPartiallyDestroyed and RefPtrAllowingPartiallyDestroyed (PR #82209)

2024-02-20 Thread Artem Dergachev via cfe-commits
@@ -103,15 +103,18 @@ std::optional isRefCountable(const CXXRecordDecl* R) return hasRef && hasDeref; } +bool isRefType(const std::string &name) { + return name == "Ref" || name == "RefAllowingPartiallyDestroyed" || + name == "RefPtr" || name == "RefPtrAllowingParti

[clang] [Analyzer] Support RefAllowingPartiallyDestroyed and RefPtrAllowingPartiallyDestroyed (PR #82209)

2024-02-20 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM! I have one stylistic nitpick. https://github.com/llvm/llvm-project/pull/82209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [alpha.webkit.UncountedLocalVarsChecker] Allow uncounted object references within trivial statements (PR #82229)

2024-02-20 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Ooo interesting. I want to spend a bit more time thinking whether this has to go into every callback, maybe it can be a set-and-forget thing? (Probably not.) Also it might be a good idea to cache only statements that may ever get directly queried. (This seems to be exactly necess

[clang] [alpha.webkit.UncountedLocalVarsChecker] Allow uncounted object references within trivial statements (PR #82229)

2024-02-21 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: > > I want to spend a bit more time thinking whether this has to go into every > > callback, maybe it can be a set-and-forget thing? (Probably not.) > > What do you mean by set-and-forget? I mean like, so that you didn't have to remember to edit every callback in a specific way

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: Thanks a lot!! Some comments are very much overdue here. https://github.com/llvm/llvm-project/pull/97407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/97407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
@@ -326,6 +326,12 @@ class LocAsInteger : public NonLoc { static bool classof(SVal V) { return V.getKind() == LocAsIntegerKind; } }; +/// The simplest example of a concrete compound value is nonloc::CompoundVal, +/// which represents a concrete r-value of an initializer-list

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
@@ -346,6 +352,39 @@ class CompoundVal : public NonLoc { static bool classof(SVal V) { return V.getKind() == CompoundValKind; } }; +/// The simplest example of a concrete compound value is nonloc::CompoundVal, +/// which represents a concrete r-value of an initializer-list o

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
@@ -346,6 +352,39 @@ class CompoundVal : public NonLoc { static bool classof(SVal V) { return V.getKind() == CompoundValKind; } }; +/// The simplest example of a concrete compound value is nonloc::CompoundVal, +/// which represents a concrete r-value of an initializer-list o

[clang] [analyzer][NFC] Add some docs for LazyCompoundValue (PR #97407)

2024-07-02 Thread Artem Dergachev via cfe-commits
@@ -346,6 +352,39 @@ class CompoundVal : public NonLoc { static bool classof(SVal V) { return V.getKind() == CompoundValKind; } }; +/// The simplest example of a concrete compound value is nonloc::CompoundVal, +/// which represents a concrete r-value of an initializer-list o

[clang] [clang][analyzer][doc] Migrate user-related docs from HTML to RST (PR #97034)

2024-07-02 Thread Artem Dergachev via cfe-commits
Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= Message-ID: In-Reply-To:

[clang] [clang][analyzer][doc] Migrate user-related docs from HTML to RST (PR #97034)

2024-07-02 Thread Artem Dergachev via cfe-commits
Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= Message-ID: In-Reply-To:

[clang] [clang][analyzer][doc] Migrate user-related docs from HTML to RST (PR #97034)

2024-07-02 Thread Artem Dergachev via cfe-commits
Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= , Endre =?utf-8?q?Fülöp?= Message-ID: In-Reply-To:

[clang] [-Wunsafe-buffer-usage] Warning Libc functions (PR #101583)

2024-09-09 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: `-Wunsafe-buffer-usage` is theoretically possible to use in C but it involves a lot of `#pragma clang unsafe_buffer_usage` to annotate and encapsulate every unsafe buffer operation. So it's impractical but we aren't disabling it because that'd be an unnecessary restriction and it

[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

2024-09-10 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ commented: Aha makes sense! Looks like you're putting no restrictions on what the opaque function is. This may cause some false negatives but it's probably ultimately ok, but it might be a good idea to confirm. https://github.com/llvm/llvm-project/pull/107676 ___

[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

2024-09-10 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/107676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

2024-09-10 Thread Artem Dergachev via cfe-commits
@@ -67,6 +68,15 @@ class DerefFuncDeleteExprVisitor const Decl *D = CE->getCalleeDecl(); if (D && D->hasBody()) return VisitBody(D->getBody()); +else if (!VisitLambdaBody) { + for (unsigned i = 0; i < CE->getNumArgs(); ++i) { +auto *Arg = CE->getA

[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

2024-09-10 Thread Artem Dergachev via cfe-commits
@@ -67,6 +68,48 @@ class DerefFuncDeleteExprVisitor const Decl *D = CE->getCalleeDecl(); if (D && D->hasBody()) return VisitBody(D->getBody()); +else { + auto name = safeGetName(D); + if (name == "ensureOnMainThread" || name == "ensureOnMainRunLoop")

[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

2024-09-10 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Aha great LGTM! https://github.com/llvm/llvm-project/pull/107676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebKit Static Analyzer] Treat WTFReportBacktrace as a trivial function. (PR #108167)

2024-09-11 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. https://github.com/llvm/llvm-project/pull/108167 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
@@ -143,6 +143,16 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F) { return false; } +std::optional isUncounted(const clang::QualType T) { haoNoQ wrote: `clang::` is redundant because you're in `using namespace clang`. https://github.com/llvm

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/108184 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/108184 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/108184 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. Aha ok LGTM! https://github.com/llvm/llvm-project/pull/108184 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Allow protector functions in Objective-C++ (PR #108184)

2024-09-11 Thread Artem Dergachev via cfe-commits
@@ -143,6 +143,16 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F) { return false; } +std::optional isUncounted(const QualType T) { + if (auto *Subst = dyn_cast(T)) { +if (auto *Decl = Subst->getAssociatedDecl()) { + if (isRefType(safeGetName(Decl)))

[clang] [Safe Buffers] Fix a small bug recently found (PR #102953)

2024-08-13 Thread Artem Dergachev via cfe-commits
haoNoQ wrote: Ah classic! Forgotten `.getCanonicalType()`s always get me. https://github.com/llvm/llvm-project/pull/102953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Safe Buffers] Fix a small bug recently found (PR #102953)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -404,7 +404,7 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) { if (Arg0Ty->isConstantArrayType()) { const APSInt ConstArrSize = -APSInt(cast(Arg0Ty)->getSize()); +APSInt(cast(Arg0Ty.getCanonicalType())->getSize()); haoNo

[clang] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usage attribute to struct fields (PR #101585)

2024-08-13 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/101585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usage attribute to struct fields (PR #101585)

2024-08-13 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. LGTM!! https://github.com/llvm/llvm-project/pull/101585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usage attribute to struct fields (PR #101585)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -6835,6 +6837,31 @@ the proper solution would be to create a different function (possibly an overload of ``baz()``) that accepts a safe container like ``bar()``, and then use the attribute on the original ``baz()`` to help the users update their code to use the new function

[clang] [llvm] [analyzer] Delete `alpha.security.MallocOverflow` (PR #103059)

2024-08-13 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/103059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [analyzer] Delete `alpha.security.MallocOverflow` (PR #103059)

2024-08-13 Thread Artem Dergachev via cfe-commits
@@ -1,40 +0,0 @@ -// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -analyzer-checker=alpha.security.MallocOverflow,unix -verify %s -// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -analyzer-checker=alpha.security.MallocOverflow,unix,optin.portability -DPORTAB

[clang] [llvm] [analyzer] Delete `alpha.security.MallocOverflow` (PR #103059)

2024-08-13 Thread Artem Dergachev via cfe-commits
https://github.com/haoNoQ approved this pull request. I too think this checker can be safely deleted. To the best of my knowledge, nobody is using it. https://github.com/llvm/llvm-project/pull/103059 ___ cfe-commits mailing list cfe-commits@lists.llvm

<    5   6   7   8   9   10   11   12   13   >