[clang] [clang][dataflow][NFC] Rename `ControlFlowContext` to `AdornedCFG`. (PR #85640)

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

[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)

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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -119,20 +119,28 @@ QualType getPublicType(const Expr *E) { return Ty; } - QualType Ty = getPublicType(Cast->getSubExpr()); - - // Is `Ty` the type of `*this`? In this special case, we can upcast to the - // base class even if the base is non-public. - bool TyIsThi

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl &RD) { return false; } +static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) { + if (RD == nullptr) +return nullptr; + if (hasOptionalClassName(*RD)) +return RD; + + if

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -129,19 +215,19 @@ auto inPlaceClass() { auto isOptionalNulloptConstructor() { return cxxConstructExpr( - hasOptionalType(), + hasOptionalOrDerivedType(), ymand wrote: Here and below -- now that this matcher is more expensive, please move until

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From 3b20e1823753ab46e3e259d3d8c727dea91ce1d4 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH 1/2] [clang][dataflow] Refactor processing of terminator element

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -337,26 +274,33 @@ computeBlockInputState(const CFGBlock &Block, AnalysisContext &AC) { AC.BlockStates[Pred->getBlockID()]; if (!MaybePredState) continue; - -if (AC.Analysis.builtinOptions()) { - if (const Stmt *PredTerminatorStmt = Pred->getTermi

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-19 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From 02381f2dbdcc569889ae55a2ca5d8698f74626d8 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH 1/2] [clang][dataflow] Refactor processing of terminator element

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-19 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/84499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] CXXForRangeStmt should extend flow condition (PR #80989)

2024-03-19 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Just a note: I've siginfiicantly simplified the code that you're modifying in this PR (https://github.com/llvm/llvm-project/pull/84499), so expect some merge conflicts next time you pull from main. https://github.com/llvm/llvm-project/pull/80989 ___

[clang] [NFC][CLANG] Fix static analyzer bugs about unnecessary object copies with auto keyword (PR #85962)

2024-03-20 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Looks good, but per LLVM style guidelines, should we go ahead and replace the `auto` as well? https://github.com/llvm/llvm-project/pull/85962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/82950 >From 33f753d99bbb477ad37614d29658e964aa590a80 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 23 Feb 2024 20:15:36 + Subject: [PATCH 1/3] [clang][dataflow] Factor out built-in boolean model into a

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
@@ -1059,9 +1066,16 @@ void Environment::assume(const Formula &F) { DACtx->addFlowConditionConstraint(FlowConditionToken, F); } +#if 0 bool Environment::proves(const Formula &F) const { return DACtx->flowConditionImplies(FlowConditionToken, F); } +#else +bool Environmen

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Martin, I've thoroughly updated the refactoring, exactly as you suggested -- all of the interesting differences are actually just in how we handle the logical operations, so most of the changes are now in DataflowEnvironment.cpp. I've left the factoring in Transfer because we may

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/82950 >From 33f753d99bbb477ad37614d29658e964aa590a80 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 23 Feb 2024 20:15:36 + Subject: [PATCH 1/3] [clang][dataflow] Factor out built-in boolean model into a

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/82950 >From 33f753d99bbb477ad37614d29658e964aa590a80 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 23 Feb 2024 20:15:36 + Subject: [PATCH 1/3] [clang][dataflow] Factor out built-in boolean model into a

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-21 Thread Yitzhak Mandelbaum via cfe-commits
@@ -50,29 +50,206 @@ const Environment *StmtToEnvMap::getEnvironment(const Stmt &S) const { return &State->Env; } -static BoolValue &evaluateBooleanEquality(const Expr &LHS, const Expr &RHS, - Environment &Env) { - Value *LHSValue =

[clang] [clang][dataflow] Bail out if input is Objective-C++. (PR #86479)

2024-03-25 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/86479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Introduce a helper class for handling record initializer lists. (PR #86675)

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

[clang] [clang][dataflow] Introduce a helper class for handling record initializer lists. (PR #86675)

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

[clang] [clang][dataflow] Introduce a helper class for handling record initializer lists. (PR #86675)

2024-03-27 Thread Yitzhak Mandelbaum via cfe-commits
@@ -744,6 +744,35 @@ RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME, std::vector getFieldsForInitListExpr(const InitListExpr *InitList); +/// Helper class for initialization of a record with an `InitListExpr`. +/// `InitListExpr::inits()` contains the initi

[clang] [clang][dataflow] Fix for value constructor in class derived from optional. (PR #86942)

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

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/87233 The previous API relied on pointer equality of inputs and outputs to signal whether a change occured. This was too subtle and led to bugs in practice. It was also very limiting: the override could not return an equiv

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233 >From b7f63ed7ca3c503f55eccc215f0a66368e2c5e5e Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 1 Apr 2024 12:13:39 + Subject: [PATCH] [clang][dataflow] Refactor `widen` API to be explicit about cha

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233 >From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 1 Apr 2024 12:13:39 + Subject: [PATCH] [clang][dataflow] Refactor `widen` API to be explicit about cha

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -122,17 +135,19 @@ class Environment { /// /// `Prev` and `Current` must be assigned to the same storage location in /// `PrevEnv` and `CurrentEnv`, respectively. -virtual Value *widen(QualType Type, Value &Prev, const Environment &PrevEnv, -

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -805,6 +805,25 @@ class NullPointerAnalysis final else JoinedVal.setProperty("is_null", JoinedEnv.makeTopBoolValue()); } + + std::optional widen(QualType Type, Value &Prev, + const Environment &PrevEnv, Value &Current, +

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -975,6 +994,35 @@ TEST_F(WideningTest, DistinctValuesWithSamePropertiesAreEquivalent) { }); } +TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) { + std::string Code = R"( +void target(bool Cond) { + int *Foo; + int i = 0; +

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -975,6 +994,35 @@ TEST_F(WideningTest, DistinctValuesWithSamePropertiesAreEquivalent) { }); } +TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) { + std::string Code = R"( +void target(bool Cond) { + int *Foo; + int i = 0; +

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233 >From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 1 Apr 2024 12:13:39 + Subject: [PATCH 1/2] [clang][dataflow] Refactor `widen` API to be explicit about

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233 >From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 1 Apr 2024 12:13:39 + Subject: [PATCH 1/3] [clang][dataflow] Refactor `widen` API to be explicit about

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -975,6 +994,35 @@ TEST_F(WideningTest, DistinctValuesWithSamePropertiesAreEquivalent) { }); } +TEST_F(WideningTest, DistinctValuesWithDifferentPropertiesWidenedToTop) { + std::string Code = R"( +void target(bool Cond) { + int *Foo; + int i = 0; +

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Martin, I've addressed all of your comments. PTAL. https://github.com/llvm/llvm-project/pull/87233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/87233 >From d8d875271bd47b71701143afb06ea654546e2b7c Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 1 Apr 2024 12:13:39 + Subject: [PATCH 1/4] [clang][dataflow] Refactor `widen` API to be explicit about

[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)

2024-04-02 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: I also fixed up the other tests to use `getValue/LocForDecl` to be consistent. https://github.com/llvm/llvm-project/pull/87233 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-06 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80361 >From 660d1afbda79416beb6f373e6252670f912a5181 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:02:21 + Subject: [PATCH 1/4] Add new `join` API and replace existing `merge` implementa

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -248,12 +251,12 @@ class JoinedStateBuilder { // initialize the state of each basic block differently. return {AC.Analysis.typeErasedInitialElement(), AC.InitEnv.fork()}; if (All.size() == 1) ymand wrote: Agreed with keeping as is for reduci

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-06 Thread Yitzhak Mandelbaum via cfe-commits
@@ -307,7 +310,22 @@ computeBlockInputState(const CFGBlock &Block, AnalysisContext &AC) { } } - JoinedStateBuilder Builder(AC); + // If any of the predecessor blocks contains an expression consumed in a + // different block, we need to keep expression state. + // No

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

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

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-06 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Per offline discussion, please see if we can be more targeted in our use of the generalized matching, given the potentially high cost incurred (for every relevant operation, like comparison, we'll be searching the entire type hierchy of the arguments). https://github.com/llvm/llv

[clang] [clang][dataflow] When analyzing ctors, don't initialize fields of `*this` with values. (PR #84164)

2024-03-07 Thread Yitzhak Mandelbaum via cfe-commits
@@ -414,8 +414,15 @@ void Environment::initialize() { } } else if (MethodDecl->isImplicitObjectMemberFunction()) { QualType ThisPointeeType = MethodDecl->getFunctionObjectParameterType(); - setThisPointeeStorageLocation( - cast(createObject(ThisPoi

[clang] [clang][dataflow] When analyzing ctors, don't initialize fields of `*this` with values. (PR #84164)

2024-03-07 Thread Yitzhak Mandelbaum via cfe-commits
@@ -799,6 +806,16 @@ PointerValue &Environment::getOrCreateNullPointerValue(QualType PointeeType) { return DACtx->getOrCreateNullPointerValue(PointeeType); } +void Environment::initializeFieldsWithValues(RecordStorageLocation &Loc) { ymand wrote: I don't k

[clang] [clang][dataflow] When analyzing ctors, don't initialize fields of `*this` with values. (PR #84164)

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

[clang] [clang-tools-extra] [clang-tidy][dataflow] Add `bugprone-null-check-after-dereference` check (PR #84166)

2024-03-07 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > My main problem is that dataflow framework is slow and unstable, there are 20 > issues open for an bugprone-unchecked-optional-access check that uses this > framework and 19 issues for a framework alone. It crashes, it hangs and only > cause problems. I think those issues are s

[clang] [clang-tools-extra] [clang-tidy][dataflow] Add `bugprone-null-check-after-dereference` check (PR #84166)

2024-03-07 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > > I think those issues are stale. > > Last time I tested it it were on Clang-tidy 17. I'm doing migration to > Clang-tidy 18 now. I will check this and bugprone-unchecked-optional-access > check on my code-base, on which it were unstable previously. If nothing will > hang/crash

[clang] [clang][dataflow] Add context-sensitive test for returning a record by value. (PR #84317)

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

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > > Draft to demo how we can pull out the boolean model. Let's discuss > > specifics of namings, location, etc. > > Not sure -- do you mean let's wordsmith names now, or do you mean we should > discuss naming and location, but that should happen after we've talked about > the gen

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/84499 This patch vastly simplifies the code handling terminators, without changing any behavior. Additionally, the simplification unblocks our ability to address a (simple) FIXME in the code to invoke `transferBranch`, eve

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Terminator cleanup split out into https://github.com/llvm/llvm-project/pull/84499 https://github.com/llvm/llvm-project/pull/82950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From 81945389b60e95019ff916d356127119183e8198 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH] [clang][dataflow] Refactor processing of terminator element Thi

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From b7887543320f8727545a7ce8e6d9e02b77604472 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH] [clang][dataflow] Refactor processing of terminator element Thi

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From d1bedf3a9b1d0d4c2fbfc10509797b39eef3d592 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH] [clang][dataflow] Refactor processing of terminator element Thi

[clang] [clang][dataflow] Refactor processing of terminator element (PR #84499)

2024-03-08 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/84499 >From 3b20e1823753ab46e3e259d3d8c727dea91ce1d4 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH] [clang][dataflow] Refactor processing of terminator element Thi

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-03-11 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/82950 >From 3b20e1823753ab46e3e259d3d8c727dea91ce1d4 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Fri, 8 Mar 2024 15:19:14 + Subject: [PATCH 1/3] [clang][dataflow] Refactor processing of terminator element

[clang] Revert "[clang][dataflow] Correctly handle `InitListExpr` of union type." (PR #82856)

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

[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

2024-02-25 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/82950 Draft to demo how we can pull out the boolean model. Let's discuss specifics of namings, location, etc. The purpose of this refactoring is to enable us to compare the performance of different boolean models. In part

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

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

[clang] [clang][dataflow] Skip array types when handling InitListExprs. (PR #83013)

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

[clang] [clang][dataflow] Skip array types when handling InitListExprs. (PR #83013)

2024-02-26 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/83013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Remove deprecated `ValueModel::merge()` function. (PR #82602)

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

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

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

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

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

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-27 Thread Yitzhak Mandelbaum via cfe-commits
@@ -2392,14 +2392,88 @@ TEST(TransferTest, InitListExprAsUnion) { } F; public: - constexpr target() : F{nullptr} {} + constexpr target() : F{nullptr} { +int *null = nullptr; +F.b; // Make sure we reference 'b' so it is modeled. +//

[clang] [clang][dataflow] Correctly treat empty initializer lists for unions. (PR #82986)

2024-02-27 Thread Yitzhak Mandelbaum via cfe-commits
@@ -2392,14 +2392,88 @@ TEST(TransferTest, InitListExprAsUnion) { } F; public: - constexpr target() : F{nullptr} {} + constexpr target() : F{nullptr} { +int *null = nullptr; +F.b; // Make sure we reference 'b' so it is modeled. +//

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

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

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand approved this pull request. I'm a little concerned with the complexity and cost required to support this optimization. With this added cost, do you know if the analysis still faster (and less SAT timeouts?) than if we just did the simple thing of not dropping state? h

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-01 Thread Yitzhak Mandelbaum via cfe-commits
@@ -248,12 +251,12 @@ class JoinedStateBuilder { // initialize the state of each basic block differently. return {AC.Analysis.typeErasedInitialElement(), AC.InitEnv.fork()}; if (All.size() == 1) ymand wrote: guard on ExprBehavior as well, like

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-01 Thread Yitzhak Mandelbaum via cfe-commits
@@ -221,18 +221,21 @@ class PrettyStackTraceCFGElement : public llvm::PrettyStackTraceEntry { // Avoids unneccesary copies of the environment. class JoinedStateBuilder { AnalysisContext ∾ + Environment::ExprJoinBehavior ExprBehavior; ymand wrote: If you

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-01 Thread Yitzhak Mandelbaum via cfe-commits
@@ -307,7 +310,22 @@ computeBlockInputState(const CFGBlock &Block, AnalysisContext &AC) { } } - JoinedStateBuilder Builder(AC); + // If any of the predecessor blocks contains an expression consumed in a + // different block, we need to keep expression state. + // No

[clang] [clang][nullability] Don't discard expression state before end of full-expression. (PR #82611)

2024-03-01 Thread Yitzhak Mandelbaum via cfe-commits
@@ -94,6 +94,36 @@ static llvm::BitVector findReachableBlocks(const CFG &Cfg) { return BlockReachable; } +static llvm::DenseSet +buildContainsExprConsumedInDifferentBlock( +const CFG &Cfg, +const llvm::DenseMap &StmtToBlock) { + llvm::DenseSet Result; + + auto Chec

[clang] [clang][CFG] Change child order in Reverse Post Order (RPO) iteration. (PR #80030)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: Gabor, please let me know if you think anyone else should review this change, given that there are assorted clients of the PostCFG view. We think this is a benefit for anyone using a post-order view in a worklist algorithm, but have a hard time anticipating all the potential uses.

[clang] [clang][CFG] Change child order in Reverse Post Order (RPO) iteration. (PR #80030)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80030 >From 974b337c522973cc03eca3d6c1e873e83f8201aa Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 29 Jan 2024 21:26:27 + Subject: [PATCH] [clang][CFG] Change child order in Reverse Post Order (RPO) it

[clang] [clang][dataflow] Drop block-relative cap on worklist iterations. (PR #80033)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/80033 As per the FIXME, this cap never really served its purpose. This patch simplifies to a single, caller-specified, absolute cap. >From fef909302d31b131007558252981270360fcac39 Mon Sep 17 00:00:00 2001 From: Yitzhak M

[clang] [clang][dataflow] Extend debug output for `Environment`. (PR #79982)

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

[clang] [clang][dataflow] In the CFG visualization, mark converged blocks. (PR #79999)

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

[clang] [clang][dataflow] Drop block-relative cap on worklist iterations. (PR #80033)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80033 >From bb93306b6fdefa6d00622386af93d3baef251c2c Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:52:13 + Subject: [PATCH] [clang][dataflow] Drop block-relative cap on worklist iteratio

[clang] [clang][dataflow] Drop block-relative cap on worklist iterations. (PR #80033)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80033 >From 221ceddcca1f045725216c09432216440d1c6b63 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:52:13 + Subject: [PATCH] [clang][dataflow] Drop block-relative cap on worklist iteratio

[clang] [clang][dataflow] Drop block-relative cap on worklist iterations. (PR #80033)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/80033 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][CFG] Change child order in Reverse Post Order (RPO) iteration. (PR #80030)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80030 >From 4ea1f14cfd835308064579554c3b8f5ce71ef0c0 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Mon, 29 Jan 2024 21:26:27 + Subject: [PATCH] [clang][CFG] Change child order in Reverse Post Order (RPO) it

[clang] [clang][CFG] Change child order in Reverse Post Order (RPO) iteration. (PR #80030)

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

[clang] [clang][CFG] Change child order in Reverse Post Order (RPO) iteration. (PR #80030)

2024-01-30 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/80030 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/80361 This patch adds a new interface for the join operation, now properly called `join`. Originally, the framework offered a single `merge` operation, which could serve either as a join or a widening. In practice, thoug

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-01 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80361 >From 660d1afbda79416beb6f373e6252670f912a5181 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:02:21 + Subject: [PATCH] Add new `join` API and replace existing `merge` implementation

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-02 Thread Yitzhak Mandelbaum via cfe-commits
@@ -105,6 +105,27 @@ class Environment { return true; } +/// Modifies `JoinedVal` to approximate both `Val1` and `Val2`. This should +/// obey the properties of a lattice join. +/// +/// `Env1` and `Env2` can be used to query child values and path con

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-02 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80361 >From 660d1afbda79416beb6f373e6252670f912a5181 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:02:21 + Subject: [PATCH 1/2] Add new `join` API and replace existing `merge` implementa

[clang] [clang][dataflow] Add new `join` API and replace existing `merge` implementations. (PR #80361)

2024-02-02 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/80361 >From 660d1afbda79416beb6f373e6252670f912a5181 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 30 Jan 2024 16:02:21 + Subject: [PATCH 1/3] Add new `join` API and replace existing `merge` implementa

[clang] [clang][dataflow] Tighten checking for existence of a function body. (PR #78163)

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

[clang] [clang][dataflow] Use `ignoreCFGOmittedNodes()` in `setValue()`. (PR #78245)

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

[clang] [clang][dataflow] Fix bug in `Value` comparison. (PR #76746)

2024-01-16 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/76746 >From 7a41ed57e7597c9f40ce7d8727833132d05c7d6a Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Tue, 2 Jan 2024 19:27:21 + Subject: [PATCH] [clang][dataflow] Fix bug in `Value` comparison. Makes value eq

[clang] [clang][dataflow] Fix bug in `Value` comparison. (PR #76746)

2024-01-16 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/76746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Process terminator condition within `transferCFGBlock()`. (PR #78127)

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

[clang] [clang][dataflow] Process terminator condition within `transferCFGBlock()`. (PR #78127)

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

[clang] [clang][dataflow] Process terminator condition within `transferCFGBlock()`. (PR #78127)

2024-01-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -25,10 +25,17 @@ namespace dataflow { /// Maps statements to the environments of basic blocks that contain them. class StmtToEnvMap { public: + // `CurBlock` is the block currently being processed, and `CurState` is the + // pending state currently associated with this blo

[clang] [clang][dataflow] Treat comma operator correctly in `getResultObjectLocation()`. (PR #78427)

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

[clang] [clang][dataflow] Make cap on block visits configurable by caller. (PR #77481)

2024-01-19 Thread Yitzhak Mandelbaum via cfe-commits
@@ -138,13 +138,20 @@ struct TypeErasedDataflowAnalysisState { /// dataflow analysis cannot be performed successfully. Otherwise, calls /// `PostVisitCFG` on each CFG element with the final analysis results at that /// program point. +/// +/// `MaxBlockVisits` caps the number o

[clang] [clang][dataflow] Make cap on block visits configurable by caller. (PR #77481)

2024-01-19 Thread Yitzhak Mandelbaum via cfe-commits
@@ -186,6 +186,14 @@ template struct DataflowAnalysisState { /// the dataflow analysis cannot be performed successfully. Otherwise, calls /// `PostVisitCFG` on each CFG element with the final analysis results at that /// program point. +/// +/// `MaxBlockVisits` caps the numbe

[clang] [clang][dataflow] Make cap on block visits configurable by caller. (PR #77481)

2024-01-19 Thread Yitzhak Mandelbaum via cfe-commits
@@ -138,13 +138,20 @@ struct TypeErasedDataflowAnalysisState { /// dataflow analysis cannot be performed successfully. Otherwise, calls /// `PostVisitCFG` on each CFG element with the final analysis results at that /// program point. +/// +/// `MaxBlockVisits` caps the number o

<    1   2   3   4   5   6   7   >