diff options
Diffstat (limited to 'lib')
27 files changed, 142 insertions, 168 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 9b8bae3142..2b7fcd07f9 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -571,7 +571,7 @@ bool DiagnosticBuilder::Emit() { // the Diagnostic object. DiagObj->NumDiagArgs = NumArgs; DiagObj->NumDiagRanges = NumRanges; - DiagObj->NumCodeModificationHints = NumCodeModificationHints; + DiagObj->NumFixItHints = NumFixItHints; // Process the diagnostic, sending the accumulated information to the // DiagnosticClient. @@ -996,9 +996,9 @@ StoredDiagnostic::StoredDiagnostic(Diagnostic::Level Level, for (unsigned I = 0, N = Info.getNumRanges(); I != N; ++I) Ranges.push_back(Info.getRange(I)); - FixIts.reserve(Info.getNumCodeModificationHints()); - for (unsigned I = 0, N = Info.getNumCodeModificationHints(); I != N; ++I) - FixIts.push_back(Info.getCodeModificationHint(I)); + FixIts.reserve(Info.getNumFixItHints()); + for (unsigned I = 0, N = Info.getNumFixItHints(); I != N; ++I) + FixIts.push_back(Info.getFixItHint(I)); } StoredDiagnostic::~StoredDiagnostic() { } @@ -1231,7 +1231,7 @@ StoredDiagnostic::Deserialize(FileManager &FM, SourceManager &SM, return Diag; } - CodeModificationHint Hint; + FixItHint Hint; Hint.RemoveRange = SourceRange(RemoveBegin, RemoveEnd); Hint.InsertionLoc = InsertionLoc; Hint.CodeToInsert.assign(Memory, Memory + InsertLen); diff --git a/lib/Checker/PathDiagnostic.cpp b/lib/Checker/PathDiagnostic.cpp index 97500d9578..963923c9ad 100644 --- a/lib/Checker/PathDiagnostic.cpp +++ b/lib/Checker/PathDiagnostic.cpp @@ -108,8 +108,8 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel, for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) P->addRange(Info.getRange(i)); - for (unsigned i = 0, e = Info.getNumCodeModificationHints(); i != e; ++i) - P->addCodeModificationHint(Info.getCodeModificationHint(i)); + for (unsigned i = 0, e = Info.getNumFixItHints(); i != e; ++i) + P->addFixItHint(Info.getFixItHint(i)); D->push_front(P); HandlePathDiagnostic(D); diff --git a/lib/Frontend/FixItRewriter.cpp b/lib/Frontend/FixItRewriter.cpp index 0b04cf2b44..20d452e76a 100644 --- a/lib/Frontend/FixItRewriter.cpp +++ b/lib/Frontend/FixItRewriter.cpp @@ -93,7 +93,7 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, // completely ignore it, even if it's an error: fix-it locations // are meant to perform specific fix-ups even in the presence of // other errors. - if (Info.getNumCodeModificationHints() == 0) + if (Info.getNumFixItHints() == 0) return; // See if the location of the error is one that matches what the @@ -122,10 +122,10 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, // Make sure that we can perform all of the modifications we // in this diagnostic. - bool CanRewrite = Info.getNumCodeModificationHints() > 0; - for (unsigned Idx = 0, Last = Info.getNumCodeModificationHints(); + bool CanRewrite = Info.getNumFixItHints() > 0; + for (unsigned Idx = 0, Last = Info.getNumFixItHints(); Idx < Last; ++Idx) { - const CodeModificationHint &Hint = Info.getCodeModificationHint(Idx); + const FixItHint &Hint = Info.getFixItHint(Idx); if (Hint.RemoveRange.isValid() && Rewrite.getRangeSize(Hint.RemoveRange) == -1) { CanRewrite = false; @@ -140,7 +140,7 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, } if (!CanRewrite) { - if (Info.getNumCodeModificationHints() > 0) + if (Info.getNumFixItHints() > 0) Diag(Info.getLocation(), diag::note_fixit_in_macro); // If this was an error, refuse to perform any rewriting. @@ -152,9 +152,9 @@ void FixItRewriter::HandleDiagnostic(Diagnostic::Level DiagLevel, } bool Failed = false; - for (unsigned Idx = 0, Last = Info.getNumCodeModificationHints(); + for (unsigned Idx = 0, Last = Info.getNumFixItHints(); Idx < Last; ++Idx) { - const CodeModificationHint &Hint = Info.getCodeModificationHint(Idx); + const FixItHint &Hint = Info.getFixItHint(Idx); if (!Hint.RemoveRange.isValid()) { // We're adding code. if (Rewrite.InsertTextBefore(Hint.InsertionLoc, Hint.CodeToInsert)) diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp index da99cb8b7b..022a34d0bd 100644 --- a/lib/Frontend/HTMLDiagnostics.cpp +++ b/lib/Frontend/HTMLDiagnostics.cpp @@ -484,8 +484,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID, // FIXME: This code is disabled because it seems to mangle the HTML // output. I'm leaving it here because it's generally the right idea, // but needs some help from someone more familiar with the rewriter. - for (const CodeModificationHint *Hint = P.code_modifications_begin(), - *HintEnd = P.code_modifications_end(); + for (const FixItHint *Hint = P.fixit_begin(), *HintEnd = P.fixit_end(); Hint != HintEnd; ++Hint) { if (Hint->RemoveRange.isValid()) { HighlightRange(R, LPosInfo.first, Hint->RemoveRange, diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 24d51e2c78..4e91f8d4c2 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -276,7 +276,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, SourceRange *Ranges, unsigned NumRanges, SourceManager &SM, - const CodeModificationHint *Hints, + const FixItHint *Hints, unsigned NumHints, unsigned Columns) { assert(LangOpts && "Unexpected diagnostic outside source file processing"); @@ -409,7 +409,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc, std::string FixItInsertionLine; if (NumHints && DiagOpts->ShowFixits) { - for (const CodeModificationHint *Hint = Hints, *LastHint = Hints + NumHints; + for (const FixItHint *Hint = Hints, *LastHint = Hints + NumHints; Hint != LastHint; ++Hint) { if (Hint->InsertionLoc.isValid()) { // We have an insertion hint. Determine whether the inserted @@ -833,7 +833,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, if (DiagOpts->ShowCarets && Info.getLocation().isValid() && ((LastLoc != Info.getLocation()) || Info.getNumRanges() || (LastCaretDiagnosticWasNote && Level != Diagnostic::Note) || - Info.getNumCodeModificationHints())) { + Info.getNumFixItHints())) { // Cache the LastLoc, it allows us to omit duplicate source/caret spewage. LastLoc = Info.getLocation(); LastCaretDiagnosticWasNote = (Level == Diagnostic::Note); @@ -845,9 +845,9 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, for (unsigned i = 0; i != NumRanges; ++i) Ranges[i] = Info.getRange(i); - unsigned NumHints = Info.getNumCodeModificationHints(); + unsigned NumHints = Info.getNumFixItHints(); for (unsigned idx = 0; idx < NumHints; ++idx) { - const CodeModificationHint &Hint = Info.getCodeModificationHint(idx); + const FixItHint &Hint = Info.getFixItHint(idx); if (Hint.RemoveRange.isValid()) { assert(NumRanges < 20 && "Out of space"); Ranges[NumRanges++] = Hint.RemoveRange; @@ -855,8 +855,8 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, } EmitCaretDiagnostic(LastLoc, Ranges, NumRanges, LastLoc.getManager(), - Info.getCodeModificationHints(), - Info.getNumCodeModificationHints(), + Info.getFixItHints(), + Info.getNumFixItHints(), DiagOpts->MessageLength); } diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 2f89142409..19f25ea4a8 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -1372,8 +1372,7 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { // a pedwarn. if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) Diag(BufferEnd, diag::ext_no_newline_eof) - << CodeModificationHint::CreateInsertion(getSourceLocation(BufferEnd), - "\n"); + << FixItHint::CreateInsertion(getSourceLocation(BufferEnd), "\n"); BufferPtr = CurPtr; diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 7b601010b2..757ba9014d 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -127,10 +127,10 @@ void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) { // Add a fixit in GNU/C99/C++ mode. Don't offer a fixit for strict-C89, // because it is more trouble than it is worth to insert /**/ and check that // there is no /**/ in the range also. - CodeModificationHint FixItHint; + FixItHint Hint; if (Features.GNUMode || Features.C99 || Features.CPlusPlus) - FixItHint = CodeModificationHint::CreateInsertion(Tmp.getLocation(),"//"); - Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << FixItHint; + Hint = FixItHint::CreateInsertion(Tmp.getLocation(),"//"); + Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType << Hint; DiscardUntilEndOfDirective(); } } diff --git a/lib/Parse/DeclSpec.cpp b/lib/Parse/DeclSpec.cpp index 4a699e7ad5..11865ab97b 100644 --- a/lib/Parse/DeclSpec.cpp +++ b/lib/Parse/DeclSpec.cpp @@ -481,7 +481,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) { if (TypeSpecComplex != TSC_unspecified) { if (TypeSpecType == TST_unspecified) { Diag(D, TSCLoc, SrcMgr, diag::ext_plain_complex) - << CodeModificationHint::CreateInsertion( + << FixItHint::CreateInsertion( PP.getLocForEndOfToken(getTypeSpecComplexLoc()), " double"); TypeSpecType = TST_double; // _Complex -> _Complex double. @@ -507,7 +507,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) { Diag(D, SCLoc, SrcMgr, diag::err_friend_storage_spec) << SpecName - << CodeModificationHint::CreateRemoval(SourceRange(SCLoc, SCEndLoc)); + << FixItHint::CreateRemoval(SourceRange(SCLoc, SCEndLoc)); ClearStorageClassSpecs(); } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index cff35b72c4..e87d052141 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -734,7 +734,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, if (TagName) { Diag(Loc, diag::err_use_of_tag_name_without_tag) << Tok.getIdentifierInfo() << TagName << getLang().CPlusPlus - << CodeModificationHint::CreateInsertion(Tok.getLocation(),TagName); + << FixItHint::CreateInsertion(Tok.getLocation(),TagName); // Parse this as a tag as if the missing tag were present. if (TagKind == tok::kw_enum) @@ -1360,7 +1360,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, DS.SetRangeEnd(EndProtoLoc); Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id) - << CodeModificationHint::CreateInsertion(Loc, "id") + << FixItHint::CreateInsertion(Loc, "id") << SourceRange(Loc, EndProtoLoc); // Need to support trailing type qualifiers (e.g. "id<p> const"). // If a type specifier follows, it will be diagnosed elsewhere. @@ -1756,7 +1756,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // Check for extraneous top-level semicolon. if (Tok.is(tok::semi)) { Diag(Tok, diag::ext_extra_struct_semi) - << CodeModificationHint::CreateRemoval(Tok.getLocation()); + << FixItHint::CreateRemoval(Tok.getLocation()); ConsumeToken(); continue; } @@ -1999,7 +1999,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) { !(getLang().C99 || getLang().CPlusPlus0x)) Diag(CommaLoc, diag::ext_enumerator_list_comma) << getLang().CPlusPlus - << CodeModificationHint::CreateRemoval(CommaLoc); + << FixItHint::CreateRemoval(CommaLoc); } // Eat the }. @@ -3009,7 +3009,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // We have ellipsis without a preceding ',', which is ill-formed // in C. Complain and provide the fix. Diag(EllipsisLoc, diag::err_missing_comma_before_ellipsis) - << CodeModificationHint::CreateInsertion(EllipsisLoc, ", "); + << FixItHint::CreateInsertion(EllipsisLoc, ", "); } } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 3dc6ad9b34..813c24ce3d 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -837,7 +837,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, Diag(TemplateId->TemplateNameLoc, diag::err_explicit_instantiation_with_definition) << SourceRange(TemplateInfo.TemplateLoc) - << CodeModificationHint::CreateInsertion(LAngleLoc, "<>"); + << FixItHint::CreateInsertion(LAngleLoc, "<>"); // Create a fake template parameter list that contains only // "template<>", so that we treat this construct as a class @@ -1079,7 +1079,7 @@ Parser::BaseResult Parser::ParseBaseSpecifier(DeclPtrTy ClassDecl) { if (IsVirtual) { // Complain about duplicate 'virtual' Diag(VirtualLoc, diag::err_dup_virtual) - << CodeModificationHint::CreateRemoval(VirtualLoc); + << FixItHint::CreateRemoval(VirtualLoc); } IsVirtual = true; @@ -1554,7 +1554,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, // Check for extraneous top-level semicolon. if (Tok.is(tok::semi)) { Diag(Tok, diag::ext_extra_struct_semi) - << CodeModificationHint::CreateRemoval(Tok.getLocation()); + << FixItHint::CreateRemoval(Tok.getLocation()); ConsumeToken(); continue; } diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index f1e989f4a7..8528f8fe19 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -246,7 +246,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, // recover like this. PP.LookAhead(1).is(tok::identifier)) { Diag(Next, diag::err_unexected_colon_in_nested_name_spec) - << CodeModificationHint::CreateReplacement(Next.getLocation(), "::"); + << FixItHint::CreateReplacement(Next.getLocation(), "::"); // Recover as if the user wrote '::'. Next.setKind(tok::coloncolon); @@ -1313,7 +1313,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, Diag(TemplateId->TemplateNameLoc, diag::err_out_of_line_constructor_template_id) << TemplateId->Name - << CodeModificationHint::CreateRemoval( + << FixItHint::CreateRemoval( SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc)); Result.setConstructorName(Actions.getTypeName(*TemplateId->Name, TemplateId->TemplateNameLoc, diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp index c4e79cae3f..9154d8d599 100644 --- a/lib/Parse/ParseInit.cpp +++ b/lib/Parse/ParseInit.cpp @@ -76,9 +76,8 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() { SourceLocation ColonLoc = ConsumeToken(); Diag(Tok, diag::ext_gnu_old_style_field_designator) - << CodeModificationHint::CreateReplacement(SourceRange(NameLoc, - ColonLoc), - NewSyntax.str()); + << FixItHint::CreateReplacement(SourceRange(NameLoc, ColonLoc), + NewSyntax.str()); Designation D; D.AddDesignator(Designator::getField(FieldName, SourceLocation(), NameLoc)); @@ -218,7 +217,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() { (Desig.getDesignator(0).isArrayDesignator() || Desig.getDesignator(0).isArrayRangeDesignator())) { Diag(Tok, diag::ext_gnu_missing_equal_designator) - << CodeModificationHint::CreateInsertion(Tok.getLocation(), "= "); + << FixItHint::CreateInsertion(Tok.getLocation(), "= "); return Actions.ActOnDesignatedInitializer(Desig, Tok.getLocation(), true, ParseInitializer()); } diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 7a8aed7a21..2d43f15cba 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -988,7 +988,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl, // Check for extraneous top-level semicolon. if (Tok.is(tok::semi)) { Diag(Tok, diag::ext_extra_struct_semi) - << CodeModificationHint::CreateRemoval(Tok.getLocation()); + << FixItHint::CreateRemoval(Tok.getLocation()); ConsumeToken(); continue; } @@ -1571,7 +1571,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() { if (Tok.is(tok::semi)) { if (ObjCImpDecl) { Diag(Tok, diag::warn_semicolon_before_method_body) - << CodeModificationHint::CreateRemoval(Tok.getLocation()); + << FixItHint::CreateRemoval(Tok.getLocation()); } ConsumeToken(); } diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 12f26bfcb9..ff69953401 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -660,7 +660,7 @@ Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template, ReplaceStr = "> > "; Diag(Tok.getLocation(), diag::err_two_right_angle_brackets_need_space) - << CodeModificationHint::CreateReplacement( + << FixItHint::CreateReplacement( SourceRange(Tok.getLocation()), ReplaceStr); } diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index d45aaed70e..489586c36f 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -95,8 +95,8 @@ void Parser::SuggestParentheses(SourceLocation Loc, unsigned DK, } Diag(Loc, DK) - << CodeModificationHint::CreateInsertion(ParenRange.getBegin(), "(") - << CodeModificationHint::CreateInsertion(EndLoc, ")"); + << FixItHint::CreateInsertion(ParenRange.getBegin(), "(") + << FixItHint::CreateInsertion(EndLoc, ")"); } /// MatchRHSPunctuation - For punctuation with a LHS and RHS (e.g. '['/']'), @@ -146,7 +146,7 @@ bool Parser::ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned DiagID, // Show what code to insert to fix this problem. Diag(EndLoc, DiagID) << Msg - << CodeModificationHint::CreateInsertion(EndLoc, Spelling); + << FixItHint::CreateInsertion(EndLoc, Spelling); } else Diag(Tok, DiagID) << Msg; @@ -395,7 +395,7 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr) case tok::semi: if (!getLang().CPlusPlus0x) Diag(Tok, diag::ext_top_level_semi) - << CodeModificationHint::CreateRemoval(Tok.getLocation()); + << FixItHint::CreateRemoval(Tok.getLocation()); ConsumeToken(); // TODO: Invoke action for top-level semicolon. @@ -829,7 +829,7 @@ Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) { PP.getLocForEndOfToken(Tok.getLocation())); Diag(Tok, diag::warn_file_asm_volatile) - << CodeModificationHint::CreateRemoval(RemovalRange); + << FixItHint::CreateRemoval(RemovalRange); ConsumeToken(); } diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index 95b79abd8f..c90f75eef5 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -486,13 +486,13 @@ Sema::CXXScopeTy *Sema::BuildCXXNestedNameSpecifier(Scope *S, if (LookupCtx) Diag(Found.getNameLoc(), diag::err_no_member_suggest) << Name << LookupCtx << Found.getLookupName() << SS.getRange() - << CodeModificationHint::CreateReplacement(Found.getNameLoc(), - Found.getLookupName().getAsString()); + << FixItHint::CreateReplacement(Found.getNameLoc(), + Found.getLookupName().getAsString()); else Diag(Found.getNameLoc(), diag::err_undeclared_var_use_suggest) << Name << Found.getLookupName() - << CodeModificationHint::CreateReplacement(Found.getNameLoc(), - Found.getLookupName().getAsString()); + << FixItHint::CreateReplacement(Found.getNameLoc(), + Found.getLookupName().getAsString()); if (NamedDecl *ND = Found.getAsSingle<NamedDecl>()) Diag(ND->getLocation(), diag::note_previous_decl) diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index b8158bb7a0..6c15efb438 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -255,13 +255,13 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, if (!SS || !SS->isSet()) Diag(IILoc, diag::err_unknown_typename_suggest) << &II << Lookup.getLookupName() - << CodeModificationHint::CreateReplacement(SourceRange(IILoc), - Result->getNameAsString()); + << FixItHint::CreateReplacement(SourceRange(IILoc), + Result->getNameAsString()); else if (DeclContext *DC = computeDeclContext(*SS, false)) Diag(IILoc, diag::err_unknown_nested_typename_suggest) << &II << DC << Lookup.getLookupName() << SS->getRange() - << CodeModificationHint::CreateReplacement(SourceRange(IILoc), - Result->getNameAsString()); + << FixItHint::CreateReplacement(SourceRange(IILoc), + Result->getNameAsString()); else llvm_unreachable("could not have corrected a typo here"); @@ -285,8 +285,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, Diag(SS->getRange().getBegin(), diag::err_typename_missing) << (NestedNameSpecifier *)SS->getScopeRep() << II.getName() << SourceRange(SS->getRange().getBegin(), IILoc) - << CodeModificationHint::CreateInsertion(SS->getRange().getBegin(), - "typename "); + << FixItHint::CreateInsertion(SS->getRange().getBegin(), "typename "); SuggestedType = ActOnTypenameType(SourceLocation(), *SS, II, IILoc).get(); } else { assert(SS && SS->isInvalid() && @@ -590,8 +589,7 @@ ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *&Id, (IDecl = R.getAsSingle<ObjCInterfaceDecl>())) { Diag(RecoverLoc, diag::err_undef_interface_suggest) << Id << IDecl->getDeclName() - << CodeModificationHint::CreateReplacement(RecoverLoc, - IDecl->getNameAsString()); + << FixItHint::CreateReplacement(RecoverLoc, IDecl->getNameAsString()); Diag(IDecl->getLocation(), diag::note_previous_decl) << IDecl->getDeclName(); @@ -2345,8 +2343,7 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, if (SC == VarDecl::Static) { Diag(D.getDeclSpec().getStorageClassSpecLoc(), diag::err_static_out_of_line) - << CodeModificationHint::CreateRemoval( - D.getDeclSpec().getStorageClassSpecLoc()); + << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); } else if (SC == VarDecl::None) SC = VarDecl::Static; } @@ -2954,8 +2951,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, Diag(D.getIdentifierLoc(), diag::err_template_spec_decl_friend) << Name << RemoveRange - << CodeModificationHint::CreateRemoval(RemoveRange) - << CodeModificationHint::CreateInsertion(InsertLoc, "<>"); + << FixItHint::CreateRemoval(RemoveRange) + << FixItHint::CreateInsertion(InsertLoc, "<>"); } } @@ -2975,8 +2972,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, } else if (!CurContext->isRecord()) { // 'virtual' was specified outside of the class. Diag(D.getDeclSpec().getVirtualSpecLoc(), diag::err_virtual_out_of_class) - << CodeModificationHint::CreateRemoval( - D.getDeclSpec().getVirtualSpecLoc()); + << FixItHint::CreateRemoval(D.getDeclSpec().getVirtualSpecLoc()); } else { // Okay: Add virtual to the method. CXXRecordDecl *CurClass = cast<CXXRecordDecl>(DC); @@ -2993,16 +2989,14 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // 'explicit' was specified outside of the class. Diag(D.getDeclSpec().getExplicitSpecLoc(), diag::err_explicit_out_of_class) - << CodeModificationHint::CreateRemoval( - D.getDeclSpec().getExplicitSpecLoc()); + << FixItHint::CreateRemoval(D.getDeclSpec().getExplicitSpecLoc()); } else if (!isa<CXXConstructorDecl>(NewFD) && !isa<CXXConversionDecl>(NewFD)) { // 'explicit' was specified on a function that wasn't a constructor // or conversion function. Diag(D.getDeclSpec().getExplicitSpecLoc(), diag::err_explicit_non_ctor_or_conv_function) - << CodeModificationHint::CreateRemoval( - D.getDeclSpec().getExplicitSpecLoc()); + << FixItHint::CreateRemoval(D.getDeclSpec().getExplicitSpecLoc()); } } @@ -3037,8 +3031,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // member function definition. Diag(D.getDeclSpec().getStorageClassSpecLoc(), diag::err_static_out_of_line) - << CodeModificationHint::CreateRemoval( - D.getDeclSpec().getStorageClassSpecLoc()); + << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); } // Handle GNU asm-label extension (encoded as an attribute). @@ -3136,7 +3129,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // too few of them). Diag(D.getIdentifierLoc(), diag::err_template_spec_needs_header) << SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc) - << CodeModificationHint::CreateInsertion( + << FixItHint::CreateInsertion( D.getDeclSpec().getSourceRange().getBegin(), "template<> "); isFunctionTemplateSpecialization = true; @@ -4174,7 +4167,7 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, << ";\n"; Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared) << FTI.ArgInfo[i].Ident - << CodeModificationHint::CreateInsertion(LocAfterDecls, Code.str()); + << FixItHint::CreateInsertion(LocAfterDecls, Code.str()); // Implicitly declare the argument as type 'int' for lack of a better // type. @@ -4684,7 +4677,7 @@ bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous, Diag(NewTagLoc, diag::warn_struct_class_tag_mismatch) << (NewTag == TagDecl::TK_class) << isTemplate << &Name - << CodeModificationHint::CreateReplacement(SourceRange(NewTagLoc), + << FixItHint::CreateReplacement(SourceRange(NewTagLoc), OldTag == TagDecl::TK_class? "class" : "struct"); Diag(Previous->getLocation(), diag::note_previous_use); return true; @@ -4930,8 +4923,8 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, if (SafeToContinue) Diag(KWLoc, diag::err_use_with_wrong_tag) << Name - << CodeModificationHint::CreateReplacement(SourceRange(KWLoc), - PrevTagDecl->getKindName()); + << FixItHint::CreateReplacement(SourceRange(KWLoc), + PrevTagDecl->getKindName()); else Diag(KWLoc, diag::err_use_with_wrong_tag) << Name; Diag(PrevTagDecl->getLocation(), diag::note_previous_use); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 3c3786d217..4c101ad2b8 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1104,8 +1104,8 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // member. Diag(R.getNameLoc(), diag::err_mem_init_not_member_or_class_suggest) << MemberOrBase << true << R.getLookupName() - << CodeModificationHint::CreateReplacement(R.getNameLoc(), - R.getLookupName().getAsString()); + << FixItHint::CreateReplacement(R.getNameLoc(), + R.getLookupName().getAsString()); Diag(Member->getLocation(), diag::note_previous_decl) << Member->getDeclName(); @@ -1123,8 +1123,8 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // that base class. Diag(R.getNameLoc(), diag::err_mem_init_not_member_or_class_suggest) << MemberOrBase << false << R.getLookupName() - << CodeModificationHint::CreateReplacement(R.getNameLoc(), - R.getLookupName().getAsString()); + << FixItHint::CreateReplacement(R.getNameLoc(), + R.getLookupName().getAsString()); const CXXBaseSpecifier *BaseSpec = DirectBaseSpec? DirectBaseSpec : Virt |