diff options
-rw-r--r-- | lib/AST/ASTImporter.cpp | 12 | ||||
-rw-r--r-- | lib/AST/Stmt.cpp | 26 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 60 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 30 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 23 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 26 | ||||
-rw-r--r-- | lib/Sema/SemaInit.cpp | 32 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 40 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 53 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 12 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 10 |
11 files changed, 162 insertions, 162 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index 0bc50c5f30..cc0213fca2 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -965,10 +965,10 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, Base1->getType(), Base2->getType())) { Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); - Context.Diag2(Base2->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag2(Base2->getLocStart(), diag::note_odr_base) << Base2->getType() << Base2->getSourceRange(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); return false; @@ -978,10 +978,10 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, if (Base1->isVirtual() != Base2->isVirtual()) { Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); - Context.Diag2(Base2->getSourceRange().getBegin(), + Context.Diag2(Base2->getLocStart(), diag::note_odr_virtual_base) << Base2->isVirtual() << Base2->getSourceRange(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->isVirtual() << Base1->getSourceRange(); return false; @@ -991,7 +991,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.C2.getTypeDeclType(D2); const CXXBaseSpecifier *Base1 = D1CXX->bases_begin(); - Context.Diag1(Base1->getSourceRange().getBegin(), diag::note_odr_base) + Context.Diag1(Base1->getLocStart(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); Context.Diag2(D2->getLocation(), diag::note_odr_missing_base); @@ -4171,7 +4171,7 @@ TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) { return 0; return ToContext.getTrivialTypeSourceInfo(T, - FromTSI->getTypeLoc().getSourceRange().getBegin()); + FromTSI->getTypeLoc().getLocStart()); } Decl *ASTImporter::Import(Decl *FromD) { diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 7907e565dd..6af20df4be 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -693,9 +693,9 @@ void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, @@ -724,9 +724,9 @@ void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[CONDVAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[CONDVAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond) @@ -751,9 +751,9 @@ void SwitchStmt::setConditionVariable(ASTContext &C, VarDecl *V) { return; } - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } Stmt *SwitchCase::getSubStmt() { @@ -784,10 +784,10 @@ void WhileStmt::setConditionVariable(ASTContext &C, VarDecl *V) { SubExprs[VAR] = 0; return; } - - SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), - V->getSourceRange().getBegin(), - V->getSourceRange().getEnd()); + + SourceRange VarRange = V->getSourceRange(); + SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(), + VarRange.getEnd()); } // IndirectGotoStmt diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 062e4aa38f..7957473a6b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2423,7 +2423,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, Record->getDeclContext()->isRecord()) return BuildAnonymousStructOrUnion(S, DS, AS, Record); - Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators) + Diag(DS.getLocStart(), diag::ext_no_declarators) << DS.getSourceRange(); emittedWarning = true; } @@ -2441,7 +2441,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if ((Record && Record->getDeclName() && !Record->isCompleteDefinition()) || (DS.getTypeSpecType() == DeclSpec::TST_typename && DS.getRepAsType().get()->isStructureType())) { - Diag(DS.getSourceRange().getBegin(), diag::ext_ms_anonymous_struct) + Diag(DS.getLocStart(), diag::ext_ms_anonymous_struct) << DS.getSourceRange(); return BuildMicrosoftCAnonymousStruct(S, DS, Record); } @@ -2465,12 +2465,12 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, // extension in both Microsoft and GNU. if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef && Tag && isa<EnumDecl>(Tag)) { - Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name) + Diag(DS.getLocStart(), diag::ext_typedef_without_a_name) << DS.getSourceRange(); return Tag; } - Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators) + Diag(DS.getLocStart(), diag::ext_no_declarators) << DS.getSourceRange(); emittedWarning = true; } @@ -2848,7 +2848,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, NamedDecl *Anon = 0; if (RecordDecl *OwningClass = dyn_cast<RecordDecl>(Owner)) { Anon = FieldDecl::Create(Context, OwningClass, - DS.getSourceRange().getBegin(), + DS.getLocStart(), Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), @@ -2875,7 +2875,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, = StorageClassSpecToVarDeclStorageClass(SCSpec); Anon = VarDecl::Create(Context, Owner, - DS.getSourceRange().getBegin(), + DS.getLocStart(), Record->getLocation(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), TInfo, SC, SCAsWritten); @@ -2945,8 +2945,8 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, // Create a declaration for this anonymous struct. NamedDecl* Anon = FieldDecl::Create(Context, cast<RecordDecl>(CurContext), - DS.getSourceRange().getBegin(), - DS.getSourceRange().getBegin(), + DS.getLocStart(), + DS.getLocStart(), /*IdentifierInfo=*/0, Context.getTypeDeclType(Record), TInfo, @@ -3242,7 +3242,7 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, // one, the ParsedFreeStandingDeclSpec action should be used. if (!Name) { if (!D.isInvalidType()) // Reject this if we think it is valid. - Diag(D.getDeclSpec().getSourceRange().getBegin(), + Diag(D.getDeclSpec().getLocStart(), diag::err_declarator_need_ident) << D.getDeclSpec().getSourceRange() << D.getSourceRange(); return 0; @@ -3913,7 +3913,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool isExplicitSpecialization = false; VarDecl *NewVD; if (!getLangOptions().CPlusPlus) { - NewVD = VarDecl::Create(Context, DC, D.getSourceRange().getBegin(), + NewVD = VarDecl::Create(Context, DC, D.getLocStart(), D.getIdentifierLoc(), II, R, TInfo, SC, SCAsWritten); @@ -3957,7 +3957,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool Invalid = false; if (TemplateParameterList *TemplateParams = MatchTemplateParametersToScopeSpecifier( - D.getDeclSpec().getSourceRange().getBegin(), + D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), D.getCXXScopeSpec(), TemplateParamLists.get(), @@ -3983,7 +3983,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } - NewVD = VarDecl::Create(Context, DC, D.getSourceRange().getBegin(), + NewVD = VarDecl::Create(Context, DC, D.getLocStart(), D.getIdentifierLoc(), II, R, TInfo, SC, SCAsWritten); @@ -4676,7 +4676,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, (!isa<FunctionType>(R.getTypePtr()) && R->isFunctionProtoType()); NewFD = FunctionDecl::Create(SemaRef.Context, DC, - D.getSourceRange().getBegin(), NameInfo, R, + D.getLocStart(), NameInfo, R, TInfo, SC, SCAsWritten, isInline, HasPrototype); if (D.isInvalidType()) @@ -4708,7 +4708,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, R = SemaRef.CheckConstructorDeclarator(D, R, SC); return CXXConstructorDecl::Create(SemaRef.Context, cast<CXXRecordDecl>(DC), - D.getSourceRange().getBegin(), NameInfo, + D.getLocStart(), NameInfo, R, TInfo, isExplicit, isInline, /*isImplicitlyDeclared=*/false, isConstexpr); @@ -4720,7 +4720,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, CXXRecordDecl *Record = cast<CXXRecordDecl>(DC); CXXDestructorDecl *NewDD = CXXDestructorDecl::Create( SemaRef.Context, Record, - D.getSourceRange().getBegin(), + D.getLocStart(), NameInfo, R, TInfo, isInline, /*isImplicitlyDeclared=*/false); @@ -4743,7 +4743,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // Create a FunctionDecl to satisfy the function definition parsing // code path. return FunctionDecl::Create(SemaRef.Context, DC, - D.getSourceRange().getBegin(), + D.getLocStart(), D.getIdentifierLoc(), Name, R, TInfo, SC, SCAsWritten, isInline, /*hasPrototype=*/true, isConstexpr); @@ -4759,7 +4759,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, SemaRef.CheckConversionDeclarator(D, R, SC); IsVirtualOkay = true; return CXXConversionDecl::Create(SemaRef.Context, cast<CXXRecordDecl>(DC), - D.getSourceRange().getBegin(), NameInfo, + D.getLocStart(), NameInfo, R, TInfo, isInline, isExplicit, isConstexpr, SourceLocation()); @@ -4795,7 +4795,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // This is a C++ method declaration. return CXXMethodDecl::Create(SemaRef.Context, cast<CXXRecordDecl>(DC), - D.getSourceRange().getBegin(), NameInfo, R, + D.getLocStart(), NameInfo, R, TInfo, isStatic, SCAsWritten, isInline, isConstexpr, SourceLocation()); @@ -4804,7 +4804,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // prototype. This true when: // - we're in C++ (where every function has a prototype), return FunctionDecl::Create(SemaRef.Context, DC, - D.getSourceRange().getBegin(), + D.getLocStart(), NameInfo, R, TInfo, SC, SCAsWritten, isInline, true/*HasPrototype*/, isConstexpr); } @@ -4888,7 +4888,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool Invalid = false; if (TemplateParameterList *TemplateParams = MatchTemplateParametersToScopeSpecifier( - D.getDeclSpec().getSourceRange().getBegin(), + D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), D.getCXXScopeSpec(), TemplateParamLists.get(), @@ -5317,7 +5317,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, Diag(D.getIdentifierLoc(), diag::err_template_spec_needs_header) << SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc) << FixItHint::CreateInsertion( - D.getDeclSpec().getSourceRange().getBegin(), + D.getDeclSpec().getLocStart(), "template<> "); isFunctionTemplateSpecialization = true; } else { @@ -6093,14 +6093,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, if (CXXDirectInit->getNumExprs() == 0) { // It isn't possible to write this directly, but it is possible to // end up in this situation with "auto x(some_pack...);" - Diag(CXXDirectInit->getSourceRange().getBegin(), + Diag(CXXDirectInit->getLocStart(), diag::err_auto_var_init_no_expression) << VDecl->getDeclName() << VDecl->getType() << VDecl->getSourceRange(); RealDecl->setInvalidDecl(); return; } else if (CXXDirectInit->getNumExprs() > 1) { - Diag(CXXDirectInit->getExpr(1)->getSourceRange().getBegin(), + Diag(CXXDirectInit->getExpr(1)->getLocStart(), diag::err_auto_var_init_multiple_expressions) << VDecl->getDeclName() << VDecl->getType() << VDecl->getSourceRange(); @@ -6917,7 +6917,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { // the enclosing context. This prevents them from accidentally // looking like class members in C++. ParmVarDecl *New = CheckParameter(Context.getTranslationUnitDecl(), - D.getSourceRange().getBegin(), + D.getLocStart(), D.getIdentifierLoc(), II, parmDeclType, TInfo, StorageClass, StorageClassAsWritten); @@ -7662,7 +7662,7 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T, // Scope manipulation handled by caller. TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext, - D.getSourceRange().getBegin(), + D.getLocStart(), D.getIdentifierLoc(), D.getIdentifier(), TInfo); @@ -8777,7 +8777,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, bool Mutable = (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable); - SourceLocation TSSL = D.getSourceRange().getBegin(); + SourceLocation TSSL = D.getLocStart(); FieldDecl *NewFD = CheckFieldDecl(II, T, TInfo, Record, Loc, Mutable, BitWidth, HasInit, TSSL, AS, PrevDecl, &D); @@ -9067,7 +9067,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { if (RD->hasUserDeclaredCopyAssignment()) { // FIXME: this should use the location of the copy // assignment, not the type. - SourceLocation TyLoc = RD->getSourceRange().getBegin(); + SourceLocation TyLoc = RD->getLocStart(); Diag(TyLoc, diag::note_nontrivial_user_defined) << QT << member; return; } @@ -9099,7 +9099,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { // so we just iterate through the direct bases. for (base_iter bi = RD->bases_begin(), be = RD->bases_end(); bi != be; ++bi) if (bi->isVirtual()) { - SourceLocation BaseLoc = bi->getSourceRange().getBegin(); + SourceLocation BaseLoc = bi->getLocStart(); Diag(BaseLoc, diag::note_nontrivial_has_virtual) << QT << 1; return; } @@ -9109,7 +9109,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { for (meth_iter mi = RD->method_begin(), me = RD->method_end(); mi != me; ++mi) { if (mi->isVirtual()) { - SourceLocation MLoc = mi->getSourceRange().getBegin(); + SourceLocation MLoc = mi->getLocStart(); Diag(MLoc, diag::note_nontrivial_has_virtual) << QT << 0; return; } @@ -9136,7 +9136,7 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { assert(BaseRT && "Don't know how to handle dependent bases"); CXXRecordDecl *BaseRecTy = cast<CXXRecordDecl>(BaseRT->getDecl()); if (!(BaseRecTy->*hasTrivial)()) { - SourceLocation BaseLoc = bi->getSourceRange().getBegin(); + SourceLocation BaseLoc = bi->getLocStart(); Diag(BaseLoc, diag::note_nontrivial_has_nontrivial) << QT << 1 << member; DiagnoseNontrivial(BaseRT, member); return; diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 32284968c9..21a394f715 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -86,7 +86,7 @@ namespace { // evaluated. Parameters of a function declared before a default // argument expression are in scope and can hide namespace and // class member names. - return S->Diag(DRE->getSourceRange().getBegin(), + return S->Diag(DRE->getLocStart(), diag::err_param_default_argument_references_param) << Param->getDeclName() << DefaultArg->getSourceRange(); } else if (VarDecl *VDecl = dyn_cast<VarDecl>(Decl)) { @@ -94,7 +94,7 @@ namespace { // Local variables shall not be used in default argument // expressions. if (VDecl->isLocalVarDecl()) - return S->Diag(DRE->getSourceRange().getBegin(), + return S->Diag(DRE->getLocStart(), diag::err_param_default_argument_references_local) << VDecl->getDeclName() << DefaultArg->getSourceRange(); } @@ -107,7 +107,7 @@ namespace { // C++ [dcl.fct.default]p8: // The keyword this shall not be used in a default argument of a // member function. - return S->Diag(ThisE->getSourceRange().getBegin(), + return S->Diag(ThisE->getLocStart(), diag::err_param_default_argument_references_this) << ThisE->getSourceRange(); } @@ -680,7 +680,7 @@ bool Sema::CheckConstexprFunctionDecl(const FunctionDecl *NewFD) { << RD->getNumVBases(); for (CXXRecordDecl::base_class_const_iterator I = RD->vbases_begin(), E = RD->vbases_end(); I != E; ++I) - Diag(I->getSourceRange().getBegin(), + Diag(I->getLocStart(), diag::note_constexpr_virtual_base_here) << I->getSourceRange(); return false; } @@ -1134,7 +1134,7 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases, // C++ [class.mi]p3: // A class shall not be specified as a direct base class of a // derived class more than once. - Diag(Bases[idx]->getSourceRange().getBegin(), + Diag(Bases[idx]->getLocStart(), diag::err_duplicate_base_class) << KnownBase->getType() << Bases[idx]->getSourceRange(); @@ -1442,7 +1442,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, // For anonymous bitfields, the location should point to the type. if (Loc.isInvalid()) - Loc = D.getSourceRange().getBegin(); + Loc = D.getLocStart(); Expr *BitWidth = static_cast<Expr*>(BW); @@ -1907,7 +1907,7 @@ Sema::BuildMemInitializer(Decl *ConstructorD, const CXXBaseSpecifier *BaseSpec = DirectBaseSpec? DirectBaseSpec : VirtualBaseSpec; - Diag(BaseSpec->getSourceRange().getBegin(), + Diag(BaseSpec->getLocStart(), diag::note_base_class_specified_here) << BaseSpec->getType() << BaseSpec->getSourceRange(); @@ -3333,7 +3333,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location, assert(Dtor && "No dtor found for BaseClassDecl!"); // FIXME: caret should be on the start of the class name - CheckDestructorAccess(Base->getSourceRange().getBegin(), Dtor, + CheckDestructorAccess(Base->getLocStart(), Dtor, PDiag(diag::err_access_dtor_base) << Base->getType() << Base->getSourceRange()); @@ -5863,7 +5863,7 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, case UnqualifiedId::IK_ConstructorName: case UnqualifiedId::IK_ConstructorTemplateId: // C++0x inherited constructors. - Diag(Name.getSourceRange().getBegin(), + Diag(Name.getLocStart(), getLangOptions().CPlusPlus0x ? diag::warn_cxx98_compat_using_decl_constructor : diag::err_using_decl_constructor) @@ -5874,12 +5874,12 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, return 0; case UnqualifiedId::IK_DestructorName: - Diag(Name.getSourceRange().getBegin(), diag::err_using_decl_destructor) + Diag(Name.getLocStart(), diag::err_using_decl_destructor) << SS.getRange(); return 0; case UnqualifiedId::IK_TemplateId: - Diag(Name.getSourceRange().getBegin(), diag::err_using_decl_template_id) + Diag(Name.getLocStart(), diag::err_using_decl_template_id) << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); return 0; } @@ -5894,7 +5894,7 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, // talk about access decls instead of using decls in the // diagnostics. if (!HasUsingKeyword) { - UsingLoc = Name.getSourceRange().getBegin(); + UsingLoc = Name.getLocStart(); Diag(UsingLoc, diag::warn_access_decl_deprecated) << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using "); @@ -9615,7 +9615,7 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { } VarDecl *ExDecl = BuildExceptionDeclaration(S, TInfo, - D.getSourceRange().getBegin(), + D.getLocStart(), D.getIdentifierLoc(), D.getIdentifier()); if (Invalid) @@ -9871,7 +9871,7 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, /// template <> template <class T> friend class A<int>::B; Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TempParams) { - SourceLocation Loc = DS.getSourceRange().getBegin(); + SourceLocation Loc = DS.getLocStart(); assert(DS.isFriendSpecified()); assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); @@ -10344,7 +10344,7 @@ static void SearchForReturnInStmt(Sema &Self, Stmt *S) { if (!SubStmt) continue; if (isa<ReturnStmt>(SubStmt)) - Self.Diag(SubStmt->getSourceRange().getBegin(), + Self.Diag(SubStmt->getLocStart(), diag::err_return_in_constructor_handler); if (!isa<Expr>(SubStmt)) SearchForReturnInStmt(Self, SubStmt); diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 2adce06ce0..85778e4a43 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3297,7 +3297,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, = InitializedEntity::InitializeParameter(Context, Param); InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(), - /*FIXME:EqualLoc*/UninstExpr->getSourceRange().getBegin()); + /*FIXME:EqualLoc*/UninstExpr->getLocStart()); Expr *ResultE = Result.takeAs<Expr>(); InitializationSequence InitSeq(*this, Entity, Kind, &ResultE, 1); @@ -3418,7 +3418,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, CallType = VariadicBlock; // Block else if (isa<MemberExpr>(Fn)) CallType = VariadicMethod; - Invalid = GatherArgumentsForCall(Call->getSourceRange().getBegin(), FDecl, + Invalid = GatherArgumentsForCall(Call->getLocStart(), FDecl, Proto, 0, Args, NumArgs, AllArgs, CallType); if (Invalid) return true; @@ -3453,7 +3453,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, if (ArgIx < NumArgs) { Arg = Args[ArgIx++]; - if (RequireCompleteType(Arg->getSourceRange().getBegin(), + if (RequireCompleteType(Arg->getLocStart(), ProtoArgType, PDiag(diag::err_call_incomplete_argument) << Arg->getSourceRange())) @@ -3840,7 +3840,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, // Check for a valid return type if (CheckCallReturnType(FuncT->getResultType(), - Fn->getSourceRange().getBegin(), TheCall, + Fn->getLocStart(), TheCall, FDecl)) return ExprError(); @@ -3899,7 +3899,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, Arg = ArgE.takeAs<Expr>(); } - if (RequireCompleteType(Arg->getSourceRange().getBegin(), + if (RequireCompleteType(Arg->getLocStart(), Arg->getType(), PDiag(diag::err_call_incomplete_argument) << Arg->getSourceRange())) @@ -8895,7 +8895,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { // Don't allow returning a objc interface by value. if (RetTy->isObjCObjectType()) { - Diag(ParamInfo.getSourceRange().getBegin(), + Diag(ParamInfo.getLocStart(), diag::err_object_cannot_be_passed_returned_by_value) << 0 << RetTy; return; } @@ -8930,7 +8930,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { I = Fn->arg_type_begin(), E = Fn->arg_type_end(); I != E; ++I) { ParmVarDecl *Param = BuildParmVarDeclForTypedef(CurBlock->TheDecl, - ParamInfo.getSourceRange().getBegin(), + ParamInfo.getLocStart(), *I); Params.push_back(Param); } @@ -9392,7 +9392,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, PartialDiagnostic NotIceDiag, bool AllowFold, PartialDiagnostic FoldDiag) { - SourceLocation DiagLoc = E->getSourceRange().getBegin(); + SourceLocation DiagLoc = E->getLocStart(); if (getLangOptions().CPlusPlus0x) { // C++11 [expr.const]p5: @@ -10641,7 +10641,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { Diag(Loc, diagnostic) << E->getSourceRange(); - SourceLocation Open = E->getSourceRange().getBegin(); + SourceLocation Open = E->getLocStart(); SourceLocation Close = PP.getLocForEndOfToken(E->getSourceRange().getEnd()); Diag(Loc, diag::note_condition_assign_silence) << FixItHint::CreateInsertion(Open, "(") @@ -10675,9 +10675,10 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) { SourceLocation Loc = opE->getOperatorLoc(); Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); + SourceRange ParenERange = ParenE->getSourceRange(); Diag(Loc, diag::note_equality_comparison_silence) - << FixItHint::CreateRemoval(ParenE->getSourceRange().getBegin()) - << FixItHint::CreateRemoval(ParenE->getSourceRange().getEnd()); + << FixItHint::CreateRemoval(ParenERange.getBegin()) + << FixItHint::CreateRemoval(ParenERange.getEnd()); Diag(Loc, diag::note_equality_comparison_to_assign) << FixItHint::CreateReplacement(Loc, "="); } diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 6c7bdeb742..c7152196ca 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1057,12 +1057,12 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, return ExprError(Diag(StartLoc, diag::err_auto_new_requires_ctor_arg) << AllocType << TypeRange); if (initStyle == CXXNewExpr::ListInit) - return ExprError(Diag(Inits[0]->getSourceRange().getBegin(), + return ExprError(Diag(Inits[0]->getLocStart(), diag::err_auto_new_requires_parens) << AllocType << TypeRange); if (NumInits > 1) { Expr *FirstBad = Inits[1]; - return ExprError(Diag(FirstBad->getSourceRange().getBegin(), + return ExprError(Diag(FirstBad->getLocStart(), diag::err_auto_new_ctor_multiple_expressions) << AllocType << TypeRange); } @@ -1157,11 +1157,11 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, llvm::APInt::getNullValue(Value.getBitWidth()), Value.isUnsigned())) { if (getLangOptions().CPlusPlus0x) - Diag(ArraySize->getSourceRange().getBegin(), + Diag(ArraySize->getLocStart(), diag::warn_typecheck_negative_array_new_size) << ArraySize->getSourceRange(); else - return ExprError(Diag(ArraySize->getSourceRange().getBegin(), + return ExprError(Diag(ArraySize->getLocStart(), diag::err_typecheck_negative_array_size) << ArraySize->getSourceRange()); } else if (!AllocType->isDependentType()) { @@ -1169,12 +1169,12 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, ConstantArrayType::getNumAddressingBits(Context, AllocType, Value); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { if (getLangOptions().CPlusPlus0x) - Diag(ArraySize->getSourceRange().getBegin(), + Diag(ArraySize->getLocStart(), diag::warn_array_new_too_large) << Value.toString(10) << ArraySize->getSourceRange(); else - return ExprError(Diag(ArraySize->getSourceRange().getBegin(), + return ExprError(Diag(ArraySize->getLocStart(), diag::err_array_too_large) << Value.toString(10) << ArraySize->getSourceRange()); @@ -2453,7 +2453,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, if (!Fn) return ExprError(); - if (DiagnoseUseOfDecl(Fn, From->getSourceRange().getBegin())) + if (DiagnoseUseOfDecl(Fn, From->getLocStart())) return ExprError(); From = FixOverloadedFunctionReference(From, Found, Fn); @@ -2562,12 +2562,12 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, if (SCS.IncompatibleObjC && Action != AA_Casting) { // Diagnose incompatible Objective-C conversions if (Action == AA_Initializing || Action == AA_Assigning) - Diag(From->getSourceRange().getBegin(), + Diag(From->getLocStart(), diag::ext_typecheck_convert_incompatible_pointer) << ToType << From->getType() << Action << From->getSourceRange() << 0; else - Diag(From->getSourceRange().getBegin(), + Diag(From->getLocStart(), diag::ext_typecheck_convert_incompatible_pointer) << From->getType() << ToType << Action << From->getSourceRange() << 0; @@ -2580,10 +2580,10 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, !CheckObjCARCUnavailableWeakConversion(ToType, From->getType())) { if (Action == AA_Initializing) - Diag(From->getSourceRange().getBegin(), + Diag(From->getLocStart(), diag::err_arc_weak_unavailable_assign); else - Diag(From->getSourceRange().getBegin(), + Diag(From->getLocStart(), diag::err_arc_convesion_of_weak_unavailable) << (Action == AA_Casting) << From->getType() << ToType << From->getSourceRange(); @@ -3280,7 +3280,7 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc, if (T->isObjectType() || T->isFunctionType()) T = S.Context.getRValueReferenceType(T); OpaqueArgExprs.push_back( - OpaqueValueExpr(Args[I]->getTypeLoc().getSourceRange().getBegin(), + OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(), T.getNonLValueExprType(S.Context), Expr::getValueKindForType(T))); ArgExprs.push_back(&OpaqueArgExprs.back()); @@ -4661,7 +4661,7 @@ ExprResult Sema::ActOnDecltypeExpression(Expr *E) { continue; if (CheckCallReturnType(Call->getCallReturnType(), - Call->getSourceRange().getBegin(), + Call->getLocStart(), Call, Call->getDirectCallee())) return ExprError(); } diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index fe4815c30f..7c1de21385 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -118,13 +118,13 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, // [dcl.init.string]p2 if (StrLength > CAT->getSize().getZExtValue()) - S.Diag(Str->getSourceRange().getBegin(), + S.Diag(Str->getLocStart(), diag::err_initializer_string_for_char_array_too_long) << Str->getSourceRange(); } else { // C99 6.7.8p14. if (StrLength-1 > CAT->getSize().getZExtValue()) - S.Diag(Str->getSourceRange().getBegin(), + S.Diag(Str->getLocStart(), diag::warn_initializer_string_for_char_array_too_long) << Str->getSourceRange(); } @@ -289,7 +289,7 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field, const InitializedEntity &ParentEntity, InitListExpr *ILE, bool &RequiresSecondPass) { - SourceLocation Loc = ILE->getSourceRange().getBegin(); + SourceLocation Loc = ILE->getLocStart(); unsigned NumInits = ILE->getNumInits(); InitializedEntity MemberEntity = InitializedEntity::InitializeMember(Field, &ParentEntity); @@ -354,9 +354,9 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, bool &RequiresSecondPass) { |