summaryrefslogtreecommitdiffstats
path: root/clang/Driver/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-06-13 17:45:37 +0000
committerBill Wendling <isanbard@gmail.com>2007-06-13 17:45:37 +0000
commit478b88638ff0c0c5348308bc26e32b8f2fc6df24 (patch)
tree788890f9d2ad70390056bafbc458b61e221afe67 /clang/Driver/TextDiagnosticPrinter.cpp
parentd6fbee81dfd74e26977d9154d6cb043a68d7b452 (diff)
downloadbcm5719-llvm-478b88638ff0c0c5348308bc26e32b8f2fc6df24.tar.gz
bcm5719-llvm-478b88638ff0c0c5348308bc26e32b8f2fc6df24.zip
Submitted by: Bill Wendling
Reviewed by: Chris Lattner - Created a base class (TextDiagnostics) for all text diagnostic classes. Moved the "IgnoreDiagnostic" method up there, and created a method that will format the diagnostic string, replacing %# with the appropriate string. This is in preparation for adding a text diagnostic checker. llvm-svn: 39650
Diffstat (limited to 'clang/Driver/TextDiagnosticPrinter.cpp')
-rw-r--r--clang/Driver/TextDiagnosticPrinter.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/clang/Driver/TextDiagnosticPrinter.cpp b/clang/Driver/TextDiagnosticPrinter.cpp
index 38290823084..8478c58e898 100644
--- a/clang/Driver/TextDiagnosticPrinter.cpp
+++ b/clang/Driver/TextDiagnosticPrinter.cpp
@@ -121,27 +121,6 @@ unsigned TextDiagnosticPrinter::GetTokenLength(SourceLocation Loc) {
return TheTok.getLength();
}
-bool TextDiagnosticPrinter::IgnoreDiagnostic(Diagnostic::Level Level,
- SourceLocation Pos) {
- if (Pos.isValid()) {
- // If this is a warning or note, and if it a system header, suppress the
- // diagnostic.
- if (Level == Diagnostic::Warning ||
- Level == Diagnostic::Note) {
- SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Pos);
- const FileEntry *F = SourceMgr.getFileEntryForFileID(PhysLoc.getFileID());
- if (F) {
- DirectoryLookup::DirType DirInfo = TheHeaderSearch->getFileDirFlavor(F);
- if (DirInfo == DirectoryLookup::SystemHeaderDir ||
- DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
- return true;
- }
- }
- }
-
- return false;
-}
-
void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
SourceLocation Pos,
diag::kind ID,
@@ -197,18 +176,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
break;
}
- std::string Msg = Diagnostic::getDescription(ID);
-
- // Replace all instances of %0 in Msg with 'Extra'.
- for (unsigned i = 0; i < Msg.size()-1; ++i) {
- if (Msg[i] == '%' && isdigit(Msg[i+1])) {
- unsigned StrNo = Msg[i+1]-'0';
- Msg = std::string(Msg.begin(), Msg.begin()+i) +
- (StrNo < NumStrs ? Strs[StrNo] : "<<<INTERNAL ERROR>>>") +
- std::string(Msg.begin()+i+2, Msg.end());
- }
- }
- cerr << Msg << "\n";
+ cerr << FormatDiagnostic(Level, ID, Strs, NumStrs) << "\n";
if (!NoCaretDiagnostics && Pos.isValid()) {
// Get the line of the source file.
OpenPOWER on IntegriCloud