class FixItRewriter
Declaration
class FixItRewriter : public DiagnosticConsumer { /* full declaration omitted */ };
Description
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:62
Inherits from: DiagnosticConsumer
Member Variables
- private clang::DiagnosticsEngine& Diags
- The diagnostics machinery.
- private edit::EditedSource Editor
- private clang::Rewriter Rewrite
- The rewriter used to perform the various code modifications.
- private clang::DiagnosticConsumer* Client
- The diagnostic client that performs the actual formatting of error messages.
- private std::unique_ptr<DiagnosticConsumer> Owner
- private clang::FixItOptions* FixItOpts
- Turn an input path into an output path. NULL implies overwriting the original.
- private unsigned int NumFailures = 0
- The number of rewriter failures.
- private bool PrevDiagSilenced = false
- Whether the previous diagnostic was not passed to the consumer.
Inherited from DiagnosticConsumer:
Method Overview
- public void Diag(clang::SourceLocation Loc, unsigned int DiagID)
- public FixItRewriter(clang::DiagnosticsEngine & Diags, clang::SourceManager & SourceMgr, const clang::LangOptions & LangOpts, clang::FixItOptions * FixItOpts)
- public void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic & Info)
- public bool IncludeInDiagnosticCounts() const
- public bool IsModified(clang::FileID ID) const
- public bool WriteFixedFile(clang::FileID ID, llvm::raw_ostream & OS)
- public bool WriteFixedFiles(std::vector<std::pair<std::string, std::string>> * RewrittenFiles = nullptr)
- public clang::FixItRewriter::iterator buffer_begin()
- public clang::FixItRewriter::iterator buffer_end()
- public ~FixItRewriter()
Inherited from DiagnosticConsumer:
- public BeginSourceFile
- public EndSourceFile
- public HandleDiagnostic
- public IncludeInDiagnosticCounts
- public clear
- public finish
- public getNumErrors
- public getNumWarnings
Methods
¶void Diag(clang::SourceLocation Loc,
unsigned int DiagID)
void Diag(clang::SourceLocation Loc,
unsigned int DiagID)
Description
Emit a diagnostic via the adapted diagnostic client.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:129
Parameters
- clang::SourceLocation Loc
- unsigned int DiagID
¶FixItRewriter(clang::DiagnosticsEngine& Diags,
clang::SourceManager& SourceMgr,
const clang::LangOptions& LangOpts,
clang::FixItOptions* FixItOpts)
FixItRewriter(clang::DiagnosticsEngine& Diags,
clang::SourceManager& SourceMgr,
const clang::LangOptions& LangOpts,
clang::FixItOptions* FixItOpts)
Description
Initialize a new fix-it rewriter.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:89
Parameters
- clang::DiagnosticsEngine& Diags
- clang::SourceManager& SourceMgr
- const clang::LangOptions& LangOpts
- clang::FixItOptions* FixItOpts
¶void HandleDiagnostic(
DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic& Info)
void HandleDiagnostic(
DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic& Info)
Description
HandleDiagnostic - Handle this diagnostic, reporting it to the user or capturing it to a log as needed.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:125
Parameters
- DiagnosticsEngine::Level DiagLevel
- const clang::Diagnostic& Info
¶bool IncludeInDiagnosticCounts() const
bool IncludeInDiagnosticCounts() const
Description
IncludeInDiagnosticCounts - This method (whose default implementation returns true) indicates whether the diagnostics handled by this DiagnosticConsumer should be included in the number of diagnostics reported by DiagnosticsEngine.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:121
¶bool IsModified(clang::FileID ID) const
bool IsModified(clang::FileID ID) const
Description
Check whether there are modifications for a given file.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:96
Parameters
¶bool WriteFixedFile(clang::FileID ID,
llvm::raw_ostream& OS)
bool WriteFixedFile(clang::FileID ID,
llvm::raw_ostream& OS)
Description
Write a single modified source file.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:109
Parameters
Returns
true if there was an error, false otherwise.
¶bool WriteFixedFiles(
std::vector<
std::pair<std::string, std::string>>*
RewrittenFiles = nullptr)
bool WriteFixedFiles(
std::vector<
std::pair<std::string, std::string>>*
RewrittenFiles = nullptr)
Description
Write the modified source files.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:114
Parameters
- std::vector<std::pair<std::string, std::string>>* RewrittenFiles = nullptr
Returns
true if there was an error, false otherwise.
¶clang::FixItRewriter::iterator buffer_begin()
clang::FixItRewriter::iterator buffer_begin()
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:103
¶clang::FixItRewriter::iterator buffer_end()
clang::FixItRewriter::iterator buffer_end()
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:104
¶~FixItRewriter()
~FixItRewriter()
Description
Destroy the fix-it rewriter.
Declared at: clang/include/clang/Rewrite/Frontend/FixItRewriter.h:93