diff options
author | Jordan Rose <jordan_rose@apple.com> | 2014-03-03 18:29:52 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2014-03-03 18:29:52 +0000 |
commit | 7ef1c387a049191d5a730461d344f9b0b3064e1d (patch) | |
tree | 1c38d2a9a8dcf9f2dc88bd6cbdae835ebb43aa9a /clang/lib/Frontend/SerializedDiagnosticPrinter.cpp | |
parent | 77d7698709874b0a8c0fef6d8652db58b40fd83e (diff) | |
download | bcm5719-llvm-7ef1c387a049191d5a730461d344f9b0b3064e1d.tar.gz bcm5719-llvm-7ef1c387a049191d5a730461d344f9b0b3064e1d.zip |
Serialized diagnostic severity levels should be stable.
Serialized diagnostics were accidentally using the AST diagnostic level values
rather than a dedicated stable enum, so the addition of "remark" broke the
reading of existing serialized diagnostics files. I've added a .dia file
generated from Xcode 5's Clang to make sure we don't break this in the future.
llvm-svn: 202733
Diffstat (limited to 'clang/lib/Frontend/SerializedDiagnosticPrinter.cpp')
-rw-r--r-- | clang/lib/Frontend/SerializedDiagnosticPrinter.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index 6514321f228..bed52b5361b 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -174,7 +174,7 @@ private: const SourceManager &SM); /// \brief The version of the diagnostics file. - enum { Version = 1 }; + enum { Version = 2 }; /// \brief Language options, which can differ from one clone of this client /// to another. @@ -566,6 +566,21 @@ void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, &Info); } +static serialized_diags::Level getStableLevel(DiagnosticsEngine::Level Level) { + switch (Level) { +#define CASE(X) case DiagnosticsEngine::X: return serialized_diags::X; + CASE(Ignored) + CASE(Note) + CASE(Remark) + CASE(Warning) + CASE(Error) + CASE(Fatal) +#undef CASE + } + + llvm_unreachable("invalid diagnostic level"); +} + void SDiagsWriter::EmitDiagnosticMessage(SourceLocation Loc, PresumedLoc PLoc, DiagnosticsEngine::Level Level, @@ -579,7 +594,7 @@ void SDiagsWriter::EmitDiagnosticMessage(SourceLocation Loc, // Emit the RECORD_DIAG record. Record.clear(); Record.push_back(RECORD_DIAG); - Record.push_back(Level); + Record.push_back(getStableLevel(Level)); AddLocToRecord(Loc, SM, PLoc, Record); if (const Diagnostic *Info = D.dyn_cast<const Diagnostic*>()) { |