Author: charusso Date: Sat Mar 16 03:44:49 2019 New Revision: 356321 URL: http://llvm.org/viewvc/llvm-project?rev=356321&view=rev Log: Revert "[analyzer] ConditionBRVisitor: Remove GDM checking"
This reverts commit f962485adad9d646511fd3240c0408d9554e6784. Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h?rev=356321&r1=356320&r2=356321&view=diff ============================================================================== --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h Sat Mar 16 03:44:49 2019 @@ -79,9 +79,6 @@ public: ConstraintManager() = default; virtual ~ConstraintManager(); - virtual bool haveEqualConstraints(ProgramStateRef S1, - ProgramStateRef S2) const = 0; - virtual ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption) = 0; Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h?rev=356321&r1=356320&r2=356321&view=diff ============================================================================== --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h Sat Mar 16 03:44:49 2019 @@ -588,15 +588,11 @@ public: ProgramStateRef getPersistentStateWithGDM(ProgramStateRef FromState, ProgramStateRef GDMState); - bool haveEqualConstraints(ProgramStateRef S1, ProgramStateRef S2) const { - return ConstraintMgr->haveEqualConstraints(S1, S2); - } - - bool haveEqualEnvironments(ProgramStateRef S1, ProgramStateRef S2) const { + bool haveEqualEnvironments(ProgramStateRef S1, ProgramStateRef S2) { return S1->Env == S2->Env; } - bool haveEqualStores(ProgramStateRef S1, ProgramStateRef S2) const { + bool haveEqualStores(ProgramStateRef S1, ProgramStateRef S2) { return S1->store == S2->store; } Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h?rev=356321&r1=356320&r2=356321&view=diff ============================================================================== --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h Sat Mar 16 03:44:49 2019 @@ -220,11 +220,6 @@ public: OS << nl; } - bool haveEqualConstraints(ProgramStateRef S1, - ProgramStateRef S2) const override { - return S1->get<ConstraintSMT>() == S2->get<ConstraintSMT>(); - } - bool canReasonAbout(SVal X) const override { const TargetInfo &TI = getBasicVals().getContext().getTargetInfo(); Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=356321&r1=356320&r2=356321&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Sat Mar 16 03:44:49 2019 @@ -1816,10 +1816,13 @@ ConditionBRVisitor::VisitNodeImpl(const BugReporterContext &BRC, BugReport &BR) { ProgramPoint progPoint = N->getLocation(); ProgramStateRef CurrentState = N->getState(); - ProgramStateRef PreviousState = N->getFirstPred()->getState(); + ProgramStateRef PrevState = N->getFirstPred()->getState(); - // If the constraint information does not changed there is no assumption. - if (BRC.getStateManager().haveEqualConstraints(CurrentState, PreviousState)) + // Compare the GDMs of the state, because that is where constraints + // are managed. Note that ensure that we only look at nodes that + // were generated by the analyzer engine proper, not checkers. + if (CurrentState->getGDM().getRoot() == + PrevState->getGDM().getRoot()) return nullptr; // If an assumption was made on a branch, it should be caught Modified: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp?rev=356321&r1=356320&r2=356321&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp Sat Mar 16 03:44:49 2019 @@ -230,11 +230,6 @@ public: // Implementation for interface from ConstraintManager. //===------------------------------------------------------------------===// - bool haveEqualConstraints(ProgramStateRef S1, - ProgramStateRef S2) const override { - return S1->get<ConstraintRange>() == S2->get<ConstraintRange>(); - } - bool canReasonAbout(SVal X) const override; ConditionTruthVal checkNull(ProgramStateRef State, SymbolRef Sym) override; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits