зеркало из https://github.com/microsoft/clang-1.git
Rename DiagnosticInfo to Diagnostic as per issue 5397
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140493 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ef3643fbbb
Коммит
40847cfb58
|
@ -579,7 +579,7 @@ private:
|
|||
// diagnostic is in flight at a time.
|
||||
friend class DiagnosticIDs;
|
||||
friend class DiagnosticBuilder;
|
||||
friend class DiagnosticInfo;
|
||||
friend class Diagnostic;
|
||||
friend class PartialDiagnostic;
|
||||
friend class DiagnosticErrorTrap;
|
||||
|
||||
|
@ -874,18 +874,18 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) {
|
|||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DiagnosticInfo
|
||||
// Diagnostic
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// DiagnosticInfo - This is a little helper class (which is basically a smart
|
||||
/// Diagnostic - This is a little helper class (which is basically a smart
|
||||
/// pointer that forward info from DiagnosticsEngine) that allows clients to
|
||||
/// enquire about the currently in-flight diagnostic.
|
||||
class DiagnosticInfo {
|
||||
class Diagnostic {
|
||||
const DiagnosticsEngine *DiagObj;
|
||||
StringRef StoredDiagMessage;
|
||||
public:
|
||||
explicit DiagnosticInfo(const DiagnosticsEngine *DO) : DiagObj(DO) {}
|
||||
DiagnosticInfo(const DiagnosticsEngine *DO, StringRef storedDiagMessage)
|
||||
explicit Diagnostic(const DiagnosticsEngine *DO) : DiagObj(DO) {}
|
||||
Diagnostic(const DiagnosticsEngine *DO, StringRef storedDiagMessage)
|
||||
: DiagObj(DO), StoredDiagMessage(storedDiagMessage) {}
|
||||
|
||||
const DiagnosticsEngine *getDiags() const { return DiagObj; }
|
||||
|
@ -995,7 +995,7 @@ class StoredDiagnostic {
|
|||
|
||||
public:
|
||||
StoredDiagnostic();
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, const DiagnosticInfo &Info);
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
StringRef Message);
|
||||
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
||||
|
@ -1071,7 +1071,7 @@ public:
|
|||
/// Default implementation just keeps track of the total number of warnings
|
||||
/// and errors.
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -510,7 +510,7 @@ enum { InvalidObjCMethodFamily = (1 << ObjCMethodFamilyBitWidth) - 1 };
|
|||
/// selectors that take no arguments and selectors that take 1 argument, which
|
||||
/// accounts for 78% of all selectors in Cocoa.h.
|
||||
class Selector {
|
||||
friend class DiagnosticInfo;
|
||||
friend class Diagnostic;
|
||||
|
||||
enum IdentifierInfoFlag {
|
||||
// MultiKeywordSelector = 0.
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
*this->DiagStorage = *Other.DiagStorage;
|
||||
}
|
||||
|
||||
PartialDiagnostic(const DiagnosticInfo &Other, StorageAllocator &Allocator)
|
||||
PartialDiagnostic(const Diagnostic &Other, StorageAllocator &Allocator)
|
||||
: DiagID(Other.getID()), DiagStorage(0), Allocator(&Allocator)
|
||||
{
|
||||
// Copy arguments.
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(DiagLevel, Info);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
void EndSourceFile();
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
const_iterator note_end() const { return Notes.end(); }
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
|
||||
/// FlushDiagnostics - Flush the buffered diagnostics to an given
|
||||
/// diagnostic engine.
|
||||
|
|
|
@ -57,11 +57,11 @@ public:
|
|||
const SourceManager &SM);
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
|
||||
private:
|
||||
void EmitDiagnosticLoc(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info,
|
||||
const Diagnostic &Info,
|
||||
const SourceManager &SM,
|
||||
PresumedLoc PLoc);
|
||||
};
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
virtual void EndSourceFile();
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
};
|
||||
|
||||
} // end namspace clang
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
|
||||
/// capturing it to a log as needed.
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
|
||||
/// \brief Emit a diagnostic via the adapted diagnostic client.
|
||||
void Diag(SourceLocation Loc, unsigned DiagID);
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
: Diags(diags), CapturedDiags(capturedDiags) { }
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level level,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
if (arcmt::isARCDiagnostic(Info.getID(), Diags) ||
|
||||
level >= DiagnosticsEngine::Error || level == DiagnosticsEngine::Note) {
|
||||
CapturedDiags.push_back(StoredDiagnostic(level, Info));
|
||||
|
|
|
@ -247,7 +247,7 @@ void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) {
|
|||
|
||||
assert(Client && "DiagnosticConsumer not set!");
|
||||
Level DiagLevel = storedDiag.getLevel();
|
||||
DiagnosticInfo Info(this, storedDiag.getMessage());
|
||||
Diagnostic Info(this, storedDiag.getMessage());
|
||||
Client->HandleDiagnostic(DiagLevel, Info);
|
||||
if (Client->IncludeInDiagnosticCounts()) {
|
||||
if (DiagLevel == DiagnosticsEngine::Warning)
|
||||
|
@ -294,7 +294,7 @@ bool DiagnosticBuilder::Emit() {
|
|||
DiagnosticConsumer::~DiagnosticConsumer() {}
|
||||
|
||||
void DiagnosticConsumer::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
if (!IncludeInDiagnosticCounts())
|
||||
return;
|
||||
|
||||
|
@ -343,7 +343,7 @@ static const char *ScanFormat(const char *I, const char *E, char Target) {
|
|||
/// "%2" has a value from 0-2. If the value is 0, the diagnostic prints 'foo'.
|
||||
/// If the value is 1, it prints 'bar'. If it has the value 2, it prints 'baz'.
|
||||
/// This is very useful for certain classes of variant diagnostics.
|
||||
static void HandleSelectModifier(const DiagnosticInfo &DInfo, unsigned ValNo,
|
||||
static void HandleSelectModifier(const Diagnostic &DInfo, unsigned ValNo,
|
||||
const char *Argument, unsigned ArgumentLen,
|
||||
SmallVectorImpl<char> &OutStr) {
|
||||
const char *ArgumentEnd = Argument+ArgumentLen;
|
||||
|
@ -501,7 +501,7 @@ static bool EvalPluralExpr(unsigned ValNo, const char *Start, const char *End) {
|
|||
/// {1:form0|[2,4]:form1|:form2}
|
||||
/// Polish (requires repeated form):
|
||||
/// {1:form0|%100=[10,20]:form2|%10=[2,4]:form1|:form2}
|
||||
static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo,
|
||||
static void HandlePluralModifier(const Diagnostic &DInfo, unsigned ValNo,
|
||||
const char *Argument, unsigned ArgumentLen,
|
||||
SmallVectorImpl<char> &OutStr) {
|
||||
const char *ArgumentEnd = Argument + ArgumentLen;
|
||||
|
@ -529,7 +529,7 @@ static void HandlePluralModifier(const DiagnosticInfo &DInfo, unsigned ValNo,
|
|||
/// FormatDiagnostic - Format this diagnostic into a string, substituting the
|
||||
/// formal arguments into the %0 slots. The result is appended onto the Str
|
||||
/// array.
|
||||
void DiagnosticInfo::
|
||||
void Diagnostic::
|
||||
FormatDiagnostic(SmallVectorImpl<char> &OutStr) const {
|
||||
if (!StoredDiagMessage.empty()) {
|
||||
OutStr.append(StoredDiagMessage.begin(), StoredDiagMessage.end());
|
||||
|
@ -542,7 +542,7 @@ FormatDiagnostic(SmallVectorImpl<char> &OutStr) const {
|
|||
FormatDiagnostic(Diag.begin(), Diag.end(), OutStr);
|
||||
}
|
||||
|
||||
void DiagnosticInfo::
|
||||
void Diagnostic::
|
||||
FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
|
||||
SmallVectorImpl<char> &OutStr) const {
|
||||
|
||||
|
@ -712,7 +712,7 @@ StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
|
|||
: ID(ID), Level(Level), Loc(), Message(Message) { }
|
||||
|
||||
StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info)
|
||||
const Diagnostic &Info)
|
||||
: ID(Info.getID()), Level(Level)
|
||||
{
|
||||
assert((Info.getLocation().isInvalid() || Info.hasSourceManager()) &&
|
||||
|
|
|
@ -674,7 +674,7 @@ bool DiagnosticIDs::setDiagnosticGroupMapping(StringRef Group,
|
|||
/// ProcessDiag - This is the method used to report a diagnostic that is
|
||||
/// finally fully formed.
|
||||
bool DiagnosticIDs::ProcessDiag(DiagnosticsEngine &Diag) const {
|
||||
DiagnosticInfo Info(&Diag);
|
||||
Diagnostic Info(&Diag);
|
||||
|
||||
if (Diag.SuppressAllDiagnostics)
|
||||
return false;
|
||||
|
|
|
@ -457,7 +457,7 @@ public:
|
|||
: StoredDiags(StoredDiags) { }
|
||||
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info);
|
||||
const Diagnostic &Info);
|
||||
};
|
||||
|
||||
/// \brief RAII object that optionally captures diagnostics, if
|
||||
|
@ -489,7 +489,7 @@ public:
|
|||
} // anonymous namespace
|
||||
|
||||
void StoredDiagnosticConsumer::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(Level, Info);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void LogDiagnosticPrinter::EndSourceFile() {
|
|||
}
|
||||
|
||||
void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(Level, Info);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace clang;
|
|||
/// reported.
|
||||
///
|
||||
void TextDiagnosticBuffer::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(Level, Info);
|
||||
|
||||
|
|
|
@ -958,7 +958,7 @@ static PresumedLoc getDiagnosticPresumedLoc(const SourceManager &SM,
|
|||
/// diagnostic and printing it, as well as any include stack or source ranges
|
||||
/// necessary.
|
||||
void TextDiagnosticPrinter::EmitDiagnosticLoc(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info,
|
||||
const Diagnostic &Info,
|
||||
const SourceManager &SM,
|
||||
PresumedLoc PLoc) {
|
||||
if (PLoc.isInvalid()) {
|
||||
|
@ -1086,14 +1086,14 @@ static void PrintDiagnosticLevel(raw_ostream &OS,
|
|||
OS.resetColor();
|
||||
}
|
||||
|
||||
static void PrintDiagnosticName(raw_ostream &OS, const DiagnosticInfo &Info) {
|
||||
static void PrintDiagnosticName(raw_ostream &OS, const Diagnostic &Info) {
|
||||
if (!DiagnosticIDs::isBuiltinNote(Info.getID()))
|
||||
OS << " [" << DiagnosticIDs::getName(Info.getID()) << "]";
|
||||
}
|
||||
|
||||
static void PrintDiagnosticOptions(raw_ostream &OS,
|
||||
DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info,
|
||||
const Diagnostic &Info,
|
||||
const DiagnosticOptions &DiagOpts) {
|
||||
std::string OptionName;
|
||||
if (DiagOpts.ShowOptionNames) {
|
||||
|
@ -1156,7 +1156,7 @@ static void PrintDiagnosticOptions(raw_ostream &OS,
|
|||
}
|
||||
|
||||
void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(Level, Info);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void VerifyDiagnosticConsumer::EndSourceFile() {
|
|||
}
|
||||
|
||||
void VerifyDiagnosticConsumer::HandleDiagnostic(
|
||||
DiagnosticsEngine::Level DiagLevel, const DiagnosticInfo &Info) {
|
||||
DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) {
|
||||
if (FirstErrorFID.isInvalid() && Info.hasSourceManager()) {
|
||||
const SourceManager &SM = Info.getSourceManager();
|
||||
FirstErrorFID = SM.getFileID(Info.getLocation());
|
||||
|
|
|
@ -79,7 +79,7 @@ bool FixItRewriter::IncludeInDiagnosticCounts() const {
|
|||
}
|
||||
|
||||
void FixItRewriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Default implementation (Warnings/errors count).
|
||||
DiagnosticConsumer::HandleDiagnostic(DiagLevel, Info);
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ namespace {
|
|||
/// diags.
|
||||
class IgnoringDiagConsumer : public DiagnosticConsumer {
|
||||
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
// Just ignore it.
|
||||
}
|
||||
};
|
||||
|
|
|
@ -669,7 +669,7 @@ Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
|
|||
// Make a copy of this suppressed diagnostic and store it with the
|
||||
// template-deduction information;
|
||||
FlushCounts();
|
||||
DiagnosticInfo DiagInfo(&SemaRef.Diags);
|
||||
Diagnostic DiagInfo(&SemaRef.Diags);
|
||||
|
||||
if (*Info)
|
||||
(*Info)->addSuppressedDiagnostic(DiagInfo.getLocation(),
|
||||
|
|
|
@ -25,7 +25,7 @@ class DiagnosticOutputGetter {
|
|||
SmallString<64> LastDiagnostic;
|
||||
public:
|
||||
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
|
||||
const DiagnosticInfo &Info) {
|
||||
const Diagnostic &Info) {
|
||||
LastDiagnostic.clear();
|
||||
Info.FormatDiagnostic(LastDiagnostic);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче