diff --git a/clang/docs/analyzer/developer-docs/Statistics.rst b/clang/docs/analyzer/developer-docs/Statistics.rst index 595b44dd95753..4f2484a89a6af 100644 --- a/clang/docs/analyzer/developer-docs/Statistics.rst +++ b/clang/docs/analyzer/developer-docs/Statistics.rst @@ -22,7 +22,6 @@ However, note that with ``LLVM_ENABLE_STATS`` disabled, only storage of the valu If you want to define a statistic only for entry point, EntryPointStats.h has four classes at your disposal: -- ``BoolEPStat`` - a boolean value assigned at most once per entry point. For example: "has the inline limit been reached". - ``UnsignedEPStat`` - an unsigned value assigned at most once per entry point. For example: "the number of source characters in an entry-point body". - ``CounterEPStat`` - an additive statistic. It starts with 0 and you can add to it as many times as needed. For example: "the number of bugs discovered". - ``UnsignedMaxEPStat`` - a maximizing statistic. It starts with 0 and when you join it with a value, it picks the maximum of the previous value and the new one. For example, "the longest execution path of a bug". diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h index 448e40269ca2d..389f17d36e65a 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h @@ -42,19 +42,6 @@ class EntryPointStat { llvm::StringLiteral Name; }; -class BoolEPStat : public EntryPointStat { - std::optional Value = {}; - -public: - explicit BoolEPStat(llvm::StringLiteral Name); - unsigned value() const { return Value && *Value; } - void set(bool V) { - assert(!Value.has_value()); - Value = V; - } - void reset() { Value = {}; } -}; - // used by CounterEntryPointTranslationUnitStat class CounterEPStat : public EntryPointStat { using EntryPointStat::EntryPointStat; diff --git a/clang/lib/StaticAnalyzer/Core/EntryPointStats.cpp b/clang/lib/StaticAnalyzer/Core/EntryPointStats.cpp index 62ae62f2f2154..abfb176d6384d 100644 --- a/clang/lib/StaticAnalyzer/Core/EntryPointStats.cpp +++ b/clang/lib/StaticAnalyzer/Core/EntryPointStats.cpp @@ -24,7 +24,6 @@ using namespace ento; namespace { struct Registry { - std::vector BoolStats; std::vector CounterStats; std::vector UnsignedMaxStats; std::vector UnsignedStats; @@ -33,7 +32,6 @@ struct Registry { struct Snapshot { const Decl *EntryPoint; - std::vector BoolStatValues; std::vector UnsignedStatValues; void dumpAsCSV(llvm::raw_ostream &OS) const; @@ -48,7 +46,6 @@ static llvm::ManagedStatic StatsRegistry; namespace { template void enumerateStatVectors(const Callback &Fn) { - Fn(StatsRegistry->BoolStats); Fn(StatsRegistry->CounterStats); Fn(StatsRegistry->UnsignedMaxStats); Fn(StatsRegistry->UnsignedStats); @@ -94,12 +91,6 @@ void EntryPointStat::lockRegistry(llvm::StringRef CPPFileName) { return Result; } -BoolEPStat::BoolEPStat(llvm::StringLiteral Name) : EntryPointStat(Name) { - assert(!StatsRegistry->IsLocked); - assert(!isRegistered(Name)); - StatsRegistry->BoolStats.push_back(this); -} - CounterEPStat::CounterEPStat(llvm::StringLiteral Name) : EntryPointStat(Name) { assert(!StatsRegistry->IsLocked); assert(!isRegistered(Name)); @@ -165,28 +156,14 @@ void Registry::Snapshot::dumpAsCSV(llvm::raw_ostream &OS) const { OS << StatsRegistry->EscapedCPPFileName << "\",\""; llvm::printEscapedString( clang::AnalysisDeclContext::getFunctionName(EntryPoint), OS); - OS << "\","; - auto PrintAsBool = [&OS](bool B) { OS << (B ? "true" : "false"); }; - llvm::interleave(BoolStatValues, OS, PrintAsBool, ","); - OS << ((BoolStatValues.empty() || UnsignedStatValues.empty()) ? "" : ","); + OS << "\""; + OS << (UnsignedStatValues.empty() ? "" : ","); llvm::interleave(UnsignedStatValues, OS, [&OS](unsigned U) { OS << U; }, ","); } -static std::vector consumeBoolStats() { - std::vector Result; - Result.reserve(StatsRegistry->BoolStats.size()); - for (auto *M : StatsRegistry->BoolStats) { - Result.push_back(M->value()); - M->reset(); - } - return Result; -} - void EntryPointStat::takeSnapshot(const Decl *EntryPoint) { - auto BoolValues = consumeBoolStats(); auto UnsignedValues = consumeUnsignedStats(); - StatsRegistry->Snapshots.push_back( - {EntryPoint, std::move(BoolValues), std::move(UnsignedValues)}); + StatsRegistry->Snapshots.push_back({EntryPoint, std::move(UnsignedValues)}); } void EntryPointStat::dumpStatsAsCSV(llvm::StringRef FileName) {