vsavchenko created this revision. vsavchenko added reviewers: NoQ, xazax.hun, martong, steakhal, Szelethus, manas, RedDocMD. Herald added subscribers: ASDenysPetrov, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware. vsavchenko requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D103917 Files: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -2153,7 +2153,8 @@ } }; -class DefaultExpressionHandler final : public ExpressionHandler { +// TODO: extract it into more handlers +class InterestingLValueHandler final : public ExpressionHandler { public: using ExpressionHandler::ExpressionHandler; @@ -2225,11 +2226,25 @@ if (auto KV = V.getAs<KnownSVal>()) getParentTracker().track(*KV, R, Opts, SFC); - - return Result; } } + return Result; + } +}; + +class DefaultExpressionHandler final : public ExpressionHandler { +public: + using ExpressionHandler::ExpressionHandler; + + Tracker::Result handle(const Expr *Inner, const ExplodedNode *InputNode, + const ExplodedNode *LVNode, + TrackingOptions Opts) override { + ProgramStateRef LVState = LVNode->getState(); + const StackFrameContext *SFC = LVNode->getStackFrame(); + PathSensitiveBugReport &Report = getParentTracker().getReport(); + Tracker::Result Result; + // If the expression is not an "lvalue expression", we can still // track the constraints on its contents. SVal V = LVState->getSValAsScalarOrLoc(Inner, LVNode->getLocationContext()); @@ -2336,6 +2351,7 @@ addLowPriorityHandler<ControlDependencyHandler>(); addLowPriorityHandler<NilReceiverHandler>(); addLowPriorityHandler<ArrayIndexHandler>(); + addLowPriorityHandler<InterestingLValueHandler>(); addLowPriorityHandler<DefaultExpressionHandler>(); addLowPriorityHandler<RValueHandler>(); // Default store handlers.
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -2153,7 +2153,8 @@ } }; -class DefaultExpressionHandler final : public ExpressionHandler { +// TODO: extract it into more handlers +class InterestingLValueHandler final : public ExpressionHandler { public: using ExpressionHandler::ExpressionHandler; @@ -2225,11 +2226,25 @@ if (auto KV = V.getAs<KnownSVal>()) getParentTracker().track(*KV, R, Opts, SFC); - - return Result; } } + return Result; + } +}; + +class DefaultExpressionHandler final : public ExpressionHandler { +public: + using ExpressionHandler::ExpressionHandler; + + Tracker::Result handle(const Expr *Inner, const ExplodedNode *InputNode, + const ExplodedNode *LVNode, + TrackingOptions Opts) override { + ProgramStateRef LVState = LVNode->getState(); + const StackFrameContext *SFC = LVNode->getStackFrame(); + PathSensitiveBugReport &Report = getParentTracker().getReport(); + Tracker::Result Result; + // If the expression is not an "lvalue expression", we can still // track the constraints on its contents. SVal V = LVState->getSValAsScalarOrLoc(Inner, LVNode->getLocationContext()); @@ -2336,6 +2351,7 @@ addLowPriorityHandler<ControlDependencyHandler>(); addLowPriorityHandler<NilReceiverHandler>(); addLowPriorityHandler<ArrayIndexHandler>(); + addLowPriorityHandler<InterestingLValueHandler>(); addLowPriorityHandler<DefaultExpressionHandler>(); addLowPriorityHandler<RValueHandler>(); // Default store handlers.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits