aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-31 17:25:35 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-31 17:25:35 +0000
commit275313cbb0847f1f117f60d144d113804d4fa42d (patch)
treec0408861e801f2a9506031acaee9ef9b8300c202 /lib/Sema
parentd0ebe080eee7c37e73754068b47fd90cc506e128 (diff)
Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaCXXScopeSpec.cpp8
-rw-r--r--lib/Sema/SemaDecl.cpp43
-rw-r--r--lib/Sema/SemaDeclCXX.cpp16
-rw-r--r--lib/Sema/SemaDeclObjC.cpp4
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp3
-rw-r--r--lib/Sema/SemaExpr.cpp68
-rw-r--r--lib/Sema/SemaExprCXX.cpp8
-rw-r--r--lib/Sema/SemaInit.cpp18
-rw-r--r--lib/Sema/SemaStmt.cpp6
-rw-r--r--lib/Sema/SemaTemplate.cpp28
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp4
-rw-r--r--lib/Sema/SemaType.cpp3
12 files changed, 116 insertions, 93 deletions
diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index c90f75eef5..95b79abd8f 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()
- << FixItHint::CreateReplacement(Found.getNameLoc(),
- Found.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
+ Found.getLookupName().getAsString());
else
Diag(Found.getNameLoc(), diag::err_undeclared_var_use_suggest)
<< Name << Found.getLookupName()
- << FixItHint::CreateReplacement(Found.getNameLoc(),
- Found.getLookupName().getAsString());
+ << CodeModificationHint::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 6c15efb438..b8158bb7a0 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()
- << FixItHint::CreateReplacement(SourceRange(IILoc),
- Result->getNameAsString());
+ << CodeModificationHint::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()
- << FixItHint::CreateReplacement(SourceRange(IILoc),
- Result->getNameAsString());
+ << CodeModificationHint::CreateReplacement(SourceRange(IILoc),
+ Result->getNameAsString());
else
llvm_unreachable("could not have corrected a typo here");
@@ -285,7 +285,8 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
Diag(SS->getRange().getBegin(), diag::err_typename_missing)
<< (NestedNameSpecifier *)SS->getScopeRep() << II.getName()
<< SourceRange(SS->getRange().getBegin(), IILoc)
- << FixItHint::CreateInsertion(SS->getRange().getBegin(), "typename ");
+ << CodeModificationHint::CreateInsertion(SS->getRange().getBegin(),
+ "typename ");
SuggestedType = ActOnTypenameType(SourceLocation(), *SS, II, IILoc).get();
} else {
assert(SS && SS->isInvalid() &&
@@ -589,7 +590,8 @@ ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *&Id,
(IDecl = R.getAsSingle<ObjCInterfaceDecl>())) {
Diag(RecoverLoc, diag::err_undef_interface_suggest)
<< Id << IDecl->getDeclName()
- << FixItHint::CreateReplacement(RecoverLoc, IDecl->getNameAsString());
+ << CodeModificationHint::CreateReplacement(RecoverLoc,
+ IDecl->getNameAsString());
Diag(IDecl->getLocation(), diag::note_previous_decl)
<< IDecl->getDeclName();
@@ -2343,7 +2345,8 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
if (SC == VarDecl::Static) {
Diag(D.getDeclSpec().getStorageClassSpecLoc(),
diag::err_static_out_of_line)
- << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
+ << CodeModificationHint::CreateRemoval(
+ D.getDeclSpec().getStorageClassSpecLoc());
} else if (SC == VarDecl::None)
SC = VarDecl::Static;
}
@@ -2951,8 +2954,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
Diag(D.getIdentifierLoc(), diag::err_template_spec_decl_friend)
<< Name << RemoveRange
- << FixItHint::CreateRemoval(RemoveRange)
- << FixItHint::CreateInsertion(InsertLoc, "<>");
+ << CodeModificationHint::CreateRemoval(RemoveRange)
+ << CodeModificationHint::CreateInsertion(InsertLoc, "<>");
}
}
@@ -2972,7 +2975,8 @@ 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)
- << FixItHint::CreateRemoval(D.getDeclSpec().getVirtualSpecLoc());
+ << CodeModificationHint::CreateRemoval(
+ D.getDeclSpec().getVirtualSpecLoc());
} else {
// Okay: Add virtual to the method.
CXXRecordDecl *CurClass = cast<CXXRecordDecl>(DC);
@@ -2989,14 +2993,16 @@ 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)
- << FixItHint::CreateRemoval(D.getDeclSpec().getExplicitSpecLoc());
+ << CodeModificationHint::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)
- << FixItHint::CreateRemoval(D.getDeclSpec().getExplicitSpecLoc());
+ << CodeModificationHint::CreateRemoval(
+ D.getDeclSpec().getExplicitSpecLoc());
}
}
@@ -3031,7 +3037,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// member function definition.
Diag(D.getDeclSpec().getStorageClassSpecLoc(),
diag::err_static_out_of_line)
- << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
+ << CodeModificationHint::CreateRemoval(
+ D.getDeclSpec().getStorageClassSpecLoc());
}
// Handle GNU asm-label extension (encoded as an attribute).
@@ -3129,7 +3136,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)
- << FixItHint::CreateInsertion(
+ << CodeModificationHint::CreateInsertion(
D.getDeclSpec().getSourceRange().getBegin(),
"template<> ");
isFunctionTemplateSpecialization = true;
@@ -4167,7 +4174,7 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
<< ";\n";
Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared)
<< FTI.ArgInfo[i].Ident
- << FixItHint::CreateInsertion(LocAfterDecls, Code.str());
+ << CodeModificationHint::CreateInsertion(LocAfterDecls, Code.str());
// Implicitly declare the argument as type 'int' for lack of a better
// type.
@@ -4677,7 +4684,7 @@ bool Sema::isAcceptableTagRedeclaration(const TagDecl *Previous,
Diag(NewTagLoc, diag::warn_struct_class_tag_mismatch)
<< (NewTag == TagDecl::TK_class)
<< isTemplate << &Name
- << FixItHint::CreateReplacement(SourceRange(NewTagLoc),
+ << CodeModificationHint::CreateReplacement(SourceRange(NewTagLoc),
OldTag == TagDecl::TK_class? "class" : "struct");
Diag(Previous->getLocation(), diag::note_previous_use);
return true;
@@ -4923,8 +4930,8 @@ Sema::DeclPtrTy Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (SafeToContinue)
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< Name
- << FixItHint::CreateReplacement(SourceRange(KWLoc),
- PrevTagDecl->getKindName());
+ << CodeModificationHint::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 4c101ad2b8..3c3786d217 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()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::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()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
const CXXBaseSpecifier *BaseSpec = DirectBaseSpec? DirectBaseSpec
: VirtualBaseSpec;
@@ -2612,7 +2612,7 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
if (Context.getCanonicalType(ParamType).getUnqualifiedType() == ClassTy) {
SourceLocation ParamLoc = Constructor->getParamDecl(0)->getLocation();
Diag(ParamLoc, diag::err_constructor_byvalue_arg)
- << FixItHint::CreateInsertion(ParamLoc, " const &");
+ << CodeModificationHint::CreateInsertion(ParamLoc, " const &");
// FIXME: Rather that making the constructor invalid, we should endeavor
// to fix the type.
@@ -3157,7 +3157,8 @@ Sema::DeclPtrTy Sema::ActOnUsingDeclaration(Scope *S,
UsingLoc = Name.getSourceRange().getBegin();
Diag(UsingLoc, diag::warn_access_decl_deprecated)
- << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using ");
+ << CodeModificationHint::CreateInsertion(SS.getRange().getBegin(),
+ "using ");
}
NamedDecl *UD = BuildUsingDeclaration(S, AS, UsingLoc, SS,
@@ -5432,7 +5433,8 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
<< (unsigned) RD->getTagKind()
<< T
<< SourceRange(DS.getFriendSpecLoc())
- << FixItHint::CreateInsertion(DS.getTypeSpecTypeLoc(), InsertionText);
+ << CodeModificationHint::CreateInsertion(DS.getTypeSpecTypeLoc(),
+ InsertionText);
return DeclPtrTy();
}else {
Diag(DS.getFriendSpecLoc(), diag::err_unexpected_friend)
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 1334e063f7..cf7ffae236 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -559,8 +559,8 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
<< ClassName << R.getLookupName();
Diag(IDecl->getLocation(), diag::note_previous_decl)
<< R.getLookupName()
- << FixItHint::CreateReplacement(ClassLoc,
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(ClassLoc,
+ R.getLookupName().getAsString());
IDecl = 0;
} else {
Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index 53e9385749..fab94df4d0 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -210,7 +210,8 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
// late-specified return types.
Diag(New->getLocation(), diag::warn_missing_exception_specification)
<< New << OS.str()
- << FixItHint::CreateInsertion(AfterParenLoc, " " + OS.str().str());
+ << CodeModificationHint::CreateInsertion(AfterParenLoc,
+ " " + OS.str().str());
}
if (!Old->getLocation().isInvalid())
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index fbdf080bc4..1c698da053 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -949,7 +949,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS,
// Actually quite difficult!
if (isInstance)
Diag(R.getNameLoc(), diagnostic) << Name
- << FixItHint::CreateInsertion(R.getNameLoc(), "this->");
+ << CodeModificationHint::CreateInsertion(R.getNameLoc(),
+ "this->");
else
Diag(R.getNameLoc(), diagnostic) << Name;
@@ -968,14 +969,14 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, const CXXScopeSpec &SS,
if (isa<ValueDecl>(*R.begin()) || isa<FunctionTemplateDecl>(*R.begin())) {
if (SS.isEmpty())
Diag(R.getNameLoc(), diagnostic_suggest) << Name << R.getLookupName()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
else
Diag(R.getNameLoc(), diag::err_no_member_suggest)
<< Name << computeDeclContext(SS, false) << R.getLookupName()
<< SS.getRange()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
if (NamedDecl *ND = R.getAsSingle<NamedDecl>())
Diag(ND->getLocation(), diag::note_previous_decl)
<< ND->getDeclName();
@@ -2613,8 +2614,8 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
(isa<ValueDecl>(*R.begin()) || isa<FunctionTemplateDecl>(*R.begin()))) {
SemaRef.Diag(R.getNameLoc(), diag::err_no_member_suggest)
<< Name << DC << R.getLookupName() << SS.getRange()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ R.getLookupName().getAsString());
if (NamedDecl *ND = R.getAsSingle<NamedDecl>())
SemaRef.Diag(ND->getLocation(), diag::note_previous_decl)
<< ND->getDeclName();
@@ -2892,7 +2893,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
SourceLocation Loc = PP.getLocForEndOfToken(BaseExpr->getLocEnd());
Diag(Loc, diag::err_member_reference_needs_call)
<< QualType(Fun, 0)
- << FixItHint::CreateInsertion(Loc, "()");
+ << CodeModificationHint::CreateInsertion(Loc, "()");
OwningExprResult NewBase
= ActOnCallExpr(0, ExprArg(*this, BaseExpr), Loc,
@@ -3011,7 +3012,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
// by now.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
<< BaseType << int(IsArrow) << BaseExpr->getSourceRange()
- << FixItHint::CreateReplacement(OpLoc, ".");
+ << CodeModificationHint::CreateReplacement(OpLoc, ".");
IsArrow = false;
} else {
Diag(MemberLoc, diag::err_typecheck_member_reference_arrow)
@@ -3031,7 +3032,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
if (PT && PT->getPointeeType()->isRecordType()) {
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
<< BaseType << int(IsArrow) << BaseExpr->getSourceRange()
- << FixItHint::CreateReplacement(OpLoc, "->");
+ << CodeModificationHint::CreateReplacement(OpLoc, "->");
BaseType = PT->getPointeeType();
IsArrow = true;
}
@@ -3070,8 +3071,8 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
Diag(R.getNameLoc(),
diag::err_typecheck_member_reference_ivar_suggest)
<< IDecl->getDeclName() << MemberName << IV->getDeclName()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- IV->getNameAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ IV->getNameAsString());
Diag(IV->getLocation(), diag::note_previous_decl)
<< IV->getDeclName();
}
@@ -3245,8 +3246,8 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
Res.getAsSingle<ObjCPropertyDecl>()) {
Diag(R.getNameLoc(), diag::err_property_not_found_suggest)
<< MemberName << BaseType << Res.getLookupName()
- << FixItHint::CreateReplacement(R.getNameLoc(),
- Res.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(R.getNameLoc(),
+ Res.getLookupName().getAsString());
ObjCPropertyDecl *Property = Res.getAsSingle<ObjCPropertyDecl>();
Diag(Property->getLocation(), diag::note_previous_decl)
<< Property->getDeclName();
@@ -3575,7 +3576,7 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc,
if (NumArgs > 0) {
// Pseudo-destructor calls should not have any arguments.
Diag(Fn->getLocStart(), diag::err_pseudo_dtor_call_with_args)
- << FixItHint::CreateRemoval(
+ << CodeModificationHint::CreateRemoval(
SourceRange(Args[0]->getLocStart(),
Args[NumArgs-1]->getLocEnd()));
@@ -5425,10 +5426,12 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
PDiag(diag::warn_stringcompare)
<< isa<ObjCEncodeExpr>(literalStringStripped)
<< literalString->getSourceRange()
- << FixItHint::CreateReplacement(SourceRange(Loc), ", ")
- << FixItHint::CreateInsertion(lex->getLocStart(), "strcmp(")
- << FixItHint::CreateInsertion(PP.getLocForEndOfToken(rex->getLocEnd()),
- resultComparison));
+ << CodeModificationHint::CreateReplacement(SourceRange(Loc), ", ")
+ << CodeModificationHint::CreateInsertion(lex->getLocStart(),
+ "strcmp(")
+ << CodeModificationHint::CreateInsertion(
+ PP.getLocForEndOfToken(rex->getLocEnd()),
+ resultComparison));
}
}
@@ -6412,8 +6415,8 @@ static void SuggestParentheses(Sema &Self, SourceLocation Loc,
}
Self.Diag(Loc, PD)
- << FixItHint::CreateInsertion(ParenRange.getBegin(), "(")
- << FixItHint::CreateInsertion(EndLoc, ")");
+ << CodeModificationHint::CreateInsertion(ParenRange.getBegin(), "(")
+ << CodeModificationHint::CreateInsertion(EndLoc, ")");
if (!SecondPD.getDiagID())
return;
@@ -6427,8 +6430,8 @@ static void SuggestParentheses(Sema &Self, SourceLocation Loc,
}
Self.Diag(Loc, SecondPD)
- << FixItHint::CreateInsertion(SecondParenRange.getBegin(), "(")
- << FixItHint::CreateInsertion(EndLoc, ")");
+ << CodeModificationHint::CreateInsertion(SecondParenRange.getBegin(), "(")
+ << CodeModificationHint::CreateInsertion(EndLoc, ")");
}
/// DiagnoseBitwisePrecedence - Emit a warning when bitwise and comparison
@@ -7132,8 +7135,11 @@ Sema::OwningExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
return Owned(new (Context) GNUNullExpr(Ty, TokenLoc));
}
-static void MakeObjCStringLiteralFixItHint(Sema& SemaRef, QualType DstType,
- Expr *SrcExpr, FixItHint &Hint) {
+static void
+MakeObjCStringLiteralCodeModificationHint(Sema& SemaRef,
+ QualType DstType,
+ Expr *SrcExpr,
+ CodeModificationHint &Hint) {
if (!SemaRef.getLangOptions().ObjC1)
return;
@@ -7154,7 +7160,7 @@ static void MakeObjCStringLiteralFixItHint(Sema& SemaRef, QualType DstType,
if (!SL || SL->isWide())
return;
- Hint = FixItHint::CreateInsertion(SL->getLocStart(), "@");
+ Hint = CodeModificationHint::CreateInsertion(SL->getLocStart(), "@");
}
bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
@@ -7164,7 +7170,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
// Decode the result (notice that AST's are still created for extensions).
bool isInvalid = false;
unsigned DiagKind;
- FixItHint Hint;
+ CodeModificationHint Hint;
switch (ConvTy) {
default: assert(0 && "Unknown conversion type");
@@ -7176,7 +7182,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
DiagKind = diag::ext_typecheck_convert_int_pointer;
break;
case IncompatiblePointer:
- MakeObjCStringLiteralFixItHint(*this, DstType, SrcExpr, Hint);
+ MakeObjCStringLiteralCodeModificationHint(*this, DstType, SrcExpr, Hint);
DiagKind = diag::ext_typecheck_convert_incompatible_pointer;
break;
case IncompatiblePointerSign:
@@ -7543,10 +7549,10 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
Diag(Loc, diagnostic)
<< E->getSourceRange()
- << FixItHint::CreateInsertion(Open, "(")
- << FixItHint::CreateInsertion(Close, ")");
+ << CodeModificationHint::CreateInsertion(Open, "(")
+ << CodeModificationHint::CreateInsertion(Close, ")");
Diag(Loc, diag::note_condition_assign_to_comparison)
- << FixItHint::CreateReplacement(Loc, "==");
+ << CodeModificationHint::CreateReplacement(Loc, "==");
}
bool Sema::CheckBooleanCondition(Expr *&E, SourceLocation Loc) {
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 8024af28d4..3befb7e24e 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1858,7 +1858,7 @@ QualType Sema::CheckPointerToMemberOperands(
else {
Diag(Loc, diag::err_bad_memptr_lhs)
<< OpSpelling << 1 << LType
- << FixItHint::CreateReplacement(SourceRange(Loc), ".*");
+ << CodeModificationHint::CreateReplacement(SourceRange(Loc), ".*");
return QualType();
}
}
@@ -2589,7 +2589,7 @@ Sema::OwningExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
SourceLocation ExpectedLParenLoc = PP.getLocForEndOfToken(NameLoc);
Diag(E->getLocStart(), diag::err_dtor_expr_without_call)
<< isa<CXXPseudoDestructorExpr>(E)
- << FixItHint::CreateInsertion(ExpectedLParenLoc, "()");
+ << CodeModificationHint::CreateInsertion(ExpectedLParenLoc, "()");
return ActOnCallExpr(/*Scope*/ 0,
move(MemExpr),
@@ -2623,7 +2623,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(ExprArg Base,
// The user wrote "p->" when she probably meant "p."; fix it.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
<< ObjectType << true
- << FixItHint::CreateReplacement(OpLoc, ".");
+ << CodeModificationHint::CreateReplacement(OpLoc, ".");
if (isSFINAEContext())
return ExprError();
@@ -2728,7 +2728,7 @@ Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
// The user wrote "p->" when she probably meant "p."; fix it.
Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
<< ObjectType << true
- << FixItHint::CreateReplacement(OpLoc, ".");
+ << CodeModificationHint::CreateReplacement(OpLoc, ".");
if (isSFINAEContext())
return ExprError();
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 648e43bdb4..00e2fba5fe 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -504,11 +504,13 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
SemaRef.Diag(StructuredSubobjectInitList->getLocStart(),
diag::warn_missing_braces)
<< StructuredSubobjectInitList->getSourceRange()
- << FixItHint::CreateInsertion(StructuredSubobjectInitList->getLocStart(),
- "{")
- << FixItHint::CreateInsertion(SemaRef.PP.getLocForEndOfToken(
+ << CodeModificationHint::CreateInsertion(
+ StructuredSubobjectInitList->getLocStart(),
+ "{")
+ << CodeModificationHint::CreateInsertion(
+ SemaRef.PP.getLocForEndOfToken(
StructuredSubobjectInitList->getLocEnd()),
- "}");
+ "}");
}
}
@@ -569,8 +571,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity,
if (T->isScalarType() && !TopLevelObject)
SemaRef.Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init)
<< IList->getSourceRange()
- << FixItHint::CreateRemoval(IList->getLocStart())
- << FixItHint::CreateRemoval(IList->getLocEnd());
+ << CodeModificationHint::CreateRemoval(IList->getLocStart())
+ << CodeModificationHint::CreateRemoval(IList->getLocEnd());
}
void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity,
@@ -1361,8 +1363,8 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
SemaRef.Diag(D->getFieldLoc(),
diag::err_field_designator_unknown_suggest)
<< FieldName << CurrentObjectType << R.getLookupName()
- << FixItHint::CreateReplacement(D->getFieldLoc(),
- R.getLookupName().getAsString());
+ << CodeModificationHint::CreateReplacement(D->getFieldLoc(),
+ R.getLookupName().getAsString());
SemaRef.Diag(ReplacementField->getLocation(),
diag::note_previous_decl)
<< ReplacementField->getDeclName();
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 791de8c2b9..fd30a5360e 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -471,9 +471,9 @@ static bool CheckCXXSwitchCondition(Sema &S, SourceLocation SwitchLoc,
S.Diag(SwitchLoc, diag::err_switch_explicit_conversion)
<< CondType << ConvTy << CondExpr->getSourceRange()
- << FixItHint::CreateInsertion(CondExpr->getLocStart(),
- "static_cast<" + TypeStr + ">(")
- << FixItHint::CreateInsertion(
+ << CodeModificationHint::CreateInsertion(CondExpr->getLocStart(),
+ "static_cast<" + TypeStr + ">(")
+ << CodeModificationHint::CreateInsertion(
S.PP.getLocForEndOfToken(CondExpr->getLocEnd()),
")");
S.Diag(Conversion->getLocation(), diag::note_switch_conversion)
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 74521f9326..4507e64868 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -161,7 +161,7 @@ bool Sema::DiagnoseUnknownTemplateName(const IdentifierInfo &II,
NestedNameSpecifier *Qualifier = (NestedNameSpecifier*)SS->getScopeRep();
Diag(IILoc, diag::err_template_kw_missing)
<< Qualifier << II.getName()
- << FixItHint::CreateInsertion(IILoc, "template ");
+ << CodeModificationHint::CreateInsertion(IILoc, "template ");
SuggestedTemplate
= TemplateTy::make(Context.getDependentTemplateName(Qualifier, &II));
SuggestedKind = TNK_Dependent_template_name;
@@ -240,12 +240,12 @@ void Sema::LookupTemplateName(LookupResult &Found,
if (LookupCtx)
Diag(Found.getNameLoc(), diag::err_no_member_template_suggest)
<< Name << LookupCtx << Found.getLookupName() << SS.getRange()
- << FixItHint::CreateReplacement(Found.getNameLoc(),
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
Found.getLookupName().getAsString());
else
Diag(Found.getNameLoc(), diag::err_no_template_suggest)
<< Name << Found.getLookupName()
- << FixItHint::CreateReplacement(Found.getNameLoc(),
+ << CodeModificationHint::CreateReplacement(Found.getNameLoc(),
Found.getLookupName().getAsString());
if (TemplateDecl *Template = Found.getAsSingle<TemplateDecl>())
Diag(Template->getLocation(), diag::note_previous_decl)
@@ -822,7 +822,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
if (!isAcceptableTagRedeclaration(PrevRecordDecl, Kind, KWLoc, *Name)) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< Name
- << FixItHint::CreateReplacement(KWLoc, PrevRecordDecl->getKindName());
+ << CodeModificationHint::CreateReplacement(KWLoc,
+ PrevRecordDecl->getKindName());
Diag(PrevRecordDecl->getLocation(), diag::note_previous_use);
Kind = PrevRecordDecl->getTagKind();
}
@@ -1294,7 +1295,8 @@ Sema::MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc,
} else {
Diag(SS.getRange().getBegin(), diag::err_template_spec_needs_header)
<< SS.getRange()
- << FixItHint::CreateInsertion(FirstTemplateLoc, "template<> ");
+ << CodeModificationHint::CreateInsertion(FirstTemplateLoc,
+ "template<> ");
IsExplicitSpecialization = true;
}
return 0;
@@ -1497,7 +1499,8 @@ Sema::TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
if (!isAcceptableTagRedeclaration(D, TagKind, TagLoc, *Id)) {
Diag(TagLoc, diag::err_use_with_wrong_tag)
<< Type
- << FixItHint::CreateReplacement(SourceRange(TagLoc), D->getKindName());
+ << CodeModificationHint::CreateReplacement(SourceRange(TagLoc),
+ D->getKindName());
Diag(D->getLocation(), diag::note_previous_use);
}
}
@@ -3460,7 +3463,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
} else if (TemplateParams) {
if (TUK == TUK_Friend)
Diag(KWLoc, diag::err_template_spec_friend)
- << FixItHint::CreateRemoval(
+ << CodeModificationHint::CreateRemoval(
SourceRange(TemplateParams->getTemplateLoc(),
TemplateParams->getRAngleLoc()))
<< SourceRange(LAngleLoc, RAngleLoc);
@@ -3468,7 +3471,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
isExplicitSpecialization = true;
} else if (TUK != TUK_Friend) {
Diag(KWLoc, diag::err_template_spec_needs_header)
- << FixItHint::CreateInsertion(KWLoc, "template<> ");
+ << CodeModificationHint::CreateInsertion(KWLoc, "template<> ");
isExplicitSpecialization = true;
}
@@ -3486,7 +3489,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
*ClassTemplate->getIdentifier())) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< ClassTemplate
- << FixItHint::CreateReplacement(KWLoc,
+ << CodeModificationHint::CreateReplacement(KWLoc,
ClassTemplate->getTemplatedDecl()->getKindName());
Diag(ClassTemplate->getTemplatedDecl()->getLocation(),
diag::note_previous_use);
@@ -3528,7 +3531,8 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
// to the implicit argument list of the primary template.
Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template)
<< (TUK == TUK_Definition)
- << FixItHint::CreateRemoval(SourceRange(LAngleLoc, RAngleLoc));
+ << CodeModificationHint::CreateRemoval(SourceRange(LAngleLoc,
+ RAngleLoc));
return CheckClassTemplate(S, TagSpec, TUK, KWLoc, SS,
ClassTemplate->getIdentifier(),
TemplateNameLoc,
@@ -4375,7 +4379,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
*ClassTemplate->getIdentifier())) {
Diag(KWLoc, diag::err_use_with_wrong_tag)
<< ClassTemplate
- << FixItHint::CreateReplacement(KWLoc,
+ << CodeModificationHint::CreateReplacement(KWLoc,
ClassTemplate->getTemplatedDecl()->getKindName());
Diag(ClassTemplate->getTemplatedDecl()->getLocation(),
diag::note_previous_use);
@@ -4693,7 +4697,7 @@ Sema::DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
if (D.getDeclSpec().isInlineSpecified() && getLangOptions().CPlusPlus0x)
Diag(D.getDeclSpec().getInlineSpecLoc(),
diag::err_explicit_instantiation_inline)
- <<FixItHint::CreateRemoval(D.getDeclSpec().getInlineSpecLoc());
+ <<CodeModificationHint::CreateRemoval(D.getDeclSpec().getInlineSpecLoc());
// FIXME: check for constexpr specifier.
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index d21862b71e..d08f483a6a 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/l