[clang] [clang][ASTMatcher] Add `matchesString` for `StringLiteral` which matches literals on given `RegExp` (PR #102152)

2024-08-07 Thread Ding Fei via cfe-commits
https://github.com/danix800 edited https://github.com/llvm/llvm-project/pull/102152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Import C++20 concepts related nodes (PR #104731)

2024-08-18 Thread Ding Fei via cfe-commits
https://github.com/danix800 created https://github.com/llvm/llvm-project/pull/104731 Related nodes including: - ConceptDecl - RequiresExprBodyDecl - ImplicitConceptSpecializationDecl - RequiresExpr - ConceptSpecializationExpr - concepts::Requirement - concepts::ExprRequirement - concepts::Neste

[clang] [clang][ASTImporter] set nonnull type for var specialized from lambda template (PR #105492)

2024-08-21 Thread Ding Fei via cfe-commits
https://github.com/danix800 created https://github.com/llvm/llvm-project/pull/105492 There's circular deps here when importing btw VarTemplateSpecializationDecl (m) and its type. VarDecl is created with a null type QualType(), and the importing of its type will leads to linkage computation (f

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Ding Fei via cfe-commits
=?utf-8?q?Balázs_Kéri?= Message-ID: In-Reply-To: @@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous d

[clang] [clang][ASTImporter] set nonnull type for var specialized from lambda template (PR #105492)

2024-08-21 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/105492 >From 2ac3aa1b85d727fd15d49fa1649147f2229576cb Mon Sep 17 00:00:00 2001 From: dingfei Date: Wed, 21 Aug 2024 17:52:04 +0800 Subject: [PATCH 1/2] [clang][ASTImporter] set nonnull type for var specialized from l

[clang] [clang][ASTImporter] set nonnull type for var specialized from lambda template (PR #105492)

2024-08-21 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/105492 >From 2ac3aa1b85d727fd15d49fa1649147f2229576cb Mon Sep 17 00:00:00 2001 From: dingfei Date: Wed, 21 Aug 2024 17:52:04 +0800 Subject: [PATCH 1/3] [clang][ASTImporter] set nonnull type for var specialized from l

[clang] [clang][AST] CXXRecords in anony namespace from diff TUs shouldn't be equivalent (PR #112534)

2024-10-18 Thread Ding Fei via cfe-commits
danix800 wrote: > The fix looks acceptable, but a test is needed. The test code in the bug > report can be used somehow in at the AST merge LIT tests or in the > `ASTImporterTest`. Thanks for reviewing. There's one more other similar crash (with this fix) and I'm still reducing the testcase.

[clang] [clang][AST] CXXRecords in anony namespace from diff TUs shouldn't be equivalent (PR #112534)

2024-10-18 Thread Ding Fei via cfe-commits
https://github.com/danix800 converted_to_draft https://github.com/llvm/llvm-project/pull/112534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/114806 >From dfd42c06d94f859ec78ec1e5c3386c0e4016386f Mon Sep 17 00:00:00 2001 From: dingfei Date: Mon, 4 Nov 2024 22:37:51 +0800 Subject: [PATCH 1/3] [clang-query] add basic profiling on matching each ASTs Sample ou

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 edited https://github.com/llvm/llvm-project/pull/114806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 edited https://github.com/llvm/llvm-project/pull/114806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/114806 >From dfd42c06d94f859ec78ec1e5c3386c0e4016386f Mon Sep 17 00:00:00 2001 From: dingfei Date: Mon, 4 Nov 2024 22:37:51 +0800 Subject: [PATCH 1/2] [clang-query] add basic profiling on matching each ASTs Sample ou

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 created https://github.com/llvm/llvm-project/pull/114806 Sample output: ``` $ cat test.cql set enable-profile true m binaryOperator(isExpansionInMainFile()) $ cat test.c int test(int i, int j) { return i + j; } $ clang-query --track-memory -f test.cql test.c --

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/114806 >From dfd42c06d94f859ec78ec1e5c3386c0e4016386f Mon Sep 17 00:00:00 2001 From: dingfei Date: Mon, 4 Nov 2024 22:37:51 +0800 Subject: [PATCH 1/5] [clang-query] add basic profiling on matching each ASTs Sample ou

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-05 Thread Ding Fei via cfe-commits
https://github.com/danix800 closed https://github.com/llvm/llvm-project/pull/114806 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
@@ -0,0 +1,35 @@ +//===- QueryProfile.h - clang-query -*- 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-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/114806 >From dfd42c06d94f859ec78ec1e5c3386c0e4016386f Mon Sep 17 00:00:00 2001 From: dingfei Date: Mon, 4 Nov 2024 22:37:51 +0800 Subject: [PATCH 1/4] [clang-query] add basic profiling on matching each ASTs Sample ou

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
@@ -0,0 +1,35 @@ +//===- QueryProfile.h - clang-query -*- 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-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/114806 >From dfd42c06d94f859ec78ec1e5c3386c0e4016386f Mon Sep 17 00:00:00 2001 From: dingfei Date: Mon, 4 Nov 2024 22:37:51 +0800 Subject: [PATCH 1/6] [clang-query] add basic profiling on matching each ASTs Sample ou

[clang-tools-extra] [clang-query] add basic profiling on matching each ASTs (PR #114806)

2024-11-04 Thread Ding Fei via cfe-commits
@@ -0,0 +1,35 @@ +//===- QueryProfile.h - clang-query -*- 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] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
@@ -23,7 +23,14 @@ RangedConstraintManager::~RangedConstraintManager() {} ProgramStateRef RangedConstraintManager::assumeSym(ProgramStateRef State, SymbolRef Sym, bool Assumpti

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
https://github.com/danix800 edited https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-08 Thread Ding Fei via cfe-commits
https://github.com/danix800 created https://github.com/llvm/llvm-project/pull/115579 This could deduce some complex syms derived from simple ones whose values could be constrainted to be concrete during execution, thus reducing some overconstrainted states. This commit also fix `unix.StdCLibr

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-08 Thread Ding Fei via cfe-commits
https://github.com/danix800 edited https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-08 Thread Ding Fei via cfe-commits
https://github.com/danix800 unassigned https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
danix800 wrote: > > Thanks for the commit, I'm satisfied with it :) > > I actually like that these two related changes (the checker change and the > > constraint manager improvement) are handled together in a single commit -- > > this way somebody who browses the commit log can directly see the

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/115579 >From 19b47c6ad25453c6be74bfd4cbdb7bc7eeed401c Mon Sep 17 00:00:00 2001 From: dingfei Date: Sat, 9 Nov 2024 10:28:59 +0800 Subject: [PATCH 1/2] [StaticAnalyzer] early return if sym is concrete on assuming Thi

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
@@ -0,0 +1,33 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=unix.StdCLibraryFunctions \ +// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=true \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -triple x86_64-unknown-linux-gnu \ +//

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-11 Thread Ding Fei via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -verify + +void clang_analyzer_eval(int); + +void test_derived_sym_simplification_on_assume(int s0, int s1) { + int elem = s0 + s1 + 1; + if (elem-- == 0) // elem = s

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-12 Thread Ding Fei via cfe-commits
danix800 wrote: > First, let me thank you for posting a high quality patch like this. > > `ProgramState::isPosteriorlyOverconstrained()` was introduced to carry the > fact that even the parent state was infeasible. Checkers were written in the > sense that `ProgramState::assume()` will return

[clang] [StaticAnalyzer] early return if sym is concrete on assuming (PR #115579)

2024-11-09 Thread Ding Fei via cfe-commits
danix800 wrote: Yes these two are related. Solver is the root cause, the checker crash is the effect. Either fix could cover the crash but not enough without the other. The solver is inherently incapable of solving some constraints, which would brings in some overly constrainted states. We co

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-18 Thread Ding Fei via cfe-commits
danix800 wrote: > @danix800 Could you please have a look at the failed test, such that we could > reapply this PR? I reverted this soon after I realized the broken test is > from this PR. The test randomly fails for unknown reason, on VS2019~2022, after 1c154bd755153b5c6ada4bbed58facf23f6abff

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-19 Thread Ding Fei via cfe-commits
danix800 wrote: > I'm not sure I see why. The logs I linked in the revert only showed a single > test failure. The new test we added in this PR. This suggests close > correlations. Maybe the content of the "constraints" map in the State is > dumped in a non-deterministic order? And we just hap

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-19 Thread Ding Fei via cfe-commits
danix800 wrote: > Thank you for your dedication. What are your plans? Do you plan to continue > pushing this? > > Btw why did this test only fail on Windows? I'll further investigate if it's possilbe to do similar improvement on the solver in other ways. https://github.com/llvm/llvm-project/

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-19 Thread Ding Fei via cfe-commits
danix800 wrote: It is unstable ordering of elements from DenseMap/Set. This PR actually breaks the recursive fixpoint simplification algorithm of the eq class. One thing left which confused me is that why no randomness is observed when compiled by gcc on linux, purely out of coincidence? htt

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-14 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/115579 >From 19b47c6ad25453c6be74bfd4cbdb7bc7eeed401c Mon Sep 17 00:00:00 2001 From: dingfei Date: Sat, 9 Nov 2024 10:28:59 +0800 Subject: [PATCH 1/4] [StaticAnalyzer] early return if sym is concrete on assuming Thi

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-14 Thread Ding Fei via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -verify danix800 wrote: Thanks for reminding of this! Fixed! https://github.com/llvm/llvm-project/pull/115579 ___

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-15 Thread Ding Fei via cfe-commits
https://github.com/danix800 closed https://github.com/llvm/llvm-project/pull/115579 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-15 Thread Ding Fei via cfe-commits
danix800 wrote: > LGTM now. Thank you for this high quality patch. This isn't the first time, I > remember. Excellent track record. Thanks for your reviews and all of your kindness! @steakhal @NagyDonat https://github.com/llvm/llvm-project/pull/115579 _

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-15 Thread Ding Fei via cfe-commits
danix800 wrote: > @danix800 Could you please have a look at the failed test, such that we could > reapply this PR? I reverted this soon after I realized the broken test is > from this PR. Working on it! https://github.com/llvm/llvm-project/pull/115579 _

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-13 Thread Ding Fei via cfe-commits
https://github.com/danix800 updated https://github.com/llvm/llvm-project/pull/115579 >From 19b47c6ad25453c6be74bfd4cbdb7bc7eeed401c Mon Sep 17 00:00:00 2001 From: dingfei Date: Sat, 9 Nov 2024 10:28:59 +0800 Subject: [PATCH 1/3] [StaticAnalyzer] early return if sym is concrete on assuming Thi

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-13 Thread Ding Fei via cfe-commits
@@ -0,0 +1,31 @@ +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=debug.ExprInspection \ +// RUN: -verify + +void clang_analyzer_eval(int); + +void test_derived_sym_simplification_on_assume(int s0, int s1) { + int elem = s0 + s1 + 1; + if (elem-- == 0) // elem = s

[clang] [analyzer][Solver] Early return if sym is concrete on assuming (PR #115579)

2024-11-21 Thread Ding Fei via cfe-commits
danix800 wrote: For this testcase, two constrainst are collected on the path: ```c (1) a + b + c == d (2) b + c = 0 ``` when assuming the third constraint `b == 0`, (1) or (2) is selected at random order for simplifying eq class. The fixedpoint simplification algorithm will recurse by `Re-eva

<    1   2