Rename DiagnosticClient to DiagnosticConsumer as per issue 5397

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2011-09-25 23:39:51 +00:00
Родитель d6471f7c19
Коммит 78ad0b9884
21 изменённых файлов: 80 добавлений и 80 удалений

Просмотреть файл

@ -15,7 +15,7 @@
namespace clang { namespace clang {
class ASTContext; class ASTContext;
class DiagnosticClient; class DiagnosticConsumer;
namespace arcmt { namespace arcmt {
class MigrationPass; class MigrationPass;
@ -38,7 +38,7 @@ namespace arcmt {
/// \returns false if no error is produced, true otherwise. /// \returns false if no error is produced, true otherwise.
bool checkForManualIssues(CompilerInvocation &CI, bool checkForManualIssues(CompilerInvocation &CI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient, DiagnosticConsumer *DiagClient,
bool emitPremigrationARCErrors = false, bool emitPremigrationARCErrors = false,
StringRef plistOut = StringRef()); StringRef plistOut = StringRef());
@ -48,7 +48,7 @@ bool checkForManualIssues(CompilerInvocation &CI,
/// \returns false if no error is produced, true otherwise. /// \returns false if no error is produced, true otherwise.
bool applyTransformations(CompilerInvocation &origCI, bool applyTransformations(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient); DiagnosticConsumer *DiagClient);
/// \brief Applies automatic modifications and produces temporary files /// \brief Applies automatic modifications and produces temporary files
/// and metadata into the \arg outputDir path. /// and metadata into the \arg outputDir path.
@ -63,7 +63,7 @@ bool applyTransformations(CompilerInvocation &origCI,
/// \returns false if no error is produced, true otherwise. /// \returns false if no error is produced, true otherwise.
bool migrateWithTemporaryFiles(CompilerInvocation &origCI, bool migrateWithTemporaryFiles(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient, DiagnosticConsumer *DiagClient,
StringRef outputDir, StringRef outputDir,
bool emitPremigrationARCErrors, bool emitPremigrationARCErrors,
StringRef plistOut); StringRef plistOut);
@ -74,7 +74,7 @@ bool migrateWithTemporaryFiles(CompilerInvocation &origCI,
/// \returns false if no error is produced, true otherwise. /// \returns false if no error is produced, true otherwise.
bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap, bool getFileRemappings(std::vector<std::pair<std::string,std::string> > &remap,
StringRef outputDir, StringRef outputDir,
DiagnosticClient *DiagClient); DiagnosticConsumer *DiagClient);
typedef void (*TransformFn)(MigrationPass &pass); typedef void (*TransformFn)(MigrationPass &pass);
@ -82,11 +82,11 @@ std::vector<TransformFn> getAllTransformations();
class MigrationProcess { class MigrationProcess {
CompilerInvocation OrigCI; CompilerInvocation OrigCI;
DiagnosticClient *DiagClient; DiagnosticConsumer *DiagClient;
FileRemapper Remapper; FileRemapper Remapper;
public: public:
MigrationProcess(const CompilerInvocation &CI, DiagnosticClient *diagClient, MigrationProcess(const CompilerInvocation &CI, DiagnosticConsumer *diagClient,
StringRef outputDir = StringRef()); StringRef outputDir = StringRef());
class RewriteListener { class RewriteListener {

Просмотреть файл

@ -26,7 +26,7 @@
#include <list> #include <list>
namespace clang { namespace clang {
class DiagnosticClient; class DiagnosticConsumer;
class DiagnosticBuilder; class DiagnosticBuilder;
class IdentifierInfo; class IdentifierInfo;
class DeclContext; class DeclContext;
@ -102,9 +102,9 @@ public:
/// DiagnosticsEngine - This concrete class is used by the front-end to report /// DiagnosticsEngine - This concrete class is used by the front-end to report
/// problems and issues. It massages the diagnostics (e.g. handling things like /// problems and issues. It massages the diagnostics (e.g. handling things like
/// "report warnings as errors" and passes them off to the DiagnosticClient for /// "report warnings as errors" and passes them off to the DiagnosticConsumer
/// reporting to the user. DiagnosticsEngine is tied to one translation unit and /// for reporting to the user. DiagnosticsEngine is tied to one translation unit
/// one SourceManager. /// and one SourceManager.
class DiagnosticsEngine : public llvm::RefCountedBase<DiagnosticsEngine> { class DiagnosticsEngine : public llvm::RefCountedBase<DiagnosticsEngine> {
public: public:
/// Level - The level of the diagnostic, after it has been through mapping. /// Level - The level of the diagnostic, after it has been through mapping.
@ -160,7 +160,7 @@ private:
// 0 -> no limit. // 0 -> no limit.
ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors? ExtensionHandling ExtBehavior; // Map extensions onto warnings or errors?
llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags; llvm::IntrusiveRefCntPtr<DiagnosticIDs> Diags;
DiagnosticClient *Client; DiagnosticConsumer *Client;
bool OwnsDiagClient; bool OwnsDiagClient;
SourceManager *SourceMgr; SourceManager *SourceMgr;
@ -305,7 +305,7 @@ private:
public: public:
explicit DiagnosticsEngine( explicit DiagnosticsEngine(
const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags, const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &Diags,
DiagnosticClient *client = 0, DiagnosticConsumer *client = 0,
bool ShouldOwnClient = true); bool ShouldOwnClient = true);
~DiagnosticsEngine(); ~DiagnosticsEngine();
@ -313,15 +313,15 @@ public:
return Diags; return Diags;
} }
DiagnosticClient *getClient() { return Client; } DiagnosticConsumer *getClient() { return Client; }
const DiagnosticClient *getClient() const { return Client; } const DiagnosticConsumer *getClient() const { return Client; }
/// \brief Determine whether this \c DiagnosticsEngine object own its client. /// \brief Determine whether this \c DiagnosticsEngine object own its client.
bool ownsClient() const { return OwnsDiagClient; } bool ownsClient() const { return OwnsDiagClient; }
/// \brief Return the current diagnostic client along with ownership of that /// \brief Return the current diagnostic client along with ownership of that
/// client. /// client.
DiagnosticClient *takeClient() { DiagnosticConsumer *takeClient() {
OwnsDiagClient = false; OwnsDiagClient = false;
return Client; return Client;
} }
@ -352,7 +352,7 @@ public:
/// ///
/// \param ShouldOwnClient true if the diagnostic object should take /// \param ShouldOwnClient true if the diagnostic object should take
/// ownership of \c client. /// ownership of \c client.
void setClient(DiagnosticClient *client, bool ShouldOwnClient = true); void setClient(DiagnosticConsumer *client, bool ShouldOwnClient = true);
/// setErrorLimit - Specify a limit for the number of errors we should /// setErrorLimit - Specify a limit for the number of errors we should
/// emit before giving up. Zero disables the limit. /// emit before giving up. Zero disables the limit.
@ -501,7 +501,7 @@ public:
/// \brief Based on the way the client configured the DiagnosticsEngine /// \brief Based on the way the client configured the DiagnosticsEngine
/// object, classify the specified diagnostic ID into a Level, consumable by /// object, classify the specified diagnostic ID into a Level, consumable by
/// the DiagnosticClient. /// the DiagnosticConsumer.
/// ///
/// \param Loc The source location we are interested in finding out the /// \param Loc The source location we are interested in finding out the
/// diagnostic state. Can be null in order to query the latest state. /// diagnostic state. Can be null in order to query the latest state.
@ -1025,20 +1025,20 @@ public:
unsigned fixit_size() const { return FixIts.size(); } unsigned fixit_size() const { return FixIts.size(); }
}; };
/// DiagnosticClient - This is an abstract interface implemented by clients of /// DiagnosticConsumer - This is an abstract interface implemented by clients of
/// the front-end, which formats and prints fully processed diagnostics. /// the front-end, which formats and prints fully processed diagnostics.
class DiagnosticClient { class DiagnosticConsumer {
protected: protected:
unsigned NumWarnings; // Number of warnings reported unsigned NumWarnings; // Number of warnings reported
unsigned NumErrors; // Number of errors reported unsigned NumErrors; // Number of errors reported
public: public:
DiagnosticClient() : NumWarnings(0), NumErrors(0) { } DiagnosticConsumer() : NumWarnings(0), NumErrors(0) { }
unsigned getNumErrors() const { return NumErrors; } unsigned getNumErrors() const { return NumErrors; }
unsigned getNumWarnings() const { return NumWarnings; } unsigned getNumWarnings() const { return NumWarnings; }
virtual ~DiagnosticClient(); virtual ~DiagnosticConsumer();
/// BeginSourceFile - Callback to inform the diagnostic client that processing /// BeginSourceFile - Callback to inform the diagnostic client that processing
/// of a source file is beginning. /// of a source file is beginning.
@ -1061,8 +1061,8 @@ public:
/// IncludeInDiagnosticCounts - This method (whose default implementation /// IncludeInDiagnosticCounts - This method (whose default implementation
/// returns true) indicates whether the diagnostics handled by this /// returns true) indicates whether the diagnostics handled by this
/// DiagnosticClient should be included in the number of diagnostics reported /// DiagnosticConsumer should be included in the number of diagnostics
/// by DiagnosticsEngine. /// reported by DiagnosticsEngine.
virtual bool IncludeInDiagnosticCounts() const; virtual bool IncludeInDiagnosticCounts() const;
/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or

Просмотреть файл

@ -20,13 +20,13 @@ class LangOptions;
/// go to the first client and then the second. The first diagnostic client /// go to the first client and then the second. The first diagnostic client
/// should be the "primary" client, and will be used for computing whether the /// should be the "primary" client, and will be used for computing whether the
/// diagnostics should be included in counts. /// diagnostics should be included in counts.
class ChainedDiagnosticClient : public DiagnosticClient { class ChainedDiagnosticClient : public DiagnosticConsumer {
llvm::OwningPtr<DiagnosticClient> Primary; llvm::OwningPtr<DiagnosticConsumer> Primary;
llvm::OwningPtr<DiagnosticClient> Secondary; llvm::OwningPtr<DiagnosticConsumer> Secondary;
public: public:
ChainedDiagnosticClient(DiagnosticClient *_Primary, ChainedDiagnosticClient(DiagnosticConsumer *_Primary,
DiagnosticClient *_Secondary) { DiagnosticConsumer *_Secondary) {
Primary.reset(_Primary); Primary.reset(_Primary);
Secondary.reset(_Secondary); Secondary.reset(_Secondary);
} }
@ -49,7 +49,7 @@ public:
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(DiagLevel, Info); DiagnosticConsumer::HandleDiagnostic(DiagLevel, Info);
Primary->HandleDiagnostic(DiagLevel, Info); Primary->HandleDiagnostic(DiagLevel, Info);
Secondary->HandleDiagnostic(DiagLevel, Info); Secondary->HandleDiagnostic(DiagLevel, Info);

Просмотреть файл

@ -30,7 +30,7 @@ class ASTConsumer;
class ASTReader; class ASTReader;
class CodeCompleteConsumer; class CodeCompleteConsumer;
class DiagnosticsEngine; class DiagnosticsEngine;
class DiagnosticClient; class DiagnosticConsumer;
class ExternalASTSource; class ExternalASTSource;
class FileManager; class FileManager;
class FrontendAction; class FrontendAction;
@ -260,7 +260,7 @@ public:
/// setDiagnostics - Replace the current diagnostics engine. /// setDiagnostics - Replace the current diagnostics engine.
void setDiagnostics(DiagnosticsEngine *Value); void setDiagnostics(DiagnosticsEngine *Value);
DiagnosticClient &getDiagnosticClient() const { DiagnosticConsumer &getDiagnosticClient() const {
assert(Diagnostics && Diagnostics->getClient() && assert(Diagnostics && Diagnostics->getClient() &&
"Compiler instance has no diagnostic client!"); "Compiler instance has no diagnostic client!");
return *Diagnostics->getClient(); return *Diagnostics->getClient();
@ -461,7 +461,7 @@ public:
/// \param ShouldOwnClient If Client is non-NULL, specifies whether /// \param ShouldOwnClient If Client is non-NULL, specifies whether
/// the diagnostic object should take ownership of the client. /// the diagnostic object should take ownership of the client.
void createDiagnostics(int Argc, const char* const *Argv, void createDiagnostics(int Argc, const char* const *Argv,
DiagnosticClient *Client = 0, DiagnosticConsumer *Client = 0,
bool ShouldOwnClient = true); bool ShouldOwnClient = true);
/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter. /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
@ -471,7 +471,7 @@ public:
/// logging information. /// logging information.
/// ///
/// If no diagnostic client is provided, this creates a /// If no diagnostic client is provided, this creates a
/// DiagnosticClient that is owned by the returned diagnostic /// DiagnosticConsumer that is owned by the returned diagnostic
/// object, if using directly the caller is responsible for /// object, if using directly the caller is responsible for
/// releasing the returned DiagnosticsEngine's client eventually. /// releasing the returned DiagnosticsEngine's client eventually.
/// ///
@ -490,7 +490,7 @@ public:
static llvm::IntrusiveRefCntPtr<DiagnosticsEngine> static llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
createDiagnostics(const DiagnosticOptions &Opts, int Argc, createDiagnostics(const DiagnosticOptions &Opts, int Argc,
const char* const *Argv, const char* const *Argv,
DiagnosticClient *Client = 0, DiagnosticConsumer *Client = 0,
bool ShouldOwnClient = true, bool ShouldOwnClient = true,
const CodeGenOptions *CodeGenOpts = 0); const CodeGenOptions *CodeGenOpts = 0);

Просмотреть файл

@ -19,7 +19,7 @@ namespace clang {
class DiagnosticOptions; class DiagnosticOptions;
class LangOptions; class LangOptions;
class LogDiagnosticPrinter : public DiagnosticClient { class LogDiagnosticPrinter : public DiagnosticConsumer {
struct DiagEntry { struct DiagEntry {
/// The primary message line of the diagnostic. /// The primary message line of the diagnostic.
std::string Message; std::string Message;

Просмотреть файл

@ -22,7 +22,7 @@ namespace clang {
class Preprocessor; class Preprocessor;
class SourceManager; class SourceManager;
class TextDiagnosticBuffer : public DiagnosticClient { class TextDiagnosticBuffer : public DiagnosticConsumer {
public: public:
typedef std::vector<std::pair<SourceLocation, std::string> > DiagList; typedef std::vector<std::pair<SourceLocation, std::string> > DiagList;
typedef DiagList::iterator iterator; typedef DiagList::iterator iterator;

Просмотреть файл

@ -22,7 +22,7 @@ namespace clang {
class DiagnosticOptions; class DiagnosticOptions;
class LangOptions; class LangOptions;
class TextDiagnosticPrinter : public DiagnosticClient { class TextDiagnosticPrinter : public DiagnosticConsumer {
raw_ostream &OS; raw_ostream &OS;
const LangOptions *LangOpts; const LangOptions *LangOpts;
const DiagnosticOptions *DiagOpts; const DiagnosticOptions *DiagOpts;

Просмотреть файл

@ -62,10 +62,10 @@ class TextDiagnosticBuffer;
/// // expected-error-re {{variable has has type 'struct (.*)'}} /// // expected-error-re {{variable has has type 'struct (.*)'}}
/// // expected-error-re {{variable has has type 'struct[[:space:]](.*)'}} /// // expected-error-re {{variable has has type 'struct[[:space:]](.*)'}}
/// ///
class VerifyDiagnosticsClient : public DiagnosticClient { class VerifyDiagnosticsClient : public DiagnosticConsumer {
public: public:
DiagnosticsEngine &Diags; DiagnosticsEngine &Diags;
DiagnosticClient *PrimaryClient; DiagnosticConsumer *PrimaryClient;
bool OwnsPrimaryClient; bool OwnsPrimaryClient;
llvm::OwningPtr<TextDiagnosticBuffer> Buffer; llvm::OwningPtr<TextDiagnosticBuffer> Buffer;
Preprocessor *CurrentPreprocessor; Preprocessor *CurrentPreprocessor;

Просмотреть файл

@ -36,7 +36,7 @@ public:
bool FixWhatYouCan; bool FixWhatYouCan;
}; };
class FixItRewriter : public DiagnosticClient { class FixItRewriter : public DiagnosticConsumer {
/// \brief The diagnostics machinery. /// \brief The diagnostics machinery.
DiagnosticsEngine &Diags; DiagnosticsEngine &Diags;
@ -46,7 +46,7 @@ class FixItRewriter : public DiagnosticClient {
/// \brief The diagnostic client that performs the actual formatting /// \brief The diagnostic client that performs the actual formatting
/// of error messages. /// of error messages.
DiagnosticClient *Client; DiagnosticConsumer *Client;
/// \brief Turn an input path into an output path. NULL implies overwriting /// \brief Turn an input path into an output path. NULL implies overwriting
/// the original. /// the original.
@ -86,7 +86,7 @@ public:
/// IncludeInDiagnosticCounts - This method (whose default implementation /// IncludeInDiagnosticCounts - This method (whose default implementation
/// returns true) indicates whether the diagnostics handled by this /// returns true) indicates whether the diagnostics handled by this
/// DiagnosticClient should be included in the number of diagnostics /// DiagnosticConsumer should be included in the number of diagnostics
/// reported by DiagnosticsEngine. /// reported by DiagnosticsEngine.
virtual bool IncludeInDiagnosticCounts() const; virtual bool IncludeInDiagnosticCounts() const;

Просмотреть файл

@ -88,7 +88,7 @@ bool CapturedDiagList::hasErrors() const {
namespace { namespace {
class CaptureDiagnosticClient : public DiagnosticClient { class CaptureDiagnosticClient : public DiagnosticConsumer {
DiagnosticsEngine &Diags; DiagnosticsEngine &Diags;
CapturedDiagList &CapturedDiags; CapturedDiagList &CapturedDiags;
public: public:
@ -214,7 +214,7 @@ static void emitPremigrationErrors(const CapturedDiagList &arcDiags,
bool arcmt::checkForManualIssues(CompilerInvocation &origCI, bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient, DiagnosticConsumer *DiagClient,
bool emitPremigrationARCErrors, bool emitPremigrationARCErrors,
StringRef plistOut) { StringRef plistOut) {
if (!origCI.getLangOpts().ObjC1) if (!origCI.getLangOpts().ObjC1)
@ -271,7 +271,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
// After parsing of source files ended, we want to reuse the // After parsing of source files ended, we want to reuse the
// diagnostics objects to emit further diagnostics. // diagnostics objects to emit further diagnostics.
// We call BeginSourceFile because DiagnosticClient requires that // We call BeginSourceFile because DiagnosticConsumer requires that
// diagnostics with source range information are emitted only in between // diagnostics with source range information are emitted only in between
// BeginSourceFile() and EndSourceFile(). // BeginSourceFile() and EndSourceFile().
DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor());
@ -303,7 +303,7 @@ bool arcmt::checkForManualIssues(CompilerInvocation &origCI,
static bool applyTransforms(CompilerInvocation &origCI, static bool applyTransforms(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient, DiagnosticConsumer *DiagClient,
StringRef outputDir, StringRef outputDir,
bool emitPremigrationARCErrors, bool emitPremigrationARCErrors,
StringRef plistOut) { StringRef plistOut) {
@ -347,14 +347,14 @@ static bool applyTransforms(CompilerInvocation &origCI,
bool arcmt::applyTransformations(CompilerInvocation &origCI, bool arcmt::applyTransformations(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient) { DiagnosticConsumer *DiagClient) {
return applyTransforms(origCI, Filename, Kind, DiagClient, return applyTransforms(origCI, Filename, Kind, DiagClient,
StringRef(), false, StringRef()); StringRef(), false, StringRef());
} }
bool arcmt::migrateWithTemporaryFiles(CompilerInvocation &origCI, bool arcmt::migrateWithTemporaryFiles(CompilerInvocation &origCI,
StringRef Filename, InputKind Kind, StringRef Filename, InputKind Kind,
DiagnosticClient *DiagClient, DiagnosticConsumer *DiagClient,
StringRef outputDir, StringRef outputDir,
bool emitPremigrationARCErrors, bool emitPremigrationARCErrors,
StringRef plistOut) { StringRef plistOut) {
@ -366,7 +366,7 @@ bool arcmt::migrateWithTemporaryFiles(CompilerInvocation &origCI,
bool arcmt::getFileRemappings(std::vector<std::pair<std::string,std::string> > & bool arcmt::getFileRemappings(std::vector<std::pair<std::string,std::string> > &
remap, remap,
StringRef outputDir, StringRef outputDir,
DiagnosticClient *DiagClient) { DiagnosticConsumer *DiagClient) {
assert(!outputDir.empty()); assert(!outputDir.empty());
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
@ -468,7 +468,7 @@ public:
MigrationProcess::RewriteListener::~RewriteListener() { } MigrationProcess::RewriteListener::~RewriteListener() { }
MigrationProcess::MigrationProcess(const CompilerInvocation &CI, MigrationProcess::MigrationProcess(const CompilerInvocation &CI,
DiagnosticClient *diagClient, DiagnosticConsumer *diagClient,
StringRef outputDir) StringRef outputDir)
: OrigCI(CI), DiagClient(diagClient) { : OrigCI(CI), DiagClient(diagClient) {
if (!outputDir.empty()) { if (!outputDir.empty()) {
@ -524,7 +524,7 @@ bool MigrationProcess::applyTransform(TransformFn trans,
// After parsing of source files ended, we want to reuse the // After parsing of source files ended, we want to reuse the
// diagnostics objects to emit further diagnostics. // diagnostics objects to emit further diagnostics.
// We call BeginSourceFile because DiagnosticClient requires that // We call BeginSourceFile because DiagnosticConsumer requires that
// diagnostics with source range information are emitted only in between // diagnostics with source range information are emitted only in between
// BeginSourceFile() and EndSourceFile(). // BeginSourceFile() and EndSourceFile().
DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor()); DiagClient->BeginSourceFile(Ctx.getLangOptions(), &Unit->getPreprocessor());

Просмотреть файл

@ -35,7 +35,7 @@ static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
DiagnosticsEngine::DiagnosticsEngine( DiagnosticsEngine::DiagnosticsEngine(
const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags, const llvm::IntrusiveRefCntPtr<DiagnosticIDs> &diags,
DiagnosticClient *client, bool ShouldOwnClient) DiagnosticConsumer *client, bool ShouldOwnClient)
: Diags(diags), Client(client), OwnsDiagClient(ShouldOwnClient), : Diags(diags), Client(client), OwnsDiagClient(ShouldOwnClient),
SourceMgr(0) { SourceMgr(0) {
ArgToStringFn = DummyArgToStringFn; ArgToStringFn = DummyArgToStringFn;
@ -62,7 +62,7 @@ DiagnosticsEngine::~DiagnosticsEngine() {
delete Client; delete Client;
} }
void DiagnosticsEngine::setClient(DiagnosticClient *client, void DiagnosticsEngine::setClient(DiagnosticConsumer *client,
bool ShouldOwnClient) { bool ShouldOwnClient) {
if (OwnsDiagClient && Client) if (OwnsDiagClient && Client)
delete Client; delete Client;
@ -245,7 +245,7 @@ void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) {
FE = storedDiag.fixit_end(); FI != FE; ++FI) FE = storedDiag.fixit_end(); FI != FE; ++FI)
FixItHints[i++] = *FI; FixItHints[i++] = *FI;
assert(Client && "DiagnosticClient not set!"); assert(Client && "DiagnosticConsumer not set!");
Level DiagLevel = storedDiag.getLevel(); Level DiagLevel = storedDiag.getLevel();
DiagnosticInfo Info(this, storedDiag.getMessage()); DiagnosticInfo Info(this, storedDiag.getMessage());
Client->HandleDiagnostic(DiagLevel, Info); Client->HandleDiagnostic(DiagLevel, Info);
@ -273,7 +273,7 @@ bool DiagnosticBuilder::Emit() {
FlushCounts(); FlushCounts();
// Process the diagnostic, sending the accumulated information to the // Process the diagnostic, sending the accumulated information to the
// DiagnosticClient. // DiagnosticConsumer.
bool Emitted = DiagObj->ProcessDiag(); bool Emitted = DiagObj->ProcessDiag();
// Clear out the current diagnostic object. // Clear out the current diagnostic object.
@ -291,9 +291,9 @@ bool DiagnosticBuilder::Emit() {
} }
DiagnosticClient::~DiagnosticClient() {} DiagnosticConsumer::~DiagnosticConsumer() {}
void DiagnosticClient::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, void DiagnosticConsumer::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
if (!IncludeInDiagnosticCounts()) if (!IncludeInDiagnosticCounts())
return; return;
@ -746,9 +746,9 @@ StoredDiagnostic::~StoredDiagnostic() { }
/// IncludeInDiagnosticCounts - This method (whose default implementation /// IncludeInDiagnosticCounts - This method (whose default implementation
/// returns true) indicates whether the diagnostics handled by this /// returns true) indicates whether the diagnostics handled by this
/// DiagnosticClient should be included in the number of diagnostics /// DiagnosticConsumer should be included in the number of diagnostics
/// reported by DiagnosticsEngine. /// reported by DiagnosticsEngine.
bool DiagnosticClient::IncludeInDiagnosticCounts() const { return true; } bool DiagnosticConsumer::IncludeInDiagnosticCounts() const { return true; }
PartialDiagnostic::StorageAllocator::StorageAllocator() { PartialDiagnostic::StorageAllocator::StorageAllocator() {
for (unsigned I = 0; I != NumCached; ++I) for (unsigned I = 0; I != NumCached; ++I)

Просмотреть файл

@ -448,7 +448,7 @@ public:
} }
}; };
class StoredDiagnosticClient : public DiagnosticClient { class StoredDiagnosticClient : public DiagnosticConsumer {
SmallVectorImpl<StoredDiagnostic> &StoredDiags; SmallVectorImpl<StoredDiagnostic> &StoredDiags;
public: public:
@ -465,7 +465,7 @@ public:
class CaptureDroppedDiagnostics { class CaptureDroppedDiagnostics {
DiagnosticsEngine &Diags; DiagnosticsEngine &Diags;
StoredDiagnosticClient Client; StoredDiagnosticClient Client;
DiagnosticClient *PreviousClient; DiagnosticConsumer *PreviousClient;
public: public:
CaptureDroppedDiagnostics(bool RequestCapture, DiagnosticsEngine &Diags, CaptureDroppedDiagnostics(bool RequestCapture, DiagnosticsEngine &Diags,
@ -491,7 +491,7 @@ public:
void StoredDiagnosticClient::HandleDiagnostic(DiagnosticsEngine::Level Level, void StoredDiagnosticClient::HandleDiagnostic(DiagnosticsEngine::Level Level,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(Level, Info); DiagnosticConsumer::HandleDiagnostic(Level, Info);
StoredDiags.push_back(StoredDiagnostic(Level, Info)); StoredDiags.push_back(StoredDiagnostic(Level, Info));
} }
@ -514,7 +514,7 @@ void ASTUnit::ConfigureDiags(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
// No diagnostics engine was provided, so create our own diagnostics object // No diagnostics engine was provided, so create our own diagnostics object
// with the default options. // with the default options.
DiagnosticOptions DiagOpts; DiagnosticOptions DiagOpts;
DiagnosticClient *Client = 0; DiagnosticConsumer *Client = 0;
if (CaptureDiagnostics) if (CaptureDiagnostics)
Client = new StoredDiagnosticClient(AST.StoredDiagnostics); Client = new StoredDiagnosticClient(AST.StoredDiagnostics);
Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd- ArgBegin, Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd- ArgBegin,

Просмотреть файл

@ -104,7 +104,7 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
(*OS) << '\n'; (*OS) << '\n';
// Chain in a diagnostic client which will log the diagnostics. // Chain in a diagnostic client which will log the diagnostics.
DiagnosticClient *Logger = DiagnosticConsumer *Logger =
new TextDiagnosticPrinter(*OS.take(), DiagOpts, /*OwnsOutputStream=*/true); new TextDiagnosticPrinter(*OS.take(), DiagOpts, /*OwnsOutputStream=*/true);
Diags.setClient(new ChainedDiagnosticClient(Diags.takeClient(), Logger)); Diags.setClient(new ChainedDiagnosticClient(Diags.takeClient(), Logger));
} }
@ -140,7 +140,7 @@ static void SetUpDiagnosticLog(const DiagnosticOptions &DiagOpts,
} }
void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv, void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv,
DiagnosticClient *Client, DiagnosticConsumer *Client,
bool ShouldOwnClient) { bool ShouldOwnClient) {
Diagnostics = createDiagnostics(getDiagnosticOpts(), Argc, Argv, Client, Diagnostics = createDiagnostics(getDiagnosticOpts(), Argc, Argv, Client,
ShouldOwnClient, &getCodeGenOpts()); ShouldOwnClient, &getCodeGenOpts());
@ -149,7 +149,7 @@ void CompilerInstance::createDiagnostics(int Argc, const char* const *Argv,
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts, CompilerInstance::createDiagnostics(const DiagnosticOptions &Opts,
int Argc, const char* const *Argv, int Argc, const char* const *Argv,
DiagnosticClient *Client, DiagnosticConsumer *Client,
bool ShouldOwnClient, bool ShouldOwnClient,
const CodeGenOptions *CodeGenOpts) { const CodeGenOptions *CodeGenOpts) {
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());

Просмотреть файл

@ -42,9 +42,9 @@ void LogDiagnosticPrinter::EndSourceFile() {
// We emit all the diagnostics in EndSourceFile. However, we don't emit any // We emit all the diagnostics in EndSourceFile. However, we don't emit any
// entry if no diagnostics were present. // entry if no diagnostics were present.
// //
// Note that DiagnosticClient has no "end-of-compilation" callback, so we will // Note that DiagnosticConsumer has no "end-of-compilation" callback, so we
// miss any diagnostics which are emitted after and outside the translation // will miss any diagnostics which are emitted after and outside the
// unit processing. // translation unit processing.
if (Entries.empty()) if (Entries.empty())
return; return;
@ -96,7 +96,7 @@ void LogDiagnosticPrinter::EndSourceFile() {
void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level, void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(Level, Info); DiagnosticConsumer::HandleDiagnostic(Level, Info);
// Initialize the main file name, if we haven't already fetched it. // Initialize the main file name, if we haven't already fetched it.
if (MainFilename.empty() && Info.hasSourceManager()) { if (MainFilename.empty() && Info.hasSourceManager()) {

Просмотреть файл

@ -22,7 +22,7 @@ using namespace clang;
void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level, void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(Level, Info); DiagnosticConsumer::HandleDiagnostic(Level, Info);
llvm::SmallString<100> Buf; llvm::SmallString<100> Buf;
Info.FormatDiagnostic(Buf); Info.FormatDiagnostic(Buf);

Просмотреть файл

@ -1062,7 +1062,7 @@ void TextDiagnosticPrinter::EmitDiagnosticLoc(DiagnosticsEngine::Level Level,
void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level, void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(Level, Info); DiagnosticConsumer::HandleDiagnostic(Level, Info);
// Keeps track of the the starting position of the location // Keeps track of the the starting position of the location
// information (e.g., "foo.c:10:4:") that precedes the error // information (e.g., "foo.c:10:4:") that precedes the error

Просмотреть файл

@ -35,7 +35,7 @@ VerifyDiagnosticsClient::~VerifyDiagnosticsClient() {
delete PrimaryClient; delete PrimaryClient;
} }
// DiagnosticClient interface. // DiagnosticConsumer interface.
void VerifyDiagnosticsClient::BeginSourceFile(const LangOptions &LangOpts, void VerifyDiagnosticsClient::BeginSourceFile(const LangOptions &LangOpts,
const Preprocessor *PP) { const Preprocessor *PP) {
@ -483,7 +483,7 @@ void VerifyDiagnosticsClient::CheckDiagnostics() {
// Ensure any diagnostics go to the primary client. // Ensure any diagnostics go to the primary client.
bool OwnsCurClient = Diags.ownsClient(); bool OwnsCurClient = Diags.ownsClient();
DiagnosticClient *CurClient = Diags.takeClient(); DiagnosticConsumer *CurClient = Diags.takeClient();
Diags.setClient(PrimaryClient, false); Diags.setClient(PrimaryClient, false);
// If we have a preprocessor, scan the source for expected diagnostic // If we have a preprocessor, scan the source for expected diagnostic

Просмотреть файл

@ -81,7 +81,7 @@ bool FixItRewriter::IncludeInDiagnosticCounts() const {
void FixItRewriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, void FixItRewriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Default implementation (Warnings/errors count). // Default implementation (Warnings/errors count).
DiagnosticClient::HandleDiagnostic(DiagLevel, Info); DiagnosticConsumer::HandleDiagnostic(DiagLevel, Info);
Client->HandleDiagnostic(DiagLevel, Info); Client->HandleDiagnostic(DiagLevel, Info);

Просмотреть файл

@ -443,7 +443,7 @@ void html::SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP) {
namespace { namespace {
/// IgnoringDiagClient - This is a diagnostic client that just ignores all /// IgnoringDiagClient - This is a diagnostic client that just ignores all
/// diags. /// diags.
class IgnoringDiagClient : public DiagnosticClient { class IgnoringDiagClient : public DiagnosticConsumer {
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const DiagnosticInfo &Info) { const DiagnosticInfo &Info) {
// Just ignore it. // Just ignore it.

Просмотреть файл

@ -105,7 +105,7 @@ public:
static bool checkForMigration(StringRef resourcesPath, static bool checkForMigration(StringRef resourcesPath,
ArrayRef<const char *> Args) { ArrayRef<const char *> Args) {
DiagnosticClient *DiagClient = DiagnosticConsumer *DiagClient =
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags( llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
@ -152,7 +152,7 @@ static bool performTransformations(StringRef resourcesPath,
if (checkForMigration(resourcesPath, Args)) if (checkForMigration(resourcesPath, Args))
return true; return true;
DiagnosticClient *DiagClient = DiagnosticConsumer *DiagClient =
new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions()); new TextDiagnosticPrinter(llvm::errs(), DiagnosticOptions());
llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); llvm::IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags( llvm::IntrusiveRefCntPtr<DiagnosticsEngine> TopDiags(

Просмотреть файл

@ -21,7 +21,7 @@ using namespace clang;
namespace { namespace {
class DiagnosticOutputGetter { class DiagnosticOutputGetter {
class LastDiagnosticString : public DiagnosticClient { class LastDiagnosticString : public DiagnosticConsumer {
SmallString<64> LastDiagnostic; SmallString<64> LastDiagnostic;
public: public:
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,