[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-22 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall closed https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread via cfe-commits
https://github.com/martinboehme resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/66424 >From 35b33561af918fc2e13af9de18af6b181535ce49 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 14 Sep 2023 21:36:50 +0200 Subject: [PATCH 1/3] [dataflow] Parse formulas from text My immediate use for thi

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall updated https://github.com/llvm/llvm-project/pull/66424 >From 35b33561af918fc2e13af9de18af6b181535ce49 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Thu, 14 Sep 2023 21:36:50 +0200 Subject: [PATCH 1/2] [dataflow] Parse formulas from text My immediate use for thi

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; + EatWhitespace(); + + if (In.consume_front("!")) { +if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; + EatWhitespace(); + + if (In.consume_front("!")) { +if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
@@ -258,114 +276,71 @@ TEST(SolverTest, IffWithUnits) { } TEST(SolverTest, IffWithUnitsConflict) { - ConstraintContext Ctx; - auto X = Ctx.atom(); - auto Y = Ctx.atom(); - auto XEqY = Ctx.iff(X, Y); - auto NotY = Ctx.neg(Y); - - // (X <=> Y) ^ X !Y - EXPECT_THAT(solve(

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; sam-mccall wrote: Renamed, hard to know if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
@@ -87,6 +87,9 @@ class alignas(const Formula *) Formula { ArrayRef Operands, unsigned Value = 0); + // Parse Formulas using Arena rather than caling this function directly. + static Formula *parse(llvm::BumpPtrAllocator &All

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-19 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall resolved https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread Gábor Horváth via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; + EatWhitespace(); + + if (In.consume_front("!")) { +if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread Gábor Horváth via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; + EatWhitespace(); + + if (In.consume_front("!")) { +if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: I think it is useful to have something like this checked in, I support this PR. https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -258,114 +276,71 @@ TEST(SolverTest, IffWithUnits) { } TEST(SolverTest, IffWithUnitsConflict) { - ConstraintContext Ctx; - auto X = Ctx.atom(); - auto Y = Ctx.atom(); - auto XEqY = Ctx.iff(X, Y); - auto NotY = Ctx.neg(Y); - - // (X <=> Y) ^ X !Y - EXPECT_THAT(solve(

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -87,6 +87,9 @@ class alignas(const Formula *) Formula { ArrayRef Operands, unsigned Value = 0); + // Parse Formulas using Arena rather than caling this function directly. + static Formula *parse(llvm::BumpPtrAllocator &All

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -13,6 +13,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/Support/ErrorHandling.h" #include +#include martinboehme wrote: Inadvertent change? (There are no other changes in this file.) https://github.com/llvm/llvm-project/pull/66424 _

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -87,6 +87,9 @@ class alignas(const Formula *) Formula { ArrayRef Operands, unsigned Value = 0); + // Parse Formulas using Arena rather than caling this function directly. martinboehme wrote: ```suggestion

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -137,5 +140,46 @@ TEST_F(ArenaTest, Interning) { EXPECT_EQ(&B1.formula(), &F1); } +TEST_F(ArenaTest, Parse) { martinboehme wrote: ```suggestion TEST_F(ArenaTest, ParseFormula) { ``` Matches name of the function, and we might conceivably add other parsin

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; martinboehme wrote: ```suggestion auto Ea

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
@@ -95,4 +98,94 @@ BoolValue &Arena::makeBoolValue(const Formula &F) { return *It->second; } +namespace { +const Formula *parse(Arena &A, llvm::StringRef &In) { + auto EatWhitespace = [&] { In = In.ltrim(' '); }; + EatWhitespace(); + + if (In.consume_front("!")) { +if

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
https://github.com/martinboehme approved this pull request. https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread via cfe-commits
https://github.com/martinboehme edited https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

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

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-15 Thread Yitzhak Mandelbaum via cfe-commits
@@ -87,6 +87,9 @@ class alignas(const Formula *) Formula { ArrayRef Operands, unsigned Value = 0); + // Parse Formulas using Arena rather than caling this function directly. ymand wrote: nit: Maybe prefix wit

[clang] [dataflow] Parse formulas from text (PR #66424)

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

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread Sam McCall via cfe-commits
sam-mccall wrote: Not sure if this is really important to have checked in, but I've wanted to investigate/reproduce flow condition slowness a few times now, so thought I should send the patch in case others think it's useful. https://github.com/llvm/llvm-project/pull/66424

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall review_requested https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall review_requested https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-analysis Changes My immediate use for this is not in checked-in code, but rather the ability to plug printed flow conditions (from analysis logs) back into sat solver unittests to reproduce slowness. It does allow simplifying some of the

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread via cfe-commits
https://github.com/llvmbot labeled https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread via cfe-commits
https://github.com/llvmbot labeled https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread via cfe-commits
https://github.com/llvmbot labeled https://github.com/llvm/llvm-project/pull/66424 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [dataflow] Parse formulas from text (PR #66424)

2023-09-14 Thread Sam McCall via cfe-commits
https://github.com/sam-mccall created https://github.com/llvm/llvm-project/pull/66424: My immediate use for this is not in checked-in code, but rather the ability to plug printed flow conditions (from analysis logs) back into sat solver unittests to reproduce slowness. It does allow simplifying