[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-03-17 Thread Fangyi Zhou via cfe-commits
fangyi-zhou wrote: May I get a re-review for the changes please? https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-26 Thread Fangyi Zhou via cfe-commits
@@ -695,6 +695,21 @@ class CFGBlock { void dump() const { dumpToStream(llvm::errs()); } + +void Profile(llvm::FoldingSetNodeID &ID) const { + ID.AddPointer(Parent); + ID.AddInteger(Index); +} + +int64_t getID() const { fangyi

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-24 Thread Fangyi Zhou via cfe-commits
@@ -494,7 +494,7 @@ void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE, auto &SymMgr = C.getSymbolManager(); auto *LCtx = C.getLocationContext(); RetVal = nonloc::SymbolVal(SymMgr.conjureSymbol( -CE, LCtx, C.getASTContext().BoolTy, C.

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-24 Thread Fangyi Zhou via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-24 Thread Fangyi Zhou via cfe-commits
@@ -27,7 +27,8 @@ namespace ento { /// by the loop body in any iteration. ProgramStateRef getWidenedLoopState(ProgramStateRef PrevState, const LocationContext *LCtx, -unsigned BlockCount, const Stmt *LoopSt

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -166,57 +166,47 @@ DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, if (Ex->isGLValue()) T = LCtx->getAnalysisDeclContext()->getASTContext().getPointerType(ExType); - return conjureSymbolVal(SymbolTag, Ex, LCtx, T, Count); + return conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -151,10 +151,10 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) { return nonloc::SymbolVal(sym); } -DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, fangyi-zhou wrote: This overload would have been remove

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1376,8 +1379,8 @@ StoreRef RegionStoreManager::invalidateRegions( } RegionBindingsRef B = getRegionBindings(store); - InvalidateRegionsWorker W(*this, StateMgr, B, S, Count, LCtx, IS, ITraits, -Invalidated, GlobalsFilter); + InvalidateRegi

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call, // conjure a return value for later. if (lastElement.isUnknown()) lastElement = C.getSValBuilder().conjureSymbolVal( -nullptr, Call.getOriginExpr

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -533,18 +538,12 @@ class SymbolManager { template const SymExprT *acquire(Args &&...args); - const SymbolConjured *conjureSymbol(const Stmt *E, - const LocationContext *LCtx, QualType T, - unsig

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
https://github.com/fangyi-zhou ready_for_review https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
@@ -111,8 +111,13 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
@@ -867,18 +868,18 @@ ProgramStateRef createContainerBegin(ProgramStateRef State, return setContainerData(State, Cont, CData); } -ProgramStateRef createContainerEnd(ProgramStateRef State, const MemRegion *Cont, - const Expr *E, QualType T,

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
@@ -844,7 +845,7 @@ SymbolRef getContainerEnd(ProgramStateRef State, const MemRegion *Cont) { return CDataPtr->getEnd(); } -ProgramStateRef createContainerBegin(ProgramStateRef State, +ProgramStateRef createContainerBegin(CheckerContext &C, ProgramStateRef State,

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
fangyi-zhou wrote: I've made some more progress, the crash goes away, there are still some review comments that I need to address, which I'll try to complete later. ``` /home/fangyi/playground/bug.cc:21:5: warning: value derived from (symbol of type 'int' conjured at statement '->~S() (Implici

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
https://github.com/fangyi-zhou edited https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
@@ -151,72 +151,63 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) { return nonloc::SymbolVal(sym); } -DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, - const Expr *Ex, -

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-22 Thread Fangyi Zhou via cfe-commits
@@ -111,8 +111,13 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-21 Thread Fangyi Zhou via cfe-commits
@@ -1376,8 +1379,8 @@ StoreRef RegionStoreManager::invalidateRegions( } RegionBindingsRef B = getRegionBindings(store); - InvalidateRegionsWorker W(*this, StateMgr, B, S, Count, LCtx, IS, ITraits, -Invalidated, GlobalsFilter); + InvalidateRegi

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-21 Thread Fangyi Zhou via cfe-commits
@@ -171,20 +172,27 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-21 Thread Fangyi Zhou via cfe-commits
@@ -113,19 +120,21 @@ class SymbolConjured : public SymbolData { void dumpToStream(raw_ostream &os) const override; - static void Profile(llvm::FoldingSetNodeID &profile, const Stmt *S, + static void Profile(llvm::FoldingSetNodeID &profile, + const CF

[clang] [Clang] [analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-21 Thread Fangyi Zhou via cfe-commits
https://github.com/fangyi-zhou created https://github.com/llvm/llvm-project/pull/128251 Closes #57270. This PR changes the `Stmt *` field in `SymbolConjured` with `CFGBlock::ConstCFGElementRef`. The motivation is that, when conjuring a symbol, there might not always be a statement available,