99#include " clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h"
1010#include " clang/AST/DeclBase.h"
1111#include " clang/Analysis/AnalysisDeclContext.h"
12- #include " clang/Index/USRGeneration.h"
1312#include " llvm/ADT/STLExtras.h"
14- #include " llvm/ADT/SmallVector.h"
1513#include " llvm/ADT/StringExtras.h"
1614#include " llvm/ADT/StringRef.h"
1715#include " llvm/Support/FileSystem.h"
@@ -40,7 +38,6 @@ struct Registry {
4038 };
4139
4240 std::vector<Snapshot> Snapshots;
43- std::string EscapedCPPFileName;
4441};
4542} // namespace
4643
@@ -72,7 +69,7 @@ static void checkStatName(const EntryPointStat *M) {
7269 }
7370}
7471
75- void EntryPointStat::lockRegistry (llvm::StringRef CPPFileName ) {
72+ void EntryPointStat::lockRegistry () {
7673 auto CmpByNames = [](const EntryPointStat *L, const EntryPointStat *R) {
7774 return L->name () < R->name ();
7875 };
@@ -81,8 +78,6 @@ void EntryPointStat::lockRegistry(llvm::StringRef CPPFileName) {
8178 enumerateStatVectors (
8279 [](const auto &Stats) { llvm::for_each (Stats, checkStatName); });
8380 StatsRegistry->IsLocked = true ;
84- llvm::raw_string_ostream OS (StatsRegistry->EscapedCPPFileName );
85- llvm::printEscapedString (CPPFileName, OS);
8681}
8782
8883[[maybe_unused]] static bool isRegistered (llvm::StringLiteral Name) {
@@ -149,27 +144,15 @@ static std::vector<llvm::StringLiteral> getStatNames() {
149144 return Ret;
150145}
151146
152- static std::string getUSR (const Decl *D) {
153- llvm::SmallVector<char > Buf;
154- if (index::generateUSRForDecl (D, Buf)) {
155- assert (false && " This should never fail" );
156- return AnalysisDeclContext::getFunctionName (D);
157- }
158- return llvm::toStringRef (Buf).str ();
159- }
160-
161147void Registry::Snapshot::dumpAsCSV (llvm::raw_ostream &OS) const {
162148 OS << ' "' ;
163- llvm::printEscapedString (getUSR (EntryPoint), OS);
164- OS << " \" ,\" " ;
165- OS << StatsRegistry->EscapedCPPFileName << " \" ,\" " ;
166149 llvm::printEscapedString (
167150 clang::AnalysisDeclContext::getFunctionName (EntryPoint), OS);
168- OS << " \" ," ;
151+ OS << " \" , " ;
169152 auto PrintAsBool = [&OS](bool B) { OS << (B ? " true" : " false" ); };
170- llvm::interleave (BoolStatValues, OS, PrintAsBool, " , " );
171- OS << ((BoolStatValues.empty () || UnsignedStatValues.empty ()) ? " " : " ," );
172- llvm::interleave (UnsignedStatValues, OS, [&OS]( unsigned U) { OS << U; }, " , " );
153+ llvm::interleaveComma (BoolStatValues, OS, PrintAsBool);
154+ OS << ((BoolStatValues.empty () || UnsignedStatValues.empty ()) ? " " : " , " );
155+ llvm::interleaveComma (UnsignedStatValues, OS);
173156}
174157
175158static std::vector<bool > consumeBoolStats () {
@@ -198,8 +181,8 @@ void EntryPointStat::dumpStatsAsCSV(llvm::StringRef FileName) {
198181}
199182
200183void EntryPointStat::dumpStatsAsCSV (llvm::raw_ostream &OS) {
201- OS << " USR,File,DebugName, " ;
202- llvm::interleave (getStatNames (), OS, [&OS]( const auto &a) { OS << a; }, " , " );
184+ OS << " EntryPoint, " ;
185+ llvm::interleaveComma (getStatNames (), OS);
203186 OS << " \n " ;
204187
205188 std::vector<std::string> Rows;
0 commit comments