[clang] [clang][ASTImporter] fix variable inline of CXX17 (PR #87314)

2024-04-02 Thread Balazs Benics via cfe-commits
@@ -5317,6 +5317,34 @@ TEST_P(ASTImporterOptionSpecificTestBase, EXPECT_FALSE(ToX); } +TEST_P(ASTImporterOptionSpecificTestBase, VarTemplateDeclInlineWithCXX17) { + Decl *FromTU = getTuDecl( + R"( + struct S { +template static constexpr bool X = true; +

[clang] [clang][analyzer] Add "pedantic" mode to StreamChecker. (PR #87322)

2024-04-02 Thread Balazs Benics via cfe-commits
steakhal wrote: > > Unless you plan to add more heuristics, I'd prefer a more concrete option > > name, like AssumeSuccessfulWrites=true. This would better describe it imo. > > I do not like totally the name "Pedantic", it could be > "AssumeOftenUncheckedOperationsMayFail". I am not sure if th

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-05 Thread Balazs Benics via cfe-commits
@@ -2516,6 +2518,47 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call) const { + DestinationArgExp

[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: The patch looks a lot better this way. Thanks! I'd recommend adding this test to the existing `clang/test/Analysis/cxx2b-deducing-this.cpp` test file to have all deducing this testcases at a common place. https://github.com/llvm/llvm-project/pull/83585 _

[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/83585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

2024-03-05 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -std=c++23 -verify %s +// expected-no-diagnostics + +struct S { + bool operator==(this auto, S) { +return true; + } +}; +int use_deducing_this() { + return S{} == S{}; steakhal wrote: ```s

[clang] Reapply "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, … (PR #83281)

2024-03-05 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: steakhal wrote: @alejandro-alvarez-sonarsource Should we merge this, and give it a try? https://github.com/llvm/llvm-project/pull/83281 ___ cfe-commits mailing list cfe-commits@l

[clang] [clang][StaticAnalyzer] Crash on loop unrolling mode (PR #82089)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/82089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][StaticAnalyzer] Crash on loop unrolling mode (PR #82089)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/82089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Fix crash in loop unrolling (PR #82089)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/82089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Demonstrate superfluous unsigned >= 0 assumption (PR #78442)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/78442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, … (PR #83281)

2024-03-06 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/83281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] Reapply "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, … (PR #83281)

2024-03-06 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/83281 >From a9419bc3ffa3d383a9373f0a116795162632dd40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Wed, 28 Feb 2

[clang] Reapply "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, … (PR #83281)

2024-03-06 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/83281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [analyzer][NFC] Document check::ASTCodeBody checker callback (PR #84160)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84160 Fixes #73764 With this patch, now all the callbacks are demonstrated here. >From a3da80aa7114d938e9cc3f03ec7941c91fbf Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 6 Mar 2024 13:05:44 +0100 Subje

[clang] [analyzer][NFC] Document check::ASTCodeBody checker callback (PR #84160)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84160 >From a3da80aa7114d938e9cc3f03ec7941c91fbf Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Wed, 6 Mar 2024 13:05:44 +0100 Subject: [PATCH 1/2] [analyzer][NFC] Document check::ASTCodeBody checker callback

[clang] [analyzer][NFC] Document check::ASTCodeBody checker callback (PR #84160)

2024-03-06 Thread Balazs Benics via cfe-commits
@@ -33,30 +33,33 @@ namespace ento { /// checking. /// /// \sa CheckerContext -class CheckerDocumentation : public Checker< check::PreStmt, - check::PostStmt, - check::PreObjCMessage, -

[clang] [analyzer][NFC] Document check::ASTCodeBody checker callback (PR #84160)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/84160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Trim license header comments to 81 characters (PR #82919)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/82919 >From 319329630e0d2a86b22dd435985026ea236f8e56 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 25 Feb 2024 12:48:06 +0100 Subject: [PATCH 1/2] [clang][NFC] Trim license header comments to 81 characters

[clang] [clang][NFC] Trim license header comments to 81 characters (PR #82919)

2024-03-06 Thread Balazs Benics via cfe-commits
@@ -1,10 +1,10 @@ -//===- unittest/ASTMatchers/Dynamic/VariantValueTest.cpp - VariantValue unit tests -===// +// unittest/ASTMatchers/Dynamic/VariantValueTest.cpp - VariantValue unit tests steakhal wrote: Fixed. https://github.com/llvm/llvm-project/pull/82919 _

[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/83585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-06 Thread Balazs Benics via cfe-commits
@@ -1158,6 +1173,123 @@ void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent &Call, C.addTransition(StateFailed); } +ProgramStateRef +StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr, +CheckerContext &C, P

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-06 Thread Balazs Benics via cfe-commits
@@ -13,6 +13,9 @@ #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H +#include "ProgramState_Fwd.h" +#include "SVals.h" + steakhal wrote: ```suggestion ``` https://gith

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,327 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.Stream,debug.ExprInspection -verify %s + +#include "Inputs/system-header-simulator.h" +#include "Inputs/system-header-simulator-for-malloc.h" +#include "Inputs/system-header-simulator-for-valist.h" +

[clang] [analyzer] Demonstrate superfluous unsigned >= 0 assumption (PR #78442)

2024-03-06 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. Still looks good. https://github.com/llvm/llvm-project/pull/78442 ___ cfe-commits mailing list cfe-commits@lis

[clang] [clang][NFC] Trim license header comments to 81 characters (PR #82919)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/82919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Model allocation behavior or getdelim/geline (PR #83138)

2024-03-06 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/83138 ___ cfe-commits mailing list cfe

[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

2024-03-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/83585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Avoid a crash in a debug printout function (PR #79446)

2024-03-06 Thread Balazs Benics via cfe-commits
steakhal wrote: I'm thinking of backporting this to clang-18, but given that it's only developer-facing, I don't think it worth it. WDYT @NagyDonat? https://github.com/llvm/llvm-project/pull/79446 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [clang][analyzer] Fix StreamChecker `ftell` and `fgetpos` at indeterminate file position. (PR #84191)

2024-03-07 Thread Balazs Benics via cfe-commits
@@ -880,6 +883,24 @@ void StreamChecker::preReadWrite(const FnDescription *Desc, } } +void StreamChecker::preWrite(const FnDescription *Desc, const CallEvent &Call, steakhal wrote: Let me share my experience with `std::bind` and with this checker. Unfortuna

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/83027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/83027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1183,6 +1315,20 @@ void StreamChecker::evalGetdelim(const FnDescription *Desc, State->BindExpr(E.CE, C.getLocationContext(), RetVal); StateNotFailed = E.assumeBinOpNN(StateNotFailed, BO_GE, R

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1196,6 +1342,11 @@ void StreamChecker::evalGetdelim(const FnDescription *Desc, E.isStreamEof() ? ErrorFEof : ErrorFEof | ErrorFError; StateFailed = E.setStreamState( StateFailed, StreamState::getOp

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1158,6 +1173,123 @@ void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent &Call, C.addTransition(StateFailed); } +ProgramStateRef +StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1158,6 +1173,123 @@ void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent &Call, C.addTransition(StateFailed); } +ProgramStateRef +StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *

[clang] [clang][analyzer] Fix StreamChecker `ftell` and `fgetpos` at indeterminate file position. (PR #84191)

2024-03-07 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. I haven't gone deep into this PR, but it looks good to me. Please wait for someone else to sign it too. https://github.com/llvm/llvm-project/pull/84191 ___ cfe-commits mailing list cfe-commits@lis

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-07 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/83027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [clang][ASTMatcher] Add matchers for isExplicitObjectMemberFunction() (PR #84446)

2024-03-08 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84446 Note that this patch will be necessary to fix `forEachArgumentWithParam()` and `forEachArgumentWithParamType()` matchers for deducing "this"; which is my true motivation. >From 9ffc1b9ec60a9638c5b07cb25574ddb2

[clang] [clang][ASTMatcher] Add matchers for isExplicitObjectMemberFunction() (PR #84446)

2024-03-08 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTMatcher] Add matchers for isExplicitObjectMemberFunction() (PR #84446)

2024-03-08 Thread Balazs Benics via cfe-commits
steakhal wrote: Thanks for the prompt review @PiotrZSL! I plan to merge it by the end of the day, unless someone objects. https://github.com/llvm/llvm-project/pull/84446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [clang][ASTMatcher] Add matchers for isExplicitObjectMemberFunction() (PR #84446)

2024-03-08 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/84446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/83675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

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

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -165,6 +165,8 @@ class CStringChecker : public Checker< eval::Call, {{CDM::CLibrary, {"explicit_bzero"}, 2}, &CStringChecker::evalBzero}, {{CDM::CLibrary, {"sprintf"}, 2}, &CStringChecker::evalSprintf}, {{CDM::CLibrary, {"snprintf"}, 2}, &CStringChecker::ev

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -529,3 +529,42 @@ void nocrash_on_locint_offset(void *addr, void* from, struct S s) { size_t iAdd = (size_t) addr; memcpy(((void *) &(s.f)), from, iAdd); } + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +/* present in both glibc 2.25 and musl

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call, CharKind CK) const { ---

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call, CharKind CK) const { + Dest

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2516,6 +2518,47 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call) const { + DestinationArgExp

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call, CharKind CK) const { + Dest

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -219,6 +221,7 @@ class CStringChecker : public Checker< eval::Call, void evalSnprintf(CheckerContext &C, const CallEvent &Call) const; void evalSprintfCommon(CheckerContext &C, const CallEvent &Call, bool IsBounded, bool IsBuiltin) const; + void

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call, CharKind CK) const { + Dest

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -529,3 +529,42 @@ void nocrash_on_locint_offset(void *addr, void* from, struct S s) { size_t iAdd = (size_t) addr; memcpy(((void *) &(s.f)), from, iAdd); } + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +/* present in both glibc 2.25 and musl

[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)

2024-03-08 Thread Balazs Benics via cfe-commits
@@ -2515,6 +2518,57 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call, C.addTransition(State); } +void CStringChecker::evalGetentropy(CheckerContext &C, +const CallEvent &Call, CharKind CK) const { + Dest

[clang] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-08 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 commented: Looks good to me, but I'd be more eased if had seen some unittests for this matter. You could use AST-matchers selecting different FunctionDecls and query them using this free-func

[clang] [analyzer] Mention possibility of underflow in array overflow errors (PR #84201)

2024-03-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: @@ -109,6 +136,33 @@ int *potentialAfterTheEndPtr(int idx) { // &TenElements[idx]. } +int overflowOrUnderflow(int arg) { + // expected-note@+2 {{Assuming 'arg' is < 0}} + // expected-note@+1 {{Taking false branch}} + if (

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-08 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=, Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID:

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-08 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/steakhal edited https://gi

[clang] f07157e - Fixup 7457e2c1535acd54 by adding a switch case

2024-03-08 Thread Balazs Benics via cfe-commits
Author: Balazs Benics Date: 2024-03-08T14:55:10+01:00 New Revision: f07157eb2e8212068cb9469d77f9bc3779ef2ea4 URL: https://github.com/llvm/llvm-project/commit/f07157eb2e8212068cb9469d77f9bc3779ef2ea4 DIFF: https://github.com/llvm/llvm-project/commit/f07157eb2e8212068cb9469d77f9bc3779ef2ea4.diff

[clang] [clang][ASTMatcher] Add matchers for isExplicitObjectMemberFunction() (PR #84446)

2024-03-08 Thread Balazs Benics via cfe-commits
steakhal wrote: I had to push a fixup commit, because I forgot about one switch-case. https://github.com/llvm/llvm-project/commit/f07157eb2e8212068cb9469d77f9bc3779ef2ea4 I pushed it already to fix the build bot, but let me know if you disagree with the fix. https://github.com/llvm/llvm-projec

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-08 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -1158,6 +1173,118 @@ void

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-08 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: steakhal wrote: > This functionality could be

[clang] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-08 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: steakhal wrote: > I feel that I'm getting bogged down in this area with changes that are more > general than what's strictly necessary and only tangentially related to my > real goals... > > I'm not familiar with the u

[clang] [analyzer] Turn NodeBuilderContext into a class (PR #84638)

2024-03-10 Thread Balazs Benics via cfe-commits
steakhal wrote: Thanks for the PR. I think it would make sense to not expose data members in a class' public api. We might need some member functions along the way to make this possible. https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits m

[clang] [analyzer] Turn NodeBuilderContext into a class (PR #84638)

2024-03-10 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. See my previous reply. https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [analyzer] Turn NodeBuilderContext into a class (PR #84638)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Turn NodeBuilderContext into a class (PR #84638)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Alright. So we can simply mark all the members private. I was surprised a bit. LGTM, but remove the TODO comment you fix. https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@li

[clang] [analyzer] Turn NodeBuilderContext into a class (PR #84638)

2024-03-11 Thread Balazs Benics via cfe-commits
@@ -194,11 +194,12 @@ class CoreEngine { }; // TODO: Turn into a class. steakhal wrote: Remove this TODO, as its completed. https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@l

[clang] [analyzer] Mention possibility of underflow in array overflow errors (PR #84201)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy ,NagyDonat Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. I scrolled over, and it looks harmless, so LGTM. https://github.com/llvm/llvm-project/pull/84201 ___ cfe-commits mailing list cf

[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)

2024-03-11 Thread Balazs Benics via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: steakhal wrote: > I want to avoid that some f

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

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

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy ,Balazs Benics Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. I'm good now. https://github.com/llvm/llvm-project/pull/84469 ___ cfe-commits mailing list cfe

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,Balazs Benics Message-ID: In-Reply-To: @@ -0,0 +1,89 @@ +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Frontend/ASTUni

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,Balazs Benics Message-ID: In-Reply-To: @@ -0,0 +1,89 @@ +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Frontend/ASTUni

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy ,Balazs Benics Message-ID: In-Reply-To: @@ -0,0 +1,89 @@ +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Front

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-11 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy ,Balazs Benics Message-ID: In-Reply-To: https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/84469 ___ cfe-commits mailing list cfe-commits@lists

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84823 When debugging CSA issues, sometimes it would be useful to have a dedicated note for the analysis entry point, aka. the function name you would need to pass as "-analyze-function=XYZ" to reproduce a specific is

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal unassigned https://github.com/llvm/llvm-project/pull/84823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal unassigned https://github.com/llvm/llvm-project/pull/84823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal unassigned https://github.com/llvm/llvm-project/pull/84823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Set and display CSA analysis entry points as notes on debugging (PR #84823)

2024-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal unassigned https://github.com/llvm/llvm-project/pull/84823 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84887 This is a follow-up commit of #84446. In this patch, I demonstrate that `forEachArgumentWithParam` and `forEachArgumentWithParamType` did not correctly handle the presence of the explicit object parameter for o

[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

2024-03-12 Thread Balazs Benics via cfe-commits
@@ -5121,11 +5142,12 @@ AST_POLYMORPHIC_MATCHER_P2(forEachArgumentWithParamType, // argument of the method which should not be matched against a parameter, so // we skip over it here. BoundNodesTreeBuilder Matches; - unsigned ArgIndex = cxxOperatorCallExpr(callee(cxxMeth

[clang] [clang][ASTMatchers] Fix forEachArgumentWithParam* for deducing "this" operator calls (PR #84887)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/84887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Turn NodeBuilderContext into a class (PR #84638)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Turn NodeBuilderContext into a class (PR #84638)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/84638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-12 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,Balazs Benics ,NagyDonat Message-ID: In-Reply-To: steakhal wrote: Thanks! Indeed, it looks like valgrind also complains: ``` [ RUN ] IsCLibraryFunctionTest.AcceptsGlobal ==999215== Invalid read of size 1 ==999215==at 0x15420D0: hasAttr

[clang] [llvm] Reapply "[analyzer] Accept C library functions from the `std` namespace" (#84926) (PR #84963)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84963 Relands PR #84926, after resolving use-after-free of the AST of the unittest xD Pretty silly bug, I must admit. >From a88c479c8c1141af65887829e27194b2715ebfb2 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date:

[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

2024-03-12 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,Balazs Benics ,NagyDonat Message-ID: In-Reply-To: steakhal wrote: I proposed the PR #84963 for relanding this, including the fix for the use-after-free of the AST of the unittest. https://github.com/llvm/llvm-project/pull/84469 __

[clang] [llvm] Reapply "[analyzer] Accept C library functions from the `std` namespace" (#84926) (PR #84963)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84963 >From a88c479c8c1141af65887829e27194b2715ebfb2 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 12 Mar 2024 18:24:26 +0100 Subject: [PATCH 1/3] Reapply "[analyzer] Accept C library functions from the `st

[clang] [analyzer] Support C++23 static operator calls (PR #84972)

2024-03-12 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/84972 Made by following: https://github.com/llvm/llvm-project/pull/83585#issuecomment-1980340866 Thanks for the details Tomek! >From 9860dad609c8a27dfaa178af5b72285e3ad050fd Mon Sep 17 00:00:00 2001 From: Balazs Beni

[clang] [analyzer] Support C++23 static operator calls (PR #84972)

2024-03-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84972 >From 9860dad609c8a27dfaa178af5b72285e3ad050fd Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 12 Mar 2024 19:55:29 +0100 Subject: [PATCH 1/2] [analyzer] Support C++23 static operator calls Made by foll

[clang] [analyzer] Support C++23 static operator calls (PR #84972)

2024-03-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84972 >From 9860dad609c8a27dfaa178af5b72285e3ad050fd Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 12 Mar 2024 19:55:29 +0100 Subject: [PATCH 1/3] [analyzer] Support C++23 static operator calls Made by foll

[clang] [analyzer] Support C++23 static operator calls (PR #84972)

2024-03-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/84972 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reapply "[analyzer] Accept C library functions from the `std` namespace" (#84926) (PR #84963)

2024-03-13 Thread Balazs Benics via cfe-commits
steakhal wrote: You gave approval for the fix for the buggy tests I suggested. I think there is nothing wrong with this. Thanks for having a look at my fix. Ill recommit this as you authored, and I coauthored. https://github.com/llvm/llvm-project/pull/84963 _

[clang] [llvm] Reapply "[analyzer] Accept C library functions from the `std` namespace" (#84926) (PR #84963)

2024-03-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84963 >From bca501228e3a146d3ca6c05b7de15fd914fb16b9 Mon Sep 17 00:00:00 2001 From: NagyDonat Date: Tue, 12 Mar 2024 18:24:26 +0100 Subject: [PATCH] Reapply "[analyzer] Accept C library functions from the `std` names

[clang] [llvm] Reapply "[analyzer] Accept C library functions from the `std` namespace" (#84926) (PR #84963)

2024-03-13 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/84963 >From e48d5a838f69e0a8e0ae95a8aed1a8809f45465a Mon Sep 17 00:00:00 2001 From: NagyDonat Date: Tue, 12 Mar 2024 18:24:26 +0100 Subject: [PATCH] Reapply "[analyzer] Accept C library functions from the `std` names

[clang] e48d5a8 - Reapply "[analyzer] Accept C library functions from the `std` namespace"

2024-03-13 Thread Balazs Benics via cfe-commits
Author: NagyDonat Date: 2024-03-13T14:48:42+01:00 New Revision: e48d5a838f69e0a8e0ae95a8aed1a8809f45465a URL: https://github.com/llvm/llvm-project/commit/e48d5a838f69e0a8e0ae95a8aed1a8809f45465a DIFF: https://github.com/llvm/llvm-project/commit/e48d5a838f69e0a8e0ae95a8aed1a8809f45465a.diff LOG

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