Changeset View
Changeset View
Standalone View
Standalone View
src/FixItExporter.h
Show All 27 Lines | |||||
28 | 28 | | |||
29 | namespace clang { | 29 | namespace clang { | ||
30 | class FixItOptions; | 30 | class FixItOptions; | ||
31 | } | 31 | } | ||
32 | 32 | | |||
33 | class FixItExporter : public clang::DiagnosticConsumer { | 33 | class FixItExporter : public clang::DiagnosticConsumer { | ||
34 | public: | 34 | public: | ||
35 | FixItExporter(clang::DiagnosticsEngine &DiagEngine, clang::SourceManager &SourceMgr, | 35 | FixItExporter(clang::DiagnosticsEngine &DiagEngine, clang::SourceManager &SourceMgr, | ||
36 | const clang::LangOptions &LangOpts, clang::FixItOptions *FixItOpts); | 36 | const clang::LangOptions &LangOpts, const std::string &exportFixes); | ||
37 | 37 | | |||
38 | ~FixItExporter() override; | 38 | ~FixItExporter() override; | ||
39 | 39 | | |||
40 | bool IncludeInDiagnosticCounts() const override; | 40 | bool IncludeInDiagnosticCounts() const override; | ||
41 | 41 | | |||
42 | void BeginSourceFile(const clang::LangOptions &LangOpts, | 42 | void BeginSourceFile(const clang::LangOptions &LangOpts, | ||
43 | const clang::Preprocessor *PP = nullptr) override; | 43 | const clang::Preprocessor *PP = nullptr) override; | ||
44 | 44 | | |||
45 | void EndSourceFile() override; | 45 | void EndSourceFile() override; | ||
46 | 46 | | |||
47 | void HandleDiagnostic(clang::DiagnosticsEngine::Level DiagLevel, | 47 | void HandleDiagnostic(clang::DiagnosticsEngine::Level DiagLevel, | ||
48 | const clang::Diagnostic &Info) override; | 48 | const clang::Diagnostic &Info) override; | ||
49 | 49 | | |||
50 | void Export(); | 50 | void Export(); | ||
51 | 51 | | |||
52 | /// Emit a diagnostic via the adapted diagnostic client. | 52 | /// Emit a diagnostic via the adapted diagnostic client. | ||
53 | void Diag(clang::SourceLocation Loc, unsigned DiagID); | 53 | void Diag(clang::SourceLocation Loc, unsigned DiagID); | ||
54 | 54 | | |||
55 | private: | 55 | private: | ||
56 | clang::DiagnosticsEngine &DiagEngine; | 56 | clang::DiagnosticsEngine &DiagEngine; | ||
57 | clang::SourceManager &SourceMgr; | 57 | clang::SourceManager &SourceMgr; | ||
58 | const clang::LangOptions &LangOpts; | 58 | const clang::LangOptions &LangOpts; | ||
59 | clang::FixItOptions *FixItOpts; | 59 | const std::string exportFixes; | ||
60 | DiagnosticConsumer *Client; | 60 | DiagnosticConsumer *Client; | ||
61 | std::unique_ptr<DiagnosticConsumer> Owner; | 61 | std::unique_ptr<DiagnosticConsumer> Owner; | ||
62 | clang::tooling::TranslationUnitDiagnostics TUDiag; | 62 | clang::tooling::TranslationUnitDiagnostics TUDiag; | ||
63 | clang::tooling::Diagnostic ConvertDiagnostic(const clang::Diagnostic &Info); | 63 | clang::tooling::Diagnostic ConvertDiagnostic(const clang::Diagnostic &Info); | ||
64 | clang::tooling::Replacement ConvertFixIt(const clang::FixItHint &Hint); | 64 | clang::tooling::Replacement ConvertFixIt(const clang::FixItHint &Hint); | ||
65 | }; | 65 | }; | ||
66 | 66 | | |||
67 | #endif // CLAZY_FIX_IT_EXPORTER_H | 67 | #endif // CLAZY_FIX_IT_EXPORTER_H |