[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -37,6 +43,19 @@ static SVal conjureOffsetSymbolOnLocation( return Symbol; } +// Update the SVal bound to the Cast expression with the SVal +// bound to the casted expression +static ProgramStateRef updateStateAfterSimpleCast(StmtNodeBuilder& Bldr, +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -51,27 +47,29 @@ removeInformationStoredForDeadInstances(const CallEvent , } template -void handleConstructorAndAssignment(const CallEvent , CheckerContext , +bool handleConstructorAndAssignment(const CallEvent , CheckerContext , SVal

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -602,6 +619,37 @@ void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred, ExplodedNode *UpdatedN = N; SVal InitVal = state->getSVal(InitEx, LC); + // The call expression to which we have bound something is hidden behind + // an

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -681,6 +681,37 @@ ExprEngine::processRegionChanges(ProgramStateRef state, LCtx, Call); } +ProgramStateRef +ExprEngine::handleCastingBeforeEvalCall(ExplodedNode *Pred, const Expr *Ex, +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -355,4 +356,38 @@ void nonInlineFunctionCallPtr() { char c = std::get (v); // no-warning (void)a; (void)c; -} \ No newline at end of file +} + +//// +// std::swap for std::variant

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -37,6 +43,19 @@ static SVal conjureOffsetSymbolOnLocation( return Symbol; } +// Update the SVal bound to the Cast expression with the SVal +// bound to the casted expression +static ProgramStateRef updateStateAfterSimpleCast(StmtNodeBuilder& Bldr,

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
@@ -206,23 +221,42 @@ class StdVariantChecker : public Checker { if (!ThisMemRegion) return; +// Get the first type alternative of the std::variant instance. +assert((ThisSVal.getType(C.getASTContext())->isPointerType() || +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-05-14 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat commented: Some additional remarks. https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -206,23 +221,42 @@ class StdVariantChecker : public Checker { if (!ThisMemRegion) return; +// Get the first type alternative of the std::variant instance. +assert((ThisSVal.getType(C.getASTContext())->isPointerType() || +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -2261,6 +2261,8 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, Bldr.takeNodes(Pred); const auto *C = cast(S); ExplodedNodeSet dstExpr; + // Point of interes: maybe my cast somehow will not get visited or will NagyDonat

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -286,6 +332,21 @@ class StdVariantChecker : public Checker { C.emitReport(std::move(R)); return true; } + + // TODO Implement modeling of std::variant's emplace method. + // Currently when this method call is encountered we just + // stop the modeling of that

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -206,23 +221,42 @@ class StdVariantChecker : public Checker { if (!ThisMemRegion) return; +// Get the first type alternative of the std::variant instance. +assert((ThisSVal.getType(C.getASTContext())->isPointerType() || +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -231,16 +265,22 @@ class StdVariantChecker : public Checker { // Get the mem region of the argument std::variant and look up the type // information that we know about it. const MemRegion *ArgMemRegion = Call.getArgSVal(0).getAsRegion(); -const QualType

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
https://github.com/NagyDonat edited https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -51,27 +47,29 @@ removeInformationStoredForDeadInstances(const CallEvent , } template -void handleConstructorAndAssignment(const CallEvent , CheckerContext , +bool handleConstructorAndAssignment(const CallEvent , CheckerContext , SVal

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
@@ -265,16 +305,22 @@ class StdVariantChecker : public Checker { } QualType RetrievedCanonicalType = RetrievedType.getCanonicalType(); -QualType StoredCanonicalType = StoredType->getCanonicalType(); -if (RetrievedCanonicalType == StoredCanonicalType) +

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-08 Thread via cfe-commits
https://github.com/NagyDonat commented: Thanks for working on this checker and improving its behavior! I started a review of this commit, but I didn't get too far yet; I'll continue reviewing on the next days. So far I read the code under `Checkers/`and added some minor stylistic remarks, but

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-06 Thread Gábor Spaits via cfe-commits
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-06 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff b5f2db940643af3837c77adde1dadb7208922211 b250e2db91515b33c427bfa1b9faf6f376010bf0 --

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-06 Thread Gábor Spaits via cfe-commits
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Variant checker bindings (PR #87886)

2024-04-06 Thread Gábor Spaits via cfe-commits
https://github.com/spaits edited https://github.com/llvm/llvm-project/pull/87886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits