Skip to content

Commit

Permalink
Revert "[analyzer][NFC] Add unittest for FalsePositiveRefutationBRVis…
Browse files Browse the repository at this point in the history
…itor"

This reverts commit e22cae3. It broke
the build:

FalsePositiveRefutationBRVisitorTest.cpp:112:3: error: use of undeclared identifier 'LLVM_WITH_Z3'
  • Loading branch information
gribozavr committed Jun 29, 2020
1 parent cc83695 commit a44425f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 217 deletions.
12 changes: 1 addition & 11 deletions clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
Expand Up @@ -52,7 +52,6 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
Expand Down Expand Up @@ -2813,19 +2812,12 @@ UndefOrNullArgVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
// Implementation of FalsePositiveRefutationBRVisitor.
//===----------------------------------------------------------------------===//

#define DEBUG_TYPE "FalsePositiveRefutationBRVisitor"
STATISTIC(CrosscheckedBugReports,
"The # of bug reports which were checked for infeasible constraints");
STATISTIC(CrosscheckInvalidatedBugReports,
"The # of bug reports invalidated due to infeasible constraints");

FalsePositiveRefutationBRVisitor::FalsePositiveRefutationBRVisitor()
: Constraints(ConstraintRangeTy::Factory().getEmptyMap()) {}

void FalsePositiveRefutationBRVisitor::finalizeVisitor(
BugReporterContext &BRC, const ExplodedNode *EndPathNode,
PathSensitiveBugReport &BR) {
++CrosscheckedBugReports;
// Collect new constraints
VisitNode(EndPathNode, BRC, BR);

Expand Down Expand Up @@ -2856,10 +2848,8 @@ void FalsePositiveRefutationBRVisitor::finalizeVisitor(
if (!isSat.hasValue())
return;

if (!isSat.getValue()) {
++CrosscheckInvalidatedBugReports;
if (!isSat.getValue())
BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext());
}
}

PathDiagnosticPieceRef FalsePositiveRefutationBRVisitor::VisitNode(
Expand Down
1 change: 0 additions & 1 deletion clang/unittests/StaticAnalyzer/CMakeLists.txt
Expand Up @@ -7,7 +7,6 @@ add_clang_unittest(StaticAnalysisTests
AnalyzerOptionsTest.cpp
CallDescriptionTest.cpp
CallEventTest.cpp
FalsePositiveRefutationBRVisitorTest.cpp
ParamRegionTest.cpp
RangeSetTest.cpp
RegisterCustomCheckersTest.cpp
Expand Down
31 changes: 1 addition & 30 deletions clang/unittests/StaticAnalyzer/CheckerRegistration.h
Expand Up @@ -14,7 +14,6 @@
#include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
#include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
#include "clang/Tooling/Tooling.h"
#include "gtest/gtest.h"

namespace clang {
namespace ento {
Expand Down Expand Up @@ -66,21 +65,10 @@ class TestAction : public ASTFrontendAction {
}
};

inline SmallString<80> getCurrentTestNameAsFileName() {
const ::testing::TestInfo *Info =
::testing::UnitTest::GetInstance()->current_test_info();

SmallString<80> FileName;
(Twine{Info->name()} + ".cc").toVector(FileName);
return FileName;
}

template <AddCheckerFn... Fns>
bool runCheckerOnCode(const std::string &Code, std::string &Diags) {
const SmallVectorImpl<char> &FileName = getCurrentTestNameAsFileName();
llvm::raw_string_ostream OS(Diags);
return tooling::runToolOnCode(std::make_unique<TestAction<Fns...>>(OS), Code,
FileName);
return tooling::runToolOnCode(std::make_unique<TestAction<Fns...>>(OS), Code);
}

template <AddCheckerFn... Fns>
Expand All @@ -89,22 +77,5 @@ bool runCheckerOnCode(const std::string &Code) {
return runCheckerOnCode<Fns...>(Code, Diags);
}

template <AddCheckerFn... Fns>
bool runCheckerOnCodeWithArgs(const std::string &Code,
const std::vector<std::string> &Args,
std::string &Diags) {
const SmallVectorImpl<char> &FileName = getCurrentTestNameAsFileName();
llvm::raw_string_ostream OS(Diags);
return tooling::runToolOnCodeWithArgs(
std::make_unique<TestAction<Fns...>>(OS), Code, Args, FileName);
}

template <AddCheckerFn... Fns>
bool runCheckerOnCodeWithArgs(const std::string &Code,
const std::vector<std::string> &Args) {
std::string Diags;
return runCheckerOnCodeWithArgs<Fns...>(Code, Args, Diags);
}

} // namespace ento
} // namespace clang

This file was deleted.

0 comments on commit a44425f

Please sign in to comment.