[PATCH] D124239: [analyzer] Fix ValistChecker false-positive involving symbolic pointers

2022-04-22 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, xazax.hun, Szelethus, ASDenysPetrov. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. Herald added a project: All. steakhal requested review of this revisio

[PATCH] D85528: [analyzer] Fix cast evaluation on scoped enums in ExprEngine

2022-04-22 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 424470. steakhal added a comment. Added two new RUN lines, demonstrating the behavior of `support-symbolic-integer-casts={true,false}`. Also refined the match string to be less fuzzy. It helps to grasp the difference between the expectations. CHANGES SINC

[PATCH] D124239: [analyzer] Fix ValistChecker false-positive involving symbolic pointers

2022-04-22 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 424478. steakhal added a comment. fix test CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124239/new/ https://reviews.llvm.org/D124239 Files: clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp clang/test/Analysis/valist-uninitialized-no-undef.

[PATCH] D85528: [analyzer] Fix cast evaluation on scoped enums in ExprEngine

2022-04-22 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 424497. steakhal added a comment. Added the missing `-verify` flag for the new RUN line. Also, add an elaborate description in the test for explaining the situation. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85528/new/ https://reviews.llvm.org/

[PATCH] D123464: [analyzer] Clean checker options from bool to DefaultBool (NFC)

2022-04-23 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. Good stuff. Update the summary and title, and I think good to go. In addition to this, we should do something similar with the rest of the checker options and initialize them at the declar

[PATCH] D124349: [analyzer] Get direct binding for specific punned case

