|
2 | 2 | //
|
3 | 3 | // This source file is part of the Swift.org open source project
|
4 | 4 | //
|
5 |
| -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 5 | +// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors |
6 | 6 | // Licensed under Apache License v2.0 with Runtime Library Exception
|
7 | 7 | //
|
8 | 8 | // See https://swift.org/LICENSE.txt for license information
|
|
14 | 14 | //
|
15 | 15 | //===----------------------------------------------------------------------===//
|
16 | 16 |
|
| 17 | +#include "clang/Frontend/SerializedDiagnostics.h" |
| 18 | + |
17 | 19 | #include "swift/Frontend/SerializedDiagnosticConsumer.h"
|
18 | 20 | #include "swift/AST/DiagnosticConsumer.h"
|
19 | 21 | #include "swift/AST/DiagnosticsFrontend.h"
|
|
30 | 32 | #include "llvm/ADT/SmallString.h"
|
31 | 33 | #include "llvm/Bitstream/BitstreamWriter.h"
|
32 | 34 |
|
33 |
| -// For constant values only. |
34 |
| -#include "clang/Frontend/SerializedDiagnosticPrinter.h" |
35 |
| - |
36 | 35 | using namespace swift;
|
37 |
| - |
38 |
| -//===----------------------------------------------------------------------===// |
39 |
| -// These must match Clang's diagnostic IDs. We can consider sharing the |
40 |
| -// header files to avoid this copy-paste. |
41 |
| -//===----------------------------------------------------------------------===// |
42 |
| - |
43 |
| -enum BlockIDs { |
44 |
| - /// A top-level block which represents any meta data associated |
45 |
| - /// with the diagnostics, including versioning of the format. |
46 |
| - BLOCK_META = llvm::bitc::FIRST_APPLICATION_BLOCKID, |
47 |
| - |
48 |
| - /// The this block acts as a container for all the information |
49 |
| - /// for a specific diagnostic. |
50 |
| - BLOCK_DIAG |
51 |
| -}; |
52 |
| - |
53 |
| -enum RecordIDs { |
54 |
| - RECORD_VERSION = 1, |
55 |
| - RECORD_DIAG, |
56 |
| - RECORD_SOURCE_RANGE, |
57 |
| - RECORD_DIAG_FLAG, |
58 |
| - RECORD_CATEGORY, |
59 |
| - RECORD_FILENAME, |
60 |
| - RECORD_FIXIT, |
61 |
| - RECORD_FIRST = RECORD_VERSION, |
62 |
| - RECORD_LAST = RECORD_FIXIT |
63 |
| -}; |
64 |
| - |
65 |
| -//===----------------------------------------------------------------------===// |
| 36 | +using namespace clang::serialized_diags; |
66 | 37 |
|
67 | 38 | namespace {
|
68 | 39 | class AbbreviationMap {
|
@@ -193,9 +164,6 @@ class SerializedDiagnosticConsumer : public DiagnosticConsumer {
|
193 | 164 |
|
194 | 165 | void handleDiagnostic(SourceManager &SM, const DiagnosticInfo &Info) override;
|
195 | 166 |
|
196 |
| - /// The version of the diagnostics file. |
197 |
| - enum { Version = 1 }; |
198 |
| - |
199 | 167 | private:
|
200 | 168 | /// Emit bitcode for the preamble.
|
201 | 169 | void emitPreamble();
|
@@ -334,7 +302,7 @@ void SerializedDiagnosticConsumer::emitMetaBlock() {
|
334 | 302 | Stream.EnterSubblock(BLOCK_META, 3);
|
335 | 303 | Record.clear();
|
336 | 304 | Record.push_back(RECORD_VERSION);
|
337 |
| - Record.push_back(Version); |
| 305 | + Record.push_back(clang::serialized_diags::VersionNumber); |
338 | 306 | Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);
|
339 | 307 | Stream.ExitBlock();
|
340 | 308 | }
|
|
0 commit comments