[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -718,16 +730,24 @@ class Environment { void pushCallInternal(const FunctionDecl *FuncDecl, ArrayRef Args); + // FIXME: Add support for resetting globals after function calls to enable + // the implementation of sound analyses.

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -164,23 +169,28 @@ class Environment { Environment =(Environment &) = default; /// Creates an environment that uses `DACtx` to store objects that encompass - /// the state of a program. - /// - /// If `DeclCtx` is a function, initializes the environment with

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -290,13 +295,13 @@ widenKeyToValueMap(const llvm::MapVector , namespace { // Visitor that builds a map from record prvalues to result objects. -// This traverses the body of the function to be analyzed; for each result -// object that it encounters, it propagates the

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -290,13 +295,13 @@ widenKeyToValueMap(const llvm::MapVector , namespace { // Visitor that builds a map from record prvalues to result objects. -// This traverses the body of the function to be analyzed; for each result -// object that it encounters, it propagates the

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -403,4 +405,35 @@ TEST_F(EnvironmentTest, Contains(Member)); } +TEST_F(EnvironmentTest, Stmt) { + using namespace ast_matchers; + + std::string Code = R"cc( + struct S {int i;}; + void foo() { +S AnS = S{1}; + }

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -403,4 +405,35 @@ TEST_F(EnvironmentTest, Contains(Member)); } +TEST_F(EnvironmentTest, Stmt) { + using namespace ast_matchers; + + std::string Code = R"cc( + struct S {int i;}; + void foo() { +S AnS = S{1}; + } +)cc"; + auto

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -146,6 +146,30 @@ TEST_F(DataflowAnalysisTest, DiagnoseFunctionDiagnoserCalledOnEachElement) { " (Lifetime ends)\n"))); } +TEST_F(DataflowAnalysisTest, CanAnalyzeStmt) { + std::string Code = R"cc( + struct S {int i;}; + S

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -146,6 +146,30 @@ TEST_F(DataflowAnalysisTest, DiagnoseFunctionDiagnoserCalledOnEachElement) { " (Lifetime ends)\n"))); } +TEST_F(DataflowAnalysisTest, CanAnalyzeStmt) { + std::string Code = R"cc( + struct S {int i;}; + S

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
@@ -146,6 +146,30 @@ TEST_F(DataflowAnalysisTest, DiagnoseFunctionDiagnoserCalledOnEachElement) { " (Lifetime ends)\n"))); } +TEST_F(DataflowAnalysisTest, CanAnalyzeStmt) { + std::string Code = R"cc( + struct S {int i;}; + S

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-15 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/7] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-10 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/6] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-10 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/5] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-10 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/4] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-10 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/3] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-10 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: I agree with the usefulness of storing the initial target separately, reducing checks and branching based on whether the current target is a `Stmt` or `Function`. Since I was touching everywhere `CallStack` was used anyway, I went ahead with not pushing the starting

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-09 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/91616 >From b62a95001e32a0c1d63204950481eb500c9d0275 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 9 May 2024 12:00:06 -0400 Subject: [PATCH 1/2] [clang][dataflow] Fully support Environment construction for

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-09 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @ymand Can you review and eventually merge for me? https://github.com/llvm/llvm-project/pull/91616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fully support Environment construction for Stmt analysis. (PR #91616)

2024-05-09 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/91616 Assume in fewer places that the analysis is of a FunctionDecl, and initialize the Environment properly for Stmts. Moves constructors for Environment to header to make it more obvious that there are only minor

