forked from OSchip/llvm-project
Rename PathDiagnosticClient to PathDiagnosticConsumer as per issue 5397
llvm-svn: 140492
This commit is contained in:
parent
292e76939b
commit
53c125d063
|
@ -28,10 +28,10 @@ ANALYSIS_CONSTRAINTS(RangeConstraints, "range", "Use constraint tracking of conc
|
|||
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN, AUTOCREATE)
|
||||
#endif
|
||||
|
||||
ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML", createHTMLDiagnosticClient, false)
|
||||
ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", createPlistDiagnosticClient, true)
|
||||
ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", "Output analysis results using HTML wrapped with Plists", createPlistHTMLDiagnosticClient, true)
|
||||
ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results", createTextPathDiagnosticClient, true)
|
||||
ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML", createHTMLDiagnosticConsumer, false)
|
||||
ANALYSIS_DIAGNOSTICS(PLIST, "plist", "Output analysis results using Plists", createPlistDiagnosticConsumer, true)
|
||||
ANALYSIS_DIAGNOSTICS(PLIST_HTML, "plist-html", "Output analysis results using HTML wrapped with Plists", createPlistHTMLDiagnosticConsumer, true)
|
||||
ANALYSIS_DIAGNOSTICS(TEXT, "text", "Text output of analysis results", createTextPathDiagnosticConsumer, true)
|
||||
|
||||
#undef ANALYSIS_STORE
|
||||
#undef ANALYSIS_CONSTRAINTS
|
||||
|
|
|
@ -218,7 +218,7 @@ class BugReporterData {
|
|||
public:
|
||||
virtual ~BugReporterData();
|
||||
virtual DiagnosticsEngine& getDiagnostic() = 0;
|
||||
virtual PathDiagnosticClient* getPathDiagnosticClient() = 0;
|
||||
virtual PathDiagnosticConsumer* getPathDiagnosticConsumer() = 0;
|
||||
virtual ASTContext &getASTContext() = 0;
|
||||
virtual SourceManager& getSourceManager() = 0;
|
||||
};
|
||||
|
@ -264,8 +264,8 @@ public:
|
|||
return D.getDiagnostic();
|
||||
}
|
||||
|
||||
PathDiagnosticClient* getPathDiagnosticClient() {
|
||||
return D.getPathDiagnosticClient();
|
||||
PathDiagnosticConsumer* getPathDiagnosticConsumer() {
|
||||
return D.getPathDiagnosticConsumer();
|
||||
}
|
||||
|
||||
/// \brief Iterator over the set of BugTypes tracked by the BugReporter.
|
||||
|
|
|
@ -45,11 +45,11 @@ class ExplodedNode;
|
|||
|
||||
class PathDiagnostic;
|
||||
|
||||
class PathDiagnosticClient {
|
||||
class PathDiagnosticConsumer {
|
||||
public:
|
||||
PathDiagnosticClient() {}
|
||||
PathDiagnosticConsumer() {}
|
||||
|
||||
virtual ~PathDiagnosticClient() {}
|
||||
virtual ~PathDiagnosticConsumer() {}
|
||||
|
||||
virtual void
|
||||
FlushDiagnostics(SmallVectorImpl<std::string> *FilesMade = 0) = 0;
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
protected:
|
||||
/// The actual logic for handling path diagnostics, as implemented
|
||||
/// by subclasses of PathDiagnosticClient.
|
||||
/// by subclasses of PathDiagnosticConsumer.
|
||||
virtual void HandlePathDiagnosticImpl(const PathDiagnostic* D) = 0;
|
||||
|
||||
};
|
||||
|
@ -288,7 +288,7 @@ public:
|
|||
const std::string& getString() const { return str; }
|
||||
|
||||
/// getDisplayHint - Return a hint indicating where the diagnostic should
|
||||
/// be displayed by the PathDiagnosticClient.
|
||||
/// be displayed by the PathDiagnosticConsumer.
|
||||
DisplayHint getDisplayHint() const { return Hint; }
|
||||
|
||||
virtual PathDiagnosticLocation getLocation() const = 0;
|
||||
|
|
|
@ -22,18 +22,18 @@ class Preprocessor;
|
|||
|
||||
namespace ento {
|
||||
|
||||
class PathDiagnosticClient;
|
||||
class PathDiagnosticConsumer;
|
||||
|
||||
PathDiagnosticClient*
|
||||
createHTMLDiagnosticClient(const std::string& prefix, const Preprocessor &PP);
|
||||
PathDiagnosticConsumer*
|
||||
createHTMLDiagnosticConsumer(const std::string& prefix, const Preprocessor &PP);
|
||||
|
||||
PathDiagnosticClient*
|
||||
createPlistDiagnosticClient(const std::string& prefix, const Preprocessor &PP,
|
||||
PathDiagnosticClient *SubPD = 0);
|
||||
PathDiagnosticConsumer*
|
||||
createPlistDiagnosticConsumer(const std::string& prefix, const Preprocessor &PP,
|
||||
PathDiagnosticConsumer *SubPD = 0);
|
||||
|
||||
PathDiagnosticClient*
|
||||
createTextPathDiagnosticClient(const std::string& prefix,
|
||||
const Preprocessor &PP);
|
||||
PathDiagnosticConsumer*
|
||||
createTextPathDiagnosticConsumer(const std::string& prefix,
|
||||
const Preprocessor &PP);
|
||||
|
||||
} // end GR namespace
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class AnalysisManager : public BugReporterData {
|
|||
DiagnosticsEngine &Diags;
|
||||
const LangOptions &LangInfo;
|
||||
|
||||
llvm::OwningPtr<PathDiagnosticClient> PD;
|
||||
llvm::OwningPtr<PathDiagnosticConsumer> PD;
|
||||
|
||||
// Configurable components creators.
|
||||
StoreManagerCreator CreateStoreMgr;
|
||||
|
@ -76,7 +76,7 @@ class AnalysisManager : public BugReporterData {
|
|||
|
||||
public:
|
||||
AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
||||
const LangOptions &lang, PathDiagnosticClient *pd,
|
||||
const LangOptions &lang, PathDiagnosticConsumer *pd,
|
||||
StoreManagerCreator storemgr,
|
||||
ConstraintManagerCreator constraintmgr,
|
||||
CheckerManager *checkerMgr,
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
return LangInfo;
|
||||
}
|
||||
|
||||
virtual PathDiagnosticClient *getPathDiagnosticClient() {
|
||||
virtual PathDiagnosticConsumer *getPathDiagnosticConsumer() {
|
||||
return PD.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ using namespace clang;
|
|||
using namespace ento;
|
||||
|
||||
AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
||||
const LangOptions &lang, PathDiagnosticClient *pd,
|
||||
const LangOptions &lang,
|
||||
PathDiagnosticConsumer *pd,
|
||||
StoreManagerCreator storemgr,
|
||||
ConstraintManagerCreator constraintmgr,
|
||||
CheckerManager *checkerMgr,
|
||||
|
|
|
@ -127,13 +127,13 @@ public:
|
|||
|
||||
class PathDiagnosticBuilder : public BugReporterContext {
|
||||
BugReport *R;
|
||||
PathDiagnosticClient *PDC;
|
||||
PathDiagnosticConsumer *PDC;
|
||||
llvm::OwningPtr<ParentMap> PM;
|
||||
NodeMapClosure NMC;
|
||||
public:
|
||||
PathDiagnosticBuilder(GRBugReporter &br,
|
||||
BugReport *r, NodeBackMap *Backmap,
|
||||
PathDiagnosticClient *pdc)
|
||||
PathDiagnosticConsumer *pdc)
|
||||
: BugReporterContext(br),
|
||||
R(r), PDC(pdc), NMC(Backmap) {}
|
||||
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
|
||||
PathDiagnosticLocation getEnclosingStmtLocation(const Stmt *S);
|
||||
|
||||
PathDiagnosticClient::PathGenerationScheme getGenerationScheme() const {
|
||||
return PDC ? PDC->getGenerationScheme() : PathDiagnosticClient::Extensive;
|
||||
PathDiagnosticConsumer::PathGenerationScheme getGenerationScheme() const {
|
||||
return PDC ? PDC->getGenerationScheme() : PathDiagnosticConsumer::Extensive;
|
||||
}
|
||||
|
||||
bool supportsLogicalOpControlFlow() const {
|
||||
|
@ -1631,7 +1631,8 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
|
|||
const ExplodedNode *N = GPair.second.first;
|
||||
|
||||
// Start building the path diagnostic...
|
||||
PathDiagnosticBuilder PDB(*this, R, BackMap.get(), getPathDiagnosticClient());
|
||||
PathDiagnosticBuilder PDB(*this, R, BackMap.get(),
|
||||
getPathDiagnosticConsumer());
|
||||
|
||||
// Register additional node visitors.
|
||||
R->addVisitor(new NilReceiverBRVisitor());
|
||||
|
@ -1656,10 +1657,10 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
|
|||
return;
|
||||
|
||||
switch (PDB.getGenerationScheme()) {
|
||||
case PathDiagnosticClient::Extensive:
|
||||
case PathDiagnosticConsumer::Extensive:
|
||||
GenerateExtensivePathDiagnostic(PD, PDB, N);
|
||||
break;
|
||||
case PathDiagnosticClient::Minimal:
|
||||
case PathDiagnosticConsumer::Minimal:
|
||||
GenerateMinimalPathDiagnostic(PD, PDB, N);
|
||||
break;
|
||||
}
|
||||
|
@ -1850,7 +1851,7 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) {
|
|||
if (!exampleReport)
|
||||
return;
|
||||
|
||||
PathDiagnosticClient* PD = getPathDiagnosticClient();
|
||||
PathDiagnosticConsumer* PD = getPathDiagnosticConsumer();
|
||||
|
||||
// FIXME: Make sure we use the 'R' for the path that was actually used.
|
||||
// Probably doesn't make a difference in practice.
|
||||
|
@ -1906,7 +1907,7 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) {
|
|||
diagBuilder << *I;
|
||||
}
|
||||
|
||||
// Emit a full diagnostic for the path if we have a PathDiagnosticClient.
|
||||
// Emit a full diagnostic for the path if we have a PathDiagnosticConsumer.
|
||||
if (!PD)
|
||||
return;
|
||||
|
||||
|
|
|
@ -786,7 +786,7 @@ void CallEnterNodeBuilder::generateNode(const ProgramState *state) {
|
|||
// The Diagnostic is actually shared when we create ASTUnits from AST files.
|
||||
AnalysisManager AMgr(TU->getASTContext(), TU->getDiagnostic(),
|
||||
OldMgr.getLangOptions(),
|
||||
OldMgr.getPathDiagnosticClient(),
|
||||
OldMgr.getPathDiagnosticConsumer(),
|
||||
OldMgr.getStoreManagerCreator(),
|
||||
OldMgr.getConstraintManagerCreator(),
|
||||
OldMgr.getCheckerManager(),
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace ento;
|
|||
|
||||
namespace {
|
||||
|
||||
class HTMLDiagnostics : public PathDiagnosticClient {
|
||||
class HTMLDiagnostics : public PathDiagnosticConsumer {
|
||||
llvm::sys::Path Directory, FilePrefix;
|
||||
bool createdDir, noDir;
|
||||
const Preprocessor &PP;
|
||||
|
@ -78,8 +78,8 @@ HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix,
|
|||
FilePrefix.appendComponent("report");
|
||||
}
|
||||
|
||||
PathDiagnosticClient*
|
||||
ento::createHTMLDiagnosticClient(const std::string& prefix,
|
||||
PathDiagnosticConsumer*
|
||||
ento::createHTMLDiagnosticConsumer(const std::string& prefix,
|
||||
const Preprocessor &PP) {
|
||||
return new HTMLDiagnostics(prefix, PP);
|
||||
}
|
||||
|
|
|
@ -82,10 +82,10 @@ PathDiagnostic::PathDiagnostic(StringRef bugtype, StringRef desc,
|
|||
Desc(StripTrailingDots(desc)),
|
||||
Category(StripTrailingDots(category)) {}
|
||||
|
||||
void PathDiagnosticClient::HandlePathDiagnostic(const PathDiagnostic *D) {
|
||||
void PathDiagnosticConsumer::HandlePathDiagnostic(const PathDiagnostic *D) {
|
||||
// For now this simply forwards to HandlePathDiagnosticImpl. In the future
|
||||
// we can use this indirection to control for multi-threaded access to
|
||||
// the PathDiagnosticClient from multiple bug reporters.
|
||||
// the PathDiagnosticConsumer from multiple bug reporters.
|
||||
HandlePathDiagnosticImpl(D);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,15 +60,15 @@ struct CompareDiagnostics {
|
|||
}
|
||||
|
||||
namespace {
|
||||
class PlistDiagnostics : public PathDiagnosticClient {
|
||||
class PlistDiagnostics : public PathDiagnosticConsumer {
|
||||
std::vector<const PathDiagnostic*> BatchedDiags;
|
||||
const std::string OutputFile;
|
||||
const LangOptions &LangOpts;
|
||||
llvm::OwningPtr<PathDiagnosticClient> SubPD;
|
||||
llvm::OwningPtr<PathDiagnosticConsumer> SubPD;
|
||||
bool flushed;
|
||||
public:
|
||||
PlistDiagnostics(const std::string& prefix, const LangOptions &LangOpts,
|
||||
PathDiagnosticClient *subPD);
|
||||
PathDiagnosticConsumer *subPD);
|
||||
|
||||
~PlistDiagnostics() { FlushDiagnostics(NULL); }
|
||||
|
||||
|
@ -89,18 +89,18 @@ namespace {
|
|||
|
||||
PlistDiagnostics::PlistDiagnostics(const std::string& output,
|
||||
const LangOptions &LO,
|
||||
PathDiagnosticClient *subPD)
|
||||
PathDiagnosticConsumer *subPD)
|
||||
: OutputFile(output), LangOpts(LO), SubPD(subPD), flushed(false) {}
|
||||
|
||||
PathDiagnosticClient*
|
||||
ento::createPlistDiagnosticClient(const std::string& s, const Preprocessor &PP,
|
||||
PathDiagnosticClient *subPD) {
|
||||
PathDiagnosticConsumer*
|
||||
ento::createPlistDiagnosticConsumer(const std::string& s, const Preprocessor &PP,
|
||||
PathDiagnosticConsumer *subPD) {
|
||||
return new PlistDiagnostics(s, PP.getLangOptions(), subPD);
|
||||
}
|
||||
|
||||
PathDiagnosticClient::PathGenerationScheme
|
||||
PathDiagnosticConsumer::PathGenerationScheme
|
||||
PlistDiagnostics::getGenerationScheme() const {
|
||||
if (const PathDiagnosticClient *PD = SubPD.get())
|
||||
if (const PathDiagnosticConsumer *PD = SubPD.get())
|
||||
return PD->getGenerationScheme();
|
||||
|
||||
return Extensive;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace {
|
|||
|
||||
/// \brief Simple path diagnostic client used for outputting as diagnostic notes
|
||||
/// the sequence of events.
|
||||
class TextPathDiagnostics : public PathDiagnosticClient {
|
||||
class TextPathDiagnostics : public PathDiagnosticConsumer {
|
||||
const std::string OutputFile;
|
||||
DiagnosticsEngine &Diag;
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
} // end anonymous namespace
|
||||
|
||||
PathDiagnosticClient*
|
||||
ento::createTextPathDiagnosticClient(const std::string& out,
|
||||
PathDiagnosticConsumer*
|
||||
ento::createTextPathDiagnosticConsumer(const std::string& out,
|
||||
const Preprocessor &PP) {
|
||||
return new TextPathDiagnostics(out, PP.getDiagnostics());
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ static ExplodedNode::Auditor* CreateUbiViz();
|
|||
// Special PathDiagnosticClients.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static PathDiagnosticClient*
|
||||
createPlistHTMLDiagnosticClient(const std::string& prefix,
|
||||
static PathDiagnosticConsumer*
|
||||
createPlistHTMLDiagnosticConsumer(const std::string& prefix,
|
||||
const Preprocessor &PP) {
|
||||
PathDiagnosticClient *PD =
|
||||
createHTMLDiagnosticClient(llvm::sys::path::parent_path(prefix), PP);
|
||||
return createPlistDiagnosticClient(prefix, PP, PD);
|
||||
PathDiagnosticConsumer *PD =
|
||||
createHTMLDiagnosticConsumer(llvm::sys::path::parent_path(prefix), PP);
|
||||
return createPlistDiagnosticConsumer(prefix, PP, PD);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
ArrayRef<std::string> Plugins;
|
||||
|
||||
// PD is owned by AnalysisManager.
|
||||
PathDiagnosticClient *PD;
|
||||
PathDiagnosticConsumer *PD;
|
||||
|
||||
StoreManagerCreator CreateStoreMgr;
|
||||
ConstraintManagerCreator CreateConstraintMgr;
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
|
||||
void DigestAnalyzerOptions() {
|
||||
// Create the PathDiagnosticClient.
|
||||
// Create the PathDiagnosticConsumer.
|
||||
if (!OutDir.empty()) {
|
||||
switch (Opts.AnalysisDiagOpt) {
|
||||
default:
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
} else if (Opts.AnalysisDiagOpt == PD_TEXT) {
|
||||
// Create the text client even without a specified output file since
|
||||
// it just uses diagnostic notes.
|
||||
PD = createTextPathDiagnosticClient("", PP);
|
||||
PD = createTextPathDiagnosticConsumer("", PP);
|
||||
}
|
||||
|
||||
// Create the analyzer component creators.
|
||||
|
@ -244,9 +244,9 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
|
|||
// After all decls handled, run checkers on the entire TranslationUnit.
|
||||
checkerMgr->runCheckersOnEndOfTranslationUnit(TU, *Mgr, BR);
|
||||
|
||||
// Explicitly destroy the PathDiagnosticClient. This will flush its output.
|
||||
// Explicitly destroy the PathDiagnosticConsumer. This will flush its output.
|
||||
// FIXME: This should be replaced with something that doesn't rely on
|
||||
// side-effects in PathDiagnosticClient's destructor. This is required when
|
||||
// side-effects in PathDiagnosticConsumer's destructor. This is required when
|
||||
// used with option -disable-free.
|
||||
Mgr.reset(NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue