diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-25 01:28:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-25 01:28:26 +0000 |
commit | b6f9ab63781f0b63079e8ec0fbd2745296e425f1 (patch) | |
tree | 1c649074f0f1cf612455ec270de1837d0f1fb17a /clang/lib/Basic/DiagnosticIDs.cpp | |
parent | 4c82cd21ed47db332cbf74627f6a761d2a6326d2 (diff) | |
download | bcm5719-llvm-b6f9ab63781f0b63079e8ec0fbd2745296e425f1.tar.gz bcm5719-llvm-b6f9ab63781f0b63079e8ec0fbd2745296e425f1.zip |
Teach TextDiagnosticPrinter to print out '-Werror' in addition to the warning flag for a warning mapped to an error.
For example:
t.c:7:9: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]
llvm-svn: 126466
Diffstat (limited to 'clang/lib/Basic/DiagnosticIDs.cpp')
-rw-r--r-- | clang/lib/Basic/DiagnosticIDs.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index 8725e7f9c0c..553e4c92945 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -288,14 +288,15 @@ const char *DiagnosticIDs::getDescription(unsigned DiagID) const { /// the DiagnosticClient. DiagnosticIDs::Level DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, - const Diagnostic &Diag) const { + const Diagnostic &Diag, + diag::Mapping *mapping) const { // Handle custom diagnostics, which cannot be mapped. if (DiagID >= diag::DIAG_UPPER_LIMIT) return CustomDiagInfo->getLevel(DiagID); unsigned DiagClass = getBuiltinDiagClass(DiagID); assert(DiagClass != CLASS_NOTE && "Cannot get diagnostic level of a note!"); - return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag); + return getDiagnosticLevel(DiagID, DiagClass, Loc, Diag, mapping); } /// \brief Based on the way the client configured the Diagnostic @@ -307,7 +308,8 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, SourceLocation Loc, DiagnosticIDs::Level DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, SourceLocation Loc, - const Diagnostic &Diag) const { + const Diagnostic &Diag, + diag::Mapping *mapping) const { // Specific non-error diagnostics may be mapped to various levels from ignored // to error. Errors can only be mapped to fatal. DiagnosticIDs::Level Result = DiagnosticIDs::Fatal; @@ -323,6 +325,9 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, MappingInfo = GetDefaultDiagMapping(DiagID); Diag.setDiagnosticMappingInternal(DiagID, MappingInfo, State, false, false); } + + if (mapping) + *mapping = (diag::Mapping) (MappingInfo & 7); switch (MappingInfo & 7) { default: assert(0 && "Unknown mapping!"); |