From 486754660bb926339aefcf012a3f848592babb8b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 28 Jul 2018 11:06:01 +0000 Subject: Vendor import of clang trunk r338150: https://llvm.org/svn/llvm-project/cfe/trunk@338150 --- lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp') diff --git a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp index c5010f53785a8..5b602468cdd4b 100644 --- a/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp @@ -48,7 +48,7 @@ public: DefaultBool IsPureOnly; void checkBeginFunction(CheckerContext &C) const; - void checkEndFunction(CheckerContext &C) const; + void checkEndFunction(const ReturnStmt *RS, CheckerContext &C) const; void checkPreCall(const CallEvent &Call, CheckerContext &C) const; private: @@ -57,7 +57,7 @@ private: void reportBug(StringRef Msg, bool PureError, const MemRegion *Reg, CheckerContext &C) const; - class VirtualBugVisitor : public BugReporterVisitorImpl { + class VirtualBugVisitor : public BugReporterVisitor { private: const MemRegion *ObjectRegion; bool Found; @@ -108,7 +108,7 @@ VirtualCallChecker::VirtualBugVisitor::VisitNode(const ExplodedNode *N, if (!MD) return nullptr; auto ThiSVal = - State->getSVal(SVB.getCXXThis(MD, LCtx->getCurrentStackFrame())); + State->getSVal(SVB.getCXXThis(MD, LCtx->getStackFrame())); const MemRegion *Reg = ThiSVal.castAs().getRegion(); if (!Reg) return nullptr; @@ -167,7 +167,8 @@ void VirtualCallChecker::checkBeginFunction(CheckerContext &C) const { } // The EndFunction callback when leave a constructor or a destructor. -void VirtualCallChecker::checkEndFunction(CheckerContext &C) const { +void VirtualCallChecker::checkEndFunction(const ReturnStmt *RS, + CheckerContext &C) const { registerCtorDtorCallInState(false, C); } @@ -230,7 +231,7 @@ void VirtualCallChecker::registerCtorDtorCallInState(bool IsBeginFunction, // Enter a constructor, set the corresponding memregion be true. if (isa(MD)) { auto ThiSVal = - State->getSVal(SVB.getCXXThis(MD, LCtx->getCurrentStackFrame())); + State->getSVal(SVB.getCXXThis(MD, LCtx->getStackFrame())); const MemRegion *Reg = ThiSVal.getAsRegion(); if (IsBeginFunction) State = State->set(Reg, ObjectState::CtorCalled); @@ -244,7 +245,7 @@ void VirtualCallChecker::registerCtorDtorCallInState(bool IsBeginFunction, // Enter a Destructor, set the corresponding memregion be true. if (isa(MD)) { auto ThiSVal = - State->getSVal(SVB.getCXXThis(MD, LCtx->getCurrentStackFrame())); + State->getSVal(SVB.getCXXThis(MD, LCtx->getStackFrame())); const MemRegion *Reg = ThiSVal.getAsRegion(); if (IsBeginFunction) State = State->set(Reg, ObjectState::DtorCalled); -- cgit v1.2.3