[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 closed https://github.com/llvm/llvm-project/pull/84963 ___ 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: Merged to main as e48d5a838f69e0a8e0ae95a8aed1a8809f45465a https://github.com/llvm/llvm-project/pull/84963 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -565,37 +565,67 @@ til::SExpr *SExprBuilder::translateBinaryOperator(const BinaryOperator *BO, case BO_PtrMemI: return new (Arena) til::Undefined(BO); - case BO_Mul: return translateBinOp(til::BOP_Mul, BO, Ctx); - case BO_Div: return translateBinOp(til::BOP_Div,

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

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

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -535,7 +545,8 @@ void CFNumberChecker::checkPreStmt(const CallExpr *CE, } //===--===// -// CFRetain/CFRelease/CFMakeCollectable/CFAutorelease checking for null arguments. +// CFRetain/CFRelease/CFMakeColl

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -18,37 +18,57 @@ using namespace til; StringRef til::getUnaryOpcodeString(TIL_UnaryOpcode Op) { switch (Op) { -case UOP_Minus:return "-"; -case UOP_BitNot: return "~"; -case UOP_LogicNot: return "!"; + case UOP_Minus: +return "-"; + case UOP_BitNot

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -380,27 +376,41 @@ enum CFNumberType { }; static std::optional GetCFNumberSize(ASTContext &Ctx, uint64_t i) { - static const unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 }; + static const unsigned char FixedSize[] = {8, 16, 32, 64, 32, 64}; if (i < kCFNumberCh

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

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

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -244,24 +246,25 @@ void WalkAST::VisitCallExpr(CallExpr *CE) { if (containsBadStrlcpyStrlcatPattern(CE)) { const Expr *DstArg = CE->getArg(0); const Expr *LenArg = CE->getArg(2); - PathDiagnosticLocation Loc = -PathDiagnosticLocation::createBegin

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Yeey, my review is done. We only have a handful (<50) debatable formatting problems. I'll try to fix them in an other PR. https://github.com/llvm/llvm-project/pull/82599 ___ cfe-commits mailing list cfe-commits@l

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -1,4 +1,5 @@ -//===-- SimpleStreamChecker.cpp -*- C++ -*--// +//===-- SimpleStreamChecker.cpp -*- C++ +//-*--// steakhal wrote: ```suggestion //===-- SimpleStreamChecker.cpp -

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -49,54 +50,44 @@ const char *IsARPBind = "isautoreleasepoolbind"; class ObjCAutoreleaseWriteChecker : public Checker { public: - void checkASTCodeBody(const Decl *D, -AnalysisManager &AM, + void checkASTCodeBody(const Decl *D, AnalysisManager &AM,

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -110,21 +111,41 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B, continue; } -assert (B->isCompoundAssignmentOp()); +assert(B->isCompoundAssignmentOp()); switch (Op) { - default: -llvm_unreachable("Invalid opcode for co

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -219,17 +219,19 @@ void WalkAST::VisitCallExpr(CallExpr *CE) { if (containsBadStrncatPattern(CE)) { const Expr *DstArg = CE->getArg(0); const Expr *LenArg = CE->getArg(2); - PathDiagnosticLocation Loc = -PathDiagnosticLocation::createBegin(LenArg

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -1,4 +1,5 @@ -//=- DirectIvarAssignment.cpp - Check rules on ObjC properties -*- C++ *-==// +//=- DirectIvarAssignment.cpp - Check rules on ObjC properties -*- C++ +//*-==// steakhal wrote: Bad formatting. ```suggestion //=- DirectIvarAssignment.cpp -

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-23 Thread Balazs Benics via cfe-commits
@@ -1,4 +1,5 @@ -//===-- STLAlgorithmModeling.cpp ---*- C++ -*--// +//===-- STLAlgorithmModeling.cpp ---*- C++ +//-*--// steakhal wrote: ```suggestion //===-- STLAlgorithmModeling.cpp --

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

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

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

2024-02-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/82919 clang-format would format these headers poorly by splitting it into multiple lines. ```regex //=.{78,} ``` >From 319329630e0d2a86b22dd435985026ea236f8e56 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun

[clang] [clang][NFC] Prefer usings over typedefs (PR #82920)

2024-02-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/82920 None >From fd85686af33570f0baf8ba60a0b0b8113e999c4a Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 25 Feb 2024 12:37:49 +0100 Subject: [PATCH] [clang][NFC] Prefer usings over typedefs --- .../clang/A

[clang] [clang][analyzer][NFC] Prepare for clang-format (PR #82921)

2024-02-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/82921 This is the followup PR for #82599 to fix the cases where clang-format would regress the flow of the code. >From 245de9ea5c33649ff7b3e359cd360361d4dc5ae3 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun,

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-25 Thread Balazs Benics via cfe-commits
steakhal wrote: I've submitted PRs to resolve the pending formatting issues. https://github.com/llvm/llvm-project/pull/82599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

2024-02-25 Thread Balazs Benics via cfe-commits
steakhal wrote: > (In case you do intend to merge changes related to formatting, consider > adding the resulting commit hash into the blame-ignore file.) I dont intend to merge this. https://github.com/llvm/llvm-project/pull/82599 ___ cfe-commits mai

[clang] [clang][NFC] Prefer usings over typedefs (PR #82920)

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

[clang] [clang][analyzer] StreamChecker: Model getc, vfscanf, putc, vfprintf (PR #82476)

2024-02-28 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?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Aylló

[clang] [clang][analyzer] StreamChecker: Model getc, vfscanf, putc, vfprintf (PR #82476)

2024-02-28 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?=, Alejandro =?utf-8?q?Álvarez_Ayllón?=, Alejandro =?utf-8?q?Álvarez_Aylló

[clang] 570bc5d - Revert "[clang][analyzer] StreamChecker: Model getc, vfscanf, putc, vfprintf (#82476)"

2024-02-28 Thread Balazs Benics via cfe-commits
Author: Balazs Benics Date: 2024-02-28T14:10:22+01:00 New Revision: 570bc5d291f92e19f6264262b02ddff1a2f2e09b URL: https://github.com/llvm/llvm-project/commit/570bc5d291f92e19f6264262b02ddff1a2f2e09b DIFF: https://github.com/llvm/llvm-project/commit/570bc5d291f92e19f6264262b02ddff1a2f2e09b.diff

[clang] [clang][StaticAnalyzer] fix function evalCall() typo in CheckerDocumentation (PR #83677)

2024-03-02 Thread Balazs Benics via cfe-commits
steakhal wrote: Makes sense, but how did it build before the fix? I thought by inheriting from `Checker` it would take the address of the member function with the expected signature to store them inside vectors. How could it take the address of a nonexisting member function? https://github.com

[clang] [clang][StaticAnalyzer] fix function evalCall() typo in CheckerDocumentation (PR #83677)

2024-03-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/83677 ___ 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-02 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-02 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-02 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++23 -verify %s +// expected-no-diagnostics + +struct S +{ +constexpr auto operator==(this auto, S) +{ +return true; +} +}; + +int main() +{ +return S {} == S {}; +} -

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

2024-03-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: I feel like it's better than crashing, but I suspect it only resolves that, right? https://github.com/llvm/llvm-project/pull/83585 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cg

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

2024-03-02 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++23 -verify %s steakhal wrote: ```suggestion // RUN: %clang_analyze_cc1 -analyzer-checker=core -std=c++23 -verify %s ``` https://github.com/llvm/llvm-project/pull/83585 __

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

2024-03-02 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++23 -verify %s +// expected-no-diagnostics + +struct S +{ +constexpr auto operator==(this auto, S) +{ +return true; +} +}; + +int main() +{ +return S {} == S {}; +} -

[clang] [analyzer][NFC] Remove dead code (PR #83968)

2024-03-04 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/83968 None >From 3a7f862398a5168028f2d3d66d6b8986e7d528da Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Tue, 5 Mar 2024 08:47:56 +0100 Subject: [PATCH] [analyzer][NFC] Remove dead code --- .../StaticAnalyzer/C

[clang] [analyzer][NFC] Remove dead code (PR #83968)

2024-03-04 Thread Balazs Benics via cfe-commits
steakhal wrote: Please merge it once approved. https://github.com/llvm/llvm-project/pull/83968 ___ 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-04 Thread Balazs Benics via cfe-commits
steakhal wrote: > +1 to @pogo59's comment about pruning complete paths - I suspect they're in > the minority. Might be worth checking whether the `===` at the start and end > is markup for any particular thing (I /think/ the `-*- C++ -*-` is load > bearing for some editors to inform them this

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

2024-03-05 Thread Balazs Benics via cfe-commits
steakhal wrote: I did some grepping. Inside the `clang` project: `^/+=(.*)/(.*)...$`: 297 files `^/+=([^\n/]*)\.(h|cpp)([^\n/]*)...$`: 1766 files This suggests to me that indeed, absolute paths are the used way fewer times. https://github.com/llvm/llvm-project/pull/82919 ___

[clang] [analyzer][NFC] Make CheckerDocumentation checker in-sync with actual checker callbacks (PR #83973)

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/83973 In PR #83677 I was surprised to see that outdated checker callback signatures are a problem. It turns out, we need the `registerChecker...` function to invoke the `Mgr.registerChecker<>()` which would instantia

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

2024-03-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Thanks for the PR! At first I was hesitant if this checker is the right place for this API. But actually, it should be fine to have it here. Maybe the stdlibraryfunctionschecker would be a better place in long term, but I don't

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

2024-03-05 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-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] [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] [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] [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][NFC] Make CheckerDocumentation checker in-sync with actual checker callbacks (PR #83973)

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

[clang] [analyzer][NFC] Make CheckerDocumentation checker in-sync with actual checker callbacks (PR #83973)

2024-03-05 Thread Balazs Benics via cfe-commits
steakhal wrote: > LGTM. > > Minor remark: "signatires" is misspelled in the commit message. Fixed the typos. Thanks! https://github.com/llvm/llvm-project/pull/83973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [analyzer][NFC] Make CheckerDocumentation checker in-sync with actual checker callbacks (PR #83973)

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

[clang] [clang][analyzer] Bring cplusplus.ArrayDelete out of alpha (PR #83985)

2024-03-05 Thread Balazs Benics via cfe-commits
steakhal wrote: I'm fine with the change. https://github.com/llvm/llvm-project/pull/83985 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improve documentation of StreamChecker (NFC). (PR #83858)

2024-03-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -3020,44 +3020,82 @@ Check for misuses of stream APIs. Check for misuses of stream APIs: ``fopen, fcl alpha.unix.Stream (C) " -Check stream handling functions: ``fopen, tmpfile, fclose, fread, fwrite,

[clang] [analyzer] Teach analzer about ms __analyzer_assume(bool) and friends (PR #80456)

2024-02-02 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/80456 See the MS docs: https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/using-the--analysis-assume-function-to-suppress-false-defects https://learn.microsoft.com/en-us/cpp/code-quality/how-to-specif

[clang] [analyzer] Teach analzer about ms __analyzer_assume(bool) and friends (PR #80456)

2024-02-02 Thread Balazs Benics via cfe-commits
steakhal wrote: Let me know if this is correct @Xazax-hun. You probably have more insights on these APIs than me ;) https://github.com/llvm/llvm-project/pull/80456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [analyzer] Teach analzer about ms __analyzer_assume(bool) and friends (PR #80456)

2024-02-03 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/80456 >From 9065aec18b5b9c4d922b0650e709e71ed31b5a45 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Fri, 2 Feb 2024 16:24:21 +0100 Subject: [PATCH 1/2] [analyzer] Teach analzer about ms __analyzer_assume(bool) an

[clang] [analyzer] Teach analzer about ms __analyzer_assume(bool) and friends (PR #80456)

2024-02-03 Thread Balazs Benics via cfe-commits
steakhal wrote: > The code LGTM with some minor remarks. (Disclaimer: I'm not familiar with > these MS functions.) > > I'm not sure whether these "builtin by Microsoft" functions are in scope for > "our" BuiltinFunctionChecker which previously only checked functions that are > recognized as `

[clang] [analyzer] Teach analzer about ms __analyzer_assume(bool) and friends (PR #80456)

2024-02-05 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/80456 >From 3a11db7ce1e91daacb86e183e7137db7a6101c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Joly?= Date: Tue, 9 Aug 2022 23:21:18 +0200 Subject: [PATCH] [analyzer] Model Microsoft "__assume" in the same

[clang] [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume" (PR #80456)

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

[clang] [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume" (PR #80456)

2024-02-05 Thread Balazs Benics via cfe-commits
steakhal wrote: It turns out we already had a downstream patch, so I'll drop this one in favor of what we already had. Sorry about the confusion. This version is already in production for many years now. https://github.com/llvm/llvm-project/pull/80456 ___

[clang] [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume" (PR #80456)

2024-02-05 Thread Balazs Benics via cfe-commits
steakhal wrote: Thanks Donát! I'll wait for @Xazax-hun explicit approval to be sure everyone on board (who left remarks) are okay with the current content. https://github.com/llvm/llvm-project/pull/80456 ___ cfe-commits mailing list cfe-commits@lists

[llvm] [clang] [clang-tools-extra] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,

[clang-tools-extra] [llvm] [clang] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,

[clang-tools-extra] [clang] [llvm] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy ,

[clang] [llvm] [clang-tools-extra] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,

[clang-tools-extra] [llvm] [clang] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy ,

[llvm] [clang] [clang-tools-extra] [analyzer] Support interestingness in ArrayBoundV2 (PR #78315)

2024-02-05 Thread Balazs Benics via cfe-commits
=?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy , =?utf-8?q?Don=C3=A1t?= Nagy ,

[clang] ae354c5 - [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume"

2024-02-05 Thread Balazs Benics via cfe-commits
Author: Loïc Joly Date: 2024-02-05T17:02:24+01:00 New Revision: ae354c5a45d319b3117c2822b8f6988461f3cb33 URL: https://github.com/llvm/llvm-project/commit/ae354c5a45d319b3117c2822b8f6988461f3cb33 DIFF: https://github.com/llvm/llvm-project/commit/ae354c5a45d319b3117c2822b8f6988461f3cb33.diff LOG

[clang] [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume" (PR #80456)

2024-02-05 Thread Balazs Benics via cfe-commits
steakhal wrote: Pushed manually to preserve the patch author. (I believe, "squash&merge" would overwrite it.) Merged as ae354c5a45d319b3117c2822b8f6988461f3cb33. https://github.com/llvm/llvm-project/pull/80456 ___ cfe-commits mailing list cfe-commits@

[clang] [analyzer] Model Microsoft "__assume" in the same way as clang "__builtin_assume" (PR #80456)

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

[clang] [clang][analyzer] Change default value of checker option in unix.StdCLibraryFunctions. (PR #80457)

2024-02-05 Thread Balazs Benics via cfe-commits
steakhal wrote: I'm excited to see this change. I've not reviewed this yet. https://github.com/llvm/llvm-project/pull/80457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Support `fgets` in the SteamChecker (PR #73638)

2024-01-24 Thread Balazs Benics via cfe-commits
@@ -778,42 +781,61 @@ void StreamChecker::evalFgetc(const FnDescription *Desc, const CallEvent &Call, assertStreamStateOpened(OldSS); steakhal wrote: This patch caused a downstream test failure. Here is the fix: ```suggestion // We don't model the buffer

[clang] [clang][analyzer] Support `fgets` in the SteamChecker (PR #73638)

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

[clang] [clang][analyzer] Add function 'fprintf' to StreamChecker. (PR #77613)

2024-01-24 Thread Balazs Benics via cfe-commits
@@ -926,6 +932,49 @@ void StreamChecker::evalFputx(const FnDescription *Desc, const CallEvent &Call, C.addTransition(StateFailed); } +void StreamChecker::evalFprintf(const FnDescription *Desc, +const CallEvent &Call, +

[clang] [clang][analyzer] Add function 'fscanf' to StreamChecker. (PR #78180)

2024-01-24 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: steakhal wrote: > This patch breaks a downstream test, like this: > > ```c++ > void test_fscanf_2() { > FILE *F1 = tmpfile(); > if (!F1) > return; > > int a; > unsigned b; > fscanf(F1, "%d %u", &a, &b); > clang_analyzer_dump_in

[clang] [clang][analyzer] Add function 'fprintf' to StreamChecker. (PR #77613)

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

[clang] [clang][analyzer] Support `fgets` in the SteamChecker (PR #73638)

2024-01-24 Thread Balazs Benics via cfe-commits
@@ -778,42 +781,61 @@ void StreamChecker::evalFgetc(const FnDescription *Desc, const CallEvent &Call, assertStreamStateOpened(OldSS); steakhal wrote: At first glance you should be right. However, when I tried it, it didn't break any tests but this one. I p

[clang] [clang][analyzer] Support `fgets` in the SteamChecker (PR #73638)

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

[clang] [clang][analyzer] Support `fgets` in the SteamChecker (PR #73638)

2024-01-24 Thread Balazs Benics via cfe-commits
@@ -778,42 +781,61 @@ void StreamChecker::evalFgetc(const FnDescription *Desc, const CallEvent &Call, assertStreamStateOpened(OldSS); steakhal wrote: The problem should apply to all APIs that potentially write to the passed buffer; including `fread` too.

[clang] [clang][analyzer] Simplify code of StreamChecker (NFC). (PR #79312)

2024-01-24 Thread Balazs Benics via cfe-commits
steakhal wrote: I'm yet to review the PR, but I would express my opinion on the ergonomics of the StreamChecker, as I've spent the last couple of days around it. I find code duplication less harmful than unnatural generalization over small set of functions (I know, it's a hot take :D). `std::b

[clang] [clang][analyzer] Improve modeling of 'execv' and 'execvp' in StdLibraryFunctionsChecker (PR #78930)

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

[clang] [clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (PR #78895)

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

[clang] [clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (PR #78895)

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

[clang] [clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (PR #78895)

2024-01-24 Thread Balazs Benics via cfe-commits
@@ -2211,6 +2221,15 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( ErrnoNEZeroIrrelevant, GenericFailureMsg) .ArgConstraint(NotNull(ArgNo(0; +// int pclose(FILE *stream); +addToFunctionSummaryMap( +"pclose", Signatu

[clang] [clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (PR #78895)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -2211,6 +2221,15 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( ErrnoNEZeroIrrelevant, GenericFailureMsg) .ArgConstraint(NotNull(ArgNo(0; +// int pclose(FILE *stream); +addToFunctionSummaryMap( +"pclose", Signatu

[clang] [clang][analyzer] Improve modeling of 'popen' and 'pclose' in StdLibraryFunctionsChecker (PR #78895)

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

[clang] [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (PR #79398)

2024-01-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: I only have minor nits. No objections. https://github.com/llvm/llvm-project/pull/79398 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (PR #79398)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -27,6 +28,8 @@ class PathDiagnosticLocation; class BugSuppression { public: + BugSuppression(ASTContext &ACtx) : ACtx(ACtx) {} steakhal wrote: ```suggestion explicit BugSuppression(const ASTContext &ACtx) : ACtx(ACtx) {} ``` https://github.com/llvm/llv

[clang] [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (PR #79398)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -44,7 +47,9 @@ class BugSuppression { using CachedRanges = llvm::SmallVector; - llvm::DenseMap CachedSuppressionLocations; + llvm::DenseMap CachedSuppressionLocations{}; + + ASTContext &ACtx; steakhal wrote: ```suggestion llvm::DenseMap Cached

[clang] [analyzer] Unbreak [[clang::suppress]] on checkers without decl-with-issue. (PR #79398)

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

[clang] [clang][analyzer] Simplify code of StreamChecker (NFC). (PR #79312)

2024-01-25 Thread Balazs Benics via cfe-commits
steakhal wrote: > I'm seconding the suggestions of @steakhal, and in particular I agree with > > > I'd also advise against using more callables bundled with CallDescriptions. > > They make debugging code more difficult, as the control-flow would become > > also data-dependent. I'd suggest othe

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

2024-01-25 Thread Balazs Benics via cfe-commits
steakhal wrote: When is it possible to have an empty range set as a constraint? https://github.com/llvm/llvm-project/pull/79446 ___ 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-01-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/79446 ___ 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-01-25 Thread Balazs Benics via cfe-commits
@@ -3270,8 +3270,12 @@ void RangeConstraintManager::printJson(raw_ostream &Out, ProgramStateRef State, void RangeConstraintManager::printValue(raw_ostream &Out, ProgramStateRef State, SymbolRef Sym) { const RangeSet RS = getRange(Stat

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

2024-01-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. https://github.com/llvm/llvm-project/pull/79446 ___ 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-01-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/79446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

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

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: I like what you do in this patch. I only have a couple nits. That's it. Tomorrow, I'll check if there are any other APIs that we should test; but seems complete at first glance. https://github.com/llvm/llvm-project/pull/79470 _

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,133 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=alpha.unix.Stream \ +// RUN: -analyzer-checker=debug.StreamTester \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator.h

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -544,6 +545,21 @@ const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N, return nullptr; } +static ProgramStateRef +escapeArgs(ProgramStateRef State, CheckerContext &C, const CallEvent &Call, + const SmallVector &EscapingArgs) { --

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,133 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=alpha.unix.Stream \ +// RUN: -analyzer-checker=debug.StreamTester \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator.h

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,133 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=alpha.unix.Stream \ +// RUN: -analyzer-checker=debug.StreamTester \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator.h

[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

2024-01-25 Thread Balazs Benics via cfe-commits
@@ -544,6 +545,21 @@ const ExplodedNode *StreamChecker::getAcquisitionSite(const ExplodedNode *N, return nullptr; } +static ProgramStateRef +escapeArgs(ProgramStateRef State, CheckerContext &C, const CallEvent &Call, + const SmallVector &EscapingArgs) { + const a

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