[clang] [LifetimeSafety] Avoid adding already present items in sets/maps (PR #159582)

2025-09-20 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/159582 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Avoid adding already present items in sets/maps (PR #159582)

2025-09-20 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > > Ugh, I wonder if this is unintentional and we should change the > > implementation of these data structures. I also find this behavior very > > surprising. > > I can try changing the data structure. Let me do that in a separate PR. It > would need an extra Value comparison wh

[clang] Revert "[clang][dataflow] Transfer more cast expressions." (PR #157148)

2025-09-05 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/157148 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-08-29 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/153661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-08-29 Thread Yitzhak Mandelbaum via cfe-commits
@@ -403,29 +404,20 @@ class FactManager { llvm::BumpPtrAllocator FactAllocator; }; -class FactGenerator : public ConstStmtVisitor { - using Base = ConstStmtVisitor; +class FactGeneratorVisitor : public ConstStmtVisitor { + using Base = ConstStmtVisitor; public: - FactG

[clang] [clang][dataflow] Fix uninitialized memory bug. (PR #154575)

2025-08-20 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/154575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fix uninitialized memory bug. (PR #154575)

2025-08-20 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/154575 Commit #3ecfc03 introduced a bug involving an uninitialized field in `exportLogicalContext`. This patch initializes the field properly. >From 3b7e7843cf6c5422a4bd8ea85780663596b3dd46 Mon Sep 17 00:00:00 2001 From

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/152487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From e30c8b628e7018c5f8e96aa3f712565befcd0ea6 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH 1/5] [clang][dataflow] Add support for serialization and deser

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From a39ac4fe8bdd337ca03651ca70879392b00cdfca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH 1/5] [clang][dataflow] Add support for serialization and deser

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -208,6 +208,27 @@ bool DataflowAnalysisContext::equivalentFormulas(const Formula &Val1, return isUnsatisfiable(std::move(Constraints)); } +llvm::DenseSet DataflowAnalysisContext::getTransitiveClosure( +const llvm::DenseSet &Tokens) const { + llvm::DenseSet VisitedTo

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -208,6 +208,27 @@ bool DataflowAnalysisContext::equivalentFormulas(const Formula &Val1, return isUnsatisfiable(std::move(Constraints)); } +llvm::DenseSet DataflowAnalysisContext::getTransitiveClosure( +const llvm::DenseSet &Tokens) const { + llvm::DenseSet VisitedTo

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,161 @@ +//===- FormulaSerialization.cpp -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From a39ac4fe8bdd337ca03651ca70879392b00cdfca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH 1/4] [clang][dataflow] Add support for serialization and deser

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-15 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From a39ac4fe8bdd337ca03651ca70879392b00cdfca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH 1/3] [clang][dataflow] Add support for serialization and deser

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-15 Thread Yitzhak Mandelbaum via cfe-commits
@@ -208,6 +208,27 @@ bool DataflowAnalysisContext::equivalentFormulas(const Formula &Val1, return isUnsatisfiable(std::move(Constraints)); } +llvm::DenseSet DataflowAnalysisContext::getTransitiveClosure( +const llvm::DenseSet &Tokens) const { + llvm::DenseSet VisitedTo

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-15 Thread Yitzhak Mandelbaum via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-09 Thread Yitzhak Mandelbaum via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-09 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From a39ac4fe8bdd337ca03651ca70879392b00cdfca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH 1/2] [clang][dataflow] Add support for serialization and deser

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Yitzhak Mandelbaum via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/152487 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Yitzhak Mandelbaum via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Yitzhak Mandelbaum via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Yitzhak Mandelbaum via cfe-commits
@@ -157,10 +157,18 @@ class Environment { }; /// Creates an environment that uses `DACtx` to store objects that encompass - /// the state of a program. + /// the state of a program. `FlowConditionToken` sets the flow condition + /// associated with the environment. Gene

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-07 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From a39ac4fe8bdd337ca03651ca70879392b00cdfca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH] [clang][dataflow] Add support for serialization and deseriali

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-07 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/152487 >From 48cd6c13918193fa874dac69e5794942720f1657 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 4 Aug 2025 18:09:28 + Subject: [PATCH] [clang][dataflow] Add support for serialization and deseriali

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-07 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/152487 Adds support for compact serialization of Formulas, and a corresponding parse function. Extends Environment and AnalysisContext with necessary functions for serializing and deserializing all formula-related parts

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
@@ -66,6 +88,7 @@ using OriginID = ID; // TODO(opt): Consider using a bitset to represent the set of loans. using LoanSet = llvm::ImmutableSet; using OriginSet = llvm::ImmutableSet; +using ExpiredLoanMap = llvm::ImmutableMap; ymand wrote: Maybe comment? includ

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,263 @@ +// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -verify %s + +struct MyObj { + int id; + ~MyObj() {} // Non-trivial destructor + MyObj operator+(MyObj); +}; + +//===-

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,263 @@ +// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -verify %s + +struct MyObj { + int id; + ~MyObj() {} // Non-trivial destructor + MyObj operator+(MyObj); +}; + +//===-

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,263 @@ +// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -verify %s + +struct MyObj { + int id; + ~MyObj() {} // Non-trivial destructor + MyObj operator+(MyObj); +}; + +//===-

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-31 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,263 @@ +// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -verify %s + +struct MyObj { + int id; + ~MyObj() {} // Non-trivial destructor + MyObj operator+(MyObj); +}; + +//===-

[clang] [LifetimeSafety] Make the dataflow analysis generic (PR #148222)

2025-07-16 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/148222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -493,7 +496,241 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -493,7 +496,247 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -493,7 +496,241 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -493,7 +496,241 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -493,7 +496,241 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/148065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. Looks good overall, just a few small comments. https://github.com/llvm/llvm-project/pull/148065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. Really nice! https://github.com/llvm/llvm-project/pull/142313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/142313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,504 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-11 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand commented: Overall, looks very good. I would recommend you consider splitting this into multiple smaller PRs, so reviews can focus on a specific aspect. E.g. the FactGenerator and the LifetimeDataflow seems to deserve focused reviews. https://github.com/llvm/llvm-proje

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/142313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] Introduce intra-procedural lifetime analysis in Clang (PR #142313)

2025-06-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,728 @@ +#include "clang/Analysis/Analyses/LifetimeSafety.h" +#include "clang/AST/Decl.h" +#include "clang/AST/Expr.h" +#include "clang/AST/StmtVisitor.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/AnalysisDeclContext.h" +#include "clang/Analysis/CFG.h" +#inc

[clang] [ASTMatchers] Fix matching `CXXOperatorCallExpr` of `->` (PR #139994)

2025-05-22 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/139994 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [libTooling] Fix `constructExprArgs` for direct-init and implicit construction (PR #139990)

2025-05-22 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. Nice! https://github.com/llvm/llvm-project/pull/139990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][dataflow] For bugprone-unchecked-optional-access report range (PR #131055)

2025-03-17 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/131055 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -551,91 +551,92 @@ void transferCallReturningOptional(const CallExpr *E, setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env); } +// Returns true if the const accessor is handled by caching. +// Returns false if we could not cache. We should perform default handl

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -551,91 +551,92 @@ void transferCallReturningOptional(const CallExpr *E, setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env); } +// Returns true if the const accessor is handled by caching. +// Returns false if we could not cache. We should perform default handl

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/129930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -551,15 +551,18 @@ void transferCallReturningOptional(const CallExpr *E, setHasValue(*Loc, State.Env.makeAtomicBoolValue(), State.Env); } -void handleConstMemberCall(const CallExpr *CE, +bool handleConstMemberCall(const CallExpr *CE, ymand wrote: Please

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -577,57 +580,62 @@ void handleConstMemberCall(const CallExpr *CE, auto &ResultLoc = State.Env.getResultObjectLocation(*CE); copyRecord(cast(Loc), ResultLoc, State.Env); } -return; +return true; } // Cache if the const method returns a referenc

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/129930 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add test for crash repro and clean up const accessor handling (PR #129930)

2025-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -577,57 +580,62 @@ void handleConstMemberCall(const CallExpr *CE, auto &ResultLoc = State.Env.getResultObjectLocation(*CE); copyRecord(cast(Loc), ResultLoc, State.Env); } -return; +return true; } // Cache if the const method returns a referenc

[clang] [clang][dataflow] Remove a deprecated CachedConstAccessorsLattice API (PR #127001)

2025-02-13 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/127001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fix smart pointer accessor caching to handle aliases (PR #124964)

2025-01-29 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/124964 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Use smart pointer caching in unchecked optional accessor (PR #120249)

2025-01-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -58,6 +63,106 @@ ast_matchers::StatementMatcher isSmartPointerLikeOperatorArrow(); ast_matchers::StatementMatcher isSmartPointerLikeValueMethodCall(); ast_matchers::StatementMatcher isSmartPointerLikeGetMethodCall(); +// Common transfer functions. + +/// Returns the "canon

[clang] [clang][dataflow] Use smart pointer caching in unchecked optional accessor (PR #120249)

2025-01-06 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/120249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][transformer] Allow usage of applyFirst with rewriteDescendants (PR #117658)

2024-12-30 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > Yes, indeed the original match happens in separate context, but all contexts > share one `NodesMap`, which values are overriden with a consecutive match > ('clash'). I see -- I'd missed the reuse of the MatchResult. Now that I understand the problem, I don't think that you're s

[clang] Introduce virtual interface for lattices and remove dependency on `llvm::Any`. (PR #120967)

2024-12-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/120967 >From db206514c03a58065e24afccd55886a012b2abcc Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 23 Dec 2024 13:42:21 + Subject: [PATCH] Introduce virtual interface for lattices and remove dependen

[clang] Introduce virtual interface for lattices and remove dependency on `llvm::Any`. (PR #120967)

2024-12-23 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/120967 >From 2273b56b783b7923108dbb3a5857d256fc4a44ca Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 23 Dec 2024 13:42:21 + Subject: [PATCH] Introduce virtual interface for lattices and remove dependen

[clang] Introduce virtual interface for lattices and remove dependency on `llvm::Any`. (PR #120967)

2024-12-23 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/120967 >From 3792a385b1ecd2dd029fc6321bacac1de5d8eb46 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 23 Dec 2024 13:42:21 + Subject: [PATCH] Introduce virtual interface for lattices and remove dependen

[clang] Introduce virtual interface for lattices and remove dependency on `llvm::Any`. (PR #120967)

2024-12-23 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/120967 >From 27ef09ae6f7a83fa3cf9ee98a46b02880607add8 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 23 Dec 2024 13:42:21 + Subject: [PATCH] Introduce virtual interface for lattices and remove dependen

[clang] Introduce virtual interface for lattices and remove dependency on `llvm::Any`. (PR #120967)

2024-12-23 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/120967 This PR has 2 related goals: *Remove dependency on `llvm::Any`*. For some platforms, use of `llvm::Any` forces users to explicitly define internal details related to `Any`. Aside from aesthetics, this places an ob

[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/120102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,133 @@ +#include "clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h" + +#include "clang/AST/CanonicalType.h" +#include "clang/AST/DeclCXX.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Basic/OperatorKinds.h" + +namespace clang::dataflow { + +na

[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,134 @@ +#include "clang/Analysis/FlowSensitive/SmartPointerAccessorCaching.h" + +#include "clang/AST/CanonicalType.h" +#include "clang/AST/DeclCXX.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Basic/OperatorKinds.h" + +namespace clang::dataflow { + +na

[clang] [clang][dataflow] Add matchers for smart pointer accessors to be cached (PR #120102)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -0,0 +1,63 @@ +//===-- SmartPointerAccessorCaching.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Gentle ping, since it's been a week since my last post. https://github.com/llvm/llvm-project/pull/115051 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][transformer] Allow usage of applyFirst with rewriteDescendants (PR #117658)

2024-12-18 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > > Can you expand on your concern about the clash? > > The clash is happening in `NodesMap`. See, > > 1. the matcher which is associated with `rewriteDescendants` gets "Tag0", > 2. tags for matchers from `applyfirst` are shifted, they get "Tag1", ... > 3. that is why `transformer:

[clang] [clang][transformer] Allow usage of applyFirst with rewriteDescendants (PR #117658)

2024-12-13 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > Without these changes a clash appears between a Tag, which is bound to > enclosing match, and a Tag, which is associated with first Case of applyFirst > in rewriteDescendands. Can you expand on your concern about the clash? Your approach of using the matcher ID seems like an im

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -143,6 +143,15 @@ const Formula &getFormula(const ValueDecl &D, const Environment &Env) { return cast(Env.getValue(D))->formula(); } +const BindingDecl *findBindingDecl(const char *Name, ASTContext &ASTCtx) { ymand wrote: nit: Please use StringRef. htt

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-10 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. https://github.com/llvm/llvm-project/pull/117858 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-10 Thread Yitzhak Mandelbaum via cfe-commits
@@ -143,6 +143,15 @@ const Formula &getFormula(const ValueDecl &D, const Environment &Env) { return cast(Env.getValue(D))->formula(); } +const BindingDecl *findBindingDecl(const char *Name, ASTContext &ASTCtx) { ymand wrote: why place this parameter second

[clang] [clang][transformer] Allow usage of applyFirst with rewriteDescendants (PR #117658)

2024-12-10 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > @ymand, could you please take a look? Yes -- sorry, missed the notification. I'll try to review within 24h. https://github.com/llvm/llvm-project/pull/117658 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-09 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: This review has been going on for longer than a month so, as one of the reviewers and the original author of this check, I wanted to jump in and see if we can bring it to an agreeable conclusion. I’d like to start with some background: * This check was introduced in 2020 with the

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-09 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > I am still confused why your team did not just disable this rule for test > folder? It is normal cases that source code and test code have different > quality metrics. Our codebase doesn't use test folders. We have no foolproof way of distinguishing code from test based on the

  1   2   3   4   5   6   7   8   >