clang API Documentation

Public Member Functions | Static Public Member Functions | Public Attributes
clang::FixItHint 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::FixItHint:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

CharSourceRange RemoveRange
 Code that should be replaced to correct the error. Empty for an insertion hint.
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 47 of file Diagnostic.h.


Constructor & Destructor Documentation

clang::FixItHint::FixItHint ( ) [inline]

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

Definition at line 59 of file Diagnostic.h.


Member Function Documentation

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

Create a code modification hint that inserts the given code string at a specific location.

Definition at line 67 of file Diagnostic.h.

References CodeToInsert, and RemoveRange.

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnCXXDelete(), clang::Sema::ActOnFields(), clang::Sema::ActOnFinishKNRParamDeclarations(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnUsingDeclaration(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildAnonymousStructOrUnion(), clang::Sema::BuildClassMessage(), clang::Sema::BuildFunctionType(), clang::Sema::BuildInstanceMessage(), clang::Sema::CheckConstructor(), clang::Preprocessor::CheckEndOfDirective(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckFriendTypeDecl(), clang::Sema::CheckParameter(), CheckTemplateArgumentAddressOfObjectOrFunction(), clang::Sema::CheckTypenameType(), clang::Sema::CheckVariableDeclaration(), clang::Sema::ClassifyName(), ConvertDeclSpecToType(), clang::Sema::ConvertToIntegralOrEnumerationType(), clang::Sema::DiagnoseAssignmentAsCondition(), clang::Sema::DiagnoseDtorReference(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseNarrowingInInitList(), diagnoseObjCARCConversion(), clang::Sema::DiagnoseSentinelCalls(), clang::Sema::DiagnoseUnknownTemplateName(), clang::Sema::DiagnoseUnknownTypeName(), clang::DeclSpec::Finish(), GetFullTypeForDeclarator(), MakeObjCStringLiteralFixItHint(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), SuggestInitializationFixit(), SuggestParentheses(), clang::ConversionFixItGenerator::tryToFixConversion(), and clang::Sema::tryToRecoverWithCall().

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

Definition at line 83 of file Diagnostic.h.

References CreateRemoval(), and clang::CharSourceRange::getTokenRange().

static FixItHint clang::FixItHint::CreateReplacement ( CharSourceRange  RemoveRange,
StringRef  Code 
) [inline, static]
static FixItHint clang::FixItHint::CreateReplacement ( SourceRange  RemoveRange,
StringRef  Code 
) [inline, static]

Definition at line 97 of file Diagnostic.h.

References CreateReplacement(), and clang::CharSourceRange::getTokenRange().

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

Definition at line 61 of file Diagnostic.h.

References clang::CharSourceRange::isValid(), and RemoveRange.

Referenced by clang::Sema::DiagnoseAssignmentResult().


Member Data Documentation

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

Definition at line 55 of file Diagnostic.h.

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

Code that should be replaced to correct the error. Empty for an insertion hint.

Definition at line 51 of file Diagnostic.h.

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


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