2022-04-25 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. Looks good. Wait for an other accept. Comment at: clang/test/Analysis/array-struct-region.c:362-366 +int array_struct_bitfield_1() { + BITFIELD_CAST ff = {0}; + BITFIEL

[PATCH] D124244: [analyzer] add StoreToImmutable and ModelConstQualifiedReturn checkers

2022-04-25 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Looks great. I only have nits mostly for the docs. Comment at: clang/docs/analyzer/checkers.rst:2334-2336 +modified without causing undefined behavior. These functions +include getenv(), setlocale(), localeconv(), asctime(), and +strerror(). In such ca

[PATCH] D123352: [analyzer] Add FixItHint to `nullability.NullReturnedFromNonnull` and `nullability.NullableReturnedFromNonnull`

2022-04-25 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a subscriber: NoQ. steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:589 + RetTypeLoc.getType().getCanonicalType().getAsString(); + if (CanonicalTypeStr == "id" || CanonicalTypeStr == "instancetype") { +r

[PATCH] D124239: [analyzer] Fix ValistChecker false-positive involving symbolic pointers

2022-04-25 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGbe744da01f9d: [analyzer] Fix ValistChecker false-positive involving symbolic pointers (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D1

[PATCH] D124436: [analyzer] Fix Static Analyzer g_memdup false-positive

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, Szelethus, martong, xazax.hun, ASDenysPetrov. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. Herald added a project: All. steakhal requested review of this revisio

[PATCH] D109467: [analyzer] check for std::__addressof for inner pointer checker

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal commandeered this revision. steakhal edited reviewers, added: alishuja; removed: steakhal. steakhal added a comment. Herald added a reviewer: Szelethus. Herald added a project: All. I'll finish this one. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.

[PATCH] D109467: [analyzer] check for std::__addressof for inner pointer checker

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 425139. steakhal edited the summary of this revision. steakhal added a comment. - rebased (now using `matchesAny(...)` - added a test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109467/new/ https://reviews.l

[PATCH] D124442: [analyzer] Allow exploded graph dumps in release builds

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, ASDenysPetrov. Herald added subscribers: manas, pengfei, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requested review of thi

[PATCH] D124443: [analyzer] Allow CFG dumps in release builds

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, ASDenysPetrov. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requested review of this revisio

[PATCH] D118996: [clang-tidy] Support C++14 in bugprone-signal-handler.

2022-04-26 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D118996#3473934 , @whisperity wrote: > After adding improvements to the documentation, I think this will be good to > go, and thank you! Perhaps just for a safety measure you could run it on a > few projects (LLVM itself?)

[PATCH] D124462: [Analyzer] Fix clang::ento::taint::dumpTaint definition

2022-04-27 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a reviewer: steakhal. steakhal added a comment. Could you please elaborate whats the motivation for this change? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124462/new/ https://reviews.llvm.org/D124462

[PATCH] D124462: [Analyzer] Fix clang::ento::taint::dumpTaint definition

2022-04-27 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Although gcc (and probably clang too) allows specifying `__attribute__((noinline))` at any declaration (by merging //compatible// attributes), I would prefer not to repeat ourselves. The attribute must be present at the header to force all usages not to inline it, henc

[PATCH] D124570: Revert "[analyzer][NFC] Refactor GenericTaintChecker to use CallDescriptionMap"

2022-04-28 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. I'm not comfortable with reverting this. We depend on taint capabilities downstream, thus we would rather help fixing the underlying issue. Do you have a reproducer for the crash in any form? I would take it from there. Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D124462: [Analyzer] Fix clang::ento::taint::dumpTaint definition

2022-04-28 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a subscriber: aaron.ballman. steakhal added a comment. Thanks for the stats. @aaron.ballman WDYT, where should we put the `LLVM_DUMP_METHOD` ? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124462/new/ https://reviews.llvm.org/D124462

[PATCH] D124570: Revert "[analyzer][NFC] Refactor GenericTaintChecker to use CallDescriptionMap"

2022-04-28 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124570#3480457 , @t-rasmud wrote: > In D124570#3479334 , @steakhal > wrote: > >> I'm not comfortable with reverting this. >> We depend on taint capabilities downstream, thus we would

[PATCH] D124570: Revert "[analyzer][NFC] Refactor GenericTaintChecker to use CallDescriptionMap"

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124570#3480996 , @t-rasmud wrote: > Abandoning this patch because it was a downstream problem and I incorrectly > diagnosed it on the open source branch. Oh, I see. Yeey, so it's still an NFC :D Repository: rG LLVM Gith

[PATCH] D124659: [analyzer][docs] Document alpha.security.cert.pos.34c limitations

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: martong, NoQ. Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requested review of this revisio

[PATCH] D124659: [analyzer][docs] Document alpha.security.cert.pos.34c limitations

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. PS: the html docs compile and look great. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124659/new/ https://reviews.llvm.org/D124659 ___ cfe-commits mailing list cfe-commits@lis

[PATCH] D124621: CPP-2461 [Analyzer] Fix assumptions about const field with member-initializer

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. LGTM In D124621#3481906 , @mantognini wrote: > One thing I'm not sure about and couldn't easily find in the doc is how to > reference in the com

[PATCH] D124621: CPP-2461 [Analyzer] Fix assumptions about const field with member-initializer

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Noq wrote https://github.com/llvm/llvm-project/issues/47878#issuecomment-981036634 > Aha, uhm, yeah, i see. The static analyzer indeed thinks that a combination > of "const" and a field initializer causes the field to forever stay that way. > **We'll need to undo this

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. It looks good at first glance. For the review, it would be nice to see which `clang_analyzer_dumps` and `reachables` change with the patch. Could you mark the ones which have different results depending on whether you apply your fix or not? E.g put a `no-warning` where

[PATCH] D124674: [analyzer] Indicate if a parent state is infeasible

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Finally, we have this! Can we have this https://godbolt.org/z/oferc6P5Y in addition to the one you proposed? I find it more readable. What performance hit will we suffer from this change? Please do a differential analysis. Comment at: clang/include

[PATCH] D124462: [Analyzer] Fix clang::ento::taint::dumpTaint definition

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. In D124462#3482728 , @mantognini wrote: > In D124462#3480348 , @aaron.ballman > wrote: > >> In D124462#

[PATCH] D124621: [Analyzer] Fix assumptions about const field with member-initializer

2022-04-29 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. In D124621#3482782 , @mantognini wrote: > In D124621#3481973 , @steakhal > wrote: > >> BTW have you measured the observable impact of this patch on larg

[PATCH] D124436: [analyzer] Fix Static Analyzer g_memdup false-positive

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG5a2e595eb833: [analyzer] Fix Static Analyzer g_memdup false-positive (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124436/new/ https

[PATCH] D124659: [analyzer][docs] Document alpha.security.cert.pos.34c limitations

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG464c9833df80: [analyzer][docs] Document alpha.security.cert.pos.34c limitations (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124659/

[PATCH] D85528: [analyzer] Fix cast evaluation on scoped enums in ExprEngine

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGfd7efe33f1b2: [analyzer] Fix cast evaluation on scoped enums in ExprEngine (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SI

[PATCH] D124442: [analyzer] Allow exploded graph dumps in release builds

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG5ce7050f701c: [analyzer] Allow exploded graph dumps in release builds (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124442/new/ http

[PATCH] D124443: [analyzer] Allow CFG dumps in release builds

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG29dff0d4fb46: [analyzer] Allow CFG dumps in release builds (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124443/new/ https://reviews

[PATCH] D124681: [Analyzer] Minor cleanups in StreamChecker

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. Looks great, thanks. Land it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124681/new/ https://reviews.llvm.org/D124681 __

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:204 +// subtraction/addition of the negated value. +if (!RHS.isNegative()) { + ConvertedRHS = &BasicVals.Convert(resultTy, RHS); tomasz-kaminski-sonarsour

[PATCH] D124758: [analyzer] Implement assume in terms of assumeDual

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. The patch looks great. Thanks for the stats. Beyond that, I feel these tests sooo fragile; Although I don't have anything to improve that, so be it. Comment at: clang/t

[PATCH] D124761: [analyzer] Replace adjacent assumeInBound calls to assumeInBoundDual

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. LGTM; Although, I missed some doc comments here and there. This is a really important API, it deserves a few words. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION http

[PATCH] D124621: [Analyzer] Fix assumptions about const field with member-initializer

2022-05-02 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124621#3485799 , @mantognini wrote: > Thanks for the tip. I had to fix a thing or two to get SATest.py working with > my setup (I'll try to upstream those fixes at some point). However, these > projects do not highlight th

[PATCH] D124621: [Analyzer] Fix assumptions about const field with member-initializer

2022-05-03 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124621#3487507 , @mantognini wrote: > Thanks for digging in the past. I confirm I didn't see any regression in > existing tests, so I'll land it. Go for it! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTIO

[PATCH] D109467: [analyzer] check for std::__addressof for inner pointer checker

2022-05-03 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. @alishuja, Shall I submit this patch with `--author="Ali Shuja Siddiqui "` (thus on your behalf) ? The LLVM DeveloperPolicy mandates me for asking permission. Repository: rG LLVM Github Monorepo C

[PATCH] D124674: [analyzer] Indicate if a parent state is infeasible

2022-05-03 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. I think I don't have anything left. Let's see the numbers. Comment at: clang/test/Analysis/sink-infeasible.c:37-48 + /* The BASELINE passes these checks ('wrning' is used to avoid lit to match) + // The parent state is already infeasible, look at thi

[PATCH] D109467: [analyzer] check for std::__addressof for inner pointer checker

2022-05-03 Thread Balázs Benics via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGcf7cd664f3fd: [analyzer] Check for std::__addressof for inner pointer checker (authored by alishuja, committed by steakhal). Repository: rG LLVM G

[PATCH] D124349: [analyzer] Get direct binding for specific punned case

2022-05-04 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124349#3490524 , @martong wrote: > Can we have a test for this, got idea from here > (https://stackoverflow.com/questions/4129961/how-is-the-size-of-a-struct-with-bit-fields-determined-measured) > > typedef struct > { >

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-04 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Just a few nits left. Consider marking 'done' the corresponding boxes. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:211 +// Check if the negation of the RHS is representable: +// * if resultTy is unsigned, then negation is al

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-05 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. Seems right. Thanks. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124658/new/ https://reviews.llvm.org/D124658 ___ cfe-commits mailin

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-05 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf0d6cb4a5cf5: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible (authored by tomasz-kaminski-sonarsource, committed by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINC

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-06 Thread Balázs Benics via Phabricator via cfe-commits
steakhal reopened this revision. steakhal added a comment. This revision is now accepted and ready to land. This patch triggers a crash with this minimized example. assertion at L205: `"The result operation type must have at least the same number of bits as its operands."` // build/bin/clang -

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-06 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGda5b5ae852c4: Revert "[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible" (authored by steakhal). Changed prior to commit: https://reviews.llvm.org/D124658?vs=427340&id=427582#toc

[PATCH] D124674: [analyzer] Indicate if a parent state is infeasible

2022-05-06 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. only a few typos Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:89-114 + // A state is infeasible if there is a contradiction among the constraints. + // An infeasible state is repre

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-06 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. @uabelho Could you please apply this change and check if it resolves your crashes? I'm gonna do the same on our side. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124658/new/ https://reviews.llvm.org/D124658 ___ cf

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-07 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. The patch doesn't apply to me. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124658/new/ https://reviews.llvm.org/D124658 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh. Herald added subscribers: carlosgalvezp, martong, mgrang, rnkovacs, xazax.hun. Herald added a project: All. steakhal requested review of this revision. Herald added a project: clang-tools

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D124658#3499883 , @tomasz-kaminski-sonarsource wrote: > Updated patch to match master after revert. It's still messed up. Please double-check. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.c

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 428000. steakhal added a comment. Fix the RUN line Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125209/new/ https://reviews.llvm.org/D125209 Files: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersC

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal reopened this revision. steakhal added a comment. This revision is now accepted and ready to land. When I download the "raw diff" using the `Download Raw Diff` button on this page, then I try to `git apply` it still fails. (error `219: new blank line at EOF.`) Anyway, I managed to apply

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. This time I've checked this on our test set, and it seems to run without any issues. I'm still waiting for the results of analyzing LLVM, but I think safe to say that this should work. Could you please give this another shoot at this @uabelho? Commen

[PATCH] D125225: [WIP][analyzer] Taint Notes enhancements

2022-05-09 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2363 + for (SymbolRef SubSym : SubSyms) { +if (SymbolData::classof(SubSym)) { + if (auto MaybeTK = TryToLookupTrackingKind(SubSym)) I think this is the superior wa

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-10 Thread Balázs Benics via Phabricator via cfe-commits
steakhal requested changes to this revision. steakhal added a comment. This revision now requires changes to proceed. Looks great. It'll be a nice addition. It feels like `SymbolCast` is a `UnarySymExpr`, but I like to have a distinct entity for this. Anyway. There are a lot more places where w

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. Everything passed this time. Thanks for the patience. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124658/new/ https://reviews.llvm.org/D124658 _

[PATCH] D125379: [analyzer][solver] Do not negate unsigned ranges

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Seems reasonable. Comment at: clang/test/Analysis/constraint_manager_negate_difference.c:145-148 +// FIXME only the TRUE case should appear. But it is better to be +// conservative than faulty. +clang_analyzer_eval(n - m == 1); // expected-

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:107 +return makeNonLoc(X.castAs().getSymbol(), UO_Not, + X.getType(Context)); default: I'm not sure if we should rely on `SVal::getType()`.

[PATCH] D125360: [analyzer] Add taint to the BoolAssignmentChecker

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. It turns out this only makes sense for `Obj-C` code :D Anyway, it looks good. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125360/new/ https://reviews.llvm.org/D125360 ___ cfe-

[PATCH] D125362: [NFC][analyzer] Transitive interestingness in BugReporter

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. I think since it changes how taint spreads, this patch deserves a test. Could you please demonstrate the correctness of this patch? Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2267 + for (SymbolRef SubSym : SubSyms) { +if (SymbolData

[PATCH] D125365: [NFC][analyzer] Pass down a State and a Pred ExplodedNode in the MallocChecker

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Also mention in the summary that we are doing this because we want to do multiple transitions with different NoteTags at different handlers there. For E.g. we want to put NoteTags when we do a taint propagation. That being said, now we model the extent of the allocated

[PATCH] D125362: [NFC][analyzer] Transitive interestingness in BugReporter

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D125362#3506545 , @balazske wrote: > Is it problem if `markNotInteresting` is used on a symbol that was marked > interesting and has subregions? In that case, the sub-symbols will remain still interesting. We might need to t

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Great content! I've got a long list of nits though. Nothing personal :D Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1453 +const RangeSet *NegatedRange = nullptr; +if (const UnarySymExpr *USE = dyn_cast(Sym)) { + if

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 428724. steakhal added a comment. - Ignore `extern "C++"` blocks; also added a test for this. - Also ignore `LinkageSpecDecl`s without braces. - Clear the `IncludesToBeProcessed` list at the end of each translation unit. Repository: rG LLVM Github Monorep

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-11 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked 2 inline comments as done. steakhal added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:70-73 +auto ExternCBlockBegin = +SM.getDecomposedExpansionLoc(LinkSpecDecl->getBeginLoc()); +auto ExternCBlock

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-12 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked 6 inline comments as done. steakhal added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:87-88 const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) { -PP->addPPCallbacks( -::s

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-12 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked 3 inline comments as done. steakhal added a comment. In D125209#3508573 , @whisperity wrote: > LGTM. Some typos inline. Also I think this is a significant enough bug-fix > that it warrants an entry in the Release Notes under `Changes to

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-12 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 428904. steakhal marked an inline comment as done. steakhal added a comment. - Fix typos. - Mention this in the release notes. - `clang-format` the test file as well. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.or

[PATCH] D125463: [analyzer][NFC] Tighten some of the SValBuilder return types

2022-05-12 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, ASDenysPetrov. Herald added subscribers: manas, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: All. steak

[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

2022-05-12 Thread Balázs Benics via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG14742443a258: Reland "[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible" (authored by tomasz-kaminski-sonarsource, committed b

[PATCH] D125532: [analyzer] Introduce clang_analyzer_dumpSvalType introspection function

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added a reviewer: martong. Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: All. steakhal

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:107 +return makeNonLoc(X.castAs().getSymbol(), UO_Not, + X.getType(Context)); default: martong wrote: > steakhal wrote: > > I'm not sure if

[PATCH] D125524: [BoundV2] ArrayBoundV2 checks if the extent is tainted

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:208 if (state_exceedsUpperBound && state_withinUpperBound) { - SVal ByteOffset = rawOffset.getByteOffset(); - if (isTainted(state, ByteOffset)) { + if (isTain

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. minor nits; Thanks Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h:258 + static inline llvm::SMTExprRef fromUnary(llvm::SMTSolverRef &Solve

[PATCH] D125532: [analyzer] Introduce clang_analyzer_dumpSvalType introspection function

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked an inline comment as done. steakhal added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:268 + QualType Ty = C.getSVal(Arg).getType(C.getASTContext()); + reportBug(Ty.getAsString(), C); +} martong wrote:

[PATCH] D125395: [analyzer][solver] Handle UnarySymExpr in RangeConstraintSolver

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125395/new/ https://reviews.llvm.org/D125395 ___

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG7e3ea55da88a: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.ll

[PATCH] D125463: [analyzer][NFC] Tighten some of the SValBuilder return types

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGd5ffc1ed8b62: [analyzer][NFC] Tighten some of the SValBuilder return types (authored by steakhal). Changed prior to commit: https://reviews.llvm.org/D125463?vs=428918&id=429244#toc Repository: rG LLV

[PATCH] D125532: [analyzer] Introduce clang_analyzer_dumpSvalType introspection function

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. steakhal marked an inline comment as done. Closed by commit rGa1025e6ffe9b: [analyzer] Introduce clang_analyzer_dumpSvalType introspection function (authored by steakhal). Repository: rG LLVM Github Monorepo CHANGES SINC

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-13 Thread Balázs Benics via Phabricator via cfe-commits
steakhal reopened this revision. steakhal added a comment. This revision is now accepted and ready to land. It seems like we cannot use the sorting I did. The warning within the `mylib.h` header will have a different FileID than the original TU. Consequently, the `upper_bound()` `lower_bound()`

[PATCH] D125547: [analyzer][solver] Handle UnarySymExpr in SMTConv

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Something is messed up with the diff. You refer to `fromUnOp()` but it's not defined anywhere. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125547/new/ https://reviews.llvm.org/D125547 __

[PATCH] D125318: [analyzer] Add UnarySymExpr

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision. steakhal added inline comments. This revision is now accepted and ready to land. Comment at: clang/test/Analysis/unary-sym-expr.c:35 +return; + clang_analyzer_eval(-(x + y) == -3); // expected-warning{{TRUE}} +} martong wrote

[PATCH] D125706: [analyzer][NFC] Use idiomatic classof instead of isKind

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, balazske, ASDenysPetrov, bzcheeseman. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requeste

[PATCH] D125707: [analyzer][NFC] Remove unused friend SVal declarations

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, balazske, ASDenysPetrov, bzcheeseman. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requeste

[PATCH] D125708: [analyzer][NFC] Remove unused default SVal constructors

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, balazske, ASDenysPetrov, bzcheeseman. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requeste

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, balazske, ASDenysPetrov, bzcheeseman. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a project: All. steakhal requeste

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 429947. steakhal added a comment. Use `cast` and `dyn_cast` in `castAs` and `getAs` respecitvely. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125709/new/ https://reviews.llvm.org/D125709 Files: clang/incl

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal marked an inline comment as done. steakhal added a comment. I had to fix the `doIt` to return `To` instead of `Optional` to make it work. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125709/new/ https://reviews.llvm.org/D125709

[PATCH] D125749: [analyzer][NFC] Introduce SVal::isa

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, martong, Szelethus, balazske, ASDenysPetrov, bzcheeseman, xazax.hun. Herald added subscribers: manas, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. Herald added a project: All. steakhal requeste

[PATCH] D125749: [analyzer][NFC] Introduce SVal::isa

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h:99-100 + template bool isa() const { return llvm::isa(*this); } + /// Convert to the specified SVal type, asserting that this SVal is of This is the

[PATCH] D125749: [analyzer][NFC] Introduce SVal::isa

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 429960. steakhal added a comment. Refactor in the `getAs` uses of `clang/include/StaticAnalyzer` directory as well. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125749/new/ https://reviews.llvm.org/D125749

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 430012. steakhal added a comment. This revision is now accepted and ready to land. - Copy the `mylib.h` under the build directory to have deterministic relative order to the LIT test file. - Use `SourceManager::isBeforeInTranslationUnit` instead of the fancy

[PATCH] D125769: [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh. Herald added subscribers: carlosgalvezp, martong, rnkovacs, xazax.hun. Herald added a project: All. steakhal requested review of this revision. Herald added a project: clang-tools-extra.

[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh. Herald added subscribers: carlosgalvezp, martong, rnkovacs, xazax.hun. Herald added a project: All. steakhal requested review of this revision. Herald added a project: clang-tools-extra.

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh. Herald added subscribers: martong, rnkovacs, xazax.hun. Herald added a project: All. steakhal requested review of this revision. Herald added a project: clang-tools-extra. Herald added a

[PATCH] D125709: [analyzer][Casting] Support isa, cast, dyn_cast of SVals

2022-05-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D125709#3518242 , @martong wrote: >> I'm not sure, shall I add tests? > > Yes, please. Unit tests for `dyn_cast` and `isa` should be easy. However, I > am not sure how to test `cast` for the failure cases. What if we were us

<    1   2   3   4   5   6   7   8   9   10   >