[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-04-23 Thread Balazs Benics via cfe-commits
@@ -114,7 +128,8 @@ class SValExplainer : public FullSValVisitor { std::string VisitSymbolConjured(const SymbolConjured *S) { return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; + "'

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-04-23 Thread Balazs Benics via cfe-commits
@@ -645,6 +645,7 @@ struct StreamOperationEvaluator { SymbolRef StreamSym = nullptr; const StreamState *SS = nullptr; const CallExpr *CE = nullptr; + std::optional ElemRef; steakhal wrote: Ah I completely missed the context. nvm. https://github.com/llv

[clang] [analyzer] Workaround for unintended slowdown (scope increase) (PR #136720)

2025-04-24 Thread Balazs Benics via cfe-commits
steakhal wrote: Do you have data about the analysis times per file, and per analysis entry point? Compared against the current llvm main, and also if this workaround would restore the original running times before https://github.com/llvm/llvm-project/commit/bb27d5e5c6b194a1440b8ac4e5ace68d0ee2

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-04-24 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. As for the Static Analyzer, if the tests pass, we should be good. Unique_ptr > shared_ptr for sure! https://github.com/llvm/llvm-project/pull/132984 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-04-24 Thread Balazs Benics via cfe-commits
@@ -2556,10 +2556,19 @@ void ExprEngine::processCFGBlockEntrance(const BlockEdge &L, const Stmt *Term = nodeBuilder.getContext().getBlock()->getTerminatorStmt(); if (!isa_and_nonnull(Term)) return; + +// FIXME: steakhal wrote: Now thinking

[clang] [clang][analyzer][NFC] Add a helper for conjuring symbols at call events (PR #137182)

2025-04-24 Thread Balazs Benics via cfe-commits
@@ -209,6 +209,12 @@ class SValBuilder { const LocationContext *LCtx, QualType type, unsigned visitCount); + DefinedOrUnknownSVal conjureSymbolVal(const Call

[clang] [clang][analyzer][NFC] Add a helper for conjuring symbols at call events (PR #137182)

2025-04-24 Thread Balazs Benics via cfe-commits
@@ -209,6 +209,12 @@ class SValBuilder { const LocationContext *LCtx, QualType type, unsigned visitCount); + DefinedOrUnknownSVal conjureSymbolVal(const Call

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# A tool to automatically generate documentation for the config options of the +# clang static analyzer by reading `AnalyzerOptions.def`. + +import argparse +from collections import namedtuple +from enum import Enum, auto +import re +impo

[clang] [flang] [llvm] [mlir] [NFC] Fix destroy typo. (PR #135640)

2025-04-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,102 @@ + +Configuring the Analyzer + + +The clang static analyzer supports two kinds of options: + +1. Global **analyzer options** influence the behavior of the analyzer engine. + They are documented on this page, in the

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,102 @@ + +Configuring the Analyzer + + +The clang static analyzer supports two kinds of options: + +1. Global **analyzer options** influence the behavior of the analyzer engine. + They are documented on this page, in the

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,102 @@ + +Configuring the Analyzer + + +The clang static analyzer supports two kinds of options: + +1. Global **analyzer options** influence the behavior of the analyzer engine. + They are documented on this page, in the

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,102 @@ + +Configuring the Analyzer + + +The clang static analyzer supports two kinds of options: + +1. Global **analyzer options** influence the behavior of the analyzer engine. + They are documented on this page, in the

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -7,6 +7,9 @@ //===--===// // // This file defines the analyzer options avaible with -analyzer-config. +// Note that clang/docs/tools/generate_analyzer_options_docs.py relies on the +// structure of this

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# A tool to automatically generate documentation for the config options of the +# clang static analyzer by reading `AnalyzerOptions.def`. + +import argparse +from collections import namedtuple +from enum import Enum, auto +import re +impo

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# A tool to automatically generate documentation for the config options of the +# clang static analyzer by reading `AnalyzerOptions.def`. + +import argparse +from collections import namedtuple +from enum import Enum, auto +import re +impo

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,242 @@ +#!/usr/bin/env python3 +# A tool to automatically generate documentation for the config options of the +# clang static analyzer by reading `AnalyzerOptions.def`. + +import argparse +from collections import namedtuple +from enum import Enum, auto +import re +impo

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/135169 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -143,6 +143,32 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL (PR #135720)

2025-04-17 Thread Balazs Benics via cfe-commits
@@ -105,9 +105,6 @@ void errno_getcwd(char *Buf, size_t Sz) { clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}} clang_analyzer_eval(Path == NULL); // expected-warning{{TRUE}} if (errno) {} // no warning - } else if (Path == NULL) {

[clang] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL (PR #135720)

2025-04-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal edited https://github.com/llvm/llvm-project/pull/135720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer][NFC] Improve Clang Static Analyzer performance. (PR #138295)

2025-05-04 Thread Balazs Benics via cfe-commits
steakhal wrote: FYI, build bots suggests that this PR has build errors. BTW, could you run this under perf stats to demonstrate the reduction of the cache-misses and page-faults? I'd suspect a measurable difference if these separate allocators really help. https://github.com/llvm/llvm-project

[clang] [clang][analyzer] Improve cache locality by using separate allocators (PR #138295)

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

[clang] [analyzer] Improve cache locality by using separate allocators (PR #138295)

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

[clang] [clang][analyzer][NFC] Improve Clang Static Analyzer performance. (PR #138295)

2025-05-02 Thread Balazs Benics via cfe-commits
steakhal wrote: FYI @necto https://github.com/llvm/llvm-project/pull/138295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Improve cache locality by using separate allocators (PR #138295)

2025-05-04 Thread Balazs Benics via cfe-commits
steakhal wrote: I had a look at the spreadsheet and the numbers for `linux-topro.c` looks really impressive. However, in general, we need further investigation about why are we not getting faster e.g. in the `clang-MSP430ISelDAGToDAG.cpp` case. The direction seems right though. (FYI it usuall

[clang] [clang] Remove unused local variables (NFC) (PR #138453)

2025-05-04 Thread Balazs Benics via cfe-commits
@@ -361,15 +361,8 @@ TEST(CallDescription, AliasNames) { std::cont v; v.data(); })code"; - constexpr StringRef UseStructNameInSpelling = R"code( -void foo() { - std::container v; - v.data(); -})code"; const std::string UseAliasInSpellingCod

[clang] [clang] Remove unused local variables (NFC) (PR #138453)

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

[clang] [clang] Use *(Set|Map)::contains (NFC) (PR #138464)

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

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS + +// expected-no-diagnostics + +// This test reproduces the issue that previously the static analyzer +// initializ

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

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

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Thank you for your contribution, and debugging the case. Left a couple of comments inline. https://github.com/llvm/llvm-project/pull/138594 ___ cfe-commits mailing list cfe-commits@lis

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS + +// expected-no-diagnostics + +// This test reproduces the issue that previously the static analyzer +// initializ

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS + +// expected-no-diagnostics + +// This test reproduces the issue that previously the static analyzer +// initializ

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -715,7 +717,11 @@ void ExprEngine::handleConstructor(const Expr *E, // actually make things worse. Placement new makes this tricky as well, // since it's then possible to be initializing one part of a multi- // dimensional array. -State = Stat

[clang] [StaticAnalyzer] Make it a noop when initializing a field of empty record (PR #138594)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,45 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus -verify %s -DEMPTY_CLASS + +// expected-no-diagnostics + +// This test reproduces the issue that previously the static analyzer +// initializ

[clang] Fixed issue #128882: don't warn if 1st argument to 'getcwd' is NULL (PR #135720)

2025-05-06 Thread Balazs Benics via cfe-commits
@@ -105,9 +105,6 @@ void errno_getcwd(char *Buf, size_t Sz) { clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}} clang_analyzer_eval(Path == NULL); // expected-warning{{TRUE}} if (errno) {} // no warning - } else if (Path == NULL) {

[clang] [clang][analyzer][NFC] Add a helper for conjuring symbols at call events (PR #137182)

2025-04-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM thanks https://github.com/llvm/llvm-project/pull/137182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-04-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer][NFC] Add a helper for conjuring symbols at call events (PR #137182)

2025-04-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/137182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

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

[clang] Revert "[Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured" (PR #137304)

2025-04-25 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/137304 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-04-25 Thread Balazs Benics via cfe-commits
steakhal wrote: @fangyi-zhou Could you please check what's wrong? PS: I reverted this patch for now. https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-15 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Thank you for proposing this. It looks really good already. The code looks nice and dense, and the output also looks wonderful. I had some design questions and a few remarks on the testing and error handling. Good job. https://github.com/llvm/llvm-project/

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-15 Thread Balazs Benics via cfe-commits
@@ -143,6 +143,32 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] [NFC][analyzer] Document configuration options (PR #135169)

2025-04-14 Thread Balazs Benics via cfe-commits
@@ -143,6 +143,32 @@ if (LLVM_ENABLE_SPHINX) gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}") gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td

[clang] [clang] Make the `AnalyzerOptions` reference count non-intrusive (PR #137680)

2025-04-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. LGTM. Please make sure not only clang but also clang-tidy tests pass. https://github.com/llvm/llvm-project/pull/137680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [clang][analyzer][NFC] Improve Clang Static Analyzer performance. (PR #138295)

2025-05-02 Thread Balazs Benics via cfe-commits
steakhal wrote: So is it about cache locality? https://github.com/llvm/llvm-project/pull/138295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Capture by ref to avoid copying std::string (PR #138231)

2025-05-01 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Makes sense, thanks. I just wonder why is BName an owning string? To me it would make a lot more sense if it was a StringRef owned by the ASTContext. WDYT? https://github.com/llvm/llvm-project/pull/138231 __

[clang] [clang] llvm::append_range (NFC) (PR #136440)

2025-04-19 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. https://github.com/llvm/llvm-project/pull/136440 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Make the result type of sizeof/pointer subtraction/size_t lit… (PR #136542)

2025-04-21 Thread Balazs Benics via cfe-commits
@@ -320,22 +320,6 @@ void test_buf_size_concrete_with_multiplication(void) { // bugpath-warning{{The 1st argument to '__buf_size_arg_constraint_mul' is a buffer with size 6 but should be a buffer with size equal to or greater than the value of the 2nd argument (which is 4) ti

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElement in SymbolConjured (reland) (PR #137355)

2025-05-07 Thread Balazs Benics via cfe-commits
steakhal wrote: Sorry about my availability. I barely have any focus time these days. Could you please split your commit into: 1) the original commit we had to later revert, 2) the changes to fix it that would make it on par with what you have here now This would allow me to review the affecte

[clang] [clang][analyzer] Teach the BlockInCriticalSectionChecker about O_NONBLOCK streams (PR #127049)

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

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-17 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -1,7 +1,163 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify %s -// expected-no-diagnostics -void foo(void) { +extern void __assert_fail (__const char *__assertion, __const c

[clang] [clang][analyzer] Add checker 'alpha.core.FixedAddressDereference' (PR #127191)

2025-02-17 Thread Balazs Benics via cfe-commits
=?utf-8?q?Balázs_Kéri?= , =?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: steakhal wrote: I've marked the resolved comments. There are a few unresolved conversations left. https://github.com/llvm/llvm-project/pull/127191 ___ cfe-commits mailing li

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

2025-02-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/127409 >From 5eb1d222478c6966780f22aa664321807da87114 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 16 Feb 2025 20:37:34 +0100 Subject: [PATCH 1/2] [analyzer] Delay the checker constructions after parsing I

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

2025-02-17 Thread Balazs Benics via cfe-commits
@@ -40,17 +40,28 @@ enum class OpenVariant { OpenAt }; +static CachedMacroValue getCreateFlagValue(const ASTContext &Ctx, + const Preprocessor &PP) { + CachedMacroValue MacroVal("O_CREAT", PP); + if (MacroVal.hasValue()) +retur

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

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

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

2025-02-17 Thread Balazs Benics via cfe-commits
https://github.com/steakhal commented: Thanks for the reviews! https://github.com/llvm/llvm-project/pull/127409 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Delay the checker constructions after parsing (PR #127409)

2025-02-17 Thread Balazs Benics via cfe-commits
@@ -73,6 +73,23 @@ Nullability getNullabilityAnnotation(QualType Type); /// returned. std::optional tryExpandAsInteger(StringRef Macro, const Preprocessor &PP); +class CachedMacroValue { steakhal wrote: Right! Dropped in 10b4bd0403aa82a97f22a7fd55ee5126251390

[clang] [clang][analyzer] Teach the BlockInCriticalSectionChecker about O_NONBLOCK streams (PR #127049)

2025-02-17 Thread Balazs Benics via cfe-commits
steakhal wrote: > LLVM Buildbot has detected a new failure on builder > `clang-cmake-x86_64-avx512-win` running on `avx512-intel64-win` while > building `clang` at step 6 "ninja check 1". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/81/builds/4823 This doesn'

[clang] [analyzer] Limit Store by region-store-binding-limit (PR #127602)

2025-02-18 Thread Balazs Benics via cfe-commits
steakhal wrote: > (I'm writing a review right now, please wait a bit -- at most a few hours -- > before merging.) No worries. I wouldnt have merged tgis without your approval too. https://github.com/llvm/llvm-project/pull/127602 ___ cfe-commits maili

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-07 Thread Balazs Benics via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: steakhal wrote: > > We do this by prepending a new ASTConsumer to the list of consumers: this > > new consumer sets the traversal scope in the ASTContext, which is later > > used by the MatchASTConsumer. > > I do

[clang] CodeGen: support static linking for libclosure (PR #125384)

2025-03-08 Thread Balazs Benics via cfe-commits
steakhal wrote: > @steakhal bleh, is the "New Features" a sub item of "Static Analyzer"? Ah you are right. Its at the right place. Nvm. https://github.com/llvm/llvm-project/pull/125384 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://li

[clang] [clang][analyzer][NFC] Fix typos in comments (PR #130456)

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

[clang] [clang][analyzer][NFC] Fix typos in comments (PR #130456)

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

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-08 Thread Balazs Benics via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: steakhal wrote: > I highly discourage implicit slowdowns > - If I understand correctly, you mean that this patch could lead to people > manually traversing the AST instead of using the MatchFinder, thus making >

[clang] [NFC][analyzer] OOB test consolidation IV: rename files (PR #129697)

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

[clang] CodeGen: support static linking for libclosure (PR #125384)

2025-03-08 Thread Balazs Benics via cfe-commits
steakhal wrote: Hi, I'm not sure where to move your addition in the ReleaseNotes, but I'm pretty sure it shouldn't be in the Static Analyzer section. https://github.com/llvm/llvm-project/pull/125384 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

2025-03-08 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/130418 This PR splits the existing modeling of builtin assume from the BuiltinFunctionChecker. We just sink the execution path if we are about to leave the assume expression with a false assumption. Assumptions with

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

2025-03-08 Thread Balazs Benics via cfe-commits
steakhal wrote: This patch should conclude the assume attribute modeling. After this, we would have some basic support for them. https://github.com/llvm/llvm-project/pull/130418 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] Reapply "[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond)" (PR #129234)

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

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-06 Thread Balazs Benics via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: steakhal wrote: > That's a good point. @haoNoQ @Xazax-hun @steakhal Do you see any implications > on this patch when running clang static analyzer via clang-tidy? Any checks > that would stop detecting issues? >

[clang] [NFC][analyzer] Remove CheckerNameRef::getName() (PR #130780)

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

[clang] [StaticAnalyzer] Relax the pre-condition of 'setsockopt' (PR #130683)

2025-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Thanks for the fix. Your raised points also make sense to me. https://github.com/llvm/llvm-project/pull/130683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [NFC][analyzer] OOB test consolidation IV: split off unrelated tests (PR #130763)

2025-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal approved this pull request. Ah! Sorry about this. I didn't mean to push roadblocks to you. I have a followup PR (#130418) probably later today - I'll make sure that's rebased to this one. Thanks for taking care of this! https://github.com/llvm/llvm-project/pull/13076

[clang] [NFC][analyzer] Split [[assume]] tests to a separate file (PR #130763)

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

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

2025-03-11 Thread Balazs Benics via cfe-commits
@@ -91,8 +91,29 @@ QualType getOverflowBuiltinResultType(const CallEvent &Call, CheckerContext &C, } } -class BuiltinFunctionChecker : public Checker { +class BuiltinFunctionChecker +: public Checker> { public: + void checkPostStmt(const AttributedStmt *A, CheckerCont

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

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

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

2025-03-11 Thread Balazs Benics via cfe-commits
https://github.com/steakhal updated https://github.com/llvm/llvm-project/pull/130418 >From bdb40a95061acd007d1f27f1412c216c6ab6acb6 Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Thu, 19 Dec 2024 13:45:58 +0100 Subject: [PATCH 1/3] [analyzer] Model [[assume]] attributes without side-ffects

[clang] [analyzer] Model [[assume]] attributes without side-ffects (PR #130418)

2025-03-11 Thread Balazs Benics via cfe-commits
@@ -91,8 +91,29 @@ QualType getOverflowBuiltinResultType(const CallEvent &Call, CheckerContext &C, } } -class BuiltinFunctionChecker : public Checker { +class BuiltinFunctionChecker +: public Checker> { public: + void checkPostStmt(const AttributedStmt *A, CheckerCont

[clang] [analyzer] Model [[assume]] attributes without side-effects (PR #130418)

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

[clang] [analyzer] Sink false [[assume]] execution paths (PR #130418)

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

[clang] [analyzer] Sink false [[assume]] execution paths (PR #130418)

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

[clang] [NFC][analyzer] Remove CheckerNameRef::getName() (PR #130780)

2025-03-11 Thread Balazs Benics via cfe-commits
steakhal wrote: > I have no strong feelings about the implicit/explicit question. I am also not > sure we need this lightweight wrapper type. I also fail to see the benefit of this strong-type. https://github.com/llvm/llvm-project/pull/130780 ___ cfe

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

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

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

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

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

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

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -27,6 +29,14 @@ void emitErrorReport(CheckerContext &C, const BugType &Bug, } } +inline std::string getMemRegionName(const SVal &Val) { steakhal wrote: ```suggestion static std::string getMemRegionName(SVal Val) { ``` Have you considered using the Val.d

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -1199,4 +1204,4 @@ void ExprEngine::VisitLambdaExpr(const LambdaExpr *LE, ExplodedNode *Pred, // FIXME: Move all post/pre visits to ::Visit(). getCheckerManager().runCheckersForPostStmt(Dst, Tmp, LE, *this); -} steakhal wrote: This seems like an unint

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -44,6 +54,21 @@ CREATE_EXPR_ENGINE_CHECKER(ExprEngineVisitPreChecker, PreStmt, GCCAsmStmt, CREATE_EXPR_ENGINE_CHECKER(ExprEngineVisitPostChecker, PostStmt, GCCAsmStmt, "GCCAsmStmtBug") +class MemAccessChecker : public Checker { +public: + void c

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal requested changes to this pull request. Thanks for the PR, it looks pretty good by the looks of it. I had a couple nits inline though, check them out! https://github.com/llvm/llvm-project/pull/129016 ___ cfe-commits mailing

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -84,4 +118,24 @@ TEST(ExprEngineVisitTest, checkPostStmtGCCAsmStmt) { EXPECT_EQ(Diags, "ExprEngineVisitPostChecker: checkPostStmt\n"); } +TEST(ExprEngineVisitTest, checkLocationAndBind) { + std::string Diags; + EXPECT_TRUE(runCheckerOnCode(R"( +class MyClass{ +p

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -69,14 +69,19 @@ void ExprEngine::performTrivialCopy(NodeBuilder &Bldr, ExplodedNode *Pred, assert(ThisRD); SVal V = Call.getArgSVal(0); + const Expr *VExpr = Call.getArgExpr(0); // If the value being copied is not unknown, load from its location to get // an

[clang] [analyzer] performTrivialCopy triggers checkLocation before binding (PR #129016)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -69,14 +69,19 @@ void ExprEngine::performTrivialCopy(NodeBuilder &Bldr, ExplodedNode *Pred, assert(ThisRD); SVal V = Call.getArgSVal(0); + const Expr *VExpr = Call.getArgExpr(0); // If the value being copied is not unknown, load from its location to get // an

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

2025-02-28 Thread Balazs Benics via cfe-commits
@@ -0,0 +1,30 @@ +// RUN: %clang_analyze_cc1 -verify %s\ +// RUN: -analyzer-checker=core,debug.ExprInspection + +void clang_analyzer_eval(bool); + +using size_t = decltype(sizeof(int)); + +template +void escape(FirstT first, Rest... args); + +namespace CustomClassType { +struct

[clang] [analyzer] Do list initialization for CXXNewExpr with initializer list arg (PR #127702)

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

[clang] Fix RegionStore assertion failure after #127602 (PR #129224)

2025-02-28 Thread Balazs Benics via cfe-commits
steakhal wrote: FYI @necto @NagyDonat https://github.com/llvm/llvm-project/pull/129224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond)" (PR #125348)

2025-02-28 Thread Balazs Benics via cfe-commits
steakhal wrote: Reopening this PR as #129234 as I accidentally closed this permanently. https://github.com/llvm/llvm-project/pull/125348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond)" (PR #129234)

2025-02-28 Thread Balazs Benics via cfe-commits
https://github.com/steakhal created https://github.com/llvm/llvm-project/pull/129234 This is the second attempt to bring initial support for [[assume()]] in the Clang Static Analyzer. The first attempt (#116462) was reverted in 2b9abf0db2d106c7208b4372e662ef5df869e6f1 due to some weird failure

<    18   19   20   21   22   23   24   25   26   >