clang API Documentation
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the problem. More...
#include <Diagnostic.h>

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. | |
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.
| clang::FixItHint::FixItHint | ( | ) | [inline] |
Empty code modification hint, indicating that no code modification is known.
Definition at line 59 of file Diagnostic.h.
| 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] |
Create a code modification hint that removes the given source range.
Definition at line 78 of file Diagnostic.h.
References RemoveRange.
Referenced by clang::Sema::ActOnCallExpr(), clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnDependentTemplateName(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnObjCExceptionDecl(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnTag(), clang::Sema::ActOnTypenameType(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::BuildAnonymousStructOrUnion(), clang::Sema::BuildCXXNew(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckDestructorDeclarator(), clang::Sema::CheckLogicalOperands(), clang::Sema::CheckMain(), CheckTemplateArgumentAddressOfObjectOrFunction(), CreateRemoval(), clang::Sema::DiagnoseEqualityWithExtraParens(), DiagnoseIgnoredQualifiers(), clang::Sema::DiagnoseUnusedExprResult(), clang::DeclSpec::Finish(), GenerateFixForUnusedDecl(), GetFullTypeForDeclarator(), clang::Sema::HandleDeclarator(), clang::Sema::LookupMemberExpr(), clang::Sema::ParsedFreeStandingDeclSpec(), clang::Sema::ParseTypedefDecl(), and clang::ConversionFixItGenerator::tryToFixConversion().
| 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] |
Create a code modification hint that replaces the given source range with the given code string.
Definition at line 89 of file Diagnostic.h.
References CodeToInsert, and RemoveRange.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnSizeofParameterPackExpr(), clang::Sema::ActOnStartClassImplementation(), clang::Sema::ActOnTag(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::BuildMemInitializer(), clang::Sema::BuildObjCBridgedCast(), CheckArrow(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckLogicalOperands(), clang::Sema::CheckPointerToMemberOperands(), clang::Sema::ClassifyName(), CreateReplacement(), clang::Sema::DiagnoseAssignmentAsCondition(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::DiagnoseEqualityWithExtraParens(), DiagnoseInvalidRedeclaration(), clang::Sema::DiagnoseUnknownTypeName(), DiagnoseUnusedComparison(), FixDigraph(), clang::Sema::getObjCInterfaceDecl(), clang::Sema::getObjCMessageKind(), clang::Sema::getTypeName(), clang::Sema::HandleExprPropertyRefExpr(), handleGlobalAttr(), clang::Sema::ImplicitlyDefineFunction(), clang::Sema::isAcceptableTagRedeclaration(), clang::CompilerInstance::loadModule(), clang::Sema::LookupMemberExpr(), LookupMemberExprInRecord(), clang::Sema::LookupTemplateName(), and TryNamespaceTypoCorrection().
| 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().
| std::string clang::FixItHint::CodeToInsert |
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().