[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -32,42 +32,72 @@ using namespace taint; namespace { class ArrayBoundCheckerV2 : public Checker { - mutable std::unique_ptr BT; - mutable std::unique_ptr TaintBT; + BugType BT{this,

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/67572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-19 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. No blocking comments. https://github.com/llvm/llvm-project/pull/67572 ___ cfe-commits mailing list

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
@@ -609,9 +617,13 @@ storeWhenMoreInformative(ProgramStateRef , SymbolRef Sym, /// symbol and the destination type of the cast are unrelated, report an error. void DynamicTypePropagation::checkPostStmt(const CastExpr *CE,

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
@@ -392,19 +393,26 @@ void DynamicTypePropagation::checkPostCall(const CallEvent , } } -/// TODO: Handle explicit casts. -/// Handle C++ casts. -/// -/// Precondition: the cast is between ObjCObjectPointers. ExplodedNode

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
@@ -392,19 +393,26 @@ void DynamicTypePropagation::checkPostCall(const CallEvent , } } -/// TODO: Handle explicit casts. -/// Handle C++ casts. -/// -/// Precondition: the cast is between ObjCObjectPointers. ExplodedNode

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/69057 >From 8ed4effd114ebd83d4ceaa37655ffd9b7105b28e Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sat, 14 Oct 2023 15:51:42 +0200 Subject: [PATCH 1/4] [analyzer] Trust base to derived casts for dynamic types

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/69057 >From 8ed4effd114ebd83d4ceaa37655ffd9b7105b28e Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sat, 14 Oct 2023 15:51:42 +0200 Subject: [PATCH 1/3] [analyzer] Trust base to derived casts for dynamic types

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-16 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,105 @@ +// RUN: %clang_analyze_cc1 %s -verify \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=alpha.security.taint.TaintPropagation \ +// RUN: -analyzer-checker=debug.ExprInspection + +// See issue https://github.com/llvm/llvm-project/issues/62663

[clang] [analyzer][NFC] Remove outdated FIXME comment (PR #68211)

2023-10-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: LGTM Thanks. https://github.com/llvm/llvm-project/pull/68211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix note for member reference (PR #68691)

2023-10-15 Thread Balazs Benics via cfe-commits
=?utf-8?q?G=C3=A1bor?= Spaits,=?utf-8?q?G=C3=A1bor?= Spaits, =?utf-8?q?G=C3=A1bor?= Spaits Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/68691 ___ cfe-commits mailing list

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
@@ -32,42 +32,72 @@ using namespace taint; namespace { class ArrayBoundCheckerV2 : public Checker { - mutable std::unique_ptr BT; - mutable std::unique_ptr TaintBT; + BugType BT{this, "Out-of-bound access"}; + BugType TaintBT{this, "Out-of-bound access",

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
@@ -32,42 +32,72 @@ using namespace taint; namespace { class ArrayBoundCheckerV2 : public Checker { - mutable std::unique_ptr BT; - mutable std::unique_ptr TaintBT; + BugType BT{this, "Out-of-bound access"}; + BugType TaintBT{this, "Out-of-bound access",

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
@@ -32,42 +32,72 @@ using namespace taint; namespace { class ArrayBoundCheckerV2 : public Checker { - mutable std::unique_ptr BT; - mutable std::unique_ptr TaintBT; + BugType BT{this, "Out-of-bound access"}; + BugType TaintBT{this, "Out-of-bound access",

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
@@ -32,42 +32,72 @@ using namespace taint; namespace { class ArrayBoundCheckerV2 : public Checker { - mutable std::unique_ptr BT; - mutable std::unique_ptr TaintBT; + BugType BT{this, "Out-of-bound access"}; + BugType TaintBT{this, "Out-of-bound access",

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/67572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-10-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/67572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Trust base to derived casts for dynamic types (PR #69057)

2023-10-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/69057 When doing a base to derived cast, and we should add a cast info recording that fact. This information will be then used for example inside `CXXInstanceCall::getRuntimeDefinition` (CallEvent.cpp), where for

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-09-29 Thread Balazs Benics via cfe-commits
steakhal wrote: > I'm confident that this patch is NFC, but my claim is based on theoretical > reasoning (a.k.a. "I think I didn't make a mistake"). I have a background in > theoretical mathematics, so for me "I have a rough a proof in my head" is > intuitively stronger than "I verified it on

[clang] [analyzer][NFC] Simplifications in ArrayBoundV2 (PR #67572)

2023-09-29 Thread Balazs Benics via cfe-commits
steakhal wrote: I remember I looked this once. I postponed my comments because I was expecting some numbers or confirmation of that this patch is indeed NFC, thus no report or notes change. I'm not sure if this actually holds, given the changes, but let me know in any case. BTW I'm fine with

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -532,6 +532,27 @@ def MismatchedDeallocatorChecker : Checker<"MismatchedDeallocator">, Dependencies<[DynamicMemoryModeling]>, Documentation; +def StdCLibraryFunctionsChecker : Checker<"StdCLibraryFunctions">, + HelpText<"Check for invalid arguments of C standard

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -1026,6 +1026,100 @@ Check for null pointers being passed as arguments to C string functions: return strlen(0); // warn } +.. _unix-StdCLibraryFunctions: + +unix.StdCLibraryFunctions (C) +""" +Check for calls of standard library

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -1026,6 +1026,100 @@ Check for null pointers being passed as arguments to C string functions: return strlen(0); // warn } +.. _unix-StdCLibraryFunctions: + +unix.StdCLibraryFunctions (C) +""" +Check for calls of standard library

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -1026,6 +1026,100 @@ Check for null pointers being passed as arguments to C string functions: return strlen(0); // warn } +.. _unix-StdCLibraryFunctions: + +unix.StdCLibraryFunctions (C) +""" steakhal wrote: Align this

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -2651,100 +2745,6 @@ For a more detailed description of configuration options, please see the alpha.unix ^^^ steakhal wrote: As we are here, could you align this with its section title as well? https://github.com/llvm/llvm-project/pull/66207

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -1026,6 +1026,100 @@ Check for null pointers being passed as arguments to C string functions: return strlen(0); // warn } +.. _unix-StdCLibraryFunctions: + +unix.StdCLibraryFunctions (C) +""" +Check for calls of standard library

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
@@ -1026,6 +1026,100 @@ Check for null pointers being passed as arguments to C string functions: return strlen(0); // warn } +.. _unix-StdCLibraryFunctions: + +unix.StdCLibraryFunctions (C) +""" +Check for calls of standard library

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. I didn't spent much time on this, but I think it should be good. Please check the docs with Grammarly to catch mistakes. Also, please generate the HTML for the rst to verify how it looks. I'm not sure if the release docs mentions this, but

[clang] [clang][analyzer] Move checker alpha.unix.StdCLibraryFunctions out of alpha. (PR #66207)

2023-09-29 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/66207 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Remove inaccurate legacy handling of bad bitwise shifts (PR #66647)

2023-09-29 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Should be good. Feel free to merge this. Sorry for it taking so long. https://github.com/llvm/llvm-project/pull/66647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [analyzer] Add std::variant checker (PR #66481)

2023-09-28 Thread Balazs Benics via cfe-commits
steakhal wrote: @DonatNagyE I can see you all have a lot of PRs. I have limited time, but I think I can do two this week. Maybe one next week. In what order should I go through the PRs? I guess, this one should be in the lucky two. https://github.com/llvm/llvm-project/pull/66481

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-28 Thread Balazs Benics via cfe-commits
steakhal wrote: @DonatNagyE I can see you all have a lot of PRs. I have limited time, but I think I can do two this week. Maybe one next week. In what order should I go through the PRs? I guess, this one should be in the lucky two. https://github.com/llvm/llvm-project/pull/66481

[clang] [analyzer] Fix crash in BasicValueFactory.cpp with __int128_t integers (PR #67212)

2023-09-27 Thread Balazs Benics via cfe-commits
steakhal wrote: I support changes like this. However, I think we should prefer reusing existing test files to creating more and more new ones. That has one benefit to me, one can see multiple cases of the topic on one screen without jumping around to open multiple. But that's all. I don't

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/67331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
steakhal wrote: Thanks for the review @erichkeane! https://github.com/llvm/llvm-project/pull/67331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/67331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/67331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
steakhal wrote: > Also, it appears that the clang-format bot dislikes this commit (but > frustratingly won't tell us why?), so perhaps run `git clang-format against > all the commits here` Yup, I have it on save already. It complains about lines I never touched. As per guidelines, I only run

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
@@ -320,11 +320,12 @@ namespace { } std::string getIsOmitted() const override { - if (type == "IdentifierInfo *") + StringRef T = type; + if (T == "IdentifierInfo *" || T == "Expr *") return "!get" + getUpperName().str() + "()"; - if (type

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/67331 >From 988dcf4f568a58d9b1127b2adf8890a7c7867ac5 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Mon, 25 Sep 2023 15:37:34 +0200 Subject: [PATCH 1/2] [clang] Fix pretty-printing assume_aligned attributes

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/67331 >From 988dcf4f568a58d9b1127b2adf8890a7c7867ac5 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Mon, 25 Sep 2023 15:37:34 +0200 Subject: [PATCH] [clang] Fix pretty-printing assume_aligned attributes Inside

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
@@ -320,10 +320,11 @@ namespace { } std::string getIsOmitted() const override { - if (type == "IdentifierInfo *") -return "!get" + getUpperName().str() + "()"; - if (type == "TypeSourceInfo *") + StringRef T = type; + if (T ==

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/67331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-26 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/67331 >From 67e19382fb45fe5e06a5c8de2e7b1434c8b1c68f Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Mon, 25 Sep 2023 15:37:34 +0200 Subject: [PATCH] [clang] Fix pretty-printing assume_aligned attributes Inside

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-25 Thread Balazs Benics via cfe-commits
@@ -320,10 +320,11 @@ namespace { } std::string getIsOmitted() const override { - if (type == "IdentifierInfo *") -return "!get" + getUpperName().str() + "()"; - if (type == "TypeSourceInfo *") + StringRef T = type; + if (T ==

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-25 Thread Balazs Benics via cfe-commits
@@ -320,10 +320,11 @@ namespace { } std::string getIsOmitted() const override { - if (type == "IdentifierInfo *") -return "!get" + getUpperName().str() + "()"; - if (type == "TypeSourceInfo *") + StringRef T = type; + if (T ==

[clang] [clang] Fix pretty-printing assume_aligned attributes (PR #67331)

2023-09-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/67331 Inside `writePrettyPrintFunction()`, we check if we need to emit the given argument: ```C++ if (!arg->isOptional() || arg->getIsOmitted() == "false") { FoundNonOptArg = true; continue; } ``` For the

[clang] [analyzer] Fix taint sink rules for exec-like functions (PR #66358)

2023-09-21 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/66358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix taint sink rules for exec-like functions (PR #66358)

2023-09-21 Thread Balazs Benics via cfe-commits
steakhal wrote: @DonatNagyE Any news on this? https://github.com/llvm/llvm-project/pull/66358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Remove inaccurate legacy handling of bad bitwise shifts (PR #66647)

2023-09-21 Thread Balazs Benics via cfe-commits
steakhal wrote: I think I'm fine with the numbers. Note that I could not inspect individual reports because the URL likely refers to some internal server on your side. Anyway, I'd recommend keeping the test files for two reasons: - It's probably not a big deal, we are talking about ~150 lines

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-20 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/66493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-20 Thread Balazs Benics via cfe-commits
steakhal wrote: Fixed tests for Windows, to use `size_t` for operator new. I'll land this if premerge-tests pass. https://github.com/llvm/llvm-project/pull/66493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-20 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/66493 >From 895826d0c2d65f5282096562bc5e015d511afbbf Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 20 Sep 2023 12:50:36 +0200 Subject: [PATCH] [analyzer] Fix StackAddrEscapeChecker crash on temporary

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-20 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/66493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-19 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] TaintPropagation checker strlen() should not propagate (PR #66086)

2023-09-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. I hope in the future we will have a more satisfying solution. LGTM. https://github.com/llvm/llvm-project/pull/66086 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Remove inaccurate legacy handling of bad bitwise shifts (PR #66647)

2023-09-18 Thread Balazs Benics via cfe-commits
steakhal wrote: What report diff's should we expect? https://github.com/llvm/llvm-project/pull/66647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Do not use APInt methods on _BitInt() Types (PR #65887)

2023-09-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. What are the semantics of assigning a wider biting to a smaller one? BTW LGTM. https://github.com/llvm/llvm-project/pull/65887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -318,6 +318,10 @@ def C11LockChecker : Checker<"C11Lock">, Dependencies<[PthreadLockBase]>, Documentation; +def StdVariantChecker : Checker<"StdVariant">, + HelpText<"Check wether we access the right type stored in std::variant">, steakhal wrote:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: This is my first round of review. So far it looks good. I didn't have much time, but that's all I had. I think it would make sense to have tests for variants containing variants and playing with the active members. That would be interesting to see.

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,128 @@ +//===- TaggedUnionModeling.h -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/66481 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add std::variant checker (PR #66481)

2023-09-18 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,312 @@ +//===- StdVariantChecker.cpp -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier:

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-18 Thread Balazs Benics via cfe-commits
steakhal wrote: Let me know if you are still okay with the latest change. @DonatNagyE @Xazax-hun https://github.com/llvm/llvm-project/pull/66493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-18 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/66493 >From cfdbc40487481b341d42f0472e196ff4bd33 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Fri, 15 Sep 2023 12:42:39 +0200 Subject: [PATCH 1/2] [analyzer] Fix StackAddrEscapeChecker crash on temporary

[clang] [analyzer] TaintPropagation checker strlen() should not propagate (PR #66086)

2023-09-18 Thread Balazs Benics via cfe-commits
steakhal wrote: As I'm not a maintainer, I could not push to your branch. Here is a patch that I think has the missing pieces to satisfy my review.

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -398,7 +400,7 @@ void StackAddrEscapeChecker::checkEndFunction(const ReturnStmt *RS, }(Referrer->getMemorySpace()); // This cast supposed to succeed. steakhal wrote: > I think the best would be either a comment that explains _why_ we expect a >

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66498)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/66498 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66498)

2023-09-15 Thread Balazs Benics via cfe-commits
steakhal wrote: Pushed manually with an adjusted commit message: https://github.com/llvm/llvm-project/commit/7c9abbd8a41e85a7e82a454c62138ea72f981597 https://github.com/llvm/llvm-project/pull/66498 ___ cfe-commits mailing list

[clang] 7c9abbd - Reapply [analyzer] Simplify SVal for simple NonLoc->Loc casts

2023-09-15 Thread Balazs Benics via cfe-commits
Author: dingfei Date: 2023-09-15T15:07:39+02:00 New Revision: 7c9abbd8a41e85a7e82a454c62138ea72f981597 URL: https://github.com/llvm/llvm-project/commit/7c9abbd8a41e85a7e82a454c62138ea72f981597 DIFF: https://github.com/llvm/llvm-project/commit/7c9abbd8a41e85a7e82a454c62138ea72f981597.diff LOG:

[clang] [analyzer] Reduce constraint on modulo with small concrete range (PR #65448)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/65448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Reduce constraint on modulo with small concrete range (PR #65448)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Uh, this isn't my expertiese. I'm a bit scared to do this alone. I'm also short on time to verify this patch at scale. https://github.com/llvm/llvm-project/pull/65448 ___ cfe-commits mailing list

[clang] [analyzer] Reduce constraint on modulo with small concrete range (PR #65448)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -1824,6 +1835,94 @@ RangeSet SymbolicRangeInferrer::VisitBinaryOperator(Range LHS, return {RangeFactory, ValueFactory.getValue(Min), ValueFactory.getValue(Max)}; } +RangeSet SymbolicRangeInferrer::handleConcreteModulo(Range LHS, +

[clang] [analyzer] Reduce constraint on modulo with small concrete range (PR #65448)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -1824,6 +1835,94 @@ RangeSet SymbolicRangeInferrer::VisitBinaryOperator(Range LHS, return {RangeFactory, ValueFactory.getValue(Min), ValueFactory.getValue(Max)}; } +RangeSet SymbolicRangeInferrer::handleConcreteModulo(Range LHS, +

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -398,7 +400,7 @@ void StackAddrEscapeChecker::checkEndFunction(const ReturnStmt *RS, }(Referrer->getMemorySpace()); // This cast supposed to succeed. steakhal wrote: I was thinking about it once you raised this comment. To me, to have a proper

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
steakhal wrote: I thought "Mergeing" would wait and confirm if the checks pass, and only merge it if they succeed. Apparently, it's not the case here xD The tests now break even on x86 linux. Could you please have a look? @danix800 https://github.com/llvm/llvm-project/pull/66463

[clang] 03693d5 - Revert "[analyzer] Simplify SVal for simple NonLoc->Loc casts (#66463)"

2023-09-15 Thread Balazs Benics via cfe-commits
Author: Balazs Benics Date: 2023-09-15T13:18:34+02:00 New Revision: 03693d5b40f187921ead5a502fa3cf72ce30fea4 URL: https://github.com/llvm/llvm-project/commit/03693d5b40f187921ead5a502fa3cf72ce30fea4 DIFF: https://github.com/llvm/llvm-project/commit/03693d5b40f187921ead5a502fa3cf72ce30fea4.diff

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal resolved https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/66493 Basically, the issue was that we should have unwrap the base region before we special handle temp object regions. Fixes https://github.com/llvm/llvm-project/issues/66221 I also decided to add some extra range

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: I like it. Thanks! This is pretty much good to go, but let's have a short discussion first. https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -264,7 +264,8 @@ ProgramStateRef ExprEngine::handleLValueBitCast( } // Delegate to SValBuilder to process. SVal OrigV = state->getSVal(Ex, LCtx); - SVal V = svalBuilder.evalCast(OrigV, T, ExTy); + SVal SimplifiedOrigV = svalBuilder.simplifySVal(state, OrigV); +

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false \ +// RUN: -verify + +void clang_analyzer_eval(int); + +void

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false \ +// RUN: -verify + +void clang_analyzer_eval(int); + +void

[clang] [analyzer] Simplify SVal for simple NonLoc->Loc casts (PR #66463)

2023-09-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/66463 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    3   4   5   6   7   8   9   10   11   >