[clang] [clang][dataflow] Expose getReferencedDecls for a Stmt. (PR #89444)

2024-04-19 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: Ha, so fast I hadn't even hit send to ask for you to review yet. Can you merge for me? https://github.com/llvm/llvm-project/pull/89444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][dataflow] Expose getReferencedDecls for a Stmt. (PR #89444)

2024-04-19 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/89444 None >From e7b1540984306bfb36a59fa7692208bfaf2bdc1a Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Fri, 19 Apr 2024 15:09:32 -0400 Subject: [PATCH] [clang][dataflow] Expose getReferencedDecls for a Stmt.

[clang] [clang][dataflow] Expose getReferencedDecls and relocate free functions. (PR #88754)

2024-04-16 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/88754 >From 223d4c48abf27c8b0949ac1520b66ef32cbd63c1 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Fri, 12 Apr 2024 12:18:44 -0400 Subject: [PATCH 1/4] [clang][dataflow] Expose fields, globals, and functions

[clang] [clang][dataflow] Expose getReferencedDecls and relocate free functions. (PR #88754)

2024-04-15 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @ymand @martinboehme Apologies for the broken chains of comments; can you take another look? https://github.com/llvm/llvm-project/pull/88754 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][dataflow] Expose getReferencedDecls and relocate free functions. (PR #88754)

2024-04-15 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/88754 Moves free functions from DataflowEnvironment.h/cc and DataflowAnalysisContext.h/cc to RecordOps and a new ASTOps and exposes them as needed for current use and to expose getReferencedDecls for out-of-tree use.

[clang] [clang][dataflow] Expose fields, globals, and functions referenced. (PR #88534)

2024-04-12 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @ymand Can you review and merge? https://github.com/llvm/llvm-project/pull/88534 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Expose fields, globals, and functions referenced. (PR #88534)

2024-04-12 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/88534 Exposes the collection functionality, but does not alter it beyond using a return value instead of output parameters. Also relocates underlying and related functions and a class from DataflowEnvironment's files

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

2024-02-26 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/83013 >From ee395ff3555efa5cbeae4d874f3ad39c52b85faf Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Mon, 26 Feb 2024 10:00:48 -0500 Subject: [PATCH 1/2] [clang][dataflow] Skip array types when handling

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

2024-02-26 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/83013 Crashes resulted from single-element InitListExprs for arrays with elements of a record type after #80970. >From ee395ff3555efa5cbeae4d874f3ad39c52b85faf Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Mon,

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

2024-02-23 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi edited 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] Revert "[clang][dataflow] Correctly handle `InitListExpr` of union type." (PR #82856)

2024-02-23 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @ymand Can you merge this? 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] Revert "[clang][dataflow] Correctly handle `InitListExpr` of union type." (PR #82856)

2024-02-23 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/82856 Reverts llvm/llvm-project#82348, which caused crashes when analyzing empty InitListExprs for unions. >From ae17f89f38d56c2aa9feaa1ebfc7a641b41dc068 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Fri, 23 Feb

[clang] [dataflow] Fix crash when InitListExpr is not a prvalue (PR #80970)

2024-02-22 Thread Samira Bazuzi via cfe-commits
@@ -648,6 +648,12 @@ class TransferVisitor : public ConstStmtVisitor { QualType Type = S->getType(); if (!Type->isStructureOrClassType()) { + // It is possible that InitListExpr is not a prvalue, in which case + // `setValue` will fail. In this case, we can

[clang] [clang][dataflow] Re-land: Retrieve members from accessors called usi… (PR #74336)

2023-12-04 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @martinboehme or @ymand Could you take a look and merge? The only modification from https://github.com/llvm/llvm-project/pull/73978 is the `Env.initialize()` in the test. https://github.com/llvm/llvm-project/pull/74336 ___ cfe-commits

[clang] [clang][dataflow] Re-land: Retrieve members from accessors called usi… (PR #74336)

2023-12-04 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/74336 …ng member pointers. This initially landed with a broken test due to a mid-air collision with a new requirement for Environment initialization before field modeling. Have added that initialization in the test.

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-12-01 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: Can you merge for me, now that I've finally remembered to format everything? https://github.com/llvm/llvm-project/pull/73978 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-12-01 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/73978 >From aab1069636896c4a8289545ba01d2fdf4f1715c0 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 30 Nov 2023 14:18:04 -0500 Subject: [PATCH 1/4] [clang][dataflow] Retrieve members from accessors called

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-12-01 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/73978 >From aab1069636896c4a8289545ba01d2fdf4f1715c0 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 30 Nov 2023 14:18:04 -0500 Subject: [PATCH 1/3] [clang][dataflow] Retrieve members from accessors called

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-12-01 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/73978 >From aab1069636896c4a8289545ba01d2fdf4f1715c0 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Thu, 30 Nov 2023 14:18:04 -0500 Subject: [PATCH 1/2] [clang][dataflow] Retrieve members from accessors called

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-12-01 Thread Samira Bazuzi via cfe-commits
@@ -300,9 +300,10 @@ static void insertIfFunction(const Decl , } static MemberExpr *getMemberForAccessor(const CXXMemberCallExpr ) { - if (!C.getMethodDecl()) + const auto *MethodDecl = dyn_cast_or_null(C.getCalleeDecl()); bazuzi wrote: Done

[clang] [clang][dataflow] Retrieve members from accessors called using member… (PR #73978)

2023-11-30 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @ymand Can you review? https://github.com/llvm/llvm-project/pull/73978 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fix buggy assertion: Compare an unqualified type to an unqualified type. (PR #71573)

2023-11-09 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: Could you merge for me? I don't have write access. https://github.com/llvm/llvm-project/pull/71573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fix buggy assertion: Compare an unqualified type to an unqualified type. (PR #71573)

2023-11-08 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi updated https://github.com/llvm/llvm-project/pull/71573 >From d6b87c3ff427d6425d2559e9731d88b89f2206c8 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Tue, 7 Nov 2023 13:44:51 -0500 Subject: [PATCH 1/2] [clang][dataflow] Compare an unqualified type to an

[clang] [clang][dataflow] Compare an unqualified type to an unqualified type. (PR #71573)

2023-11-07 Thread Samira Bazuzi via cfe-commits
bazuzi wrote: @martinboehme Could you review? https://github.com/llvm/llvm-project/pull/71573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Compare an unqualified type to an unqualified type. (PR #71573)

2023-11-07 Thread Samira Bazuzi via cfe-commits
https://github.com/bazuzi created https://github.com/llvm/llvm-project/pull/71573 Includes crash-reproducing test case. >From d6b87c3ff427d6425d2559e9731d88b89f2206c8 Mon Sep 17 00:00:00 2001 From: Samira Bazuzi Date: Tue, 7 Nov 2023 13:44:51 -0500 Subject: [PATCH] [clang][dataflow] Compare