clang API Documentation

clang::CodeModificationHint Class Reference

Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the problem. More...

#include <Diagnostic.h>

Collaboration diagram for clang::CodeModificationHint:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CodeModificationHint ()
 Empty code modification hint, indicating that no code modification is known.
bool isNull () const

Static Public Member Functions

static CodeModificationHint CreateInsertion (SourceLocation InsertionLoc, llvm::StringRef Code)
 Create a code modification hint that inserts the given code string at a specific location.
static CodeModificationHint CreateRemoval (SourceRange RemoveRange)
 Create a code modification hint that removes the given source range.
static CodeModificationHint CreateReplacement (SourceRange RemoveRange, llvm::StringRef Code)
 Create a code modification hint that replaces the given source range with the given code string.

Public Attributes

SourceRange RemoveRange
 Tokens that should be removed to correct the error.
SourceLocation InsertionLoc
 The location at which we should insert code to correct the error.
std::string CodeToInsert
 The actual code to insert at the insertion location, as a string.


Detailed Description

Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the problem.

This kind of hint should be used when we are certain that the introduction, removal, or modification of a particular (small!) amount of code will correct a compilation error. The compiler should also provide full recovery from such errors, such that suppressing the diagnostic output can still result in successful compilation.

Definition at line 98 of file Diagnostic.h.


Constructor & Destructor Documentation

clang::CodeModificationHint::CodeModificationHint (  )  [inline]

Empty code modification hint, indicating that no code modification is known.

Definition at line 113 of file Diagnostic.h.


Member Function Documentation

static CodeModificationHint clang::CodeModificationHint::CreateInsertion ( SourceLocation  InsertionLoc,
llvm::StringRef  Code 
) [inline, static]

static CodeModificationHint clang::CodeModificationHint::CreateRemoval ( SourceRange  RemoveRange  )  [inline, static]

static CodeModificationHint clang::CodeModificationHint::CreateReplacement ( SourceRange  RemoveRange,
llvm::StringRef  Code 
) [inline, static]

bool clang::CodeModificationHint::isNull (  )  const [inline]


Member Data Documentation

The actual code to insert at the insertion location, as a string.

Definition at line 109 of file Diagnostic.h.

Referenced by CreateInsertion(), CreateReplacement(), clang::StoredDiagnostic::Deserialize(), and clang::FixItRewriter::HandleDiagnostic().

The location at which we should insert code to correct the error.

Definition at line 105 of file Diagnostic.h.

Referenced by CreateInsertion(), CreateReplacement(), clang::StoredDiagnostic::Deserialize(), clang::FixItRewriter::HandleDiagnostic(), and isNull().


The documentation for this class was generated from the following file: