summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/AnalysisBasedWarnings.cpp101
-rw-r--r--clang/lib/Sema/JumpDiagnostics.cpp16
-rw-r--r--clang/lib/Sema/Sema.cpp10
-rw-r--r--clang/lib/Sema/SemaAttr.cpp4
-rw-r--r--clang/lib/Sema/SemaCast.cpp28
-rw-r--r--clang/lib/Sema/SemaChecking.cpp620
-rw-r--r--clang/lib/Sema/SemaCoroutine.cpp4
-rw-r--r--clang/lib/Sema/SemaDecl.cpp196
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp58
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp212
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp40
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp4
-rw-r--r--clang/lib/Sema/SemaExpr.cpp308
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp155
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp146
-rw-r--r--clang/lib/Sema/SemaInit.cpp298
-rw-r--r--clang/lib/Sema/SemaLambda.cpp41
-rw-r--r--clang/lib/Sema/SemaLookup.cpp2
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp10
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp150
-rw-r--r--clang/lib/Sema/SemaOverload.cpp221
-rw-r--r--clang/lib/Sema/SemaPseudoObject.cpp2
-rw-r--r--clang/lib/Sema/SemaStmt.cpp73
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp86
-rw-r--r--clang/lib/Sema/SemaStmtAttr.cpp8
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp215
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp6
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp4
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp72
-rw-r--r--clang/lib/Sema/SemaTemplateVariadic.cpp4
-rw-r--r--clang/lib/Sema/SemaType.cpp102
-rw-r--r--clang/lib/Sema/TreeTransform.h377
32 files changed, 1698 insertions, 1875 deletions
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index 15a0adb3cde..73787610b51 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -114,7 +114,7 @@ static void CheckUnreachable(Sema &S, AnalysisDeclContext &AC) {
//
// Note that this is also a performance optimization. Analyzing
// headers many times can be expensive.
- if (!S.getSourceManager().isInMainFile(AC.getDecl()->getLocStart()))
+ if (!S.getSourceManager().isInMainFile(AC.getDecl()->getBeginLoc()))
return;
UnreachableCodeHandler UC(S);
@@ -252,7 +252,7 @@ static void checkRecursiveFunction(Sema &S, const FunctionDecl *FD,
// Emit diagnostic if a recursive function call is detected for all paths.
if (checkForRecursiveFunctionCall(FD, cfg))
- S.Diag(Body->getLocStart(), diag::warn_infinite_recursive_function);
+ S.Diag(Body->getBeginLoc(), diag::warn_infinite_recursive_function);
}
//===----------------------------------------------------------------------===//
@@ -651,7 +651,7 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
// Short circuit for compilation speed.
if (CD.checkDiagnostics(Diags, ReturnsVoid, HasNoReturn))
return;
- SourceLocation LBrace = Body->getLocStart(), RBrace = Body->getLocEnd();
+ SourceLocation LBrace = Body->getBeginLoc(), RBrace = Body->getLocEnd();
auto EmitDiag = [&](SourceLocation Loc, unsigned DiagID) {
if (IsCoroutine)
S.Diag(Loc, DiagID) << FSI->CoroutinePromise->getType();
@@ -771,8 +771,7 @@ static void CreateIfFixit(Sema &S, const Stmt *If, const Stmt *Then,
if (CondVal) {
// If condition is always true, remove all but the 'then'.
Fixit1 = FixItHint::CreateRemoval(
- CharSourceRange::getCharRange(If->getLocStart(),
- Then->getLocStart()));
+ CharSourceRange::getCharRange(If->getBeginLoc(), Then->getBeginLoc()));
if (Else) {
SourceLocation ElseKwLoc = S.getLocForEndOfToken(Then->getLocEnd());
Fixit2 = FixItHint::CreateRemoval(
@@ -781,9 +780,8 @@ static void CreateIfFixit(Sema &S, const Stmt *If, const Stmt *Then,
} else {
// If condition is always false, remove all but the 'else'.
if (Else)
- Fixit1 = FixItHint::CreateRemoval(
- CharSourceRange::getCharRange(If->getLocStart(),
- Else->getLocStart()));
+ Fixit1 = FixItHint::CreateRemoval(CharSourceRange::getCharRange(
+ If->getBeginLoc(), Else->getBeginLoc()));
else
Fixit1 = FixItHint::CreateRemoval(If->getSourceRange());
}
@@ -797,7 +795,7 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
switch (Use.getKind()) {
case UninitUse::Always:
- S.Diag(Use.getUser()->getLocStart(), diag::warn_uninit_var)
+ S.Diag(Use.getUser()->getBeginLoc(), diag::warn_uninit_var)
<< VD->getDeclName() << IsCapturedByBlock
<< Use.getUser()->getSourceRange();
return;
@@ -809,8 +807,8 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
<< (Use.getKind() == UninitUse::AfterDecl ? 4 : 5)
<< const_cast<DeclContext*>(VD->getLexicalDeclContext())
<< VD->getSourceRange();
- S.Diag(Use.getUser()->getLocStart(), diag::note_uninit_var_use)
- << IsCapturedByBlock << Use.getUser()->getSourceRange();
+ S.Diag(Use.getUser()->getBeginLoc(), diag::note_uninit_var_use)
+ << IsCapturedByBlock << Use.getUser()->getSourceRange();
return;
case UninitUse::Maybe:
@@ -880,8 +878,8 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
if ((BO->getOpcode() == BO_LAnd && I->Output) ||
(BO->getOpcode() == BO_LOr && !I->Output))
// true && y -> y, false || y -> y.
- Fixit1 = FixItHint::CreateRemoval(SourceRange(BO->getLocStart(),
- BO->getOperatorLoc()));
+ Fixit1 = FixItHint::CreateRemoval(
+ SourceRange(BO->getBeginLoc(), BO->getOperatorLoc()));
else
// false && y -> false, true || y -> true.
Fixit1 = FixItHint::CreateReplacement(BO->getSourceRange(), FixitStr);
@@ -943,8 +941,8 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
S.Diag(Range.getBegin(), diag::warn_sometimes_uninit_var)
<< VD->getDeclName() << IsCapturedByBlock << DiagKind
<< Str << I->Output << Range;
- S.Diag(User->getLocStart(), diag::note_uninit_var_use)
- << IsCapturedByBlock << User->getSourceRange();
+ S.Diag(User->getBeginLoc(), diag::note_uninit_var_use)
+ << IsCapturedByBlock << User->getSourceRange();
if (RemoveDiagKind != -1)
S.Diag(Fixit1.RemoveRange.getBegin(), diag::note_uninit_fixit_remove_cond)
<< RemoveDiagKind << Str << I->Output << Fixit1 << Fixit2;
@@ -953,7 +951,7 @@ static void DiagUninitUse(Sema &S, const VarDecl *VD, const UninitUse &Use,
}
if (!Diagnosed)
- S.Diag(Use.getUser()->getLocStart(), diag::warn_maybe_uninit_var)
+ S.Diag(Use.getUser()->getBeginLoc(), diag::warn_maybe_uninit_var)
<< VD->getDeclName() << IsCapturedByBlock
<< Use.getUser()->getSourceRange();
}
@@ -985,9 +983,8 @@ static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
ContainsReference CR(S.Context, DRE);
CR.Visit(Initializer);
if (CR.doesContainReference()) {
- S.Diag(DRE->getLocStart(),
- diag::warn_uninit_self_reference_in_init)
- << VD->getDeclName() << VD->getLocation() << DRE->getSourceRange();
+ S.Diag(DRE->getBeginLoc(), diag::warn_uninit_self_reference_in_init)
+ << VD->getDeclName() << VD->getLocation() << DRE->getSourceRange();
return true;
}
}
@@ -996,9 +993,9 @@ static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
} else {
const BlockExpr *BE = cast<BlockExpr>(Use.getUser());
if (VD->getType()->isBlockPointerType() && !VD->hasAttr<BlocksAttr>())
- S.Diag(BE->getLocStart(),
+ S.Diag(BE->getBeginLoc(),
diag::warn_uninit_byref_blockvar_captured_by_block)
- << VD->getDeclName();
+ << VD->getDeclName();
else
DiagUninitUse(S, VD, Use, true);
}
@@ -1007,8 +1004,8 @@ static bool DiagnoseUninitializedUse(Sema &S, const VarDecl *VD,
// the initializer of that declaration & we didn't already suggest
// an initialization fixit.
if (!SuggestInitializationFixit(S, VD))
- S.Diag(VD->getLocStart(), diag::note_var_declared_here)
- << VD->getDeclName();
+ S.Diag(VD->getBeginLoc(), diag::note_var_declared_here)
+ << VD->getDeclName();
return true;
}
@@ -1098,7 +1095,7 @@ namespace {
// attribute in template instantiations as it may not be
// unreachable in all instantiations of the template.
if (!IsTemplateInstantiation)
- S.Diag(AS->getLocStart(),
+ S.Diag(AS->getBeginLoc(),
diag::warn_fallthrough_attr_unreachable);
markFallthroughVisited(AS);
++AnnotatedCnt;
@@ -1266,12 +1263,12 @@ static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
IsTemplateInstantiation))
continue;
- S.Diag(Label->getLocStart(),
- PerFunction ? diag::warn_unannotated_fallthrough_per_function
- : diag::warn_unannotated_fallthrough);
+ S.Diag(Label->getBeginLoc(),
+ PerFunction ? diag::warn_unannotated_fallthrough_per_function
+ : diag::warn_unannotated_fallthrough);
if (!AnnotatedCnt) {
- SourceLocation L = Label->getLocStart();
+ SourceLocation L = Label->getBeginLoc();
if (L.isMacroID())
continue;
if (S.getLangOpts().CPlusPlus11) {
@@ -1297,7 +1294,7 @@ static void DiagnoseSwitchLabelsFallthrough(Sema &S, AnalysisDeclContext &AC,
}
for (const auto *F : FM.getFallthroughStmts())
- S.Diag(F->getLocStart(), diag::err_fallthrough_attr_invalid_placement);
+ S.Diag(F->getBeginLoc(), diag::err_fallthrough_attr_invalid_placement);
}
static bool isInLoop(const ASTContext &Ctx, const ParentMap &PM,
@@ -1396,9 +1393,9 @@ static void diagnoseRepeatedUseOfWeak(Sema &S,
SourceManager &SM = S.getSourceManager();
llvm::sort(UsesByStmt.begin(), UsesByStmt.end(),
[&SM](const StmtUsesPair &LHS, const StmtUsesPair &RHS) {
- return SM.isBeforeInTranslationUnit(LHS.first->getLocStart(),
- RHS.first->getLocStart());
- });
+ return SM.isBeforeInTranslationUnit(LHS.first->getBeginLoc(),
+ RHS.first->getBeginLoc());
+ });
// Classify the current code body for better warning text.
// This enum should stay in sync with the cases in
@@ -1467,15 +1464,15 @@ static void diagnoseRepeatedUseOfWeak(Sema &S,
continue;
// Show the first time the object was read.
- S.Diag(FirstRead->getLocStart(), DiagKind)
- << int(ObjectKind) << KeyProp << int(FunctionKind)
- << FirstRead->getSourceRange();
+ S.Diag(FirstRead->getBeginLoc(), DiagKind)
+ << int(ObjectKind) << KeyProp << int(FunctionKind)
+ << FirstRead->getSourceRange();
// Print all the other accesses as notes.
for (const auto &Use : Uses) {
if (Use.getUseExpr() == FirstRead)
continue;
- S.Diag(Use.getUseExpr()->getLocStart(),
+ S.Diag(Use.getUseExpr()->getBeginLoc(),
diag::note_arc_weak_also_accessed_here)
<< Use.getUseExpr()->getSourceRange();
}
@@ -1538,7 +1535,7 @@ public:
// Prefer a more confident report over a less confident one.
if (a.getKind() != b.getKind())
return a.getKind() > b.getKind();
- return a.getUser()->getLocStart() < b.getUser()->getLocStart();
+ return a.getUser()->getBeginLoc() < b.getUser()->getBeginLoc();
});
for (const auto &U : *vec) {
@@ -1605,7 +1602,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
OptionalNotes getNotes() const {
if (Verbose && CurrentFunction) {
- PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
+ PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(),
S.PDiag(diag::note_thread_warning_in_fun)
<< CurrentFunction);
return OptionalNotes(1, FNote);
@@ -1616,7 +1613,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
OptionalNotes getNotes(const PartialDiagnosticAt &Note) const {
OptionalNotes ONS(1, Note);
if (Verbose && CurrentFunction) {
- PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
+ PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(),
S.PDiag(diag::note_thread_warning_in_fun)
<< CurrentFunction);
ONS.push_back(std::move(FNote));
@@ -1630,7 +1627,7 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler {
ONS.push_back(Note1);
ONS.push_back(Note2);
if (Verbose && CurrentFunction) {
- PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(),
+ PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(),
S.PDiag(diag::note_thread_warning_in_fun)
<< CurrentFunction);
ONS.push_back(std::move(FNote));
@@ -2070,7 +2067,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
// Install the logical handler for -Wtautological-overlap-compare
llvm::Optional<LogicalErrorHandler> LEH;
if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison,
- D->getLocStart())) {
+ D->getBeginLoc())) {
LEH.emplace(S);
AC.getCFGBuildOptions().Observer = &*LEH;
}
@@ -2147,9 +2144,9 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
SourceLocation FL = AC.getDecl()->getLocation();
SourceLocation FEL = AC.getDecl()->getLocEnd();
threadSafety::ThreadSafetyReporter Reporter(S, FL, FEL);
- if (!Diags.isIgnored(diag::warn_thread_safety_beta, D->getLocStart()))
+ if (!Diags.isIgnored(diag::warn_thread_safety_beta, D->getBeginLoc()))
Reporter.setIssueBetaWarnings(true);
- if (!Diags.isIgnored(diag::warn_thread_safety_verbose, D->getLocStart()))
+ if (!Diags.isIgnored(diag::warn_thread_safety_verbose, D->getBeginLoc()))
Reporter.setVerbose(true);
threadSafety::runThreadSafetyAnalysis(AC, Reporter,
@@ -2164,9 +2161,9 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
Analyzer.run(AC);
}
- if (!Diags.isIgnored(diag::warn_uninit_var, D->getLocStart()) ||
- !Diags.isIgnored(diag::warn_sometimes_uninit_var, D->getLocStart()) ||
- !Diags.isIgnored(diag::warn_maybe_uninit_var, D->getLocStart())) {
+ if (!Diags.isIgnored(diag::warn_uninit_var, D->getBeginLoc()) ||
+ !Diags.isIgnored(diag::warn_sometimes_uninit_var, D->getBeginLoc()) ||
+ !Diags.isIgnored(diag::warn_maybe_uninit_var, D->getBeginLoc())) {
if (CFG *cfg = AC.getCFG()) {
UninitValsDiagReporter reporter(S);
UninitVariablesAnalysisStats stats;
@@ -2189,29 +2186,29 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
}
bool FallThroughDiagFull =
- !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getLocStart());
+ !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getBeginLoc());
bool FallThroughDiagPerFunction = !Diags.isIgnored(
- diag::warn_unannotated_fallthrough_per_function, D->getLocStart());
+ diag::warn_unannotated_fallthrough_per_function, D->getBeginLoc());
if (FallThroughDiagFull || FallThroughDiagPerFunction ||
fscope->HasFallthroughStmt) {
DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull);
}
if (S.getLangOpts().ObjCWeak &&
- !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, D->getLocStart()))
+ !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, D->getBeginLoc()))
diagnoseRepeatedUseOfWeak(S, fscope, D, AC.getParentMap());
// Check for infinite self-recursion in functions
if (!Diags.isIgnored(diag::warn_infinite_recursive_function,
- D->getLocStart())) {
+ D->getBeginLoc())) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
checkRecursiveFunction(S, FD, Body, AC);
}
}
// Check for throw out of non-throwing function.
- if (!Diags.isIgnored(diag::warn_throw_in_noexcept_func, D->getLocStart()))
+ if (!Diags.isIgnored(diag::warn_throw_in_noexcept_func, D->getBeginLoc()))
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
if (S.getLangOpts().CPlusPlus && isNoexcept(FD))
checkThrowInNonThrowingFunc(S, FD, AC);
@@ -2219,7 +2216,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
// If none of the previous checks caused a CFG build, trigger one here
// for -Wtautological-overlap-compare
if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison,
- D->getLocStart())) {
+ D->getBeginLoc())) {
AC.getCFG();
}
diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp
index 58a7862370c..a7495e8e048 100644
--- a/clang/lib/Sema/JumpDiagnostics.cpp
+++ b/clang/lib/Sema/JumpDiagnostics.cpp
@@ -299,7 +299,7 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
auto *CS = cast<ObjCForCollectionStmt>(S);
unsigned Diag = diag::note_protected_by_objc_fast_enumeration;
unsigned NewParentScope = Scopes.size();
- Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getLocStart()));
+ Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getBeginLoc()));
BuildScopeInformation(CS->getBody(), NewParentScope);
return;
}
@@ -353,16 +353,16 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
// Cannot jump into the middle of the condition.
unsigned NewParentScope = Scopes.size();
- Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart()));
+ Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc()));
BuildScopeInformation(IS->getCond(), NewParentScope);
// Jumps into either arm of an 'if constexpr' are not allowed.
NewParentScope = Scopes.size();
- Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart()));
+ Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc()));
BuildScopeInformation(IS->getThen(), NewParentScope);
if (Stmt *Else = IS->getElse()) {
NewParentScope = Scopes.size();
- Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart()));
+ Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc()));
BuildScopeInformation(Else, NewParentScope);
}
return;
@@ -619,11 +619,11 @@ void JumpScopeChecker::VerifyJumps() {
continue;
SourceLocation Loc;
if (CaseStmt *CS = dyn_cast<CaseStmt>(SC))
- Loc = CS->getLocStart();
+ Loc = CS->getBeginLoc();
else if (DefaultStmt *DS = dyn_cast<DefaultStmt>(SC))
- Loc = DS->getLocStart();
+ Loc = DS->getBeginLoc();
else
- Loc = SC->getLocStart();
+ Loc = SC->getBeginLoc();
CheckJump(SS, SC, Loc, diag::err_switch_into_protected_scope, 0,
diag::warn_cxx98_compat_switch_into_protected_scope);
}
@@ -863,7 +863,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc,
// less nested scope. Check if it crosses a __finally along the way.
for (unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) {
if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) {
- S.Diag(From->getLocStart(), diag::warn_jump_out_of_seh_finally);
+ S.Diag(From->getBeginLoc(), diag::warn_jump_out_of_seh_finally);
break;
}
}
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 49f3decc115..e4bf27de8b8 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -441,7 +441,7 @@ void Sema::diagnoseNullableToNonnullConversion(QualType DstType,
void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) {
if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant,
- E->getLocStart()))
+ E->getBeginLoc()))
return;
// nullptr only exists from C++11 on, so don't warn on its absence earlier.
if (!getLangOpts().CPlusPlus11)
@@ -454,13 +454,13 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) {
// If it is a macro from system header, and if the macro name is not "NULL",
// do not warn.
- SourceLocation MaybeMacroLoc = E->getLocStart();
+ SourceLocation MaybeMacroLoc = E->getBeginLoc();
if (Diags.getSuppressSystemWarnings() &&
SourceMgr.isInSystemMacro(MaybeMacroLoc) &&
!findMacroSpelling(MaybeMacroLoc, "NULL"))
return;
- Diag(E->getLocStart(), diag::warn_zero_as_null_pointer_constant)
+ Diag(E->getBeginLoc(), diag::warn_zero_as_null_pointer_constant)
<< FixItHint::CreateReplacement(E->getSourceRange(), "nullptr");
}
@@ -488,7 +488,7 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty,
assert((VK == VK_RValue || !E->isRValue()) && "can't cast rvalue to lvalue");
#endif
- diagnoseNullableToNonnullConversion(Ty, E->getType(), E->getLocStart());
+ diagnoseNullableToNonnullConversion(Ty, E->getType(), E->getBeginLoc());
diagnoseZeroToNullptrConversion(Kind, E);
QualType ExprTy = Context.getCanonicalType(E->getType());
@@ -1899,6 +1899,6 @@ bool Sema::checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType QT) {
bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
IdentifierInfo *FnName = D.getIdentifier();
- return checkOpenCLDisabledTypeOrDecl(&D, E.getLocStart(), FnName,
+ return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName,
OpenCLDeclExtMap, 1, D.getSourceRange());
}
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index f6f7afe757a..056d031fd83 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -405,7 +405,7 @@ void Sema::ActOnPragmaMSSeg(SourceLocation PragmaLocation,
Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName
<< "stack empty";
if (SegmentName &&
- !checkSectionName(SegmentName->getLocStart(), SegmentName->getString()))
+ !checkSectionName(SegmentName->getBeginLoc(), SegmentName->getString()))
return;
Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName);
}
@@ -669,7 +669,7 @@ void Sema::AddPragmaAttributes(Scope *S, Decl *D) {
void Sema::PrintPragmaAttributeInstantiationPoint() {
assert(PragmaAttributeCurrentTargetDecl && "Expected an active declaration");
- Diags.Report(PragmaAttributeCurrentTargetDecl->getLocStart(),
+ Diags.Report(PragmaAttributeCurrentTargetDecl->getBeginLoc(),
diag::note_pragma_attribute_applied_decl_here);
}
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index 8599fe09a5d..ccf10639bea 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -1277,7 +1277,7 @@ TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
}
Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship(
- SrcExpr->getLocStart(), ToType, FromType, DerivedToBase, ObjCConversion,
+ SrcExpr->getBeginLoc(), ToType, FromType, DerivedToBase, ObjCConversion,
ObjCLifetimeConversion);
if (RefResult != Sema::Ref_Compatible) {
if (CStyle || RefResult == Sema::Ref_Incompatible)
@@ -1294,7 +1294,7 @@ TryCastResult TryLValueToRValueCast(Sema &Self, Expr *SrcExpr,
Kind = CK_DerivedToBase;
CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
/*DetectVirtual=*/true);
- if (!Self.IsDerivedFrom(SrcExpr->getLocStart(), SrcExpr->getType(),
+ if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(),
R->getPointeeType(), Paths))
return TC_NotApplicable;
@@ -2619,9 +2619,9 @@ void CastOperation::CheckCStyleCast() {
} else if (!SrcType->isArithmeticType()) {
if (!DestType->isIntegralType(Self.Context) &&
DestType->isArithmeticType()) {
- Self.Diag(SrcExpr.get()->getLocStart(),
- diag::err_cast_pointer_to_non_pointer_int)
- << DestType << SrcExpr.get()->getSourceRange();
+ Self.Diag(SrcExpr.get()->getBeginLoc(),
+ diag::err_cast_pointer_to_non_pointer_int)
+ << DestType << SrcExpr.get()->getSourceRange();
SrcExpr = ExprError();
return;
}
@@ -2630,8 +2630,8 @@ void CastOperation::CheckCStyleCast() {
if (Self.getLangOpts().OpenCL &&
!Self.getOpenCLOptions().isEnabled("cl_khr_fp16")) {
if (DestType->isHalfType()) {
- Self.Diag(SrcExpr.get()->getLocStart(), diag::err_opencl_cast_to_half)
- << DestType << SrcExpr.get()->getSourceRange();
+ Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half)
+ << DestType << SrcExpr.get()->getSourceRange();
SrcExpr = ExprError();
return;
}
@@ -2651,18 +2651,18 @@ void CastOperation::CheckCStyleCast() {
if (CastPtr->getPointeeType()->isObjCLifetimeType() &&
ExprPtr->getPointeeType()->isObjCLifetimeType() &&
!CastQuals.compatiblyIncludesObjCLifetime(ExprQuals)) {
- Self.Diag(SrcExpr.get()->getLocStart(),
+ Self.Diag(SrcExpr.get()->getBeginLoc(),
diag::err_typecheck_incompatible_ownership)
- << SrcType << DestType << Sema::AA_Casting
- << SrcExpr.get()->getSourceRange();
+ << SrcType << DestType << Sema::AA_Casting
+ << SrcExpr.get()->getSourceRange();
return;
}
}
}
else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) {
- Self.Diag(SrcExpr.get()->getLocStart(),
+ Self.Diag(SrcExpr.get()->getBeginLoc(),
diag::err_arc_convesion_of_weak_unavailable)
- << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
+ << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
SrcExpr = ExprError();
return;
}
@@ -2710,10 +2710,10 @@ static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
}
// This is a variant of int **x; const int **y = (const int **)x;
if (qualifiers == -1)
- Self.Diag(SrcExpr.get()->getLocStart(), diag::warn_cast_qual2)
+ Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2)
<< SrcType << DestType;
else
- Self.Diag(SrcExpr.get()->getLocStart(), diag::warn_cast_qual)
+ Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual)
<< TheOffendingSrcType << TheOffendingDestType << qualifiers;
}
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8af2c07fff5..9083cbddd08 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -117,7 +117,7 @@ static bool checkArgCount(Sema &S, CallExpr *call, unsigned desiredArgCount) {
<< call->getSourceRange();
// Highlight all the excess arguments.
- SourceRange range(call->getArg(desiredArgCount)->getLocStart(),
+ SourceRange range(call->getArg(desiredArgCount)->getBeginLoc(),
call->getArg(argCount - 1)->getLocEnd());
return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
@@ -135,8 +135,8 @@ static bool SemaBuiltinAnnotation(Sema &S, CallExpr *TheCall) {
Expr *ValArg = TheCall->getArg(0);
QualType Ty = ValArg->getType();
if (!Ty->isIntegerType()) {
- S.Diag(ValArg->getLocStart(), diag::err_builtin_annotation_first_arg)
- << ValArg->getSourceRange();
+ S.Diag(ValArg->getBeginLoc(), diag::err_builtin_annotation_first_arg)
+ << ValArg->getSourceRange();
return true;
}
@@ -144,8 +144,8 @@ static bool SemaBuiltinAnnotation(Sema &S, CallExpr *TheCall) {
Expr *StrArg = TheCall->getArg(1)->IgnoreParenCasts();
StringLiteral *Literal = dyn_cast<StringLiteral>(StrArg);
if (!Literal || !Literal->isAscii()) {
- S.Diag(StrArg->getLocStart(), diag::err_builtin_annotation_second_arg)
- << StrArg->getSourceRange();
+ S.Diag(StrArg->getBeginLoc(), diag::err_builtin_annotation_second_arg)
+ << StrArg->getSourceRange();
return true;
}
@@ -166,7 +166,7 @@ static bool SemaBuiltinMSVCAnnotation(Sema &S, CallExpr *TheCall) {
for (Expr *Arg : TheCall->arguments()) {
auto *Literal = dyn_cast<StringLiteral>(Arg->IgnoreParenCasts());
if (!Literal || !Literal->isWide()) {
- S.Diag(Arg->getLocStart(), diag::err_msvc_annotation_wide_str)
+ S.Diag(Arg->getBeginLoc(), diag::err_msvc_annotation_wide_str)
<< Arg->getSourceRange();
return true;
}
@@ -182,7 +182,7 @@ static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
return true;
ExprResult Arg(TheCall->getArg(0));
- QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getLocStart());
+ QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getBeginLoc());
if (ResultType.isNull())
return true;
@@ -200,7 +200,7 @@ static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall) {
ExprResult Arg = TheCall->getArg(I);
QualType Ty = Arg.get()->getType();
if (!Ty->isIntegerType()) {
- S.Diag(Arg.get()->getLocStart(), diag::err_overflow_builtin_must_be_int)
+ S.Diag(Arg.get()->getBeginLoc(), diag::err_overflow_builtin_must_be_int)
<< Ty << Arg.get()->getSourceRange();
return true;
}
@@ -221,7 +221,7 @@ static bool SemaBuiltinOverflow(Sema &S, CallExpr *TheCall) {
const auto *PtrTy = Ty->getAs<PointerType>();
if (!(PtrTy && PtrTy->getPointeeType()->isIntegerType() &&
!PtrTy->getPointeeType().isConstQualified())) {
- S.Diag(Arg.get()->getLocStart(),
+ S.Diag(Arg.get()->getBeginLoc(),
diag::err_overflow_builtin_must_be_ptr_int)
<< Ty << Arg.get()->getSourceRange();
return true;
@@ -258,7 +258,7 @@ static void SemaBuiltinMemChkCall(Sema &S, FunctionDecl *FDecl,
// confirmed overflow so generate the diagnostic.
IdentifierInfo *FnName = FDecl->getIdentifier();
- SourceLocation SL = TheCall->getLocStart();
+ SourceLocation SL = TheCall->getBeginLoc();
SourceRange SR = TheCall->getSourceRange();
S.Diag(SL, diag::warn_memcpy_chk_overflow) << SR << FnName;
@@ -268,7 +268,7 @@ static bool SemaBuiltinCallWithStaticChain(Sema &S, CallExpr *BuiltinCall) {
if (checkArgCount(S, BuiltinCall, 2))
return true;
- SourceLocation BuiltinLoc = BuiltinCall->getLocStart();
+ SourceLocation BuiltinLoc = BuiltinCall->getBeginLoc();
Expr *Builtin = BuiltinCall->getCallee()->IgnoreImpCasts();
Expr *Call = BuiltinCall->getArg(0);
Expr *Chain = BuiltinCall->getArg(1);
@@ -375,9 +375,9 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
SourceLocation ErrorLoc;
if (isa<BlockExpr>(BlockArg)) {
BlockDecl *BD = cast<BlockExpr>(BlockArg)->getBlockDecl();
- ErrorLoc = BD->getParamDecl(ArgCounter)->getLocStart();
+ ErrorLoc = BD->getParamDecl(ArgCounter)->getBeginLoc();
} else if (isa<DeclRefExpr>(BlockArg)) {
- ErrorLoc = cast<DeclRefExpr>(BlockArg)->getLocStart();
+ ErrorLoc = cast<DeclRefExpr>(BlockArg)->getBeginLoc();
}
S.Diag(ErrorLoc,
diag::err_opencl_enqueue_kernel_blocks_non_local_void_args);
@@ -390,8 +390,8 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
- S.Diag(Call->getLocStart(), diag::err_opencl_requires_extension)
- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
+ << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
return true;
}
return false;
@@ -407,16 +407,14 @@ static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
// First argument is an ndrange_t type.
Expr *NDRangeArg = TheCall->getArg(0);
if (NDRangeArg->getType().getUnqualifiedType().getAsString() != "ndrange_t") {
- S.Diag(NDRangeArg->getLocStart(),
- diag::err_opencl_builtin_expected_type)
+ S.Diag(NDRangeArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "'ndrange_t'";
return true;
}
Expr *BlockArg = TheCall->getArg(1);
if (!isBlockPointer(BlockArg)) {
- S.Diag(BlockArg->getLocStart(),
- diag::err_opencl_builtin_expected_type)
+ S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "block";
return true;
}
@@ -432,8 +430,7 @@ static bool SemaOpenCLBuiltinKernelWorkGroupSize(Sema &S, CallExpr *TheCall) {
Expr *BlockArg = TheCall->getArg(0);
if (!isBlockPointer(BlockArg)) {
- S.Diag(BlockArg->getLocStart(),
- diag::err_opencl_builtin_expected_type)
+ S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "block";
return true;
}
@@ -467,7 +464,7 @@ static bool checkOpenCLEnqueueVariadicArgs(Sema &S, CallExpr *TheCall,
// For each argument passed to the block, a corresponding uint needs to
// be passed to describe the size of the local memory.
if (TotalNumArgs != NumBlockParams + NumNonVarArgs) {
- S.Diag(TheCall->getLocStart(),
+ S.Diag(TheCall->getBeginLoc(),
diag::err_opencl_enqueue_kernel_local_size_args);
return true;
}
@@ -507,7 +504,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
unsigned NumArgs = TheCall->getNumArgs();
if (NumArgs < 4) {
- S.Diag(TheCall->getLocStart(), diag::err_typecheck_call_too_few_args);
+ S.Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_few_args);
return true;
}
@@ -518,7 +515,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
// First argument always needs to be a queue_t type.
if (!Arg0->getType()->isQueueT()) {
- S.Diag(TheCall->getArg(0)->getLocStart(),
+ S.Diag(TheCall->getArg(0)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << S.Context.OCLQueueTy;
return true;
@@ -526,7 +523,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
// Second argument always needs to be a kernel_enqueue_flags_t enum value.
if (!Arg1->getType()->isIntegerType()) {
- S.Diag(TheCall->getArg(1)->getLocStart(),
+ S.Diag(TheCall->getArg(1)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "'kernel_enqueue_flags_t' (i.e. uint)";
return true;
@@ -534,7 +531,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
// Third argument is always an ndrange_t type.
if (Arg2->getType().getUnqualifiedType().getAsString() != "ndrange_t") {
- S.Diag(TheCall->getArg(2)->getLocStart(),
+ S.Diag(TheCall->getArg(2)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "'ndrange_t'";
return true;
@@ -545,7 +542,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
if (NumArgs == 4) {
// check that the last argument is the right block type.
if (!isBlockPointer(Arg3)) {
- S.Diag(Arg3->getLocStart(), diag::err_opencl_builtin_expected_type)
+ S.Diag(Arg3->getBeginLoc(), diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "block";
return true;
}
@@ -553,7 +550,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
const BlockPointerType *BPT =
cast<BlockPointerType>(Arg3->getType().getCanonicalType());
if (BPT->getPointeeType()->getAs<FunctionProtoType>()->getNumParams() > 0) {
- S.Diag(Arg3->getLocStart(),
+ S.Diag(Arg3->getBeginLoc(),
diag::err_opencl_enqueue_kernel_blocks_no_args);
return true;
}
@@ -568,7 +565,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
// check common block argument.
Expr *Arg6 = TheCall->getArg(6);
if (!isBlockPointer(Arg6)) {
- S.Diag(Arg6->getLocStart(), diag::err_opencl_builtin_expected_type)
+ S.Diag(Arg6->getBeginLoc(), diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "block";
return true;
}
@@ -577,7 +574,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
// Forth argument has to be any integer type.
if (!Arg3->getType()->isIntegerType()) {
- S.Diag(TheCall->getArg(3)->getLocStart(),
+ S.Diag(TheCall->getArg(3)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee() << "integer";
return true;
@@ -590,7 +587,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
if (!Arg4->isNullPointerConstant(S.Context,
Expr::NPC_ValueDependentIsNotNull) &&
!Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) {
- S.Diag(TheCall->getArg(4)->getLocStart(),
+ S.Diag(TheCall->getArg(4)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee()
<< S.Context.getPointerType(S.Context.OCLClkEventTy);
@@ -602,7 +599,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
Expr::NPC_ValueDependentIsNotNull) &&
!(Arg5->getType()->isPointerType() &&
Arg5->getType()->getPointeeType()->isClkEventT())) {
- S.Diag(TheCall->getArg(5)->getLocStart(),
+ S.Diag(TheCall->getArg(5)->getBeginLoc(),
diag::err_opencl_builtin_expected_type)
<< TheCall->getDirectCallee()
<< S.Context.getPointerType(S.Context.OCLClkEventTy);
@@ -616,7 +613,7 @@ static bool SemaOpenCLBuiltinEnqueueKernel(Sema &S, CallExpr *TheCall) {
}
// None of the specific case has been detected, give generic error
- S.Diag(TheCall->getLocStart(),
+ S.Diag(TheCall->getBeginLoc(),
diag::err_opencl_enqueue_kernel_incorrect_args);
return true;
}
@@ -631,7 +628,7 @@ static bool checkOpenCLPipeArg(Sema &S, CallExpr *Call) {
const Expr *Arg0 = Call->getArg(0);
// First argument type should always be pipe.
if (!Arg0->getType()->isPipeType()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_first_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg)
<< Call->getDirectCallee() << Arg0->getSourceRange();
return true;
}
@@ -650,7 +647,7 @@ static bool checkOpenCLPipeArg(Sema &S, CallExpr *Call) {
case Builtin::BIwork_group_commit_read_pipe:
case Builtin::BIsub_group_commit_read_pipe:
if (!(!AccessQual || AccessQual->isReadOnly())) {
- S.Diag(Arg0->getLocStart(),
+ S.Diag(Arg0->getBeginLoc(),
diag::err_opencl_builtin_pipe_invalid_access_modifier)
<< "read_only" << Arg0->getSourceRange();
return true;
@@ -664,7 +661,7 @@ static bool checkOpenCLPipeArg(Sema &S, CallExpr *Call) {
case Builtin::BIwork_group_commit_write_pipe:
case Builtin::BIsub_group_commit_write_pipe:
if (!(AccessQual && AccessQual->isWriteOnly())) {
- S.Diag(Arg0->getLocStart(),
+ S.Diag(Arg0->getBeginLoc(),
diag::err_opencl_builtin_pipe_invalid_access_modifier)
<< "write_only" << Arg0->getSourceRange();
return true;
@@ -688,7 +685,7 @@ static bool checkOpenCLPipePacketType(Sema &S, CallExpr *Call, unsigned Idx) {
if (!ArgTy ||
!S.Context.hasSameType(
EltTy, ArgTy->getPointeeType()->getCanonicalTypeInternal())) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.getPointerType(EltTy)
<< ArgIdx->getType() << ArgIdx->getSourceRange();
return true;
@@ -721,7 +718,7 @@ static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
// read/write_pipe(pipe T, reserve_id_t, uint, T*).
// Check reserve_id_t.
if (!Call->getArg(1)->getType()->isReserveIDT()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.OCLReserveIDTy
<< Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
@@ -731,7 +728,7 @@ static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
const Expr *Arg2 = Call->getArg(2);
if (!Arg2->getType()->isIntegerType() &&
!Arg2->getType()->isUnsignedIntegerType()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.UnsignedIntTy
<< Arg2->getType() << Arg2->getSourceRange();
return true;
@@ -742,7 +739,7 @@ static bool SemaBuiltinRWPipe(Sema &S, CallExpr *Call) {
return true;
} break;
default:
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_arg_num)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_arg_num)
<< Call->getDirectCallee() << Call->getSourceRange();
return true;
}
@@ -765,7 +762,7 @@ static bool SemaBuiltinReserveRWPipe(Sema &S, CallExpr *Call) {
// Check the reserve size.
if (!Call->getArg(1)->getType()->isIntegerType() &&
!Call->getArg(1)->getType()->isUnsignedIntegerType()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.UnsignedIntTy
<< Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
@@ -793,7 +790,7 @@ static bool SemaBuiltinCommitRWPipe(Sema &S, CallExpr *Call) {
// Check reserve_id_t.
if (!Call->getArg(1)->getType()->isReserveIDT()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg)
<< Call->getDirectCallee() << S.Context.OCLReserveIDTy
<< Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange();
return true;
@@ -812,7 +809,7 @@ static bool SemaBuiltinPipePackets(Sema &S, CallExpr *Call) {
return true;
if (!Call->getArg(0)->getType()->isPipeType()) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_first_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg)
<< Call->getDirectCallee() << Call->getArg(0)->getSourceRange();
return true;
}
@@ -829,7 +826,7 @@ static bool SemaBuiltinPipePackets(Sema &S, CallExpr *Call) {
static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
CallExpr *Call) {
if (Call->getNumArgs() != 1) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_to_addr_arg_num)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_arg_num)
<< Call->getDirectCallee() << Call->getSourceRange();
return true;
}
@@ -837,7 +834,7 @@ static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID,
auto RT = Call->getArg(0)->getType();
if (!RT->isPointerType() || RT->getPointeeType()
.getAddressSpace() == LangAS::opencl_constant) {
- S.Diag(Call->getLocStart(), diag::err_opencl_builtin_to_addr_invalid_arg)
+ S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_invalid_arg)
<< Call->getArg(0) << Call->getDirectCallee() << Call->getSourceRange();
return true;
}
@@ -872,7 +869,7 @@ CheckBuiltinTargetSupport(Sema &S, unsigned BuiltinID, CallExpr *TheCall,
S.getASTContext().getTargetInfo().getTriple().getArch();
if (llvm::is_contained(SupportedArchs, CurArch))
return false;
- S.Diag(TheCall->getLocStart(), diag::err_builtin_target_unsupported)
+ S.Diag(TheCall->getBeginLoc(), diag::err_builtin_target_unsupported)
<< TheCall->getSourceRange();
return true;
}
@@ -1171,7 +1168,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
const QualType PtrArgType = PtrArg->getType();
if (!PtrArgType->isPointerType() ||
!PtrArgType->getPointeeType()->isRecordType()) {
- Diag(PtrArg->getLocStart(), diag::err_typecheck_convert_incompatible)
+ Diag(PtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
<< PtrArgType << "structure pointer" << 1 << 0 << 3 << 1 << PtrArgType
<< "structure pointer";
return ExprError();
@@ -1181,9 +1178,9 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
const Expr *FnPtrArg = TheCall->getArg(1)->IgnoreImpCasts();
const QualType FnPtrArgType = FnPtrArg->getType();
if (!FnPtrArgType->isPointerType()) {
- Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible)
- << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
- << 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
+ Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+ << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2
+ << FnPtrArgType << "'int (*)(const char *, ...)'";
return ExprError();
}
@@ -1191,15 +1188,15 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
FnPtrArgType->getPointeeType()->getAs<FunctionType>();
if (!FuncType) {
- Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible)
- << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
- << 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
+ Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+ << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2
+ << FnPtrArgType << "'int (*)(const char *, ...)'";
return ExprError();
}
if (const auto *FT = dyn_cast<FunctionProtoType>(FuncType)) {
if (!FT->getNumParams()) {
- Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible)
+ Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
<< FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
<< 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
return ExprError();
@@ -1208,7 +1205,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
if (!FT->isVariadic() || FT->getReturnType() != Context.IntTy ||
!PT->isPointerType() || !PT->getPointeeType()->isCharType() ||
!PT->getPointeeType().isConstQualified()) {
- Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible)
+ Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
<< FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3
<< 2 << FnPtrArgType << "'int (*)(const char *, ...)'";
return ExprError();
@@ -1259,7 +1256,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
return ExprError();
if (CheckCXXThrowOperand(
- TheCall->getLocStart(),
+ TheCall->getBeginLoc(),
Context.getExceptionObjectType(FDecl->getParamDecl(0)->getType()),
TheCall))
return ExprError();
@@ -1477,8 +1474,8 @@ bool Sema::CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
TV = Result.getLimitedValue(64);
if ((TV > 63) || (mask & (1ULL << TV)) == 0)
- return Diag(TheCall->getLocStart(), diag::err_invalid_neon_type_code)
- << TheCall->getArg(ImmArg)->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_invalid_neon_type_code)
+ << TheCall->getArg(ImmArg)->getSourceRange();
}
if (PtrArgNum >= 0) {
@@ -1503,7 +1500,7 @@ bool Sema::CheckNeonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
ConvTy = CheckSingleAssignmentConstraints(LHSTy, RHS);
if (RHS.isInvalid())
return true;
- if (DiagnoseAssignmentResult(ConvTy, Arg->getLocStart(), LHSTy, RHSTy,
+ if (DiagnoseAssignmentResult(ConvTy, Arg->getBeginLoc(), LHSTy, RHSTy,
RHS.get(), AA_Assigning))
return true;
}
@@ -1557,8 +1554,8 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
const PointerType *pointerType = PointerArg->getType()->getAs<PointerType>();
if (!pointerType) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
- << PointerArg->getType() << PointerArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer)
+ << PointerArg->getType() << PointerArg->getSourceRange();
return true;
}
@@ -1574,10 +1571,9 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
CastKind CastNeeded = CK_NoOp;
if (!AddrType.isAtLeastAsQualifiedAs(ValType)) {
CastNeeded = CK_BitCast;
- Diag(DRE->getLocStart(), diag::ext_typecheck_convert_discards_qualifiers)
- << PointerArg->getType()
- << Context.getPointerType(AddrType)
- << AA_Passing << PointerArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers)
+ << PointerArg->getType() << Context.getPointerType(AddrType)
+ << AA_Passing << PointerArg->getSourceRange();
}
// Finally, do the cast and replace the argument with the corrected version.
@@ -1592,16 +1588,16 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
// In general, we allow ints, floats and pointers to be loaded and stored.
if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
!ValType->isBlockPointerType() && !ValType->isFloatingType()) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
- << PointerArg->getType() << PointerArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
+ << PointerArg->getType() << PointerArg->getSourceRange();
return true;
}
// But ARM doesn't have instructions to deal with 128-bit versions.
if (Context.getTypeSize(ValType) > MaxWidth) {
assert(MaxWidth == 64 && "Diagnostic unexpectedly inaccurate");
- Diag(DRE->getLocStart(), diag::err_atomic_exclusive_builtin_pointer_size)
- << PointerArg->getType() << PointerArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size)
+ << PointerArg->getType() << PointerArg->getSourceRange();
return true;
}
@@ -1614,8 +1610,8 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
case Qualifiers::OCL_Weak:
case Qualifiers::OCL_Strong:
case Qualifiers::OCL_Autoreleasing:
- Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership)
- << ValType << PointerArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership)
+ << ValType << PointerArg->getSourceRange();
return true;
}
@@ -2491,7 +2487,7 @@ bool Sema::CheckHexagonBuiltinCpu(unsigned BuiltinID, CallExpr *TheCall) {
assert(CPU.startswith("hexagon") && "Unexpected CPU name");
CPU.consume_front("hexagon");
if (llvm::none_of(FC->second, [CPU](StringRef S) { return S == CPU; }))
- return Diag(TheCall->getLocStart(),
+ return Diag(TheCall->getBeginLoc(),
diag::err_hexagon_builtin_unsupported_cpu);
}
}
@@ -2499,7 +2495,7 @@ bool Sema::CheckHexagonBuiltinCpu(unsigned BuiltinID, CallExpr *TheCall) {
auto FH = ValidHVX.find(BuiltinID);
if (FH != ValidHVX.end()) {
if (!TI.hasFeature("hvx"))
- return Diag(TheCall->getLocStart(),
+ return Diag(TheCall->getBeginLoc(),
diag::err_hexagon_builtin_requires_hvx);
bool IsValid = llvm::any_of(FH->second,
@@ -2508,7 +2504,7 @@ bool Sema::CheckHexagonBuiltinCpu(unsigned BuiltinID, CallExpr *TheCall) {
return TI.hasFeature(F);
});
if (!IsValid)
- return Diag(TheCall->getLocStart(),
+ return Diag(TheCall->getBeginLoc(),
diag::err_hexagon_builtin_unsupported_hvx);
}
@@ -2935,13 +2931,13 @@ bool Sema::CheckPPCBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
BuiltinID == PPC::BI__builtin_divdeu;
if (Is64BitBltin && !IsTarget64Bit)
- return Diag(TheCall->getLocStart(), diag::err_64_bit_builtin_32_bit_tgt)
- << TheCall->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_64_bit_builtin_32_bit_tgt)
+ << TheCall->getSourceRange();
if ((IsBltinExtDiv && !Context.getTargetInfo().hasFeature("extdiv")) ||
(BuiltinID == PPC::BI__builtin_bpermd &&
!Context.getTargetInfo().hasFeature("bpermd")))
- return Diag(TheCall->getLocStart(), diag::err_ppc_builtin_only_on_pwr7)
+ return Diag(TheCall->getBeginLoc(), diag::err_ppc_builtin_only_on_pwr7)
<< TheCall->getSourceRange();
switch (BuiltinID) {
@@ -2973,7 +2969,7 @@ bool Sema::CheckSystemZBuiltinFunctionCall(unsigned BuiltinID,
llvm::APSInt AbortCode(32);
if (Arg->isIntegerConstantExpr(AbortCode, Context) &&
AbortCode.getSExtValue() >= 0 && AbortCode.getSExtValue() < 256)
- return Diag(Arg->getLocStart(), diag::err_systemz_invalid_tabort_code)
+ return Diag(Arg->getBeginLoc(), diag::err_systemz_invalid_tabort_code)
<< Arg->getSourceRange();
}
@@ -3037,14 +3033,14 @@ static bool SemaBuiltinCpuSupports(Sema &S, CallExpr *TheCall) {
// Check if the argument is a string literal.
if (!isa<StringLiteral>(Arg->IgnoreParenImpCasts()))
- return S.Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal)
+ return S.Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal)
<< Arg->getSourceRange();
// Check the contents of the string.
StringRef Feature =
cast<StringLiteral>(Arg->IgnoreParenImpCasts())->getString();
if (!S.Context.getTargetInfo().validateCpuSupports(Feature))
- return S.Diag(TheCall->getLocStart(), diag::err_invalid_cpu_supports)
+ return S.Diag(TheCall->getBeginLoc(), diag::err_invalid_cpu_supports)
<< Arg->getSourceRange();
return false;
}
@@ -3057,14 +3053,14 @@ static bool SemaBuiltinCpuIs(Sema &S, CallExpr *TheCall) {
// Check if the argument is a string literal.
if (!isa<StringLiteral>(Arg->IgnoreParenImpCasts()))
- return S.Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal)
+ return S.Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal)
<< Arg->getSourceRange();
// Check the contents of the string.
StringRef Feature =
cast<StringLiteral>(Arg->IgnoreParenImpCasts())->getString();
if (!S.Context.getTargetInfo().validateCpuIs(Feature))
- return S.Diag(TheCall->getLocStart(), diag::err_invalid_cpu_is)
+ return S.Diag(TheCall->getBeginLoc(), diag::err_invalid_cpu_is)
<< Arg->getSourceRange();
return false;
}
@@ -3267,8 +3263,8 @@ bool Sema::CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall) {
(HasRC && Result.getZExtValue() >= 8 && Result.getZExtValue() <= 11))
return false;
- return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_rounding)
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_rounding)
+ << Arg->getSourceRange();
}
// Check if the gather/scatter scale is legal.
@@ -3370,8 +3366,8 @@ bool Sema::CheckX86BuiltinGatherScatterScale(unsigned BuiltinID,
if (Result == 1 || Result == 2 || Result == 4 || Result == 8)
return false;
- return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_scale)
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_scale)
+ << Arg->getSourceRange();
}
static bool isX86_32Builtin(unsigned BuiltinID) {
@@ -3395,7 +3391,7 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
// Check for 32-bit only builtins on a 64-bit target.
const llvm::Triple &TT = Context.getTargetInfo().getTriple();
if (TT.getArch() != llvm::Triple::x86 && isX86_32Builtin(BuiltinID))
- return Diag(TheCall->getCallee()->getLocStart(),
+ return Diag(TheCall->getCallee()->getBeginLoc(),
diag::err_32_bit_builtin_64_bit_tgt);
// If the intrinsic has rounding or SAE make sure its valid.
@@ -4317,10 +4313,10 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
<< TheCall->getCallee()->getSourceRange();
return ExprError();
} else if (TheCall->getNumArgs() > AdjustedNumArgs) {
- Diag(TheCall->getArg(AdjustedNumArgs)->getLocStart(),
+ Diag(TheCall->getArg(AdjustedNumArgs)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
- << 0 << AdjustedNumArgs << TheCall->getNumArgs()
- << TheCall->getCallee()->getSourceRange();
+ << 0 << AdjustedNumArgs << TheCall->getNumArgs()
+ << TheCall->getCallee()->getSourceRange();
return ExprError();
}
@@ -4333,8 +4329,8 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
Ptr = ConvertedPtr.get();
const PointerType *pointerType = Ptr->getType()->getAs<PointerType>();
if (!pointerType) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
- << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer)
+ << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
@@ -4343,13 +4339,13 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
QualType ValType = AtomTy; // 'C'
if (IsC11) {
if (!AtomTy->isAtomicType()) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic)
- << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic)
+ << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
if ((Form != Load && Form != LoadCopy && AtomTy.isConstQualified()) ||
AtomTy.getAddressSpace() == LangAS::opencl_constant) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_atomic)
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_non_const_atomic)
<< (AtomTy.isConstQualified() ? 0 : 1) << Ptr->getType()
<< Ptr->getSourceRange();
return ExprError();
@@ -4357,8 +4353,8 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
ValType = AtomTy->getAs<AtomicType>()->getValueType();
} else if (Form != Load && Form != LoadCopy) {
if (ValType.isConstQualified()) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_pointer)
- << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_non_const_pointer)
+ << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
}
@@ -4368,33 +4364,33 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
// gcc does not enforce these rules for GNU atomics, but we do so for sanity.
if (IsAddSub && !ValType->isIntegerType()
&& !ValType->isPointerType()) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic_int_or_ptr)
- << IsC11 << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr)
+ << IsC11 << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
if (IsMinMax) {
const BuiltinType *BT = ValType->getAs<BuiltinType>();
if (!BT || (BT->getKind() != BuiltinType::Int &&
BT->getKind() != BuiltinType::UInt)) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_int32_or_ptr);
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_int32_or_ptr);
return ExprError();
}
}
if (!IsAddSub && !IsMinMax && !ValType->isIntegerType()) {
- Diag(DRE->getLocStart(), diag::err_atomic_op_bitwise_needs_atomic_int)
- << IsC11 << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_bitwise_needs_atomic_int)
+ << IsC11 << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
if (IsC11 && ValType->isPointerType() &&
- RequireCompleteType(Ptr->getLocStart(), ValType->getPointeeType(),
+ RequireCompleteType(Ptr->getBeginLoc(), ValType->getPointeeType(),
diag::err_incomplete_type)) {
return ExprError();
}
} else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType()) {
// For __atomic_*_n operations, the value type must be a scalar integral or
// pointer type which is 1, 2, 4, 8 or 16 bytes in length.
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic_int_or_ptr)
- << IsC11 << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr)
+ << IsC11 << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
@@ -4402,8 +4398,8 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
!AtomTy->isScalarType()) {
// For GNU atomics, require a trivially-copyable type. This is not part of
// the GNU atomics specification, but we enforce it for sanity.
- Diag(DRE->getLocStart(), diag::err_atomic_op_needs_trivial_copy)
- << Ptr->getType() << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_trivial_copy)
+ << Ptr->getType() << Ptr->getSourceRange();
return ExprError();
}
@@ -4418,8 +4414,8 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
case Qualifiers::OCL_Autoreleasing:
// FIXME: Can this happen? By this point, ValType should be known
// to be trivially copyable.
- Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership)
- << ValType << Ptr->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership)
+ << ValType << Ptr->getSourceRange();
return ExprError();
}
@@ -4457,7 +4453,7 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
case 0:
// The first argument is always a pointer. It has a fixed type.
// It is always dereferenced, a nullptr is undefined.
- CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart());
+ CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc());
// Nothing else to do: we already know all we want about this pointer.
continue;
case 1:
@@ -4471,14 +4467,14 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
else if (Form == Copy || Form == Xchg) {
if (IsPassedByAddress)
// The value pointer is always dereferenced, a nullptr is undefined.
- CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart());
+ CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc());
Ty = ByValType;
} else if (Form == Arithmetic)
Ty = Context.getPointerDiffType();
else {
Expr *ValArg = TheCall->getArg(i);
// The value pointer is always dereferenced, a nullptr is undefined.
- CheckNonNullArgument(*this, ValArg, DRE->getLocStart());
+ CheckNonNullArgument(*this, ValArg, DRE->getBeginLoc());
LangAS AS = LangAS::Default;
// Keep address space of non-atomic pointer type.
if (const PointerType *PtrTy =
@@ -4493,7 +4489,7 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
// The third argument to compare_exchange / GNU exchange is the desired
// value, either by-value (for the C11 and *_n variant) or as a pointer.
if (IsPassedByAddress)
- CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart());
+ CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc());
Ty = ByValType;
break;
case 3:
@@ -4558,7 +4554,7 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
llvm::APSInt Result(32);
if (SubExprs[1]->isIntegerConstantExpr(Result, Context) &&
!isValidOrderingForOp(Result.getSExtValue(), Op))
- Diag(SubExprs[1]->getLocStart(),
+ Diag(SubExprs[1]->getBeginLoc(),
diag::warn_atomic_op_has_invalid_memory_order)
<< SubExprs[1]->getSourceRange();
}
@@ -4568,25 +4564,26 @@ ExprResult Sema::SemaAtomicOpsOverloaded(ExprResult TheCallResult,
llvm::APSInt Result(32);
if (Scope->isIntegerConstantExpr(Result, Context) &&
!ScopeModel->isValid(Result.getZExtValue())) {
- Diag(Scope->getLocStart(), diag::err_atomic_op_has_invalid_synch_scope)
+ Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_synch_scope)
<< Scope->getSourceRange();
}
SubExprs.push_back(Scope);
}
- AtomicExpr *AE = new (Context) AtomicExpr(TheCall->getCallee()->getLocStart(),
- SubExprs, ResultType, Op,
- TheCall->getRParenLoc());
+ AtomicExpr *AE =
+ new (Context) AtomicExpr(TheCall->getCallee()->getBeginLoc(), SubExprs,
+ ResultType, Op, TheCall->getRParenLoc());
if ((Op == AtomicExpr::AO__c11_atomic_load ||
Op == AtomicExpr::AO__c11_atomic_store ||
Op == AtomicExpr::AO__opencl_atomic_load ||
Op == AtomicExpr::AO__opencl_atomic_store ) &&
Context.AtomicUsesUnsupportedLibcall(AE))
- Diag(AE->getLocStart(), diag::err_atomic_load_store_uses_lib)
+ Diag(AE->getBeginLoc(), diag::err_atomic_load_store_uses_lib)
<< ((Op == AtomicExpr::AO__c11_atomic_load ||
- Op == AtomicExpr::AO__opencl_atomic_load)
- ? 0 : 1);
+ Op == AtomicExpr::AO__opencl_atomic_load)
+ ? 0
+ : 1);
return AE;
}
@@ -4651,21 +4648,21 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
const PointerType *pointerType = FirstArg->getType()->getAs<PointerType>();
if (!pointerType) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
- << FirstArg->getType() << FirstArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer)
+ << FirstArg->getType() << FirstArg->getSourceRange();
return ExprError();
}
QualType ValType = pointerType->getPointeeType();
if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
!ValType->isBlockPointerType()) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer_intptr)
- << FirstArg->getType() << FirstArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intptr)
+ << FirstArg->getType() << FirstArg->getSourceRange();
return ExprError();
}
if (ValType.isConstQualified()) {
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_cannot_be_const)
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_cannot_be_const)
<< FirstArg->getType() << FirstArg->getSourceRange();
return ExprError();
}
@@ -4679,8 +4676,8 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
case Qualifiers::OCL_Weak:
case Qualifiers::OCL_Strong:
case Qualifiers::OCL_Autoreleasing:
- Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership)
- << ValType << FirstArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership)
+ << ValType << FirstArg->getSourceRange();
return ExprError();
}
@@ -4730,8 +4727,8 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
case 8: SizeIndex = 3; break;
case 16: SizeIndex = 4; break;
default:
- Diag(DRE->getLocStart(), diag::err_atomic_builtin_pointer_size)
- << FirstArg->getType() << FirstArg->getSourceRange();
+ Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_pointer_size)
+ << FirstArg->getType() << FirstArg->getSourceRange();
return ExprError();
}
@@ -4929,7 +4926,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
else {
// Perform builtin lookup to avoid redeclaring it.
DeclarationName DN(&Context.Idents.get(NewBuiltinName));
- LookupResult Res(*this, DN, DRE->getLocStart(), LookupOrdinaryName);
+ LookupResult Res(*this, DN, DRE->getBeginLoc(), LookupOrdinaryName);
LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true);
assert(Res.getFoundDecl());
NewBuiltinDecl = dyn_cast<FunctionDecl>(Res.getFoundDecl());
@@ -5026,7 +5023,7 @@ ExprResult Sema::SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult) {
const PointerType *pointerType = PointerArg->getType()->getAs<PointerType>();
if (!pointerType) {
- Diag(DRE->getLocStart(), diag::err_nontemporal_builtin_must_be_pointer)
+ Diag(DRE->getBeginLoc(), diag::err_nontemporal_builtin_must_be_pointer)
<< PointerArg->getType() << PointerArg->getSourceRange();
return ExprError();
}
@@ -5038,7 +5035,7 @@ ExprResult Sema::SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult) {
if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
!ValType->isBlockPointerType() && !ValType->isFloatingType() &&
!ValType->isVectorType()) {
- Diag(DRE->getLocStart(),
+ Diag(DRE->getBeginLoc(),
diag::err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector)
<< PointerArg->getType() << PointerArg->getSourceRange();
return ExprError();
@@ -5070,8 +5067,8 @@ bool Sema::CheckObjCString(Expr *Arg) {
StringLiteral *Literal = dyn_cast<StringLiteral>(Arg);
if (!Literal || !Literal->isAscii()) {
- Diag(Arg->getLocStart(), diag::err_cfstring_literal_not_string_constant)
- << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::err_cfstring_literal_not_string_constant)
+ << Arg->getSourceRange();
return true;
}
@@ -5087,8 +5084,8 @@ bool Sema::CheckObjCString(Expr *Arg) {
ToPtr + NumBytes, llvm::strictConversion);
// Check for conversion failure.
if (Result != llvm::conversionOK)
- Diag(Arg->getLocStart(),
- diag::warn_cfstring_truncated) << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::warn_cfstring_truncated)
+ << Arg->getSourceRange();
}
return false;
}
@@ -5106,7 +5103,7 @@ ExprResult Sema::CheckOSLogFormatStringArg(Expr *Arg) {
if (!Literal || (!Literal->isAscii() && !Literal->isUTF8())) {
return ExprError(
- Diag(Arg->getLocStart(), diag::err_os_log_format_not_string_constant)
+ Diag(Arg->getBeginLoc(), diag::err_os_log_format_not_string_constant)
<< Arg->getSourceRange());
}
@@ -5133,7 +5130,7 @@ static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
if (IsMSVAStart) {
// Don't allow this in System V ABI functions.
if (CC == CC_X86_64SysV || (!IsWindows && CC != CC_Win64))
- return S.Diag(Fn->getLocStart(),
+ return S.Diag(Fn->getBeginLoc(),
diag::err_ms_va_start_used_in_sysv_function);
} else {
// On x86-64/AArch64 Unix, don't allow this in Win64 ABI functions.
@@ -5142,7 +5139,7 @@ static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
// System V ABI functions on Windows.)
if ((IsWindows && CC == CC_X86_64SysV) ||
(!IsWindows && CC == CC_Win64))
- return S.Diag(Fn->getLocStart(),
+ return S.Diag(Fn->getBeginLoc(),
diag::err_va_start_used_in_wrong_abi_function)
<< !IsWindows;
}
@@ -5150,7 +5147,7 @@ static bool checkVAStartABI(Sema &S, unsigned BuiltinID, Expr *Fn) {
}
if (IsMSVAStart)
- return S.Diag(Fn->getLocStart(), diag::err_builtin_x64_aarch64_only);
+ return S.Diag(Fn->getBeginLoc(), diag::err_builtin_x64_aarch64_only);
return false;
}
@@ -5173,16 +5170,16 @@ static bool checkVAStartIsInVariadicFunction(Sema &S, Expr *Fn,
Params = MD->parameters();
} else if (isa<CapturedDecl>(Caller)) {
// We don't support va_start in a CapturedDecl.
- S.Diag(Fn->getLocStart(), diag::err_va_start_captured_stmt);
+ S.Diag(Fn->getBeginLoc(), diag::err_va_start_captured_stmt);
return true;
} else {
// This must be some other declcontext that parses exprs.
- S.Diag(Fn->getLocStart(), diag::err_va_start_outside_function);
+ S.Diag(Fn->getBeginLoc(), diag::err_va_start_outside_function);
return true;
}
if (!IsVariadic) {
- S.Diag(Fn->getLocStart(), diag::err_va_start_fixed_function);
+ S.Diag(Fn->getBeginLoc(), diag::err_va_start_fixed_function);
return true;
}
@@ -5202,12 +5199,12 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
return true;
if (TheCall->getNumArgs() > 2) {
- Diag(TheCall->getArg(2)->getLocStart(),
+ Diag(TheCall->getArg(2)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
- << 0 /*function call*/ << 2 << TheCall->getNumArgs()
- << Fn->getSourceRange()
- << SourceRange(TheCall->getArg(2)->getLocStart(),
- (*(TheCall->arg_end()-1))->getLocEnd());
+ << 0 /*function call*/ << 2 << TheCall->getNumArgs()
+ << Fn->getSourceRange()
+ << SourceRange(TheCall->getArg(2)->getBeginLoc(),
+ (*(TheCall->arg_end() - 1))->getLocEnd());
return true;
}
@@ -5249,7 +5246,7 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
}
if (!SecondArgIsLastNamedArgument)
- Diag(TheCall->getArg(1)->getLocStart(),
+ Diag(TheCall->getArg(1)->getBeginLoc(),
diag::warn_second_arg_of_va_start_not_last_named_param);
else if (IsCRegister || Type->isReferenceType() ||
Type->isSpecificBuiltinType(BuiltinType::Float) || [=] {
@@ -5266,7 +5263,7 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
unsigned Reason = 0;
if (Type->isReferenceType()) Reason = 1;
else if (IsCRegister) Reason = 2;
- Diag(Arg->getLocStart(), diag::warn_va_start_type_is_undefined) << Reason;
+ Diag(Arg->getBeginLoc(), diag::warn_va_start_type_is_undefined) << Reason;
Diag(ParamLoc, diag::note_parameter_type) << Type;
}
@@ -5305,20 +5302,18 @@ bool Sema::SemaBuiltinVAStartARMMicrosoft(CallExpr *Call) {
Context.getPointerType(Context.CharTy.withConst());
if (!Arg1Ty->isPointerType() ||
Arg1Ty->getPointeeType().withoutLocalFastQualifiers() != Context.CharTy)
- Diag(Arg1->getLocStart(), diag::err_typecheck_convert_incompatible)
- << Arg1->getType() << ConstCharPtrTy
- << 1 /* different class */
- << 0 /* qualifier difference */
- << 3 /* parameter mismatch */
+ Diag(Arg1->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+ << Arg1->getType() << ConstCharPtrTy << 1 /* different class */
+ << 0 /* qualifier difference */
+ << 3 /* parameter mismatch */
<< 2 << Arg1->getType() << ConstCharPtrTy;
const QualType SizeTy = Context.getSizeType();
if (Arg2Ty->getCanonicalTypeInternal().withoutLocalFastQualifiers() != SizeTy)
- Diag(Arg2->getLocStart(), diag::err_typecheck_convert_incompatible)
- << Arg2->getType() << SizeTy
- << 1 /* different class */
- << 0 /* qualifier difference */
- << 3 /* parameter mismatch */
+ Diag(Arg2->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+ << Arg2->getType() << SizeTy << 1 /* different class */
+ << 0 /* qualifier difference */
+ << 3 /* parameter mismatch */
<< 3 << Arg2->getType() << SizeTy;
return false;
@@ -5331,11 +5326,11 @@ bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
<< 0 << 2 << TheCall->getNumArgs()/*function call*/;
if (TheCall->getNumArgs() > 2)
- return Diag(TheCall->getArg(2)->getLocStart(),
+ return Diag(TheCall->getArg(2)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
- << 0 /*function call*/ << 2 << TheCall->getNumArgs()
- << SourceRange(TheCall->getArg(2)->getLocStart(),
- (*(TheCall->arg_end()-1))->getLocEnd());
+ << 0 /*function call*/ << 2 << TheCall->getNumArgs()
+ << SourceRange(TheCall->getArg(2)->getBeginLoc(),
+ (*(TheCall->arg_end() - 1))->getLocEnd());
ExprResult OrigArg0 = TheCall->getArg(0);
ExprResult OrigArg1 = TheCall->getArg(1);
@@ -5358,10 +5353,11 @@ bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) {
// If the common type isn't a real floating type, then the arguments were
// invalid for this operation.
if (Res.isNull() || !Res->isRealFloatingType())
- return Diag(OrigArg0.get()->getLocStart(),
+ return Diag(OrigArg0.get()->getBeginLoc(),
diag::err_typecheck_call_invalid_ordered_compare)
- << OrigArg0.get()->getType() << OrigArg1.get()->getType()
- << SourceRange(OrigArg0.get()->getLocStart(), OrigArg1.get()->getLocEnd());
+ << OrigArg0.get()->getType() << OrigArg1.get()->getType()
+ << SourceRange(OrigArg0.get()->getBeginLoc(),
+ OrigArg1.get()->getLocEnd());
return false;
}
@@ -5375,11 +5371,11 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args)
<< 0 << NumArgs << TheCall->getNumArgs()/*function call*/;
if (TheCall->getNumArgs() > NumArgs)
- return Diag(TheCall->getArg(NumArgs)->getLocStart(),
+ return Diag(TheCall->getArg(NumArgs)->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
- << 0 /*function call*/ << NumArgs << TheCall->getNumArgs()
- << SourceRange(TheCall->getArg(NumArgs)->getLocStart(),
- (*(TheCall->arg_end()-1))->getLocEnd());
+ << 0 /*function call*/ << NumArgs << TheCall->getNumArgs()
+ << SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(),
+ (*(TheCall->arg_end() - 1))->getLocEnd());
Expr *OrigArg = TheCall->getArg(NumArgs-1);
@@ -5388,9 +5384,9 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
// This operation requires a non-_Complex floating-point number.
if (!OrigArg->getType()->isRealFloatingType())
- return Diag(OrigArg->getLocStart(),
+ return Diag(OrigArg->getBeginLoc(),
diag::err_typecheck_call_invalid_unary_fp)
- << OrigArg->getType() << OrigArg->getSourceRange();
+ << OrigArg->getType() << OrigArg->getSourceRange();
// If this is an implicit conversion from float -> float, double, or
// long double, remove it.
@@ -5438,22 +5434,22 @@ bool Sema::SemaBuiltinVSX(CallExpr *TheCall) {
// Check the third argument is a compile time constant
llvm::APSInt Value;
if(!TheCall->getArg(2)->isIntegerConstantExpr(Value, Context))
- return Diag(TheCall->getLocStart(),
+ return Diag(TheCall->getBeginLoc(),
diag::err_vsx_builtin_nonconstant_argument)
<< 3 /* argument index */ << TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(2)->getLocStart(),
+ << SourceRange(TheCall->getArg(2)->getBeginLoc(),
TheCall->getArg(2)->getLocEnd());
QualType Arg1Ty = TheCall->getArg(0)->getType();
QualType Arg2Ty = TheCall->getArg(1)->getType();
// Check the type of argument 1 and argument 2 are vectors.
- SourceLocation BuiltinLoc = TheCall->getLocStart();
+ SourceLocation BuiltinLoc = TheCall->getBeginLoc();
if ((!Arg1Ty->isVectorType() && !Arg1Ty->isDependentType()) ||
(!Arg2Ty->isVectorType() && !Arg2Ty->isDependentType())) {
return Diag(BuiltinLoc, diag::err_vec_builtin_non_vector)
<< TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(0)->getLocStart(),
+ << SourceRange(TheCall->getArg(0)->getBeginLoc(),
TheCall->getArg(1)->getLocEnd());
}
@@ -5461,7 +5457,7 @@ bool Sema::SemaBuiltinVSX(CallExpr *TheCall) {
if (!Context.hasSameUnqualifiedType(Arg1Ty, Arg2Ty)) {
return Diag(BuiltinLoc, diag::err_vec_builtin_incompatible_vector)
<< TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(0)->getLocStart(),
+ << SourceRange(TheCall->getArg(0)->getBeginLoc(),
TheCall->getArg(1)->getLocEnd());
}
@@ -5494,11 +5490,11 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
QualType RHSType = TheCall->getArg(1)->getType();
if (!LHSType->isVectorType() || !RHSType->isVectorType())
- return ExprError(Diag(TheCall->getLocStart(),
- diag::err_vec_builtin_non_vector)
- << TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(0)->getLocStart(),
- TheCall->getArg(1)->getLocEnd()));
+ return ExprError(
+ Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_non_vector)
+ << TheCall->getDirectCallee()
+ << SourceRange(TheCall->getArg(0)->getBeginLoc(),
+ TheCall->getArg(1)->getLocEnd()));
numElements = LHSType->getAs<VectorType>()->getNumElements();
unsigned numResElements = TheCall->getNumArgs() - 2;
@@ -5509,16 +5505,16 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
if (TheCall->getNumArgs() == 2) {
if (!RHSType->hasIntegerRepresentation() ||
RHSType->getAs<VectorType>()->getNumElements() != numElements)
- return ExprError(Diag(TheCall->getLocStart(),
+ return ExprError(Diag(TheCall->getBeginLoc(),
diag::err_vec_builtin_incompatible_vector)
<< TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(1)->getLocStart(),
+ << SourceRange(TheCall->getArg(1)->getBeginLoc(),
TheCall->getArg(1)->getLocEnd()));
} else if (!Context.hasSameUnqualifiedType(LHSType, RHSType)) {
- return ExprError(Diag(TheCall->getLocStart(),
+ return ExprError(Diag(TheCall->getBeginLoc(),
diag::err_vec_builtin_incompatible_vector)
<< TheCall->getDirectCallee()
- << SourceRange(TheCall->getArg(0)->getLocStart(),
+ << SourceRange(TheCall->getArg(0)->getBeginLoc(),
TheCall->getArg(1)->getLocEnd()));
} else if (numElements != numResElements) {
QualType eltType = LHSType->getAs<VectorType>()->getElementType();
@@ -5534,7 +5530,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
llvm::APSInt Result(32);
if (!TheCall->getArg(i)->isIntegerConstantExpr(Result, Context))
- return ExprError(Diag(TheCall->getLocStart(),
+ return ExprError(Diag(TheCall->getBeginLoc(),
diag::err_shufflevector_nonconstant_argument)
<< TheCall->getArg(i)->getSourceRange());
@@ -5543,7 +5539,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
continue;
if (Result.getActiveBits() > 64 || Result.getZExtValue() >= numElements*2)
- return ExprError(Diag(TheCall->getLocStart(),
+ return ExprError(Diag(TheCall->getBeginLoc(),
diag::err_shufflevector_argument_too_large)
<< TheCall->getArg(i)->getSourceRange());
}
@@ -5556,7 +5552,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
}
return new (Context) ShuffleVectorExpr(Context, exprs, resType,
- TheCall->getCallee()->getLocStart(),
+ TheCall->getCallee()->getBeginLoc(),
TheCall->getRParenLoc());
}
@@ -5619,9 +5615,9 @@ bool Sema::SemaBuiltinAssume(CallExpr *TheCall) {
if (Arg->isInstantiationDependent()) return false;
if (Arg->HasSideEffects(Context))
- Diag(Arg->getLocStart(), diag::warn_assume_side_effects)
- << Arg->getSourceRange()
- << cast<FunctionDecl>(TheCall->getCalleeDecl())->getIdentifier();
+ Diag(Arg->getBeginLoc(), diag::warn_assume_side_effects)
+ << Arg->getSourceRange()
+ << cast<FunctionDecl>(TheCall->getCalleeDecl())->getIdentifier();
return false;
}
@@ -5638,25 +5634,22 @@ bool Sema::SemaBuiltinAllocaWithAlign(CallExpr *TheCall) {
if (const auto *UE =
dyn_cast<UnaryExprOrTypeTraitExpr>(Arg->IgnoreParenImpCasts()))
if (UE->getKind() == UETT_AlignOf)
- Diag(TheCall->getLocStart(), diag::warn_alloca_align_alignof)
- << Arg->getSourceRange();
+ Diag(TheCall->getBeginLoc(), diag::warn_alloca_align_alignof)
+ << Arg->getSourceRange();
llvm::APSInt Result = Arg->EvaluateKnownConstInt(Context);
if (!Result.isPowerOf2())
- return Diag(TheCall->getLocStart(),
- diag::err_alignment_not_power_of_two)
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two)
+ << Arg->getSourceRange();
if (Result < Context.getCharWidth())
- return Diag(TheCall->getLocStart(), diag::err_alignment_too_small)
- << (unsigned)Context.getCharWidth()
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_alignment_too_small)
+ << (unsigned)Context.getCharWidth() << Arg->getSourceRange();
if (Result > std::numeric_limits<int32_t>::max())
- return Diag(TheCall->getLocStart(), diag::err_alignment_too_big)
- << std::numeric_limits<int32_t>::max()
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_alignment_too_big)
+ << std::numeric_limits<int32_t>::max() << Arg->getSourceRange();
}
return false;
@@ -5683,9 +5676,8 @@ bool Sema::SemaBuiltinAssumeAligned(CallExpr *TheCall) {
return true;
if (!Result.isPowerOf2())
- return Diag(TheCall->getLocStart(),
- diag::err_alignment_not_power_of_two)
- << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two)
+ << Arg->getSourceRange();
}
if (NumArgs > 2) {
@@ -5766,7 +5758,7 @@ bool Sema::SemaBuiltinOSLogFormat(CallExpr *TheCall) {
ArrayRef<const Expr *> Args(TheCall->getArgs(), TheCall->getNumArgs());
bool Success = CheckFormatArguments(
Args, /*HasVAListArg*/ false, FormatIdx, FirstDataArg, FST_OSLog,
- VariadicFunction, TheCall->getLocStart(), SourceRange(),
+ VariadicFunction, TheCall->getBeginLoc(), SourceRange(),
CheckedVarArgs);
if (!Success)
return true;
@@ -5791,8 +5783,8 @@ bool Sema::SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
if (Arg->isTypeDependent() || Arg->isValueDependent()) return false;
if (!Arg->isIntegerConstantExpr(Result, Context))
- return Diag(TheCall->getLocStart(), diag::err_constant_integer_arg_type)
- << FDecl->getDeclName() << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_constant_integer_arg_type)
+ << FDecl->getDeclName() << Arg->getSourceRange();
return false;
}
@@ -5814,15 +5806,15 @@ bool Sema::SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
if (Result.getSExtValue() < Low || Result.getSExtValue() > High) {
if (RangeIsError)
- return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
+ return Diag(TheCall->getBeginLoc(), diag::err_argument_invalid_range)
<< Result.toString(10) << Low << High << Arg->getSourceRange();
else
// Defer the warning until we know if the code will be emitted so that
// dead code can ignore this.
- DiagRuntimeBehavior(TheCall->getLocStart(), TheCall,
- PDiag(diag::warn_argument_invalid_range)
- << Result.toString(10) << Low << High
- << Arg->getSourceRange());
+ DiagRuntimeBehavior(TheCall->getBeginLoc(), TheCall,
+ PDiag(diag::warn_argument_invalid_range)
+ << Result.toString(10) << Low << High
+ << Arg->getSourceRange());
}
return false;
@@ -5844,8 +5836,8 @@ bool Sema::SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
return true;
if (Result.getSExtValue() % Num != 0)
- return Diag(TheCall->getLocStart(), diag::err_argument_not_multiple)
- << Num << Arg->getSourceRange();
+ return Diag(TheCall->getBeginLoc(), diag::err_argument_not_multiple)
+ << Num << Arg->getSourceRange();
return false;
}
@@ -5876,7 +5868,7 @@ bool Sema::SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
// Check if the argument is a string literal.
if (!isa<StringLiteral>(Arg->IgnoreParenImpCasts()))
- return Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal)
+ return Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal)
<< Arg->getSourceRange();
// Check the type of special register given.
@@ -5885,7 +5877,7 @@ bool Sema::SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
Reg.split(Fields, ":");
if (Fields.size() != ExpectedFieldNum && !(AllowName && Fields.size() == 1))
- return Diag(TheCall->getLocStart(), diag::err_arm_invalid_specialreg)
+ return Diag(TheCall->getBeginLoc(), diag::err_arm_invalid_specialreg)
<< Arg->getSourceRange();
// If the string is the name of a register then we cannot check that it is
@@ -5927,7 +5919,7 @@ bool Sema::SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
}
if (!ValidString)
- return Diag(TheCall->getLocStart(), diag::err_arm_invalid_specialreg)
+ return Diag(TheCall->getBeginLoc(), diag::err_arm_invalid_specialreg)
<< Arg->getSourceRange();
} else if (IsAArch64Builtin && Fields.size() == 1) {
// If the register name is one of those that appear in the condition below
@@ -5955,8 +5947,8 @@ bool Sema::SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
/// that val is a constant 1.
bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {
if (!Context.getTargetInfo().hasSjLjLowering())
- return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_unsupported)
- << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd());
+ return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_unsupported)
+ << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd());
Expr *Arg = TheCall->getArg(1);
llvm::APSInt Result;
@@ -5966,8 +5958,8 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {
return true;
if (Result != 1)
- return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_invalid_val)
- << SourceRange(Arg->getLocStart(), Arg->getLocEnd());
+ return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_invalid_val)
+ << SourceRange(Arg->getBeginLoc(), Arg->getLocEnd());
return false;
}
@@ -5976,8 +5968,8 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) {
/// This checks that the target supports __builtin_setjmp.
bool Sema::SemaBuiltinSetjmp(CallExpr *TheCall) {
if (!Context.getTargetInfo().hasSjLjLowering())
- return Diag(TheCall->getLocStart(), diag::err_builtin_setjmp_unsupported)
- << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd());
+ return Diag(TheCall->getBeginLoc(), diag::err_builtin_setjmp_unsupported)
+ << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd());
return false;
}
@@ -6123,7 +6115,7 @@ class FormatStringLiteral {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
- return FExpr->getLocStart().getLocWithOffset(Offset);
+ return FExpr->getBeginLoc().getLocWithOffset(Offset);
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
@@ -6513,7 +6505,7 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *> Args,
// format is either NSString or CFString. This is a hack to prevent
// diag when using the NSLocalizedString and CFCopyLocalizedString macros
// which are usually used in place of NS and CF string literals.
- SourceLocation FormatLoc = Args[format_idx]->getLocStart();
+ SourceLocation FormatLoc = Args[format_idx]->getBeginLoc();
if (Type == FST_NSString && SourceMgr.isInSystemMacro(FormatLoc))
return false;
@@ -6833,7 +6825,7 @@ void UncoveredArgHandler::Diagnose(Sema &S, bool IsFunctionCall,
if (!ArgExpr)
return;
- SourceLocation Loc = ArgExpr->getLocStart();
+ SourceLocation Loc = ArgExpr->getBeginLoc();
if (S.getSourceManager().isInSystemMacro(Loc))
return;
@@ -7279,9 +7271,8 @@ bool CheckPrintfHandler::checkForCStrMembers(
AT.matchesType(S.Context, Method->getReturnType())) {
// FIXME: Suggest parens if the expression needs them.
SourceLocation EndLoc = S.getLocForEndOfToken(E->getLocEnd());
- S.Diag(E->getLocStart(), diag::note_printf_c_str)
- << "c_str()"
- << FixItHint::CreateInsertion(EndLoc, ".c_str()");
+ S.Diag(E->getBeginLoc(), diag::note_printf_c_str)
+ << "c_str()" << FixItHint::CreateInsertion(EndLoc, ".c_str()");
return true;
}
}
@@ -7355,22 +7346,22 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier
ArgType(S.Context.IntTy) : ArgType::CPointerTy;
if (AT.isValid() && !AT.matchesType(S.Context, Ex->getType()))
EmitFormatDiagnostic(
- S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
- << AT.getRepresentativeTypeName(S.Context) << Ex->getType()
- << false << Ex->getSourceRange(),
- Ex->getLocStart(), /*IsStringLocation*/false,
- getSpecifierRange(startSpecifier, specifierLen));
+ S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
+ << AT.getRepresentativeTypeName(S.Context) << Ex->getType()
+ << false << Ex->getSourceRange(),
+ Ex->getBeginLoc(), /*IsStringLocation*/ false,
+ getSpecifierRange(startSpecifier, specifierLen));
// Type check the second argument (char * for both %b and %D)
Ex = getDataArg(argIndex + 1);
const analyze_printf::ArgType &AT2 = ArgType::CStrTy;
if (AT2.isValid() && !AT2.matchesType(S.Context, Ex->getType()))
EmitFormatDiagnostic(
- S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
- << AT2.getRepresentativeTypeName(S.Context) << Ex->getType()
- << false << Ex->getSourceRange(),
- Ex->getLocStart(), /*IsStringLocation*/false,
- getSpecifierRange(startSpecifier, specifierLen));
+ S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
+ << AT2.getRepresentativeTypeName(S.Context) << Ex->getType()
+ << false << Ex->getSourceRange(),
+ Ex->getBeginLoc(), /*IsStringLocation*/ false,
+ getSpecifierRange(startSpecifier, specifierLen));
return true;
}
@@ -7668,7 +7659,7 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
return true;
}
- LookupResult Result(S, &S.Context.Idents.get("unichar"), E->getLocStart(),
+ LookupResult Result(S, &S.Context.Idents.get("unichar"), E->getBeginLoc(),
Sema::LookupOrdinaryName);
if (S.LookupName(Result, S.getCurScope())) {
NamedDecl *ND = Result.getFoundDecl();
@@ -7720,7 +7711,7 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
EmitFormatDiagnostic(S.PDiag(Diag)
<< AT.getRepresentativeTypeName(S.Context)
<< IntendedTy << IsEnum << E->getSourceRange(),
- E->getLocStart(),
+ E->getBeginLoc(),
/*IsStringLocation*/ false, SpecRange,
FixItHint::CreateReplacement(SpecRange, os.str()));
} else {
@@ -7749,13 +7740,13 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
} else if (!requiresParensToAddCast(E)) {
// If the expression has high enough precedence,
// just write the C-style cast.
- Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(),
- CastFix.str()));
+ Hints.push_back(
+ FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str()));
} else {
// Otherwise, add parens around the expression as well as the cast.
CastFix << "(";
- Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(),
- CastFix.str()));
+ Hints.push_back(
+ FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str()));
SourceLocation After = S.getLocForEndOfToken(E->getLocEnd());
Hints.push_back(FixItHint::CreateInsertion(After, ")"));
@@ -7775,18 +7766,17 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
: diag::warn_format_argument_needs_cast;
EmitFormatDiagnostic(S.PDiag(Diag) << Name << IntendedTy << IsEnum
<< E->getSourceRange(),
- E->getLocStart(), /*IsStringLocation=*/false,
+ E->getBeginLoc(), /*IsStringLocation=*/false,
SpecRange, Hints);
} else {
// In this case, the expression could be printed using a different
// specifier, but we've decided that the specifier is probably correct
// and we should cast instead. Just use the normal warning message.
EmitFormatDiagnostic(
- S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
- << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum
- << E->getSourceRange(),
- E->getLocStart(), /*IsStringLocation*/false,
- SpecRange, Hints);
+ S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
+ << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum
+ << E->getSourceRange(),
+ E->getBeginLoc(), /*IsStringLocation*/ false, SpecRange, Hints);
}
}
} else {
@@ -7806,41 +7796,34 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
EmitFormatDiagnostic(
S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << ExprTy
<< IsEnum << CSR << E->getSourceRange(),
- E->getLocStart(), /*IsStringLocation*/ false, CSR);
+ E->getBeginLoc(), /*IsStringLocation*/ false, CSR);
break;
}
case Sema::VAK_Undefined:
case Sema::VAK_MSVCUndefined:
- EmitFormatDiagnostic(
- S.PDiag(diag::warn_non_pod_vararg_with_format_string)
- << S.getLangOpts().CPlusPlus11
- << ExprTy
- << CallType
- << AT.getRepresentativeTypeName(S.Context)
- << CSR
- << E->getSourceRange(),
- E->getLocStart(), /*IsStringLocation*/false, CSR);
+ EmitFormatDiagnostic(S.PDiag(diag::warn_non_pod_vararg_with_format_string)
+ << S.getLangOpts().CPlusPlus11 << ExprTy
+ << CallType
+ << AT.getRepresentativeTypeName(S.Context) << CSR
+ << E->getSourceRange(),
+ E->getBeginLoc(), /*IsStringLocation*/ false, CSR);
checkForCStrMembers(AT, E);
break;
case Sema::VAK_Invalid:
if (ExprTy->isObjCObjectType())
EmitFormatDiagnostic(
- S.PDiag(diag::err_cannot_pass_objc_interface_to_vararg_format)
- << S.getLangOpts().CPlusPlus11
- << ExprTy
- << CallType
- << AT.getRepresentativeTypeName(S.Context)
- << CSR
- << E->getSourceRange(),
- E->getLocStart(), /*IsStringLocation*/false, CSR);
+ S.PDiag(diag::err_cannot_pass_objc_interface_to_vararg_format)
+ << S.getLangOpts().CPlusPlus11 << ExprTy << CallType
+ << AT.getRepresentativeTypeName(S.Context) << CSR
+ << E->getSourceRange(),
+ E->getBeginLoc(), /*IsStringLocation*/ false, CSR);
else
// FIXME: If this is an initializer list, suggest removing the braces
// or inserting a cast to the target type.
- S.Diag(E->getLocStart(), diag::err_cannot_pass_to_vararg_format)
- << isa<InitListExpr>(E) << ExprTy << CallType
- << AT.getRepresentativeTypeName(S.Context)
- << E->getSourceRange();
+ S.Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg_format)
+ << isa<InitListExpr>(E) << ExprTy << CallType
+ << AT.getRepresentativeTypeName(S.Context) << E->getSourceRange();
break;
}
@@ -8010,7 +7993,7 @@ bool CheckScanfHandler::HandleScanfSpecifier(
EmitFormatDiagnostic(
S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context)
<< Ex->getType() << false << Ex->getSourceRange(),
- Ex->getLocStart(),
+ Ex->getBeginLoc(),
/*IsStringLocation*/ false,
getSpecifierRange(startSpecifier, specifierLen),
FixItHint::CreateReplacement(
@@ -8019,7 +8002,7 @@ bool CheckScanfHandler::HandleScanfSpecifier(
EmitFormatDiagnostic(S.PDiag(Diag)
<< AT.getRepresentativeTypeName(S.Context)
<< Ex->getType() << false << Ex->getSourceRange(),
- Ex->getLocStart(),
+ Ex->getBeginLoc(),
/*IsStringLocation*/ false,
getSpecifierRange(startSpecifier, specifierLen));
}
@@ -8040,9 +8023,9 @@ static void CheckFormatString(Sema &S, const FormatStringLiteral *FExpr,
// CHECK: is the format string a wide literal?
if (!FExpr->isAscii() && !FExpr->isUTF8()) {
CheckFormatHandler::EmitFormatDiagnostic(
- S, inFunctionCall, Args[format_idx],
- S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getLocStart(),
- /*IsStringLocation*/true, OrigFormatExpr->getSourceRange());
+ S, inFunctionCall, Args[format_idx],
+ S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getBeginLoc(),
+ /*IsStringLocation*/ true, OrigFormatExpr->getSourceRange());
return;
}
@@ -8064,7 +8047,7 @@ static void CheckFormatString(Sema &S, const FormatStringLiteral *FExpr,
CheckFormatHandler::EmitFormatDiagnostic(
S, inFunctionCall, Args[format_idx],
S.PDiag(diag::warn_printf_format_string_not_null_terminated),
- FExpr->getLocStart(),
+ FExpr->getBeginLoc(),
/*IsStringLocation=*/true, OrigFormatExpr->getSourceRange());
return;
}
@@ -8072,9 +8055,9 @@ static void CheckFormatString(Sema &S, const FormatStringLiteral *FExpr,
// CHECK: empty format string?
if (StrLen == 0 && numDataArgs > 0) {
CheckFormatHandler::EmitFormatDiagnostic(
- S, inFunctionCall, Args[format_idx],
- S.PDiag(diag::warn_empty_format_string), FExpr->getLocStart(),
- /*IsStringLocation*/true, OrigFormatExpr->getSourceRange());
+ S, inFunctionCall, Args[format_idx],
+ S.PDiag(diag::warn_empty_format_string), FExpr->getBeginLoc(),
+ /*IsStringLocation*/ true, OrigFormatExpr->getSourceRange());
return;
}
@@ -8855,7 +8838,7 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
const Expr *LenExpr = Call->getArg(LenArg)->IgnoreParenImpCasts();
if (CheckMemorySizeofForComparison(*this, LenExpr, FnName,
- Call->getLocStart(), Call->getRParenLoc()))
+ Call->getBeginLoc(), Call->getRParenLoc()))
return;
// Catch cases like 'memset(buf, sizeof(buf), 0)'.
@@ -9077,7 +9060,7 @@ void Sema::CheckStrlcpycatArguments(const CallExpr *Call,
const Expr *CompareWithSrc = nullptr;
if (CheckMemorySizeofForComparison(*this, SizeArg, FnName,
- Call->getLocStart(), Call->getRParenLoc()))
+ Call->getBeginLoc(), Call->getRParenLoc()))
return;
// Look for 'strlcpy(dst, x, sizeof(x))'
@@ -9109,8 +9092,8 @@ void Sema::CheckStrlcpycatArguments(const CallExpr *Call,
return;
const Expr *OriginalSizeArg = Call->getArg(2);
- Diag(CompareWithSrcDRE->getLocStart(), diag::warn_strlcpycat_wrong_size)
- << OriginalSizeArg->getSourceRange() << FnName;
+ Diag(CompareWithSrcDRE->getBeginLoc(), diag::warn_strlcpycat_wrong_size)
+ << OriginalSizeArg->getSourceRange() << FnName;
// Output a FIXIT hint if the destination is an array (rather than a
// pointer to an array). This could be enhanced to handle some
@@ -9126,9 +9109,9 @@ void Sema::CheckStrlcpycatArguments(const CallExpr *Call,
DstArg->printPretty(OS, nullptr, getPrintingPolicy());
OS << ")";
- Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size)
- << FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(),
- OS.str());
+ Diag(OriginalSizeArg->getBeginLoc(), diag::note_strlcpycat_wrong_size)
+ << FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(),
+ OS.str());
}
/// Check if two expressions refer to the same declaration.
@@ -9161,7 +9144,7 @@ void Sema::CheckStrncatArguments(const CallExpr *CE,
const Expr *SrcArg = CE->getArg(1)->IgnoreParenCasts();
const Expr *LenArg = CE->getArg(2)->IgnoreParenCasts();
- if (CheckMemorySizeofForComparison(*this, LenArg, FnName, CE->getLocStart(),
+ if (CheckMemorySizeofForComparison(*this, LenArg, FnName, CE->getBeginLoc(),
CE->getRParenLoc()))
return;
@@ -9193,7 +9176,7 @@ void Sema::CheckStrncatArguments(const CallExpr *CE,
return;
// Generate the diagnostic.
- SourceLocation SL = LenArg->getLocStart();
+ SourceLocation SL = LenArg->getBeginLoc();
SourceRange SR = LenArg->getSourceRange();
SourceManager &SM = getSourceManager();
@@ -9740,7 +9723,7 @@ static bool IsEnumConstOrFromMacro(Sema &S, Expr *E) {
return true;
// Suppress cases where the '0' value is expanded from a macro.
- if (E->getLocStart().isMacroID())
+ if (E->getBeginLoc().isMacroID())
return true;
return false;
@@ -10547,10 +10530,9 @@ static void checkObjCCollectionLiteralElement(Sema &S,
ElementResult,
false, false)
!= Sema::Compatible) {
- S.Diag(Element->getLocStart(),
- diag::warn_objc_collection_literal_element)
- << ElementType << ElementKind << TargetElementType
- << Element->getSourceRange();
+ S.Diag(Element->getBeginLoc(), diag::warn_objc_collection_literal_element)
+ << ElementType << ElementKind << TargetElementType
+ << Element->getSourceRange();
}
if (auto ArrayLiteral = dyn_cast<ObjCArrayLiteral>(Element))
@@ -10626,7 +10608,7 @@ static bool isSameWidthConstantConversion(Sema &S, Expr *E, QualType T,
// to fill all the bits, even if there is a sign change.
if (auto *IntLit = dyn_cast<IntegerLiteral>(E->IgnoreParenImpCasts())) {
const char FirstLiteralCharacter =
- S.getSourceManager().getCharacterData(IntLit->getLocStart())[0];
+ S.getSourceManager().getCharacterData(IntLit->getBeginLoc())[0];
if (FirstLiteralCharacter == '0')
return false;
}
@@ -11069,13 +11051,13 @@ static bool checkOpenCLEnqueueIntType(Sema &S, Expr *E, const QualType &IntT) {
// Taking into account implicit conversions,
// allow any integer.
if (!E->getType()->isIntegerType()) {
- S.Diag(E->getLocStart(),
+ S.Diag(E->getBeginLoc(),
diag::err_opencl_enqueue_kernel_invalid_local_size_type);
return true;
}
// Potentially emit standard warnings for implicit conversions if enabled
// using -Wconversion.
- CheckImplicitConversion(S, E, IntT, E->getLocStart());
+ CheckImplicitConversion(S, E, IntT, E->getBeginLoc());
return false;
}
@@ -11283,7 +11265,7 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
// Suggest '&' to silence the function warning.
Diag(E->getExprLoc(), diag::note_function_warning_silence)
- << FixItHint::CreateInsertion(E->getLocStart(), "&");
+ << FixItHint::CreateInsertion(E->getBeginLoc(), "&");
// Check to see if '()' fixit should be emitted.
QualType ReturnType;
@@ -12185,8 +12167,8 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
SourceLocation RBracketLoc = SourceMgr.getSpellingLoc(
ASE->getRBracketLoc());
if (SourceMgr.isInSystemHeader(RBracketLoc)) {
- SourceLocation IndexLoc = SourceMgr.getSpellingLoc(
- IndexExpr->getLocStart());
+ SourceLocation IndexLoc =
+ SourceMgr.getSpellingLoc(IndexExpr->getBeginLoc());
if (SourceMgr.isWrittenInSameFile(RBracketLoc, IndexLoc))
return;
}
@@ -12196,11 +12178,11 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
if (ASE)
DiagID = diag::warn_array_index_exceeds_bounds;
- DiagRuntimeBehavior(BaseExpr->getLocStart(), BaseExpr,
+ DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
PDiag(DiagID) << index.toString(10, true)
- << size.toString(10, true)
- << (unsigned)size.getLimitedValue(~0U)
- << IndexExpr->getSourceRange());
+ << size.toString(10, true)
+ << (unsigned)size.getLimitedValue(~0U)
+ << IndexExpr->getSourceRange());
} else {
unsigned DiagID = diag::warn_array_index_precedes_bounds;
if (!ASE) {
@@ -12208,9 +12190,9 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
if (index.isNegative()) index = -index;
}
- DiagRuntimeBehavior(BaseExpr->getLocStart(), BaseExpr,
+ DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
PDiag(DiagID) << index.toString(10, true)
- << IndexExpr->getSourceRange());
+ << IndexExpr->getSourceRange());
}
if (!ND) {
@@ -12225,9 +12207,9 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
}
if (ND)
- DiagRuntimeBehavior(ND->getLocStart(), BaseExpr,
+ DiagRuntimeBehavior(ND->getBeginLoc(), BaseExpr,
PDiag(diag::note_array_index_out_of_bounds)
- << ND->getDeclName());
+ << ND->getDeclName());
}
void Sema::CheckArrayAccess(const Expr *expr) {
@@ -12967,15 +12949,13 @@ void Sema::DiagnoseEmptyLoopBody(const Stmt *S,
if (!ProbableTypo) {
bool BodyColInvalid;
unsigned BodyCol = SourceMgr.getPresumedColumnNumber(
- PossibleBody->getLocStart(),
- &BodyColInvalid);
+ PossibleBody->getBeginLoc(), &BodyColInvalid);
if (BodyColInvalid)
return;
bool StmtColInvalid;
- unsigned StmtCol = SourceMgr.getPresumedColumnNumber(
- S->getLocStart(),
- &StmtColInvalid);
+ unsigned StmtCol =
+ SourceMgr.getPresumedColumnNumber(S->getBeginLoc(), &StmtColInvalid);
if (StmtColInvalid)
return;
@@ -13495,7 +13475,7 @@ void Sema::DiagnoseMisalignedMembers() {
if (const TypedefNameDecl *TD = m.RD->getTypedefNameForAnonDecl())
ND = TD;
}
- Diag(m.E->getLocStart(), diag::warn_taking_address_of_packed_member)
+ Diag(m.E->getBeginLoc(), diag::warn_taking_address_of_packed_member)
<< m.MD << ND << m.E->getSourceRange();
}
MisalignedMembers.clear();
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 1d5454ca778..826cd48a8a5 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -453,7 +453,7 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise,
// to bool.
ExprResult Conv = S.PerformContextuallyConvertToBool(AwaitReady);
if (Conv.isInvalid()) {
- S.Diag(AwaitReady->getDirectCallee()->getLocStart(),
+ S.Diag(AwaitReady->getDirectCallee()->getBeginLoc(),
diag::note_await_ready_no_bool_conversion);
S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
<< AwaitReady->getDirectCallee() << E->getSourceRange();
@@ -1460,7 +1460,7 @@ static Expr *castForMoving(Sema &S, Expr *E, QualType T = QualType()) {
T = E->getType();
QualType TargetType = S.BuildReferenceType(
T, /*SpelledAsLValue*/ false, SourceLocation(), DeclarationName());
- SourceLocation ExprLoc = E->getLocStart();
+ SourceLocation ExprLoc = E->getBeginLoc();
TypeSourceInfo *TargetLoc =
S.Context.getTrivialTypeSourceInfo(TargetType, ExprLoc);
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index ca851bd53e0..906fd89ff24 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1739,8 +1739,8 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx,
tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), true);
if (AfterColon.isInvalid())
return;
- Hint = FixItHint::CreateRemoval(CharSourceRange::
- getCharRange(D->getLocStart(), AfterColon));
+ Hint = FixItHint::CreateRemoval(
+ CharSourceRange::getCharRange(D->getBeginLoc(), AfterColon));
}
}
@@ -4351,8 +4351,8 @@ Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
Record = UT->getDecl();
if (Record && getLangOpts().MicrosoftExt) {
- Diag(DS.getLocStart(), diag::ext_ms_anonymous_record)
- << Record->isUnion() << DS.getSourceRange();
+ Diag(DS.getBeginLoc(), diag::ext_ms_anonymous_record)
+ << Record->isUnion() << DS.getSourceRange();
return BuildMicrosoftCAnonymousStruct(S, DS, Record);
}
@@ -4375,8 +4375,8 @@ Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
if (!DS.isMissingDeclaratorOk()) {
// Customize diagnostic for a typedef missing a name.
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef)
- Diag(DS.getLocStart(), diag::ext_typedef_without_a_name)
- << DS.getSourceRange();
+ Diag(DS.getBeginLoc(), diag::ext_typedef_without_a_name)
+ << DS.getSourceRange();
else
DeclaresAnything = false;
}
@@ -4400,7 +4400,7 @@ Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS,
if (!DeclaresAnything) {
// In C, we allow this as a (popular) extension / bug. Don't bother
// producing further diagnostics for redundant qualifiers after this.
- Diag(DS.getLocStart(), diag::ext_no_declarators) << DS.getSourceRange();
+ Diag(DS.getBeginLoc(), diag::ext_no_declarators) << DS.getSourceRange();
return TagD;
}
@@ -4810,14 +4810,11 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
// Create a declaration for this anonymous struct/union.
NamedDecl *Anon = nullptr;
if (RecordDecl *OwningClass = dyn_cast<RecordDecl>(Owner)) {
- Anon = FieldDecl::Create(Context, OwningClass,
- DS.getLocStart(),
- Record->getLocation(),
- /*IdentifierInfo=*/nullptr,
- Context.getTypeDeclType(Record),
- TInfo,
- /*BitWidth=*/nullptr, /*Mutable=*/false,
- /*InitStyle=*/ICIS_NoInit);
+ Anon = FieldDecl::Create(
+ Context, OwningClass, DS.getBeginLoc(), Record->getLocation(),
+ /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo,
+ /*BitWidth=*/nullptr, /*Mutable=*/false,
+ /*InitStyle=*/ICIS_NoInit);
Anon->setAccess(AS);
if (getLangOpts().CPlusPlus)
FieldCollector->Add(cast<FieldDecl>(Anon));
@@ -4832,11 +4829,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
SC = SC_None;
}
- Anon = VarDecl::Create(Context, Owner,
- DS.getLocStart(),
+ Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(),
Record->getLocation(), /*IdentifierInfo=*/nullptr,
- Context.getTypeDeclType(Record),
- TInfo, SC);
+ Context.getTypeDeclType(Record), TInfo, SC);
// Default-initialize the implicit variable. This initialization will be
// trivial in almost all cases, except if a union member has an in-class
@@ -4908,15 +4903,11 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS,
QualType RecTy = Context.getTypeDeclType(Record);
// Create a declaration for this anonymous struct.
- NamedDecl *Anon = FieldDecl::Create(Context,
- ParentDecl,
- DS.getLocStart(),
- DS.getLocStart(),
- /*IdentifierInfo=*/nullptr,
- RecTy,
- TInfo,
- /*BitWidth=*/nullptr, /*Mutable=*/false,
- /*InitStyle=*/ICIS_NoInit);
+ NamedDecl *Anon =
+ FieldDecl::Create(Context, ParentDecl, DS.getBeginLoc(), DS.getBeginLoc(),
+ /*IdentifierInfo=*/nullptr, RecTy, TInfo,
+ /*BitWidth=*/nullptr, /*Mutable=*/false,
+ /*InitStyle=*/ICIS_NoInit);
Anon->setImplicit();
// Add the anonymous struct object to the current context.
@@ -5344,9 +5335,8 @@ NamedDecl *Sema::HandleDeclarator(Scope *S, Declarator &D,
return ActOnDecompositionDeclarator(S, D, TemplateParamLists);
} else if (!Name) {
if (!D.isInvalidType()) // Reject this if we think it is valid.
- Diag(D.getDeclSpec().getLocStart(),
- diag::err_declarator_need_ident)
- << D.getDeclSpec().getSourceRange() << D.getSourceRange();
+ Diag(D.getDeclSpec().getBeginLoc(), diag::err_declarator_need_ident)
+ << D.getDeclSpec().getSourceRange() << D.getSourceRange();
return nullptr;
} else if (DiagnoseUnexpandedParameterPack(NameInfo, UPPC_DeclarationType))
return nullptr;
@@ -6378,7 +6368,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
// address space qualifiers.
if (R->isEventT()) {
if (R.getAddressSpace() != LangAS::opencl_private) {
- Diag(D.getLocStart(), diag::err_event_t_addr_space_qual);
+ Diag(D.getBeginLoc(), diag::err_event_t_addr_space_qual);
D.setInvalidType();
}
}
@@ -6452,9 +6442,8 @@ NamedDecl *Sema::ActOnVariableDeclarator(
VarTemplateDecl *NewTemplate = nullptr;
TemplateParameterList *TemplateParams = nullptr;
if (!getLangOpts().CPlusPlus) {
- NewVD = VarDecl::Create(Context, DC, D.getLocStart(),
- D.getIdentifierLoc(), II,
- R, TInfo, SC);
+ NewVD = VarDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(),
+ II, R, TInfo, SC);
if (R->getContainedDeducedType())
ParsingInitForAutoVars.insert(NewVD);
@@ -6516,7 +6505,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
// Match up the template parameter lists with the scope specifier, then
// determine whether we have a template or a template specialization.
TemplateParams = MatchTemplateParametersToScopeSpecifier(
- D.getDeclSpec().getLocStart(), D.getIdentifierLoc(),
+ D.getDeclSpec().getBeginLoc(), D.getIdentifierLoc(),
D.getCXXScopeSpec(),
D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId
? D.getName().TemplateId
@@ -6575,11 +6564,11 @@ NamedDecl *Sema::ActOnVariableDeclarator(
NewVD = cast<VarDecl>(Res.get());
AddToScope = false;
} else if (D.isDecompositionDeclarator()) {
- NewVD = DecompositionDecl::Create(Context, DC, D.getLocStart(),
+ NewVD = DecompositionDecl::Create(Context, DC, D.getBeginLoc(),
D.getIdentifierLoc(), R, TInfo, SC,
Bindings);
} else
- NewVD = VarDecl::Create(Context, DC, D.getLocStart(),
+ NewVD = VarDecl::Create(Context, DC, D.getBeginLoc(),
D.getIdentifierLoc(), II, R, TInfo, SC);
// If this is supposed to be a variable template, create it as such.
@@ -6796,7 +6785,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
}
if (!R->isIntegralType(Context) && !R->isPointerType()) {
- Diag(D.getLocStart(), diag::err_asm_bad_register_type);
+ Diag(D.getBeginLoc(), diag::err_asm_bad_register_type);
NewVD->setInvalidDecl(true);
}
}
@@ -6926,12 +6915,12 @@ NamedDecl *Sema::ActOnVariableDeclarator(
// C++ [basic.start.main]p3
// A program that declares a variable main at global scope is ill-formed.
if (getLangOpts().CPlusPlus)
- Diag(D.getLocStart(), diag::err_main_global_variable);
+ Diag(D.getBeginLoc(), diag::err_main_global_variable);
// In C, and external-linkage variable named main results in undefined
// behavior.
else if (NewVD->hasExternalFormalLinkage())
- Diag(D.getLocStart(), diag::warn_main_redefined);
+ Diag(D.getBeginLoc(), diag::warn_main_redefined);
}
if (D.isRedeclaration() && !Previous.empty()) {
@@ -7933,10 +7922,8 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
(D.isFunctionDeclarator() && D.getFunctionTypeInfo().hasPrototype) ||
(!R->getAsAdjusted<FunctionType>() && R->isFunctionProtoType());
- NewFD = FunctionDecl::Create(SemaRef.Context, DC,
- D.getLocStart(), NameInfo, R,
- TInfo, SC, isInline,
- HasPrototype, false);
+ NewFD = FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), NameInfo,
+ R, TInfo, SC, isInline, HasPrototype, false);
if (D.isInvalidType())
NewFD->setInvalidDecl();
@@ -7961,22 +7948,20 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
"Constructors can only be declared in a member context");
R = SemaRef.CheckConstructorDeclarator(D, R, SC);
- return CXXConstructorDecl::Create(SemaRef.Context, cast<CXXRecordDecl>(DC),
- D.getLocStart(), NameInfo,
- R, TInfo, isExplicit, isInline,
- /*isImplicitlyDeclared=*/false,
- isConstexpr);
+ return CXXConstructorDecl::Create(
+ SemaRef.Context, cast<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,
+ TInfo, isExplicit, isInline,
+ /*isImplicitlyDeclared=*/false, isConstexpr);
} else if (Name.getNameKind() == DeclarationName::CXXDestructorName) {
// This is a C++ destructor declaration.
if (DC->isRecord()) {
R = SemaRef.CheckDestructorDeclarator(D, R, SC);
CXXRecordDecl *Record = cast<CXXRecordDecl>(DC);
- CXXDestructorDecl *NewDD = CXXDestructorDecl::Create(
- SemaRef.Context, Record,
- D.getLocStart(),
- NameInfo, R, TInfo, isInline,
- /*isImplicitlyDeclared=*/false);
+ CXXDestructorDecl *NewDD =
+ CXXDestructorDecl::Create(SemaRef.Context, Record, D.getBeginLoc(),
+ NameInfo, R, TInfo, isInline,
+ /*isImplicitlyDeclared=*/false);
// If the class is complete, then we now create the implicit exception
// specification. If the class is incomplete or dependent, we can't do
@@ -7996,10 +7981,9 @@ 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.getLocStart(),
- D.getIdentifierLoc(), Name, R, TInfo,
- SC, isInline,
+ return FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(),
+ D.getIdentifierLoc(), Name, R, TInfo, SC,
+ isInline,
/*hasPrototype=*/true, isConstexpr);
}
@@ -8012,15 +7996,14 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
SemaRef.CheckConversionDeclarator(D, R, SC);
IsVirtualOkay = true;
- return CXXConversionDecl::Create(SemaRef.Context, cast<CXXRecordDecl>(DC),
- D.getLocStart(), NameInfo,
- R, TInfo, isInline, isExplicit,
- isConstexpr, SourceLocation());
+ return CXXConversionDecl::Create(
+ SemaRef.Context, cast<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,
+ TInfo, isInline, isExplicit, isConstexpr, SourceLocation());
} else if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) {
SemaRef.CheckDeductionGuideDeclarator(D, R, SC);
- return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getLocStart(),
+ return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getBeginLoc(),
isExplicit, NameInfo, R, TInfo,
D.getLocEnd());
} else if (DC->isRecord()) {
@@ -8037,11 +8020,9 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
}
// This is a C++ method declaration.
- CXXMethodDecl *Ret = CXXMethodDecl::Create(SemaRef.Context,
- cast<CXXRecordDecl>(DC),
- D.getLocStart(), NameInfo, R,
- TInfo, SC, isInline,
- isConstexpr, SourceLocation());
+ CXXMethodDecl *Ret = CXXMethodDecl::Create(
+ SemaRef.Context, cast<CXXRecordDecl>(DC), D.getBeginLoc(), NameInfo, R,
+ TInfo, SC, isInline, isConstexpr, SourceLocation());
IsVirtualOkay = !Ret->isStatic();
return Ret;
} else {
@@ -8053,10 +8034,9 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
// Determine whether the function was written with a
// prototype. This true when:
// - we're in C++ (where every function has a prototype),
- return FunctionDecl::Create(SemaRef.Context, DC,
- D.getLocStart(),
- NameInfo, R, TInfo, SC, isInline,
- true/*HasPrototype*/, isConstexpr);
+ return FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), NameInfo,
+ R, TInfo, SC, isInline, true /*HasPrototype*/,
+ isConstexpr);
}
}
@@ -8421,7 +8401,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
bool Invalid = false;
if (TemplateParameterList *TemplateParams =
MatchTemplateParametersToScopeSpecifier(
- D.getDeclSpec().getLocStart(), D.getIdentifierLoc(),
+ D.getDeclSpec().getBeginLoc(), D.getIdentifierLoc(),
D.getCXXScopeSpec(),
D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId
? D.getName().TemplateId
@@ -8491,8 +8471,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
<< FixItHint::CreateInsertion(InsertLoc, "<>");
}
}
- }
- else {
+ } else {
// All template param lists were matched against the scope specifier:
// this is NOT (an explicit specialization of) a template.
if (TemplateParamLists.size() > 0)
@@ -10111,7 +10090,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
// A deduction guide is not on the list of entities that can be
// explicitly specialized.
if (Guide->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
- Diag(Guide->getLocStart(), diag::err_deduction_guide_specialized)
+ Diag(Guide->getBeginLoc(), diag::err_deduction_guide_specialized)
<< /*explicit specialization*/ 1;
}
@@ -10714,11 +10693,10 @@ namespace {
return;
}
- S.DiagRuntimeBehavior(DRE->getLocStart(), DRE,
+ S.DiagRuntimeBehavior(DRE->getBeginLoc(), DRE,
S.PDiag(diag)
- << DRE->getDecl()
- << OrigDecl->getLocation()
- << DRE->getSourceRange());
+ << DRE->getDecl() << OrigDecl->getLocation()
+ << DRE->getSourceRange());
}
};
@@ -10817,7 +10795,7 @@ QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl,
if (DeduceInits.empty()) {
// It isn't possible to write this directly, but it is possible to
// end up in this situation with "auto x(some_pack...);"
- Diag(Init->getLocStart(), IsInitCapture
+ Diag(Init->getBeginLoc(), IsInitCapture
? diag::err_init_capture_no_expression
: diag::err_auto_var_init_no_expression)
<< VN << Type << Range;
@@ -10825,7 +10803,7 @@ QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl,
}
if (DeduceInits.size() > 1) {
- Diag(DeduceInits[1]->getLocStart(),
+ Diag(DeduceInits[1]->getBeginLoc(),
IsInitCapture ? diag::err_init_capture_multiple_expressions
: diag::err_auto_var_init_multiple_expressions)
<< VN << Type << Range;
@@ -10834,7 +10812,7 @@ QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl,
Expr *DeduceInit = DeduceInits[0];
if (DirectInit && isa<InitListExpr>(DeduceInit)) {
- Diag(Init->getLocStart(), IsInitCapture
+ Diag(Init->getBeginLoc(), IsInitCapture
? diag::err_init_capture_paren_braces
: diag::err_auto_var_init_paren_braces)
<< isa<InitListExpr>(Init) << VN << Type << Range;
@@ -11139,7 +11117,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
if ((VDecl->getType().getObjCLifetime() == Qualifiers::OCL_Strong ||
VDecl->getType().isNonWeakInMRRWithObjCWeak(Context)) &&
!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak,
- Init->getLocStart()))
+ Init->getBeginLoc()))
FSI->markSafeWeakUse(Init);
}
@@ -11271,9 +11249,9 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
Diag(VDecl->getLocation(),
diag::ext_in_class_initializer_float_type_cxx11)
<< DclT << Init->getSourceRange();
- Diag(VDecl->getLocStart(),
+ Diag(VDecl->getBeginLoc(),
diag::note_in_class_initializer_float_type_cxx11)
- << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr ");
+ << FixItHint::CreateInsertion(VDecl->getBeginLoc(), "constexpr ");
} else {
Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type)
<< DclT << Init->getSourceRange();
@@ -11288,8 +11266,8 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
// Suggest adding 'constexpr' in C++11 for literal types.
} else if (getLangOpts().CPlusPlus11 && DclT->isLiteralType(Context)) {
Diag(VDecl->getLocation(), diag::err_in_class_initializer_literal_type)
- << DclT << Init->getSourceRange()
- << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr ");
+ << DclT << Init->getSourceRange()
+ << FixItHint::CreateInsertion(VDecl->getBeginLoc(), "constexpr ");
VDecl->setConstexpr(true);
} else {
@@ -12370,11 +12348,9 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
// Temporarily put parameter variables in the translation unit, not
// the enclosing context. This prevents them from accidentally
// looking like class members in C++.
- ParmVarDecl *New = CheckParameter(Context.getTranslationUnitDecl(),
- D.getLocStart(),
- D.getIdentifierLoc(), II,
- parmDeclType, TInfo,
- SC);
+ ParmVarDecl *New =
+ CheckParameter(Context.getTranslationUnitDecl(), D.getBeginLoc(),
+ D.getIdentifierLoc(), II, parmDeclType, TInfo, SC);
if (D.isInvalidType())
New->setInvalidDecl();
@@ -13111,7 +13087,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
if (FD->isMultiVersion() && FD->hasAttr<CPUDispatchAttr>() && Body)
if (const auto *CmpndBody = dyn_cast<CompoundStmt>(Body))
if (!CmpndBody->body_empty())
- Diag(CmpndBody->body_front()->getLocStart(),
+ Diag(CmpndBody->body_front()->getBeginLoc(),
diag::warn_dispatch_body_ignored);
if (auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
@@ -13262,7 +13238,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
if (RegisterVariables)
continue;
if (!isa<AsmStmt>(S) && !isa<NullStmt>(S)) {
- Diag(S->getLocStart(), diag::err_non_asm_stmt_in_naked_function);
+ Diag(S->getBeginLoc(), diag::err_non_asm_stmt_in_naked_function);
Diag(FD->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
FD->setInvalidDecl();
break;
@@ -13568,11 +13544,9 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T,
}
// Scope manipulation handled by caller.
- TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext,
- D.getLocStart(),
- D.getIdentifierLoc(),
- D.getIdentifier(),
- TInfo);
+ TypedefDecl *NewTD =
+ TypedefDecl::Create(Context, CurContext, D.getBeginLoc(),
+ D.getIdentifierLoc(), D.getIdentifier(), TInfo);
// Bail out immediately if we have an invalid declaration.
if (D.isInvalidType()) {
@@ -14863,12 +14837,11 @@ void Sema::ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagD,
// class itself; this is known as the injected-class-name. For
// purposes of access checking, the injected-class-name is treated
// as if it were a public member name.
- CXXRecordDecl *InjectedClassName
- = CXXRecordDecl::Create(Context, Record->getTagKind(), CurContext,
- Record->getLocStart(), Record->getLocation(),
- Record->getIdentifier(),
- /*PrevDecl=*/nullptr,
- /*DelayTypeCreation=*/true);
+ CXXRecordDecl *InjectedClassName = CXXRecordDecl::Create(
+ Context, Record->getTagKind(), CurContext, Record->getBeginLoc(),
+ Record->getLocation(), Record->getIdentifier(),
+ /*PrevDecl=*/nullptr,
+ /*DelayTypeCreation=*/true);
Context.getTypeDeclType(InjectedClassName, Record);
InjectedClassName->setImplicit();
InjectedClassName->setAccess(AS_public);
@@ -15135,7 +15108,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
bool Mutable
= (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable);
- SourceLocation TSSL = D.getLocStart();
+ SourceLocation TSSL = D.getBeginLoc();
FieldDecl *NewFD
= CheckFieldDecl(II, T, TInfo, Record, Loc, Mutable, BitWidth, InitStyle,
TSSL, AS, PrevDecl, &D);
@@ -16771,7 +16744,7 @@ static void checkModuleImportContext(Sema &S, Module *M,
switch (LSD->getLanguage()) {
case LinkageSpecDecl::lang_c:
if (ExternCLoc.isInvalid())
- ExternCLoc = LSD->getLocStart();
+ ExternCLoc = LSD->getBeginLoc();
break;
case LinkageSpecDecl::lang_cxx:
break;
@@ -16787,8 +16760,9 @@ static void checkModuleImportContext(Sema &S, Module *M,
? diag::ext_module_import_not_at_top_level_noop
: diag::err_module_import_not_at_top_level_fatal)
<< M->getFullModuleName() << DC;
- S.Diag(cast<Decl>(DC)->getLocStart(),
- diag::note_module_import_not_at_top_level) << DC;
+ S.Diag(cast<Decl>(DC)->getBeginLoc(),
+ diag::note_module_import_not_at_top_level)
+ << DC;
} else if (!M->IsExternC && ExternCLoc.isValid()) {
S.Diag(ImportLoc, diag::ext_module_import_in_extern_c)
<< M->getFullModuleName();
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index ef08faa2dc4..30f8f9683dd 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -367,10 +367,10 @@ bool Sema::checkStringLiteralArgumentAttr(const ParsedAttr &AL, unsigned ArgNum,
Expr *ArgExpr = AL.getArgAsExpr(ArgNum);
const auto *Literal = dyn_cast<StringLiteral>(ArgExpr->IgnoreParenCasts());
if (ArgLocation)
- *ArgLocation = ArgExpr->getLocStart();
+ *ArgLocation = ArgExpr->getBeginLoc();
if (!Literal || !Literal->isAscii()) {
- Diag(ArgExpr->getLocStart(), diag::err_attribute_argument_type)
+ Diag(ArgExpr->getBeginLoc(), diag::err_attribute_argument_type)
<< AL << AANT_ArgumentString;
return false;
}
@@ -764,7 +764,7 @@ static bool checkParamIsIntegerType(Sema &S, const FunctionDecl *FD,
const ParmVarDecl *Param = FD->getParamDecl(Idx.getASTIndex());
if (!Param->getType()->isIntegerType() && !Param->getType()->isCharType()) {
- SourceLocation SrcLoc = AttrArg->getLocStart();
+ SourceLocation SrcLoc = AttrArg->getBeginLoc();
S.Diag(SrcLoc, diag::err_attribute_integers_only)
<< AI << Param->getSourceRange();
return false;
@@ -977,7 +977,7 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
DiagnoseIfAttr::DiagnosticType DiagType;
if (!DiagnoseIfAttr::ConvertStrToDiagnosticType(DiagTypeStr, DiagType)) {
- S.Diag(AL.getArgAsExpr(2)->getLocStart(),
+ S.Diag(AL.getArgAsExpr(2)->getBeginLoc(),
diag::err_diagnose_if_invalid_diagnostic_type);
return;
}
@@ -992,7 +992,7 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (D->hasAttr<PassObjectSizeAttr>()) {
- S.Diag(D->getLocStart(), diag::err_attribute_only_once_per_parameter) << AL;
+ S.Diag(D->getBeginLoc(), diag::err_attribute_only_once_per_parameter) << AL;
return;
}
@@ -1005,7 +1005,7 @@ static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// __builtin_object_size. So, it has the same constraints as that second
// argument; namely, it must be in the range [0, 3].
if (Type > 3) {
- S.Diag(E->getLocStart(), diag::err_attribute_argument_outof_range)
+ S.Diag(E->getBeginLoc(), diag::err_attribute_argument_outof_range)
<< AL << 0 << 3 << E->getSourceRange();
return;
}
@@ -1015,7 +1015,7 @@ static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// At this point, we have no clue if `D` belongs to a function declaration or
// definition, so we defer the constness check until later.
if (!cast<ParmVarDecl>(D)->getType()->isPointerType()) {
- S.Diag(D->getLocStart(), diag::err_attribute_pointers_only) << AL << 1;
+ S.Diag(D->getBeginLoc(), diag::err_attribute_pointers_only) << AL << 1;
return;
}
@@ -1565,7 +1565,7 @@ void Sema::AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr,
QualType Ty = getFunctionOrMethodParamType(D, Idx.getASTIndex());
if (!Ty->isDependentType() && !Ty->isIntegralType(Context)) {
- Diag(ParamExpr->getLocStart(), diag::err_attribute_integers_only)
+ Diag(ParamExpr->getBeginLoc(), diag::err_attribute_integers_only)
<< &TmpAttr
<< FuncDecl->getParamDecl(Idx.getASTIndex())->getSourceRange();
return;
@@ -4106,15 +4106,15 @@ static void handleGlobalAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
if (const auto *Method = dyn_cast<CXXMethodDecl>(FD)) {
if (Method->isInstance()) {
- S.Diag(Method->getLocStart(), diag::err_kern_is_nonstatic_method)
+ S.Diag(Method->getBeginLoc(), diag::err_kern_is_nonstatic_method)
<< Method;
return;
}
- S.Diag(Method->getLocStart(), diag::warn_kern_is_method) << Method;
+ S.Diag(Method->getBeginLoc(), diag::warn_kern_is_method) << Method;
}
// Only warn for "inline" when compiling for host, to cut down on noise.
if (FD->isInlineSpecified() && !S.getLangOpts().CUDAIsDevice)
- S.Diag(FD->getLocStart(), diag::warn_kern_is_inline) << FD;
+ S.Diag(FD->getBeginLoc(), diag::warn_kern_is_inline) << FD;
D->addAttr(::new (S.Context)
CUDAGlobalAttr(AL.getRange(), S.Context,
@@ -4665,7 +4665,7 @@ void Sema::AddNSConsumedAttr(SourceRange AttrRange, Decl *D,
// is significant. Allow non-dependent code to contain inappropriate
// attributes even in ARC, but require template instantiations to be
// set up correctly.
- Diag(D->getLocStart(), (IsTemplateInstantiation && IsNSConsumed &&
+ Diag(D->getBeginLoc(), (IsTemplateInstantiation && IsNSConsumed &&
getLangOpts().ObjCAutoRefCount
? diag::err_ns_attribute_wrong_parameter_type
: diag::warn_ns_attribute_wrong_parameter_type))
@@ -4707,7 +4707,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
else if (const auto *Param = dyn_cast<ParmVarDecl>(D)) {
ReturnType = Param->getType()->getPointeeType();
if (ReturnType.isNull()) {
- S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type)
+ S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type)
<< AL << /*pointer-to-CF*/ 2 << AL.getRange();
return;
}
@@ -4728,7 +4728,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
ExpectedDeclKind = ExpectedFunctionMethodOrParameter;
break;
}
- S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type)
+ S.Diag(D->getBeginLoc(), diag::warn_attribute_wrong_decl_type)
<< AL.getRange() << AL << ExpectedDeclKind;
return;
}
@@ -4760,7 +4760,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
return;
if (isa<ParmVarDecl>(D)) {
- S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type)
+ S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type)
<< AL << /*pointer-to-CF*/ 2 << AL.getRange();
} else {
// Needs to be kept in sync with warn_ns_attribute_wrong_return_type.
@@ -4773,7 +4773,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D,
SubjectKind = Method;
else if (isa<ObjCPropertyDecl>(D))
SubjectKind = Property;
- S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type)
+ S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type)
<< AL << SubjectKind << Cf << AL.getRange();
}
return;
@@ -4819,7 +4819,7 @@ static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D,
if (!resultType->isReferenceType() &&
(!resultType->isPointerType() || resultType->isObjCRetainableType())) {
- S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type)
+ S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type)
<< SourceRange(loc) << Attrs
<< (isa<ObjCMethodDecl>(D) ? EP_ObjCMethod : EP_ObjCProperty)
<< /*non-retainable pointer*/ 2;
@@ -4838,13 +4838,13 @@ static void handleObjCRequiresSuperAttr(Sema &S, Decl *D,
const DeclContext *DC = Method->getDeclContext();
if (const auto *PDecl = dyn_cast_or_null<ObjCProtocolDecl>(DC)) {
- S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) << Attrs
+ S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs
<< 0;
S.Diag(PDecl->getLocation(), diag::note_protocol_decl);
return;
}
if (Method->getMethodFamily() == OMF_dealloc) {
- S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) << Attrs
+ S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs
<< 1;
return;
}
@@ -4857,7 +4857,7 @@ static void handleObjCBridgeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr;
if (!Parm) {
- S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0;
+ S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;
return;
}
@@ -4886,7 +4886,7 @@ static void handleObjCBridgeMutableAttr(Sema &S, Decl *D,
IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr;
if (!Parm) {
- S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0;
+ S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;
return;
}
@@ -4900,7 +4900,7 @@ static void handleObjCBridgeRelatedAttr(Sema &S, Decl *D,
IdentifierInfo *RelatedClass =
AL.isArgIdent(0) ? AL.getArgAsIdent(0)->Ident : nullptr;
if (!RelatedClass) {
- S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0;
+ S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0;
return;
}
IdentifierInfo *ClassMethod =
@@ -4970,7 +4970,7 @@ static void handleObjCBoxable(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleObjCOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (hasDeclarator(D)) return;
- S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type)
+ S.Diag(D->getBeginLoc(), diag::err_attribute_wrong_decl_type)
<< AL.getRange() << AL << ExpectedVariable;
}
@@ -5293,7 +5293,7 @@ static void handleAnyX86InterruptAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
// Interrupt handler must have 1 or 2 parameters.
unsigned NumParams = getFunctionOrMethodNumParams(D);
if (NumParams < 1 || NumParams > 2) {
- S.Diag(D->getLocStart(), diag::err_anyx86_interrupt_attribute)
+ S.Diag(D->getBeginLoc(), diag::err_anyx86_interrupt_attribute)
<< (S.Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86
? 0
: 1)
@@ -7062,7 +7062,7 @@ struct AttributeInsertion {
return {" ", Loc, ""};
}
static AttributeInsertion createInsertionBefore(const NamedDecl *D) {
- return {"", D->getLocStart(), "\n"};
+ return {"", D->getBeginLoc(), "\n"};
}
};
@@ -7592,18 +7592,18 @@ public:
bool VisitDeclRefExpr(DeclRefExpr *DRE) {
DiagnoseDeclAvailability(DRE->getDecl(),
- SourceRange(DRE->getLocStart(), DRE->getLocEnd()));
+ SourceRange(DRE->getBeginLoc(), DRE->getLocEnd()));
return true;
}
bool VisitMemberExpr(MemberExpr *ME) {
DiagnoseDeclAvailability(ME->getMemberDecl(),
- SourceRange(ME->getLocStart(), ME->getLocEnd()));
+ SourceRange(ME->getBeginLoc(), ME->getLocEnd()));
return true;
}
bool VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) {
- SemaRef.Diag(E->getLocStart(), diag::warn_at_available_unchecked_use)
+ SemaRef.Diag(E->getBeginLoc(), diag::warn_at_available_unchecked_use)
<< (!SemaRef.getLangOpts().ObjC1);
return true;
}
@@ -7692,7 +7692,7 @@ void DiagnoseUnguardedAvailability::DiagnoseDeclAvailability(
const SourceManager &SM = SemaRef.getSourceManager();
SourceLocation IfInsertionLoc =
- SM.getExpansionLoc(StmtOfUse->getLocStart());
+ SM.getExpansionLoc(StmtOfUse->getBeginLoc());
SourceLocation StmtEndLoc =
SM.getExpansionRange(
(LastStmtOfUse ? LastStmtOfUse : StmtOfUse)->getLocEnd())
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index b961eba1989..a7753c51ef2 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -94,17 +94,17 @@ 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->getLocStart(),
+ return S->Diag(DRE->getBeginLoc(),
diag::err_param_default_argument_references_param)
- << Param->getDeclName() << DefaultArg->getSourceRange();
+ << Param->getDeclName() << DefaultArg->getSourceRange();
} else if (VarDecl *VDecl = dyn_cast<VarDecl>(Decl)) {
// C++ [dcl.fct.default]p7
// Local variables shall not be used in default argument
// expressions.
if (VDecl->isLocalVarDecl())
- return S->Diag(DRE->getLocStart(),
+ return S->Diag(DRE->getBeginLoc(),
diag::err_param_default_argument_references_local)
- << VDecl->getDeclName() << DefaultArg->getSourceRange();
+ << VDecl->getDeclName() << DefaultArg->getSourceRange();
}
return false;
@@ -115,9 +115,9 @@ 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->getLocStart(),
+ return S->Diag(ThisE->getBeginLoc(),
diag::err_param_default_argument_references_this)
- << ThisE->getSourceRange();
+ << ThisE->getSourceRange();
}
bool CheckDefaultArgumentVisitor::VisitPseudoObjectExpr(PseudoObjectExpr *POE) {
@@ -144,8 +144,7 @@ namespace {
if (Lambda->capture_begin() == Lambda->capture_end())
return false;
- return S->Diag(Lambda->getLocStart(),
- diag::err_lambda_capture_default_arg);
+ return S->Diag(Lambda->getBeginLoc(), diag::err_lambda_capture_default_arg);
}
}
@@ -1283,9 +1282,9 @@ static const CXXRecordDecl *findDecomposableBaseClass(Sema &S,
<< RD << BaseType;
for (auto &BS : *BestPath) {
if (BS.Base->getAccessSpecifier() != AS_public) {
- S.Diag(BS.Base->getLocStart(), diag::note_access_constrained_by_path)
- << (BS.Base->getAccessSpecifier() == AS_protected)
- << (BS.Base->getAccessSpecifierAsWritten() == AS_none);
+ S.Diag(BS.Base->getBeginLoc(), diag::note_access_constrained_by_path)
+ << (BS.Base->getAccessSpecifier() == AS_protected)
+ << (BS.Base->getAccessSpecifierAsWritten() == AS_none);
break;
}
}
@@ -1619,8 +1618,8 @@ bool Sema::CheckConstexprFunctionDecl(const FunctionDecl *NewFD) {
<< isa<CXXConstructorDecl>(NewFD)
<< getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases();
for (const auto &I : RD->vbases())
- Diag(I.getLocStart(),
- diag::note_constexpr_virtual_base_here) << I.getSourceRange();
+ Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here)
+ << I.getSourceRange();
return false;
}
}
@@ -1704,11 +1703,11 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
case Decl::CXXRecord:
// C++1y allows types to be defined, not just declared.
if (cast<TagDecl>(DclIt)->isThisDeclarationADefinition())
- SemaRef.Diag(DS->getLocStart(),
+ SemaRef.Diag(DS->getBeginLoc(),
SemaRef.getLangOpts().CPlusPlus14
- ? diag::warn_cxx11_compat_constexpr_type_definition
- : diag::ext_constexpr_type_definition)
- << isa<CXXConstructorDecl>(Dcl);
+ ? diag::warn_cxx11_compat_constexpr_type_definition
+ : diag::ext_constexpr_type_definition)
+ << isa<CXXConstructorDecl>(Dcl);
continue;
case Decl::EnumConstant:
@@ -1759,12 +1758,12 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
// These are disallowed in C++11 and permitted in C++1y. Allow them
// everywhere as an extension.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = DS->getLocStart();
+ Cxx1yLoc = DS->getBeginLoc();
continue;
default:
- SemaRef.Diag(DS->getLocStart(), diag::err_constexpr_body_invalid_stmt)
- << isa<CXXConstructorDecl>(Dcl);
+ SemaRef.Diag(DS->getBeginLoc(), diag::err_constexpr_body_invalid_stmt)
+ << isa<CXXConstructorDecl>(Dcl);
return false;
}
}
@@ -1843,17 +1842,17 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
if (isa<CXXConstructorDecl>(Dcl)) {
// C++1y allows return statements in constexpr constructors.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
return true;
}
- ReturnStmts.push_back(S->getLocStart());
+ ReturnStmts.push_back(S->getBeginLoc());
return true;
case Stmt::CompoundStmtClass: {
// C++1y allows compound-statements.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
CompoundStmt *CompStmt = cast<CompoundStmt>(S);
for (auto *BodyIt : CompStmt->body()) {
@@ -1866,13 +1865,13 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
case Stmt::AttributedStmtClass:
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
return true;
case Stmt::IfStmtClass: {
// C++1y allows if-statements.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
IfStmt *If = cast<IfStmt>(S);
if (!CheckConstexprFunctionStmt(SemaRef, Dcl, If->getThen(), ReturnStmts,
@@ -1895,7 +1894,7 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
if (!SemaRef.getLangOpts().CPlusPlus14)
break;
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
for (Stmt *SubStmt : S->children())
if (SubStmt &&
!CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
@@ -1910,7 +1909,7 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
// C++1y allows switch-statements, and since they don't need variable
// mutation, we can reasonably allow them in C++11 as an extension.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
for (Stmt *SubStmt : S->children())
if (SubStmt &&
!CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts,
@@ -1924,12 +1923,12 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
// C++1y allows expression-statements.
if (!Cxx1yLoc.isValid())
- Cxx1yLoc = S->getLocStart();
+ Cxx1yLoc = S->getBeginLoc();
return true;
}
- SemaRef.Diag(S->getLocStart(), diag::err_constexpr_body_invalid_stmt)
- << isa<CXXConstructorDecl>(Dcl);
+ SemaRef.Diag(S->getBeginLoc(), diag::err_constexpr_body_invalid_stmt)
+ << isa<CXXConstructorDecl>(Dcl);
return false;
}
@@ -1948,8 +1947,8 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) {
// C++11 [dcl.constexpr]p4:
// In the definition of a constexpr constructor, [...]
// - its function-body shall not be a function-try-block;
- Diag(Body->getLocStart(), diag::err_constexpr_function_try_block)
- << isa<CXXConstructorDecl>(Dcl);
+ Diag(Body->getBeginLoc(), diag::err_constexpr_function_try_block)
+ << isa<CXXConstructorDecl>(Dcl);
return false;
}
@@ -2408,10 +2407,8 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class,
// 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]->getLocStart(),
- diag::err_duplicate_base_class)
- << KnownBase->getType()
- << Bases[idx]->getSourceRange();
+ Diag(Bases[idx]->getBeginLoc(), diag::err_duplicate_base_class)
+ << KnownBase->getType() << Bases[idx]->getSourceRange();
// Delete the duplicate base class specifier; we're going to
// overwrite its pointer later.
@@ -2434,9 +2431,9 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class,
KnownBase->getAccessSpecifier() != AS_public)) {
// The Microsoft extension __interface does not permit bases that
// are not themselves public interfaces.
- Diag(KnownBase->getLocStart(), diag::err_invalid_base_in_interface)
- << getRecordDiagFromTagKind(RD->getTagKind()) << RD
- << RD->getSourceRange();
+ Diag(KnownBase->getBeginLoc(), diag::err_invalid_base_in_interface)
+ << getRecordDiagFromTagKind(RD->getTagKind()) << RD
+ << RD->getSourceRange();
Invalid = true;
}
if (RD->hasAttr<WeakAttr>())
@@ -2470,9 +2467,9 @@ bool Sema::AttachBaseSpecifiers(CXXRecordDecl *Class,
(void)found;
if (Paths.isAmbiguous(CanonicalBase))
- Diag(Bases[idx]->getLocStart (), diag::warn_inaccessible_base_class)
- << BaseType << getAmbiguousPathsDisplayString(Paths)
- << Bases[idx]->getSourceRange();
+ Diag(Bases[idx]->getBeginLoc(), diag::warn_inaccessible_base_class)
+ << BaseType << getAmbiguousPathsDisplayString(Paths)
+ << Bases[idx]->getSourceRange();
else
assert(Bases[idx]->isVirtual());
}
@@ -2919,7 +2916,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
// For anonymous bitfields, the location should point to the type.
if (Loc.isInvalid())
- Loc = D.getLocStart();
+ Loc = D.getBeginLoc();
Expr *BitWidth = static_cast<Expr*>(BW);
@@ -3157,17 +3154,17 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
if (auto *DG = dyn_cast<CXXDeductionGuideDecl>(NonTemplateMember)) {
auto *TD = DG->getDeducedTemplate();
if (AS != TD->getAccess()) {
- Diag(DG->getLocStart(), diag::err_deduction_guide_wrong_access);
- Diag(TD->getLocStart(), diag::note_deduction_guide_template_access)
- << TD->getAccess();
+ Diag(DG->getBeginLoc(), diag::err_deduction_guide_wrong_access);
+ Diag(TD->getBeginLoc(), diag::note_deduction_guide_template_access)
+ << TD->getAccess();
const AccessSpecDecl *LastAccessSpec = nullptr;
for (const auto *D : cast<CXXRecordDecl>(CurContext)->decls()) {
if (const auto *AccessSpec = dyn_cast<AccessSpecDecl>(D))
LastAccessSpec = AccessSpec;
}
assert(LastAccessSpec && "differing access with no access specifier");
- Diag(LastAccessSpec->getLocStart(), diag::note_deduction_guide_access)
- << AS;
+ Diag(LastAccessSpec->getBeginLoc(), diag::note_deduction_guide_access)
+ << AS;
}
}
}
@@ -3651,10 +3648,10 @@ void Sema::ActOnFinishCXXInClassMemberInitializer(Decl *D,
InitializedEntity::InitializeMemberFromDefaultMemberInitializer(FD);
InitializationKind Kind =
FD->getInClassInitStyle() == ICIS_ListInit
- ? InitializationKind::CreateDirectList(InitExpr->getLocStart(),
- InitExpr->getLocStart(),
+ ? InitializationKind::CreateDirectList(InitExpr->getBeginLoc(),
+ InitExpr->getBeginLoc(),
InitExpr->getLocEnd())
- : InitializationKind::CreateCopy(InitExpr->getLocStart(), InitLoc);
+ : InitializationKind::CreateCopy(InitExpr->getBeginLoc(), InitLoc);
InitializationSequence Seq(*this, Entity, Kind, InitExpr);
Init = Seq.Perform(*this, Entity, Kind, InitExpr);
if (Init.isInvalid()) {
@@ -3921,10 +3918,8 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
const CXXBaseSpecifier *BaseSpec = DirectBaseSpec ? DirectBaseSpec
: VirtualBaseSpec;
- Diag(BaseSpec->getLocStart(),
- diag::note_base_class_specified_here)
- << BaseSpec->getType()
- << BaseSpec->getSourceRange();
+ Diag(BaseSpec->getBeginLoc(), diag::note_base_class_specified_here)
+ << BaseSpec->getType() << BaseSpec->getSourceRange();
TyD = Type;
}
@@ -4003,7 +3998,7 @@ Sema::BuildMemberInitializer(ValueDecl *Member, Expr *Init,
nullptr);
InitializationKind Kind =
InitList ? InitializationKind::CreateDirectList(
- IdLoc, Init->getLocStart(), Init->getLocEnd())
+ IdLoc, Init->getBeginLoc(), Init->getLocEnd())
: InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(),
InitRange.getEnd());
@@ -4056,7 +4051,7 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init,
QualType(ClassDecl->getTypeForDecl(), 0));
InitializationKind Kind =
InitList ? InitializationKind::CreateDirectList(
- NameLoc, Init->getLocStart(), Init->getLocEnd())
+ NameLoc, Init->getBeginLoc(), Init->getLocEnd())
: InitializationKind::CreateDirect(NameLoc, InitRange.getBegin(),
InitRange.getEnd());
InitializationSequence InitSeq(*this, DelegationEntity, Kind, Args);
@@ -4227,7 +4222,7 @@ static Expr *CastForMoving(Sema &SemaRef, Expr *E, QualType T = QualType()) {
if (T.isNull()) T = E->getType();
QualType TargetType = SemaRef.BuildReferenceType(
T, /*SpelledAsLValue*/false, SourceLocation(), DeclarationName());
- SourceLocation ExprLoc = E->getLocStart();
+ SourceLocation ExprLoc = E->getBeginLoc();
TypeSourceInfo *TargetLoc = SemaRef.Context.getTrivialTypeSourceInfo(
TargetType, ExprLoc);
@@ -5184,10 +5179,9 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
assert(Dtor && "No dtor found for BaseClassDecl!");
// FIXME: caret should be on the start of the class name
- CheckDestructorAccess(Base.getLocStart(), Dtor,
+ CheckDestructorAccess(Base.getBeginLoc(), Dtor,
PDiag(diag::err_access_dtor_base)
- << Base.getType()
- << Base.getSourceRange(),
+ << Base.getType() << Base.getSourceRange(),
Context.getTypeDeclType(ClassDecl));
MarkFunctionReferenced(Location, Dtor);
@@ -6555,7 +6549,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) {
: isa<CXXConstructorDecl>(MD)) &&
MD->isConstexpr() && !Constexpr &&
MD->getTemplatedKind() == FunctionDecl::TK_NonTemplate) {
- Diag(MD->getLocStart(), diag::err_incorrect_defaulted_constexpr) << CSM;
+ Diag(MD->getBeginLoc(), diag::err_incorrect_defaulted_constexpr) << CSM;
// FIXME: Explain why the special member can't be constexpr.
HadError = true;
}
@@ -6569,7 +6563,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) {
// If the exception specification needs to be instantiated, do so now,
// before we clobber it with an EST_Unevaluated specification below.
if (Type->getExceptionSpecType() == EST_Uninstantiated) {
- InstantiateExceptionSpec(MD->getLocStart(), MD);
+ InstantiateExceptionSpec(MD->getBeginLoc(), MD);
Type = MD->getType()->getAs<FunctionProtoType>();
}
DelayedDefaultedMemberExceptionSpecs.push_back(std::make_pair(MD, Type));
@@ -6871,10 +6865,10 @@ bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall(
<< Field << DiagKind << IsDtorCallInCtor;
} else {
CXXBaseSpecifier *Base = Subobj.get<CXXBaseSpecifier*>();
- S.Diag(Base->getLocStart(),
+ S.Diag(Base->getBeginLoc(),
diag::note_deleted_special_member_class_subobject)
- << getEffectiveCSM() << MD->getParent() << /*IsField*/false
- << Base->getType() << DiagKind << IsDtorCallInCtor;
+ << getEffectiveCSM() << MD->getParent() << /*IsField*/ false
+ << Base->getType() << DiagKind << IsDtorCallInCtor;
}
if (DiagKind == 1)
@@ -6943,10 +6937,10 @@ bool SpecialMemberDeletionInfo::shouldDeleteForBase(CXXBaseSpecifier *Base) {
// FIXME: Check that the base has a usable destructor! Sink this into
// shouldDeleteForClassSubobject.
if (BaseCtor->isDeleted() && Diagnose) {
- S.Diag(Base->getLocStart(),
+ S.Diag(Base->getBeginLoc(),
diag::note_deleted_special_member_class_subobject)
- << getEffectiveCSM() << MD->getParent() << /*IsField*/false
- << Base->getType() << /*Deleted*/1 << /*IsDtorCallInCtor*/false;
+ << getEffectiveCSM() << MD->getParent() << /*IsField*/ false
+ << Base->getType() << /*Deleted*/ 1 << /*IsDtorCallInCtor*/ false;
S.NoteDeletedFunction(BaseCtor);
}
return BaseCtor->isDeleted();
@@ -7557,7 +7551,7 @@ bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
// -- all the direct base classes have trivial [default constructors or
// destructors]
for (const auto &BI : RD->bases())
- if (!checkTrivialSubobjectCall(*this, BI.getLocStart(), BI.getType(),
+ if (!checkTrivialSubobjectCall(*this, BI.getBeginLoc(), BI.getType(),
ConstArg, CSM, TSK_BaseClass, TAH, Diagnose))
return false;
@@ -7597,14 +7591,14 @@ bool Sema::SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
// member in all bases is trivial, so vbases must all be direct.
CXXBaseSpecifier &BS = *RD->vbases_begin();
assert(BS.isVirtual());
- Diag(BS.getLocStart(), diag::note_nontrivial_has_virtual) << RD << 1;
+ Diag(BS.getBeginLoc(), diag::note_nontrivial_has_virtual) << RD << 1;
return false;
}
// Must have a virtual method.
for (const auto *MI : RD->methods()) {
if (MI->isVirtual()) {
- SourceLocation MLoc = MI->getLocStart();
+ SourceLocation MLoc = MI->getBeginLoc();
Diag(MLoc, diag::note_nontrivial_has_virtual) << RD << 0;
return false;
}
@@ -8640,13 +8634,13 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
if (Chunk.Kind == DeclaratorChunk::Paren)
continue;
if (Chunk.Kind != DeclaratorChunk::Function || FoundFunction) {
- Diag(D.getDeclSpec().getLocStart(),
- diag::err_deduction_guide_with_complex_decl)
- << D.getSourceRange();
+ Diag(D.getDeclSpec().getBeginLoc(),
+ diag::err_deduction_guide_with_complex_decl)
+ << D.getSourceRange();
break;
}
if (!Chunk.Fun.hasTrailingReturnType()) {
- Diag(D.getName().getLocStart(),
+ Diag(D.getName().getBeginLoc(),
diag::err_deduction_guide_no_trailing_return_type);
break;
}
@@ -8678,10 +8672,11 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
}
if (!AcceptableReturnType) {
- Diag(TSI->getTypeLoc().getLocStart(),
+ Diag(TSI->getTypeLoc().getBeginLoc(),
diag::err_deduction_guide_bad_trailing_return_type)
- << GuidedTemplate << TSI->getType() << MightInstantiateToSpecialization
- << TSI->getTypeLoc().getSourceRange();
+ << GuidedTemplate << TSI->getType()
+ << MightInstantiateToSpecialization
+ << TSI->getTypeLoc().getSourceRange();
}
// Keep going to check that we don't have any inner declarator pieces (we
@@ -9362,7 +9357,7 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS,
assert(S->getFlags() & Scope::DeclScope && "Invalid Scope.");
if (SS.isEmpty()) {
- Diag(Name.getLocStart(), diag::err_using_requires_qualname);
+ Diag(Name.getBeginLoc(), diag::err_using_requires_qualname);
return nullptr;
}
@@ -9377,24 +9372,23 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS,
case UnqualifiedIdKind::IK_ConstructorName:
case UnqualifiedIdKind::IK_ConstructorTemplateId:
// C++11 inheriting constructors.
- Diag(Name.getLocStart(),
- getLangOpts().CPlusPlus11 ?
- diag::warn_cxx98_compat_using_decl_constructor :
- diag::err_using_decl_constructor)
- << SS.getRange();
+ Diag(Name.getBeginLoc(),
+ getLangOpts().CPlusPlus11
+ ? diag::warn_cxx98_compat_using_decl_constructor
+ : diag::err_using_decl_constructor)
+ << SS.getRange();
if (getLangOpts().CPlusPlus11) break;
return nullptr;
case UnqualifiedIdKind::IK_DestructorName:
- Diag(Name.getLocStart(), diag::err_using_decl_destructor)
- << SS.getRange();
+ Diag(Name.getBeginLoc(), diag::err_using_decl_destructor) << SS.getRange();
return nullptr;
case UnqualifiedIdKind::IK_TemplateId:
- Diag(Name.getLocStart(), diag::err_using_decl_template_id)
- << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc);
+ Diag(Name.getBeginLoc(), diag::err_using_decl_template_id)
+ << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc);
return nullptr;
case UnqualifiedIdKind::IK_DeductionGuideName:
@@ -9408,10 +9402,10 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, AccessSpecifier AS,
// Warn about access declarations.
if (UsingLoc.isInvalid()) {
- Diag(Name.getLocStart(),
- getLangOpts().CPlusPlus11 ? diag::err_access_decl
- : diag::warn_access_decl_deprecated)
- << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using ");
+ Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11
+ ? diag::err_access_decl
+ : diag::warn_access_decl_deprecated)
+ << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using ");
}
if (EllipsisLoc.isInvalid()) {
@@ -12113,14 +12107,14 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class,
if (Existing && Existing != &BI) {
S.Diag(CurrentLocation, diag::warn_vbase_moved_multiple_times)
<< Class << Base;
- S.Diag(Existing->getLocStart(), diag::note_vbase_moved_here)
- << (Base->getCanonicalDecl() ==
- Existing->getType()->getAsCXXRecordDecl()->getCanonicalDecl())
- << Base << Existing->getType() << Existing->getSourceRange();
- S.Diag(BI.getLocStart(), diag::note_vbase_moved_here)
- << (Base->getCanonicalDecl() ==
- BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl())
- << Base << BI.getType() << BaseSpec->getSourceRange();
+ S.Diag(Existing->getBeginLoc(), diag::note_vbase_moved_here)
+ << (Base->getCanonicalDecl() ==
+ Existing->getType()->getAsCXXRecordDecl()->getCanonicalDecl())
+ << Base << Existing->getType() << Existing->getSourceRange();
+ S.Diag(BI.getBeginLoc(), diag::note_vbase_moved_here)
+ << (Base->getCanonicalDecl() ==
+ BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl())
+ << Base << BI.getType() << BaseSpec->getSourceRange();
// Only diagnose each vbase once.
Existing = nullptr;
@@ -13724,10 +13718,8 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
Invalid = true;
}
- VarDecl *ExDecl = BuildExceptionDeclaration(S, TInfo,
- D.getLocStart(),
- D.getIdentifierLoc(),
- D.getIdentifier());
+ VarDecl *ExDecl = BuildExceptionDeclaration(
+ S, TInfo, D.getBeginLoc(), D.getIdentifierLoc(), D.getIdentifier());
if (Invalid)
ExDecl->setInvalidDecl();
@@ -13883,7 +13875,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation LocStart,
// cv-qualified) class type, that class is declared as a friend; otherwise,
// the friend declaration is ignored.
return FriendDecl::Create(Context, CurContext,
- TSInfo->getTypeLoc().getLocStart(), TSInfo,
+ TSInfo->getTypeLoc().getBeginLoc(), TSInfo,
FriendLoc);
}
@@ -14025,7 +14017,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.getLocStart();
+ SourceLocation Loc = DS.getBeginLoc();
assert(DS.isFriendSpecified());
assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified);
@@ -14568,8 +14560,8 @@ static void SearchForReturnInStmt(Sema &Self, Stmt *S) {
if (!SubStmt)
continue;
if (isa<ReturnStmt>(SubStmt))
- Self.Diag(SubStmt->getLocStart(),
- diag::err_return_in_constructor_handler);
+ Self.Diag(SubStmt->getBeginLoc(),
+ diag::err_return_in_constructor_handler);
if (!isa<Expr>(SubStmt))
SearchForReturnInStmt(Self, SubStmt);
}
@@ -15475,7 +15467,7 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record,
if (PrevDecl && !isDeclInScope(PrevDecl, Record, S))
PrevDecl = nullptr;
- SourceLocation TSSL = D.getLocStart();
+ SourceLocation TSSL = D.getBeginLoc();
MSPropertyDecl *NewPD =
MSPropertyDecl::Create(Context, Record, Loc, II, T, TInfo, TSSL,
MSPropertyAttr.getPropertyDataGetter(),
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index a45d7c89a2b..f6a18e0e8be 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -717,21 +717,22 @@ DeclResult Sema::actOnObjCTypeParam(Scope *S,
if (auto attr = qual.getAs<AttributedTypeLoc>()) {
rangeToRemove = attr.getLocalSourceRange();
if (attr.getTypePtr()->getImmediateNullability()) {
- Diag(attr.getLocStart(),
+ Diag(attr.getBeginLoc(),
diag::err_objc_type_param_bound_explicit_nullability)
- << paramName << typeBound
- << FixItHint::CreateRemoval(rangeToRemove);
+ << paramName << typeBound
+ << FixItHint::CreateRemoval(rangeToRemove);
diagnosed = true;
}
}
}
if (!diagnosed) {
- Diag(qual ? qual.getLocStart()
- : typeBoundInfo->getTypeLoc().getLocStart(),
- diag::err_objc_type_param_bound_qualified)
- << paramName << typeBound << typeBound.getQualifiers().getAsString()
- << FixItHint::CreateRemoval(rangeToRemove);
+ Diag(qual ? qual.getBeginLoc()
+ : typeBoundInfo->getTypeLoc().getBeginLoc(),
+ diag::err_objc_type_param_bound_qualified)
+ << paramName << typeBound
+ << typeBound.getQualifiers().getAsString()
+ << FixItHint::CreateRemoval(rangeToRemove);
}
// If the type bound has qualifiers other than CVR, we need to strip
@@ -865,7 +866,7 @@ static bool checkTypeParamListConsistency(Sema &S,
// Diagnose the conflict and update the second declaration.
SourceLocation diagLoc = newTypeParam->getVarianceLoc();
if (diagLoc.isInvalid())
- diagLoc = newTypeParam->getLocStart();
+ diagLoc = newTypeParam->getBeginLoc();
auto diag = S.Diag(diagLoc,
diag::err_objc_type_param_variance_conflict)
@@ -886,7 +887,7 @@ static bool checkTypeParamListConsistency(Sema &S,
: "__contravariant";
if (newTypeParam->getVariance()
== ObjCTypeParamVariance::Invariant) {
- diag << FixItHint::CreateInsertion(newTypeParam->getLocStart(),
+ diag << FixItHint::CreateInsertion(newTypeParam->getBeginLoc(),
(newVarianceStr + " ").str());
} else {
diag << FixItHint::CreateReplacement(newTypeParam->getVarianceLoc(),
@@ -2164,9 +2165,10 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
} else if (ImplIvar->isBitField() && ClsIvar->isBitField() &&
ImplIvar->getBitWidthValue(Context) !=
ClsIvar->getBitWidthValue(Context)) {
- Diag(ImplIvar->getBitWidth()->getLocStart(),
- diag::err_conflicting_ivar_bitwidth) << ImplIvar->getIdentifier();
- Diag(ClsIvar->getBitWidth()->getLocStart(),
+ Diag(ImplIvar->getBitWidth()->getBeginLoc(),
+ diag::err_conflicting_ivar_bitwidth)
+ << ImplIvar->getIdentifier();
+ Diag(ClsIvar->getBitWidth()->getBeginLoc(),
diag::note_previous_definition);
}
// Make sure the names are identical.
@@ -2206,7 +2208,7 @@ static void WarnUndefinedMethod(Sema &S, SourceLocation ImpLoc,
}
// Issue a note to the original declaration.
- SourceLocation MethodLoc = method->getLocStart();
+ SourceLocation MethodLoc = method->getBeginLoc();
if (MethodLoc.isValid())
S.Diag(MethodLoc, diag::note_method_declared_at) << method;
}
@@ -3580,12 +3582,12 @@ void Sema::DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl<ObjCMethodDecl*> &
else
Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R;
- Diag(Methods[0]->getLocStart(),
+ Diag(Methods[0]->getBeginLoc(),
issueError ? diag::note_possibility : diag::note_using)
- << Methods[0]->getSourceRange();
+ << Methods[0]->getSourceRange();
for (unsigned I = 1, N = Methods.size(); I != N; ++I) {
- Diag(Methods[I]->getLocStart(), diag::note_also_found)
- << Methods[I]->getSourceRange();
+ Diag(Methods[I]->getBeginLoc(), diag::note_also_found)
+ << Methods[I]->getSourceRange();
}
}
}
@@ -4485,7 +4487,7 @@ static void checkObjCMethodX86VectorTypes(Sema &SemaRef,
QualType T;
for (const ParmVarDecl *P : Method->parameters()) {
if (P->getType()->isVectorType()) {
- Loc = P->getLocStart();
+ Loc = P->getBeginLoc();
T = P->getType();
break;
}
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 134c76ef28c..ec9dab8f53a 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -64,7 +64,7 @@ bool Sema::isLibstdcxxEagerExceptionSpecHack(const Declarator &D) {
}
// Only apply this hack within a system header.
- if (!Context.getSourceManager().isInSystemHeader(D.getLocStart()))
+ if (!Context.getSourceManager().isInSystemHeader(D.getBeginLoc()))
return false;
return llvm::StringSwitch<bool>(RD->getIdentifier()->getName())
@@ -992,7 +992,7 @@ static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D) {
if (!FT)
return CT_Can;
- FT = S.ResolveExceptionSpec(E->getLocStart(), FT);
+ FT = S.ResolveExceptionSpec(E->getBeginLoc(), FT);
if (!FT)
return CT_Can;
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ce0d32b25e5..2f1715ae4f2 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -503,11 +503,12 @@ static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
SourceLocation(), S.LookupOrdinaryName);
if (ObjectSetClass) {
SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getLocEnd());
- S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign) <<
- FixItHint::CreateInsertion(OIRE->getLocStart(), "object_setClass(") <<
- FixItHint::CreateReplacement(SourceRange(OIRE->getOpLoc(),
- AssignLoc), ",") <<
- FixItHint::CreateInsertion(RHSLocEnd, ")");
+ S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign)
+ << FixItHint::CreateInsertion(OIRE->getBeginLoc(),
+ "object_setClass(")
+ << FixItHint::CreateReplacement(
+ SourceRange(OIRE->getOpLoc(), AssignLoc), ",")
+ << FixItHint::CreateInsertion(RHSLocEnd, ")");
}
else
S.Diag(OIRE->getLocation(), diag::warn_objc_isa_assign);
@@ -517,11 +518,11 @@ static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
&S.Context.Idents.get("object_getClass"),
SourceLocation(), S.LookupOrdinaryName);
if (ObjectGetClass)
- S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use) <<
- FixItHint::CreateInsertion(OIRE->getLocStart(), "object_getClass(") <<
- FixItHint::CreateReplacement(
- SourceRange(OIRE->getOpLoc(),
- OIRE->getLocEnd()), ")");
+ S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use)
+ << FixItHint::CreateInsertion(OIRE->getBeginLoc(),
+ "object_getClass(")
+ << FixItHint::CreateReplacement(
+ SourceRange(OIRE->getOpLoc(), OIRE->getLocEnd()), ")");
else
S.Diag(OIRE->getLocation(), diag::warn_objc_isa_use);
}
@@ -576,10 +577,10 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
&Context.Idents.get("object_getClass"),
SourceLocation(), LookupOrdinaryName);
if (ObjectGetClass)
- Diag(E->getExprLoc(), diag::warn_objc_isa_use) <<
- FixItHint::CreateInsertion(OISA->getLocStart(), "object_getClass(") <<
- FixItHint::CreateReplacement(
- SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")");
+ Diag(E->getExprLoc(), diag::warn_objc_isa_use)
+ << FixItHint::CreateInsertion(OISA->getBeginLoc(), "object_getClass(")
+ << FixItHint::CreateReplacement(
+ SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")");
else
Diag(E->getExprLoc(), diag::warn_objc_isa_use);
}
@@ -820,40 +821,38 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
switch (VAK) {
case VAK_ValidInCXX11:
DiagRuntimeBehavior(
- E->getLocStart(), nullptr,
- PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg)
- << Ty << CT);
+ E->getBeginLoc(), nullptr,
+ PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
LLVM_FALLTHROUGH;
case VAK_Valid:
if (Ty->isRecordType()) {
// This is unlikely to be what the user intended. If the class has a
// 'c_str' member function, the user probably meant to call that.
- DiagRuntimeBehavior(E->getLocStart(), nullptr,
+ DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
PDiag(diag::warn_pass_class_arg_to_vararg)
- << Ty << CT << hasCStrMethod(E) << ".c_str()");
+ << Ty << CT << hasCStrMethod(E) << ".c_str()");
}
break;
case VAK_Undefined:
case VAK_MSVCUndefined:
- DiagRuntimeBehavior(
- E->getLocStart(), nullptr,
- PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
- << getLangOpts().CPlusPlus11 << Ty << CT);
+ DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
+ PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
+ << getLangOpts().CPlusPlus11 << Ty << CT);
break;
case VAK_Invalid:
if (Ty.isDestructedType() == QualType::DK_nontrivial_c_struct)
- Diag(E->getLocStart(),
- diag::err_cannot_pass_non_trivial_c_struct_to_vararg) << Ty << CT;
+ Diag(E->getBeginLoc(),
+ diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
+ << Ty << CT;
else if (Ty->isObjCObjectType())
- DiagRuntimeBehavior(
- E->getLocStart(), nullptr,
- PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
- << Ty << CT);
+ DiagRuntimeBehavior(E->getBeginLoc(), nullptr,
+ PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
+ << Ty << CT);
else
- Diag(E->getLocStart(), diag::err_cannot_pass_to_vararg)
- << isa<InitListExpr>(E) << Ty << CT;
+ Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg)
+ << isa<InitListExpr>(E) << Ty << CT;
break;
}
}
@@ -891,20 +890,19 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT,
SourceLocation TemplateKWLoc;
UnqualifiedId Name;
Name.setIdentifier(PP.getIdentifierInfo("__builtin_trap"),
- E->getLocStart());
+ E->getBeginLoc());
ExprResult TrapFn = ActOnIdExpression(TUScope, SS, TemplateKWLoc,
Name, true, false);
if (TrapFn.isInvalid())
return ExprError();
- ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(),
- E->getLocStart(), None,
- E->getLocEnd());
+ ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(),
+ None, E->getLocEnd());
if (Call.isInvalid())
return ExprError();
- ExprResult Comma = ActOnBinOp(TUScope, E->getLocStart(), tok::comma,
- Call.get(), E);
+ ExprResult Comma =
+ ActOnBinOp(TUScope, E->getBeginLoc(), tok::comma, Call.get(), E);
if (Comma.isInvalid())
return ExprError();
return Comma.get();
@@ -1437,9 +1435,9 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
// We strip parens here because the controlling expression is typically
// parenthesized in macro definitions.
ControllingExpr = ControllingExpr->IgnoreParens();
- Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_multi_match)
- << ControllingExpr->getSourceRange() << ControllingExpr->getType()
- << (unsigned) CompatIndices.size();
+ Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_multi_match)
+ << ControllingExpr->getSourceRange() << ControllingExpr->getType()
+ << (unsigned)CompatIndices.size();
for (unsigned I : CompatIndices) {
Diag(Types[I]->getTypeLoc().getBeginLoc(),
diag::note_compat_assoc)
@@ -1456,8 +1454,8 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
// We strip parens here because the controlling expression is typically
// parenthesized in macro definitions.
ControllingExpr = ControllingExpr->IgnoreParens();
- Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_no_match)
- << ControllingExpr->getSourceRange() << ControllingExpr->getType();
+ Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_no_match)
+ << ControllingExpr->getSourceRange() << ControllingExpr->getType();
return ExprError();
}
@@ -1682,7 +1680,7 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
if (getLangOpts().ObjCWeak && isa<VarDecl>(D) &&
Ty.getObjCLifetime() == Qualifiers::OCL_Weak && !isUnevaluatedContext() &&
- !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getLocStart()))
+ !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getBeginLoc()))
getCurFunction()->recordUseOfWeak(E);
FieldDecl *FD = dyn_cast<FieldDecl>(D);
@@ -4487,8 +4485,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
// wasn't promoted because of the C90 rule that doesn't
// allow promoting non-lvalue arrays. Warn, then
// force the promotion here.
- Diag(LHSExp->getLocStart(), diag::ext_subscript_non_lvalue) <<
- LHSExp->getSourceRange();
+ Diag(LHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue)
+ << LHSExp->getSourceRange();
LHSExp = ImpCastExprToType(LHSExp, Context.getArrayDecayedType(LHSTy),
CK_ArrayToPointerDecay).get();
LHSTy = LHSExp->getType();
@@ -4498,8 +4496,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
ResultType = LHSTy->getAs<PointerType>()->getPointeeType();
} else if (RHSTy->isArrayType()) {
// Same as previous, except for 123[f().a] case
- Diag(RHSExp->getLocStart(), diag::ext_subscript_non_lvalue) <<
- RHSExp->getSourceRange();
+ Diag(RHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue)
+ << RHSExp->getSourceRange();
RHSExp = ImpCastExprToType(RHSExp, Context.getArrayDecayedType(RHSTy),
CK_ArrayToPointerDecay).get();
RHSTy = RHSExp->getType();
@@ -4526,8 +4524,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
// type. Note that Functions are not objects, and that (in C99 parlance)
// incomplete types are not object types.
if (ResultType->isFunctionType()) {
- Diag(BaseExpr->getLocStart(), diag::err_subscript_function_type)
- << ResultType << BaseExpr->getSourceRange();
+ Diag(BaseExpr->getBeginLoc(), diag::err_subscript_function_type)
+ << ResultType << BaseExpr->getSourceRange();
return ExprError();
}
@@ -4593,7 +4591,7 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD,
if (Inst.isInvalid())
return true;
if (Inst.isAlreadyInstantiating()) {
- Diag(Param->getLocStart(), diag::err_recursive_default_argument) << FD;
+ Diag(Param->getBeginLoc(), diag::err_recursive_default_argument) << FD;
Param->setInvalidDecl();
return true;
}
@@ -4615,9 +4613,9 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD,
// Check the expression as an initializer for the parameter.
InitializedEntity Entity
= InitializedEntity::InitializeParameter(Context, Param);
- InitializationKind Kind
- = InitializationKind::CreateCopy(Param->getLocation(),
- /*FIXME:EqualLoc*/UninstExpr->getLocStart());
+ InitializationKind Kind = InitializationKind::CreateCopy(
+ Param->getLocation(),
+ /*FIXME:EqualLoc*/ UninstExpr->getBeginLoc());
Expr *ResultE = Result.getAs<Expr>();
InitializationSequence InitSeq(*this, Entity, Kind, ResultE);
@@ -4639,7 +4637,7 @@ bool Sema::CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD,
// If the default argument expression is not set yet, we are building it now.
if (!Param->hasInit()) {
- Diag(Param->getLocStart(), diag::err_recursive_default_argument) << FD;
+ Diag(Param->getBeginLoc(), diag::err_recursive_default_argument) << FD;
Param->setInvalidDecl();
return true;
}
@@ -4724,7 +4722,7 @@ static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn,
ArrayRef<Expr *> Args) {
MemberExpr *ME = dyn_cast<MemberExpr>(Fn);
DeclarationName FuncName = FDecl->getDeclName();
- SourceLocation NameLoc = ME ? ME->getMemberLoc() : Fn->getLocStart();
+ SourceLocation NameLoc = ME ? ME->getMemberLoc() : Fn->getBeginLoc();
if (TypoCorrection Corrected = S.CorrectTypo(
DeclarationNameInfo(FuncName, NameLoc), Sema::LookupOrdinaryName,
@@ -4815,8 +4813,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
// Emit the location of the prototype.
if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig)
- Diag(FDecl->getLocStart(), diag::note_callee_decl)
- << FDecl;
+ Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl;
return true;
}
@@ -4838,28 +4835,27 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
<< TC.getCorrectionRange());
} else if (NumParams == 1 && FDecl &&
FDecl->getParamDecl(0)->getDeclName())
- Diag(Args[NumParams]->getLocStart(),
+ Diag(Args[NumParams]->getBeginLoc(),
MinArgs == NumParams
? diag::err_typecheck_call_too_many_args_one
: diag::err_typecheck_call_too_many_args_at_most_one)
<< FnKind << FDecl->getParamDecl(0)
<< static_cast<unsigned>(Args.size()) << Fn->getSourceRange()
- << SourceRange(Args[NumParams]->getLocStart(),
+ << SourceRange(Args[NumParams]->getBeginLoc(),
Args.back()->getLocEnd());
else
- Diag(Args[NumParams]->getLocStart(),
+ Diag(Args[NumParams]->getBeginLoc(),
MinArgs == NumParams
? diag::err_typecheck_call_too_many_args
: diag::err_typecheck_call_too_many_args_at_most)
<< FnKind << NumParams << static_cast<unsigned>(Args.size())
<< Fn->getSourceRange()
- << SourceRange(Args[NumParams]->getLocStart(),
+ << SourceRange(Args[NumParams]->getBeginLoc(),
Args.back()->getLocEnd());
// Emit the location of the prototype.
if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig)
- Diag(FDecl->getLocStart(), diag::note_callee_decl)
- << FDecl;
+ Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl;
// This deletes the extra arguments.
Call->setNumArgs(Context, NumParams);
@@ -4869,8 +4865,8 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
SmallVector<Expr *, 8> AllArgs;
VariadicCallType CallType = getVariadicCallType(FDecl, Proto, Fn);
- Invalid = GatherArgumentsForCall(Call->getLocStart(), FDecl,
- Proto, 0, Args, AllArgs, CallType);
+ Invalid = GatherArgumentsForCall(Call->getBeginLoc(), FDecl, Proto, 0, Args,
+ AllArgs, CallType);
if (Invalid)
return true;
unsigned TotalNumArgs = AllArgs.size();
@@ -4898,8 +4894,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
if (ArgIx < Args.size()) {
Arg = Args[ArgIx++];
- if (RequireCompleteType(Arg->getLocStart(),
- ProtoArgType,
+ if (RequireCompleteType(Arg->getBeginLoc(), ProtoArgType,
diag::err_call_incomplete_argument, Arg))
return true;
@@ -5207,7 +5202,7 @@ static void checkDirectCallValidity(Sema &S, const Expr *Fn,
return;
if (const EnableIfAttr *Attr = S.CheckEnableIf(Callee, ArgExprs, true)) {
- S.Diag(Fn->getLocStart(),
+ S.Diag(Fn->getBeginLoc(),
isa<CXXMethodDecl>(Callee)
? diag::err_ovl_no_viable_member_function_in_call
: diag::err_ovl_no_viable_function_in_call)
@@ -5319,9 +5314,9 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
if (isa<CXXPseudoDestructorExpr>(Fn)) {
if (!ArgExprs.empty()) {
// Pseudo-destructor calls should not have any arguments.
- Diag(Fn->getLocStart(), diag::err_pseudo_dtor_call_with_args)
+ Diag(Fn->getBeginLoc(), diag::err_pseudo_dtor_call_with_args)
<< FixItHint::CreateRemoval(
- SourceRange(ArgExprs.front()->getLocStart(),
+ SourceRange(ArgExprs.front()->getBeginLoc(),
ArgExprs.back()->getLocEnd()));
}
@@ -5349,9 +5344,9 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
Context.DependentTy, VK_RValue, RParenLoc);
} else {
- tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs(
+ tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs(
*this, dyn_cast<UnresolvedMemberExpr>(Fn->IgnoreParens()),
- Fn->getLocStart());
+ Fn->getBeginLoc());
return new (Context) CallExpr(
Context, Fn, ArgExprs, Context.DependentTy, VK_RValue, RParenLoc);
@@ -5432,9 +5427,8 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
NDecl = cast<MemberExpr>(NakedFn)->getMemberDecl();
if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(NDecl)) {
- if (CallingNDeclIndirectly &&
- !checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
- Fn->getLocStart()))
+ if (CallingNDeclIndirectly && !checkAddressOfFunctionIsAvailable(
+ FD, /*Complain=*/true, Fn->getBeginLoc()))
return ExprError();
if (getLangOpts().OpenCL && checkOpenCLDisabledDecl(*FD, *Fn))
@@ -5601,7 +5595,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
}
// Check for a valid return type
- if (CheckCallReturnType(FuncT->getReturnType(), Fn->getLocStart(), TheCall,
+ if (CheckCallReturnType(FuncT->getReturnType(), Fn->getBeginLoc(), TheCall,
FDecl))
return ExprError();
@@ -5657,8 +5651,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
Arg = ArgE.getAs<Expr>();
}
- if (RequireCompleteType(Arg->getLocStart(),
- Arg->getType(),
+ if (RequireCompleteType(Arg->getBeginLoc(), Arg->getType(),
diag::err_call_incomplete_argument, Arg))
return ExprError();
@@ -6396,11 +6389,11 @@ static QualType checkConditionalVoidType(Sema &S, ExprResult &LHS,
Expr *RHSExpr = RHS.get();
if (!LHSExpr->getType()->isVoidType())
- S.Diag(RHSExpr->getLocStart(), diag::ext_typecheck_cond_one_void)
- << RHSExpr->getSourceRange();
+ S.Diag(RHSExpr->getBeginLoc(), diag::ext_typecheck_cond_one_void)
+ << RHSExpr->getSourceRange();
if (!RHSExpr->getType()->isVoidType())
- S.Diag(LHSExpr->getLocStart(), diag::ext_typecheck_cond_one_void)
- << LHSExpr->getSourceRange();
+ S.Diag(LHSExpr->getBeginLoc(), diag::ext_typecheck_cond_one_void)
+ << LHSExpr->getSourceRange();
LHS = S.ImpCastExprToType(LHS.get(), S.Context.VoidTy, CK_ToVoid);
RHS = S.ImpCastExprToType(RHS.get(), S.Context.VoidTy, CK_ToVoid);
return S.Context.VoidTy;
@@ -7217,14 +7210,15 @@ static void DiagnoseConditionalPrecedence(Sema &Self,
<< Condition->getSourceRange()
<< BinaryOperator::getOpcodeStr(CondOpcode);
- SuggestParentheses(Self, OpLoc,
- Self.PDiag(diag::note_precedence_silence)
- << BinaryOperator::getOpcodeStr(CondOpcode),
- SourceRange(Condition->getLocStart(), Condition->getLocEnd()));
+ SuggestParentheses(
+ Self, OpLoc,
+ Self.PDiag(diag::note_precedence_silence)
+ << BinaryOperator::getOpcodeStr(CondOpcode),
+ SourceRange(Condition->getBeginLoc(), Condition->getLocEnd()));
SuggestParentheses(Self, OpLoc,
- Self.PDiag(diag::note_precedence_conditional_first),
- SourceRange(CondRHS->getLocStart(), RHSExpr->getLocEnd()));
+ Self.PDiag(diag::note_precedence_conditional_first),
+ SourceRange(CondRHS->getBeginLoc(), RHSExpr->getLocEnd()));
}
/// Compute the nullability of a conditional expression.
@@ -8136,7 +8130,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &CallerRHS,
return Incompatible;
}
if (getLangOpts().ObjC1 &&
- (CheckObjCBridgeRelatedConversions(E->getLocStart(), LHSType,
+ (CheckObjCBridgeRelatedConversions(E->getBeginLoc(), LHSType,
E->getType(), E, Diagnose) ||
ConversionToObjCStringLiteralCheck(LHSType, E, Diagnose))) {
if (!Diagnose)
@@ -8921,7 +8915,7 @@ static void diagnoseStringPlusInt(Sema &Self, SourceLocation OpLoc,
return;
}
- SourceRange DiagRange(LHSExpr->getLocStart(), RHSExpr->getLocEnd());
+ SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd());
Self.Diag(OpLoc, diag::warn_string_plus_int)
<< DiagRange << IndexExpr->IgnoreImpCasts()->getType();
@@ -8929,7 +8923,7 @@ static void diagnoseStringPlusInt(Sema &Self, SourceLocation OpLoc,
if (IndexExpr == RHSExpr) {
SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd());
Self.Diag(OpLoc, diag::note_string_plus_scalar_silence)
- << FixItHint::CreateInsertion(LHSExpr->getLocStart(), "&")
+ << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&")
<< FixItHint::CreateReplacement(SourceRange(OpLoc), "[")
<< FixItHint::CreateInsertion(EndLoc, "]");
} else
@@ -8962,7 +8956,7 @@ static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc,
return;
ASTContext &Ctx = Self.getASTContext();
- SourceRange DiagRange(LHSExpr->getLocStart(), RHSExpr->getLocEnd());
+ SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd());
const QualType CharType = CharExpr->getType();
if (!CharType->isAnyCharacterType() &&
@@ -8979,7 +8973,7 @@ static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc,
if (isa<CharacterLiteral>(RHSExpr->IgnoreImpCasts())) {
SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd());
Self.Diag(OpLoc, diag::note_string_plus_scalar_silence)
- << FixItHint::CreateInsertion(LHSExpr->getLocStart(), "&")
+ << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&")
<< FixItHint::CreateReplacement(SourceRange(OpLoc), "[")
<< FixItHint::CreateInsertion(EndLoc, "]");
} else {
@@ -9651,7 +9645,7 @@ static void diagnoseObjCLiteralComparison(Sema &S, SourceLocation Loc,
if (BinaryOperator::isEqualityOp(Opc) &&
hasIsEqualMethod(S, LHS.get(), RHS.get())) {
- SourceLocation Start = LHS.get()->getLocStart();
+ SourceLocation Start = LHS.get()->getBeginLoc();
SourceLocation End = S.getLocForEndOfToken(RHS.get()->getLocEnd());
CharSourceRange OpRange =
CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc));
@@ -9684,7 +9678,7 @@ static void diagnoseLogicalNotOnLHSofCheck(Sema &S, ExprResult &LHS,
<< Loc << IsBitwiseOp;
// First note suggest !(x < y)
- SourceLocation FirstOpen = SubExpr->getLocStart();
+ SourceLocation FirstOpen = SubExpr->getBeginLoc();
SourceLocation FirstClose = RHS.get()->getLocEnd();
FirstClose = S.getLocForEndOfToken(FirstClose);
if (FirstClose.isInvalid())
@@ -9695,7 +9689,7 @@ static void diagnoseLogicalNotOnLHSofCheck(Sema &S, ExprResult &LHS,
<< FixItHint::CreateInsertion(FirstClose, ")");
// Second note suggests (!x) < y
- SourceLocation SecondOpen = LHS.get()->getLocStart();
+ SourceLocation SecondOpen = LHS.get()->getBeginLoc();
SourceLocation SecondClose = LHS.get()->getLocEnd();
SecondClose = S.getLocForEndOfToken(SecondClose);
if (SecondClose.isInvalid())
@@ -9732,7 +9726,7 @@ static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc,
QualType RHSType = RHS->getType();
if (LHSType->hasFloatingRepresentation() ||
(LHSType->isBlockPointerType() && !BinaryOperator::isEqualityOp(Opc)) ||
- LHS->getLocStart().isMacroID() || RHS->getLocStart().isMacroID() ||
+ LHS->getBeginLoc().isMacroID() || RHS->getBeginLoc().isMacroID() ||
S.inTemplateInstantiation())
return;
@@ -9886,7 +9880,7 @@ static bool checkThreeWayNarrowingConversion(Sema &S, QualType ToType, Expr *E,
case NK_Constant_Narrowing:
// Implicit conversion to a narrower type, and the value is not a constant
// expression.
- S.Diag(E->getLocStart(), diag::err_spaceship_argument_narrowing)
+ S.Diag(E->getBeginLoc(), diag::err_spaceship_argument_narrowing)
<< /*Constant*/ 1
<< PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << ToType;
return true;
@@ -9895,7 +9889,7 @@ static bool checkThreeWayNarrowingConversion(Sema &S, QualType ToType, Expr *E,
// Implicit conversion to a narrower type, and the value is not a constant
// expression.
case NK_Type_Narrowing:
- S.Diag(E->getLocStart(), diag::err_spaceship_argument_narrowing)
+ S.Diag(E->getBeginLoc(), diag::err_spaceship_argument_narrowing)
<< /*Constant*/ 0 << FromType << ToType;
// TODO: It's not a constant expression, but what if the user intended it
// to be? Can we produce notes to help them figure out why it isn't?
@@ -9970,9 +9964,9 @@ static QualType checkArithmeticOrEnumeralThreeWayCompare(Sema &S,
assert(Type->isArithmeticType() || Type->isEnumeralType());
bool HasNarrowing = checkThreeWayNarrowingConversion(
- S, Type, LHS.get(), LHSType, LHS.get()->getLocStart());
- HasNarrowing |= checkThreeWayNarrowingConversion(
- S, Type, RHS.get(), RHSType, RHS.get()->getLocStart());
+ S, Type, LHS.get(), LHSType, LHS.get()->getBeginLoc());
+ HasNarrowing |= checkThreeWayNarrowingConversion(S, Type, RHS.get(), RHSType,
+ RHS.get()->getBeginLoc());
if (HasNarrowing)
return QualType();
@@ -11148,15 +11142,14 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(RHSCheck))
RHSCheck = ICE->getSubExpr();
if (UnaryOperator *UO = dyn_cast<UnaryOperator>(RHSCheck)) {
- if ((UO->getOpcode() == UO_Plus ||
- UO->getOpcode() == UO_Minus) &&
+ if ((UO->getOpcode() == UO_Plus || UO->getOpcode() == UO_Minus) &&
Loc.isFileID() && UO->getOperatorLoc().isFileID() &&
// Only if the two operators are exactly adjacent.
Loc.getLocWithOffset(1) == UO->getOperatorLoc() &&
// And there is a space or other character before the subexpr of the
// unary +/-. We don't want to warn on "x=-1".
- Loc.getLocWithOffset(2) != UO->getSubExpr()->getLocStart() &&
- UO->getSubExpr()->getLocStart().isFileID()) {
+ Loc.getLocWithOffset(2) != UO->getSubExpr()->getBeginLoc() &&
+ UO->getSubExpr()->getBeginLoc().isFileID()) {
Diag(Loc, diag::warn_not_compound_assign)
<< (UO->getOpcode() == UO_Plus ? "+" : "-")
<< SourceRange(UO->getOperatorLoc(), UO->getOperatorLoc());
@@ -11186,7 +11179,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
// For ObjCWeak only, we do not warn if the assign is to a non-weak
// variable, which will be valid for the current autorelease scope.
if (!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak,
- RHS.get()->getLocStart()))
+ RHS.get()->getBeginLoc()))
getCurFunction()->markSafeWeakUse(RHS.get());
} else if (getLangOpts().ObjCAutoRefCount || getLangOpts().ObjCWeak) {
@@ -11267,9 +11260,9 @@ void Sema::DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc) {
return;
Diag(Loc, diag::warn_comma_operator);
- Diag(LHS->getLocStart(), diag::note_cast_to_void)
+ Diag(LHS->getBeginLoc(), diag::note_cast_to_void)
<< LHS->getSourceRange()
- << FixItHint::CreateInsertion(LHS->getLocStart(),
+ << FixItHint::CreateInsertion(LHS->getBeginLoc(),
LangOpts.CPlusPlus ? "static_cast<void>("
: "(void)(")
<< FixItHint::CreateInsertion(PP.getLocForEndOfToken(LHS->getLocEnd()),
@@ -11549,7 +11542,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
if (auto *FD = dyn_cast_or_null<FunctionDecl>(dcl))
if (!checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
- op->getLocStart()))
+ op->getBeginLoc()))
return QualType();
Expr::LValueClassification lval = op->ClassifyLValue(Context);
@@ -12004,7 +11997,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
// The meaning of x = {v} [...] is that of x = T(v) [...]. The meaning
// of x = {} is x = T().
InitializationKind Kind = InitializationKind::CreateDirectList(
- RHSExpr->getLocStart(), RHSExpr->getLocStart(), RHSExpr->getLocEnd());
+ RHSExpr->getBeginLoc(), RHSExpr->getBeginLoc(), RHSExpr->getLocEnd());
InitializedEntity Entity =
InitializedEntity::InitializeTemporary(LHSExpr->getType());
InitializationSequence InitSeq(*this, Entity, Kind, RHSExpr);
@@ -12033,7 +12026,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
// OpenCLC v2.0 s6.13.11.1 allows atomic variables to be initialized by
// the ATOMIC_VAR_INIT macro.
if (LHSTy->isAtomicType() || RHSTy->isAtomicType()) {
- SourceRange SR(LHSExpr->getLocStart(), RHSExpr->getLocEnd());
+ SourceRange SR(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd());
if (BO_Assign == Opc)
Diag(OpLoc, diag::err_opencl_atomic_init) << 0 << SR;
else
@@ -12196,10 +12189,12 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
SourceLocation(), LookupOrdinaryName);
if (ObjectSetClass && isa<ObjCIsaExpr>(LHS.get())) {
SourceLocation RHSLocEnd = getLocForEndOfToken(RHS.get()->getLocEnd());
- Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign) <<
- FixItHint::CreateInsertion(LHS.get()->getLocStart(), "object_setClass(") <<
- FixItHint::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc), ",") <<
- FixItHint::CreateInsertion(RHSLocEnd, ")");
+ Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign)
+ << FixItHint::CreateInsertion(LHS.get()->getBeginLoc(),
+ "object_setClass(")
+ << FixItHint::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc),
+ ",")
+ << FixItHint::CreateInsertion(RHSLocEnd, ")");
}
else
Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign);
@@ -12256,13 +12251,14 @@ static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc,
if (isLeftBitwise || isRightBitwise)
return;
- SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getLocStart(),
- OpLoc)
- : SourceRange(OpLoc, RHSExpr->getLocEnd());
+ SourceRange DiagRange = isLeftComp
+ ? SourceRange(LHSExpr->getBeginLoc(), OpLoc)
+ : SourceRange(OpLoc, RHSExpr->getLocEnd());
StringRef OpStr = isLeftComp ? LHSBO->getOpcodeStr() : RHSBO->getOpcodeStr();
- SourceRange ParensRange = isLeftComp ?
- SourceRange(LHSBO->getRHS()->getLocStart(), RHSExpr->getLocEnd())
- : SourceRange(LHSExpr->getLocStart(), RHSBO->getLHS()->getLocEnd());
+ SourceRange ParensRange =
+ isLeftComp
+ ? SourceRange(LHSBO->getRHS()->getBeginLoc(), RHSExpr->getLocEnd())
+ : SourceRange(LHSExpr->getBeginLoc(), RHSBO->getLHS()->getLocEnd());
Self.Diag(OpLoc, diag::warn_precedence_bitwise_rel)
<< DiagRange << BinaryOperator::getOpcodeStr(Opc) << OpStr;
@@ -12396,10 +12392,9 @@ static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc,
S.PDiag(diag::note_precedence_silence)
<< (Kind == OO_LessLess ? "<<" : ">>"),
OCE->getSourceRange());
- SuggestParentheses(S, OpLoc,
- S.PDiag(diag::note_evaluate_comparison_first),
- SourceRange(OCE->getArg(1)->getLocStart(),
- RHSExpr->getLocEnd()));
+ SuggestParentheses(
+ S, OpLoc, S.PDiag(diag::note_evaluate_comparison_first),
+ SourceRange(OCE->getArg(1)->getBeginLoc(), RHSExpr->getLocEnd()));
}
/// DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky
@@ -13069,9 +13064,9 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
// FIXME: An integral constant expression?
if (!Idx->isTypeDependent() && !Idx->isValueDependent() &&
!Idx->getType()->isIntegerType())
- return ExprError(Diag(Idx->getLocStart(),
- diag::err_typecheck_subscript_not_integer)
- << Idx->getSourceRange());
+ return ExprError(
+ Diag(Idx->getBeginLoc(), diag::err_typecheck_subscript_not_integer)
+ << Idx->getSourceRange());
// Record this array index.
Comps.push_back(OffsetOfNode(OC.LocStart, Exprs.size(), OC.LocEnd));
@@ -13363,7 +13358,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
} else if (const FunctionProtoType *Fn = T->getAs<FunctionProtoType>()) {
for (const auto &I : Fn->param_types()) {
ParmVarDecl *Param = BuildParmVarDeclForTypedef(
- CurBlock->TheDecl, ParamInfo.getLocStart(), I);
+ CurBlock->TheDecl, ParamInfo.getBeginLoc(), I);
Params.push_back(Param);
}
}
@@ -13542,7 +13537,7 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
if (const FunctionDecl *F = dyn_cast<FunctionDecl>(CurContext)) {
CUDAFunctionTarget T = IdentifyCUDATarget(F);
if (T == CFT_Global || T == CFT_Device || T == CFT_HostDevice)
- return ExprError(Diag(E->getLocStart(), diag::err_va_arg_in_device));
+ return ExprError(Diag(E->getBeginLoc(), diag::err_va_arg_in_device));
}
}
@@ -13592,9 +13587,10 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
if (!IsMS && !E->isTypeDependent() &&
!Context.hasSameType(VaListType, E->getType()))
- return ExprError(Diag(E->getLocStart(),
- diag::err_first_argument_to_va_arg_not_of_type_va_list)
- << OrigExpr->getType() << E->getSourceRange());
+ return ExprError(
+ Diag(E->getBeginLoc(),
+ diag::err_first_argument_to_va_arg_not_of_type_va_list)
+ << OrigExpr->getType() << E->getSourceRange());
if (!TInfo->getType()->isDependentType()) {
if (RequireCompleteType(TInfo->getTypeLoc().getBeginLoc(), TInfo->getType(),
@@ -13685,9 +13681,9 @@ bool Sema::ConversionToObjCStringLiteralCheck(QualType DstType, Expr *&Exp,
if (!SL || !SL->isAscii())
return false;
if (Diagnose) {
- Diag(SL->getLocStart(), diag::err_missing_atsign_prefix)
- << FixItHint::CreateInsertion(SL->getLocStart(), "@");
- Exp = BuildObjCStringLiteral(SL->getLocStart(), SL).get();
+ Diag(SL->getBeginLoc(), diag::err_missing_atsign_prefix)
+ << FixItHint::CreateInsertion(SL->getBeginLoc(), "@");
+ Exp = BuildObjCStringLiteral(SL->getBeginLoc(), SL).get();
}
return true;
}
@@ -13708,7 +13704,7 @@ static bool maybeDiagnoseAssignmentToFunction(Sema &S, QualType DstType,
return !S.checkAddressOfFunctionIsAvailable(FD,
/*Complain=*/true,
- SrcExpr->getLocStart());
+ SrcExpr->getBeginLoc());
}
bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
@@ -13961,7 +13957,7 @@ ExprResult
Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
VerifyICEDiagnoser &Diagnoser,
bool AllowFold) {
- SourceLocation DiagLoc = E->getLocStart();
+ SourceLocation DiagLoc = E->getBeginLoc();
if (getLangOpts().CPlusPlus11) {
// C++11 [expr.const]p5:
@@ -14191,7 +14187,7 @@ void Sema::PopExpressionEvaluationContext() {
llvm_unreachable("Couldn't infer lambda error message.");
for (const auto *L : Rec.Lambdas)
- Diag(L->getLocStart(), D);
+ Diag(L->getBeginLoc(), D);
} else {
// Mark the capture expressions odr-used. This was deferred
// during lambda expression creation.
@@ -15021,7 +15017,7 @@ bool Sema::tryCaptureVariable(
Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName();
Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
- Diag(LSI->Lambda->getLocStart(), diag::note_lambda_decl);
+ Diag(LSI->Lambda->getBeginLoc(), diag::note_lambda_decl);
} else
diagnoseUncapturableValueReference(*this, ExprLoc, Var, DC);
}
@@ -15075,7 +15071,7 @@ bool Sema::tryCaptureVariable(
Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
if (cast<LambdaScopeInfo>(CSI)->Lambda)
- Diag(cast<LambdaScopeInfo>(CSI)->Lambda->getLocStart(),
+ Diag(cast<LambdaScopeInfo>(CSI)->Lambda->getBeginLoc(),
diag::note_lambda_decl);
// FIXME: If we error out because an outer lambda can not implicitly
// capture a variable that an inner lambda explicitly captures, we
@@ -15433,8 +15429,8 @@ void Sema::MarkMemberReferenced(MemberExpr *E) {
if (Method->isPure())
MightBeOdrUse = false;
}
- SourceLocation Loc = E->getMemberLoc().isValid() ?
- E->getMemberLoc() : E->getLocStart();
+ SourceLocation Loc =
+ E->getMemberLoc().isValid() ? E->getMemberLoc() : E->getBeginLoc();
MarkExprReferenced(*this, Loc, E->getMemberDecl(), E, MightBeOdrUse);
}
@@ -15530,34 +15526,34 @@ namespace {
}
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
- S.MarkFunctionReferenced(E->getLocStart(),
- const_cast<CXXDestructorDecl*>(E->getTemporary()->getDestructor()));
+ S.MarkFunctionReferenced(
+ E->getBeginLoc(),
+ const_cast<CXXDestructorDecl *>(E->getTemporary()->getDestructor()));
Visit(E->getSubExpr());
}
void VisitCXXNewExpr(CXXNewExpr *E) {
if (E->getOperatorNew())
- S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorNew());
+ S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorNew());
if (E->getOperatorDelete())
- S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorDelete());
+ S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorDelete());
Inherited::VisitCXXNewExpr(E);
}
void VisitCXXDeleteExpr(CXXDeleteExpr *E) {
if (E->getOperatorDelete())
- S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorDelete());
+ S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorDelete());
QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType());
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
- S.MarkFunctionReferenced(E->getLocStart(),
- S.LookupDestructor(Record));
+ S.MarkFunctionReferenced(E->getBeginLoc(), S.LookupDestructor(Record));
}
Inherited::VisitCXXDeleteExpr(E);
}
void VisitCXXConstructExpr(CXXConstructExpr *E) {
- S.MarkFunctionReferenced(E->getLocStart(), E->getConstructor());
+ S.MarkFunctionReferenced(E->getBeginLoc(), E->getConstructor());
Inherited::VisitCXXConstructExpr(E);
}
@@ -15728,7 +15724,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
Diag(Loc, diagnostic) << E->getSourceRange();
- SourceLocation Open = E->getLocStart();
+ SourceLocation Open = E->getBeginLoc();
SourceLocation Close = getLocForEndOfToken(E->getSourceRange().getEnd());
Diag(Loc, diag::note_condition_assign_silence)
<< FixItHint::CreateInsertion(Open, "(")
@@ -15746,7 +15742,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
/// that the user intended an assignment used as condition.
void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) {
// Don't warn if the parens came from a macro.
- SourceLocation parenLoc = ParenE->getLocStart();
+ SourceLocation parenLoc = ParenE->getBeginLoc();
if (parenLoc.isInvalid() || parenLoc.isMacroID())
return;
// Don't warn for dependent expressions.
@@ -16443,13 +16439,13 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) {
}
}
- Diag(E->getLocStart(), diag::err_builtin_fn_use);
+ Diag(E->getBeginLoc(), diag::err_builtin_fn_use);
return ExprError();
}
// Expressions of unknown type.
case BuiltinType::OMPArraySection:
- Diag(E->getLocStart(), diag::err_omp_array_section_use);
+ Diag(E->getBeginLoc(), diag::err_omp_array_section_use);
return ExprError();
// Everything else should be impossible.
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index c851a81af46..cef8ba320c0 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -419,8 +419,8 @@ bool Sema::checkLiteralOperatorId(const CXXScopeSpec &SS,
// namespace scope. Therefore, this unqualified-id cannot name anything.
// Reject it early, because we have no AST representation for this in the
// case where the scope is dependent.
- Diag(Name.getLocStart(), diag::err_literal_operator_id_outside_namespace)
- << SS.getScopeRep();
+ Diag(Name.getBeginLoc(), diag::err_literal_operator_id_outside_namespace)
+ << SS.getScopeRep();
return true;
case NestedNameSpecifier::Global:
@@ -1793,20 +1793,21 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
// A new-expression that creates an object of type T initializes that
// object as follows:
InitializationKind Kind
- // - If the new-initializer is omitted, the object is default-
- // initialized (8.5); if no initialization is performed,
- // the object has indeterminate value
- = initStyle == CXXNewExpr::NoInit
- ? InitializationKind::CreateDefault(TypeRange.getBegin())
- // - Otherwise, the new-initializer is interpreted according to the
- // initialization rules of 8.5 for direct-initialization.
- : initStyle == CXXNewExpr::ListInit
- ? InitializationKind::CreateDirectList(TypeRange.getBegin(),
- Initializer->getLocStart(),
- Initializer->getLocEnd())
- : InitializationKind::CreateDirect(TypeRange.getBegin(),
- DirectInitRange.getBegin(),
- DirectInitRange.getEnd());
+ // - If the new-initializer is omitted, the object is default-
+ // initialized (8.5); if no initialization is performed,
+ // the object has indeterminate value
+ = initStyle == CXXNewExpr::NoInit
+ ? InitializationKind::CreateDefault(TypeRange.getBegin())
+ // - Otherwise, the new-initializer is interpreted according to
+ // the
+ // initialization rules of 8.5 for direct-initialization.
+ : initStyle == CXXNewExpr::ListInit
+ ? InitializationKind::CreateDirectList(
+ TypeRange.getBegin(), Initializer->getBeginLoc(),
+ Initializer->getLocEnd())
+ : InitializationKind::CreateDirect(TypeRange.getBegin(),
+ DirectInitRange.getBegin(),
+ DirectInitRange.getEnd());
// C++11 [dcl.spec.auto]p6. Deduce the type which 'auto' stands in for.
auto *Deduced = AllocType->getContainedDeducedType();
@@ -1837,12 +1838,12 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
<< AllocType << TypeRange);
if (NumInits > 1) {
Expr *FirstBad = Inits[1];
- return ExprError(Diag(FirstBad->getLocStart(),
+ return ExprError(Diag(FirstBad->getBeginLoc(),
diag::err_auto_new_ctor_multiple_expressions)
<< AllocType << TypeRange);
}
if (Braced && !getLangOpts().CPlusPlus17)
- Diag(Initializer->getLocStart(), diag::ext_auto_new_list_init)
+ Diag(Initializer->getBeginLoc(), diag::ext_auto_new_list_init)
<< AllocType << TypeRange;
Expr *Deduce = Inits[0];
QualType DeducedType;
@@ -1989,7 +1990,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
// C++14 onwards, because Value is always unsigned here!
if (ArraySize->isIntegerConstantExpr(Value, Context)) {
if (Value.isSigned() && Value.isNegative()) {
- return ExprError(Diag(ArraySize->getLocStart(),
+ return ExprError(Diag(ArraySize->getBeginLoc(),
diag::err_typecheck_negative_array_size)
<< ArraySize->getSourceRange());
}
@@ -1998,19 +1999,18 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
unsigned ActiveSizeBits =
ConstantArrayType::getNumAddressingBits(Context, AllocType, Value);
if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context))
- return ExprError(Diag(ArraySize->getLocStart(),
- diag::err_array_too_large)
- << Value.toString(10)
- << ArraySize->getSourceRange());
+ return ExprError(
+ Diag(ArraySize->getBeginLoc(), diag::err_array_too_large)
+ << Value.toString(10) << ArraySize->getSourceRange());
}
KnownArraySize = Value.getZExtValue();
} else if (TypeIdParens.isValid()) {
// Can't have dynamic array size when the type-id is in parentheses.
- Diag(ArraySize->getLocStart(), diag::ext_new_paren_array_nonconst)
- << ArraySize->getSourceRange()
- << FixItHint::CreateRemoval(TypeIdParens.getBegin())
- << FixItHint::CreateRemoval(TypeIdParens.getEnd());
+ Diag(ArraySize->getBeginLoc(), diag::ext_new_paren_array_nonconst)
+ << ArraySize->getSourceRange()
+ << FixItHint::CreateRemoval(TypeIdParens.getBegin())
+ << FixItHint::CreateRemoval(TypeIdParens.getEnd());
TypeIdParens = SourceRange();
}
@@ -2072,8 +2072,8 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
// global operator new.
if (PlacementArgs.empty() && !PassAlignment &&
(OperatorNew->isImplicit() ||
- (OperatorNew->getLocStart().isValid() &&
- getSourceManager().isInSystemHeader(OperatorNew->getLocStart())))) {
+ (OperatorNew->getBeginLoc().isValid() &&
+ getSourceManager().isInSystemHeader(OperatorNew->getBeginLoc())))) {
if (Alignment > NewAlignment)
Diag(StartLoc, diag::warn_overaligned_type)
<< AllocType
@@ -2086,7 +2086,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
// Initializer lists are also allowed, in C++11. Rely on the parser for the
// dialect distinction.
if (ArraySize && !isLegalArrayNewInitializer(initStyle, Initializer)) {
- SourceRange InitRange(Inits[0]->getLocStart(),
+ SourceRange InitRange(Inits[0]->getBeginLoc(),
Inits[NumInits - 1]->getLocEnd());
Diag(StartLoc, diag::err_new_array_init_args) << InitRange;
return ExprError();
@@ -2593,7 +2593,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
if (IsSizedDelete) {
SourceRange R = PlaceArgs.empty()
? SourceRange()
- : SourceRange(PlaceArgs.front()->getLocStart(),
+ : SourceRange(PlaceArgs.front()->getBeginLoc(),
PlaceArgs.back()->getLocEnd());
Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R;
if (!OperatorDelete->isImplicit())
@@ -3162,12 +3162,12 @@ void Sema::AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE) {
switch (Detector.analyzeDeleteExpr(DE)) {
case MismatchingNewDeleteDetector::VarInitMismatches:
case MismatchingNewDeleteDetector::MemberInitMismatches: {
- DiagnoseMismatchedNewDelete(*this, DE->getLocStart(), Detector);
+ DiagnoseMismatchedNewDelete(*this, DE->getBeginLoc(), Detector);
break;
}
case MismatchingNewDeleteDetector::AnalyzeLater: {
DeleteExprs[Detector.Field].push_back(
- std::make_pair(DE->getLocStart(), DE->isArrayForm()));
+ std::make_pair(DE->getBeginLoc(), DE->isArrayForm()));
break;
}
case MismatchingNewDeleteDetector::NoMismatch:
@@ -3286,10 +3286,10 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
if (Pointee.getAddressSpace() != LangAS::Default &&
!getLangOpts().OpenCLCPlusPlus)
- return Diag(Ex.get()->getLocStart(),
+ return Diag(Ex.get()->getBeginLoc(),
diag::err_address_space_qualified_delete)
- << Pointee.getUnqualifiedType()
- << Pointee.getQualifiers().getAddressSpaceAttributePrintValue();
+ << Pointee.getUnqualifiedType()
+ << Pointee.getQualifiers().getAddressSpaceAttributePrintValue();
CXXRecordDecl *PointeeRD = nullptr;
if (Pointee->isVoidType() && !isSFINAEContext()) {
@@ -3427,7 +3427,7 @@ static bool resolveBuiltinNewDeleteOverload(Sema &S, CallExpr *TheCall,
DeclarationName NewName = S.Context.DeclarationNames.getCXXOperatorName(
IsDelete ? OO_Delete : OO_New);
- LookupResult R(S, NewName, TheCall->getLocStart(), Sema::LookupOrdinaryName);
+ LookupResult R(S, NewName, TheCall->getBeginLoc(), Sema::LookupOrdinaryName);
S.LookupQualifiedName(R, S.Context.getTranslationUnitDecl());
assert(!R.empty() && "implicitly declared allocation functions not found");
assert(!R.isAmbiguous() && "global allocation functions are ambiguous");
@@ -3529,7 +3529,7 @@ Sema::SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
InitializedEntity Entity =
InitializedEntity::InitializeParameter(Context, ParamTy, false);
ExprResult Arg = PerformCopyInitialization(
- Entity, TheCall->getArg(i)->getLocStart(), TheCall->getArg(i));
+ Entity, TheCall->getArg(i)->getBeginLoc(), TheCall->getArg(i));
if (Arg.isInvalid())
return ExprError();
TheCall->setArg(i, Arg.get());
@@ -3817,14 +3817,10 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
From = Res.get();
}
- ExprResult CastArg
- = BuildCXXCastArgument(*this,
- From->getLocStart(),
- ToType.getNonReferenceType(),
- CastKind, cast<CXXMethodDecl>(FD),
- ICS.UserDefined.FoundConversionFunction,
- ICS.UserDefined.HadMultipleCandidates,
- From);
+ ExprResult CastArg = BuildCXXCastArgument(
+ *this, From->getBeginLoc(), ToType.getNonReferenceType(), CastKind,
+ cast<CXXMethodDecl>(FD), ICS.UserDefined.FoundConversionFunction,
+ ICS.UserDefined.HadMultipleCandidates, From);
if (CastArg.isInvalid())
return ExprError();
@@ -3912,7 +3908,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
if (!Fn)
return ExprError();
- if (DiagnoseUseOfDecl(Fn, From->getLocStart()))
+ if (DiagnoseUseOfDecl(Fn, From->getBeginLoc()))
return ExprError();
From = FixOverloadedFunctionReference(From, Found, Fn);
@@ -4051,15 +4047,15 @@ 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->getLocStart(),
+ Diag(From->getBeginLoc(),
diag::ext_typecheck_convert_incompatible_pointer)
- << ToType << From->getType() << Action
- << From->getSourceRange() << 0;
+ << ToType << From->getType() << Action << From->getSourceRange()
+ << 0;
else
- Diag(From->getLocStart(),
+ Diag(From->getBeginLoc(),
diag::ext_typecheck_convert_incompatible_pointer)
- << From->getType() << ToType << Action
- << From->getSourceRange() << 0;
+ << From->getType() << ToType << Action << From->getSourceRange()
+ << 0;
if (From->getType()->isObjCObjectPointerType() &&
ToType->isObjCObjectPointerType())
@@ -4068,13 +4064,11 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
!CheckObjCARCUnavailableWeakConversion(ToType,
From->getType())) {
if (Action == AA_Initializing)
- Diag(From->getLocStart(),
- diag::err_arc_weak_unavailable_assign);
+ Diag(From->getBeginLoc(), diag::err_arc_weak_unavailable_assign);
else
- Diag(From->getLocStart(),
- diag::err_arc_convesion_of_weak_unavailable)
- << (Action == AA_Casting) << From->getType() << ToType
- << From->getSourceRange();
+ Diag(From->getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable)
+ << (Action == AA_Casting) << From->getType() << ToType
+ << From->getSourceRange();
}
CastKind Kind;
@@ -4130,12 +4124,9 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
case ICK_Derived_To_Base: {
CXXCastPath BasePath;
- if (CheckDerivedToBaseConversion(From->getType(),
- ToType.getNonReferenceType(),
- From->getLocStart(),
- From->getSourceRange(),
- &BasePath,
- CStyle))
+ if (CheckDerivedToBaseConversion(
+ From->getType(), ToType.getNonReferenceType(), From->getBeginLoc(),
+ From->getSourceRange(), &BasePath, CStyle))
return ExprError();
From = ImpCastExprToType(From, ToType.getNonReferenceType(),
@@ -4276,10 +4267,11 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
if (SCS.DeprecatedStringLiteralToCharPtr &&
!getLangOpts().WritableStrings) {
- Diag(From->getLocStart(), getLangOpts().CPlusPlus11
- ? diag::ext_deprecated_string_literal_conversion
- : diag::warn_deprecated_string_literal_conversion)
- << ToType.getNonReferenceType();
+ Diag(From->getBeginLoc(),
+ getLangOpts().CPlusPlus11
+ ? diag::ext_deprecated_string_literal_conversion
+ : diag::warn_deprecated_string_literal_conversion)
+ << ToType.getNonReferenceType();
}
break;
@@ -4302,7 +4294,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
// _Nullable type to a _Nonnull one, complain.
if (!isCast(CCK))
diagnoseNullableToNonnullConversion(ToType, InitialFromType,
- From->getLocStart());
+ From->getBeginLoc());
return From;
}
@@ -4932,7 +4924,7 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc,
if (ArgTy->isObjectType() || ArgTy->isFunctionType())
ArgTy = S.Context.getRValueReferenceType(ArgTy);
OpaqueArgExprs.push_back(
- OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(),
+ OpaqueValueExpr(Args[I]->getTypeLoc().getBeginLoc(),
ArgTy.getNonLValueExprType(S.Context),
Expr::getValueKindForType(ArgTy)));
}
@@ -5427,10 +5419,10 @@ QualType Sema::CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS,
}
CXXCastPath BasePath;
- if (CheckDerivedToBaseConversion(LHSType, Class, Loc,
- SourceRange(LHS.get()->getLocStart(),
- RHS.get()->getLocEnd()),
- &BasePath))
+ if (CheckDerivedToBaseConversion(
+ LHSType, Class, Loc,
+ SourceRange(LHS.get()->getBeginLoc(), RHS.get()->getLocEnd()),
+ &BasePath))
return QualType();
// Cast LHS to type of use.
@@ -5524,8 +5516,8 @@ static bool TryClassUnification(Sema &Self, Expr *From, Expr *To,
HaveConversion = false;
ToType = To->getType();
- InitializationKind Kind = InitializationKind::CreateCopy(To->getLocStart(),
- SourceLocation());
+ InitializationKind Kind =
+ InitializationKind::CreateCopy(To->getBeginLoc(), SourceLocation());
// C++11 5.16p3
// The process for determining whether an operand expression E1 of type T1
// can be converted to match an operand expression E2 of type T2 is defined
@@ -5670,8 +5662,8 @@ static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS
/// TryClassUnification.
static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T) {
InitializedEntity Entity = InitializedEntity::InitializeTemporary(T);
- InitializationKind Kind = InitializationKind::CreateCopy(E.get()->getLocStart(),
- SourceLocation());
+ InitializationKind Kind =
+ InitializationKind::CreateCopy(E.get()->getBeginLoc(), SourceLocation());
Expr *Arg = E.get();
InitializationSequence InitSeq(Self, Entity, Kind, Arg);
ExprResult Result = InitSeq.Perform(Self, Entity, Kind, Arg);
@@ -6577,8 +6569,7 @@ ExprResult Sema::ActOnDecltypeExpression(Expr *E) {
continue;
if (CheckCallReturnType(Call->getCallReturnType(Context),
- Call->getLocStart(),
- Call, Call->getDirectCallee()))
+ Call->getBeginLoc(), Call, Call->getDirectCallee()))
return ExprError();
}
@@ -6713,7 +6704,7 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
<< BaseType << Base->getSourceRange();
CallExpr *CE = dyn_cast<CallExpr>(Base);
if (Decl *CD = (CE ? CE->getCalleeDecl() : nullptr)) {
- Diag(CD->getLocStart(),
+ Diag(CD->getBeginLoc(),
diag::note_member_reference_arrow_from_operator_arrow);
}
}
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index b291fc8691d..52909aced16 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -50,8 +50,8 @@ ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
// ObjC strings can't be wide or UTF.
if (!S->isAscii()) {
- Diag(S->getLocStart(), diag::err_cfstring_literal_not_string_constant)
- << S->getSourceRange();
+ Diag(S->getBeginLoc(), diag::err_cfstring_literal_not_string_constant)
+ << S->getSourceRange();
return true;
}
@@ -107,8 +107,8 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
} else {
// If there is no NSConstantString interface defined then treat this
// as error and recover from it.
- Diag(S->getLocStart(), diag::err_no_nsconstant_string_class) << NSIdent
- << S->getSourceRange();
+ Diag(S->getBeginLoc(), diag::err_no_nsconstant_string_class)
+ << NSIdent << S->getSourceRange();
Ty = Context.getObjCIdType();
}
} else {
@@ -399,9 +399,8 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
InitializedEntity Entity
= InitializedEntity::InitializeParameter(S.Context, T,
/*Consumed=*/false);
- InitializationKind Kind
- = InitializationKind::CreateCopy(Element->getLocStart(),
- SourceLocation());
+ InitializationKind Kind = InitializationKind::CreateCopy(
+ Element->getBeginLoc(), SourceLocation());
InitializationSequence Seq(S, Entity, Kind, Element);
if (!Seq.Failed())
return Seq.Perform(S, Entity, Kind, Element);
@@ -432,12 +431,12 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
isa<ObjCBoolLiteralExpr>(OrigElement)) ? 2
: 3;
- S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection)
- << Which << OrigElement->getSourceRange()
- << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@");
+ S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection)
+ << Which << OrigElement->getSourceRange()
+ << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@");
- Result = S.BuildObjCNumericLiteral(OrigElement->getLocStart(),
- OrigElement);
+ Result =
+ S.BuildObjCNumericLiteral(OrigElement->getBeginLoc(), OrigElement);
if (Result.isInvalid())
return ExprError();
@@ -448,11 +447,11 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
// If this is potentially an Objective-C string literal, add the '@'.
else if (StringLiteral *String = dyn_cast<StringLiteral>(OrigElement)) {
if (String->isAscii()) {
- S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection)
- << 0 << OrigElement->getSourceRange()
- << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@");
+ S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection)
+ << 0 << OrigElement->getSourceRange()
+ << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@");
- Result = S.BuildObjCStringLiteral(OrigElement->getLocStart(), String);
+ Result = S.BuildObjCStringLiteral(OrigElement->getBeginLoc(), String);
if (Result.isInvalid())
return ExprError();
@@ -462,8 +461,8 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
}
if (!Recovered) {
- S.Diag(Element->getLocStart(), diag::err_invalid_collection_element)
- << Element->getType();
+ S.Diag(Element->getBeginLoc(), diag::err_invalid_collection_element)
+ << Element->getType();
return ExprError();
}
}
@@ -481,9 +480,9 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
break;
}
if (!hasMacro)
- S.Diag(Element->getLocStart(),
+ S.Diag(Element->getBeginLoc(),
diag::warn_concatenated_nsarray_literal)
- << Element->getType();
+ << Element->getType();
}
}
}
@@ -491,9 +490,9 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
// Make sure that the element has the type that the container factory
// function expects.
return S.PerformCopyInitialization(
- InitializedEntity::InitializeParameter(S.Context, T,
- /*Consumed=*/false),
- Element->getLocStart(), Element);
+ InitializedEntity::InitializeParameter(S.Context, T,
+ /*Consumed=*/false),
+ Element->getBeginLoc(), Element);
}
ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
@@ -1034,8 +1033,8 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
!Element.Value->containsUnexpandedParameterPack()) {
Diag(Element.EllipsisLoc,
diag::err_pack_expansion_without_parameter_packs)
- << SourceRange(Element.Key->getLocStart(),
- Element.Value->getLocEnd());
+ << SourceRange(Element.Key->getBeginLoc(),
+ Element.Value->getLocEnd());
return ExprError();
}
@@ -1693,12 +1692,12 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
} else {
// Check for extra arguments to non-variadic methods.
if (Args.size() != NumNamedArgs) {
- Diag(Args[NumNamedArgs]->getLocStart(),
+ Diag(Args[NumNamedArgs]->getBeginLoc(),
diag::err_typecheck_call_too_many_args)
- << 2 /*method*/ << NumNamedArgs << static_cast<unsigned>(Args.size())
- << Method->getSourceRange()
- << SourceRange(Args[NumNamedArgs]->getLocStart(),
- Args.back()->getLocEnd());
+ << 2 /*method*/ << NumNamedArgs << static_cast<unsigned>(Args.size())
+ << Method->getSourceRange()
+ << SourceRange(Args[NumNamedArgs]->getBeginLoc(),
+ Args.back()->getLocEnd());
}
}
@@ -2323,7 +2322,7 @@ static void checkFoundationAPI(Sema &S, SourceLocation Loc,
<< (!Ret->isRecordType()
? /*Vector*/ 2
: Ret->isUnionType() ? /*Union*/ 1 : /*Struct*/ 0);
- S.Diag(ImpliedMethod->getLocStart(),
+ S.Diag(ImpliedMethod->getBeginLoc(),
diag::note_objc_unsafe_perform_selector_method_declared_here)
<< ImpliedMethod->getSelector() << Ret;
}
@@ -2582,7 +2581,7 @@ static bool isMethodDeclaredInRootProtocol(Sema &S, const ObjCMethodDecl *M) {
return false;
const IdentifierInfo *II = S.NSAPIObj->getNSClassId(NSAPI::ClassId_NSObject);
if (const auto *RootClass = dyn_cast_or_null<ObjCInterfaceDecl>(
- S.LookupSingleName(S.TUScope, II, Protocol->getLocStart(),
+ S.LookupSingleName(S.TUScope, II, Protocol->getBeginLoc(),
Sema::LookupOrdinaryName))) {
for (const ObjCProtocolDecl *P : RootClass->all_referenced_protocols()) {
if (P->getCanonicalDecl() == Protocol->getCanonicalDecl())
@@ -2635,7 +2634,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
"use it instead.");
// The location of the receiver.
- SourceLocation Loc = SuperLoc.isValid()? SuperLoc : Receiver->getLocStart();
+ SourceLocation Loc = SuperLoc.isValid() ? SuperLoc : Receiver->getBeginLoc();
SourceRange RecRange =
SuperLoc.isValid()? SuperLoc : Receiver->getSourceRange();
ArrayRef<SourceLocation> SelectorSlotLocs;
@@ -2856,8 +2855,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
return ExprError();
forwardClass = OCIType->getInterfaceDecl();
- Diag(Receiver ? Receiver->getLocStart()
- : SuperLoc, diag::note_receiver_is_id);
+ Diag(Receiver ? Receiver->getBeginLoc() : SuperLoc,
+ diag::note_receiver_is_id);
Method = nullptr;
} else {
Method = ClassDecl->lookupInstanceMethod(Sel);
@@ -3776,8 +3775,8 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr,
(CastClass && CastClass->isSuperClassOf(ExprClass)))
return true;
if (warn)
- S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge)
- << T << Target->getName() << castType->getPointeeType();
+ S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
+ << T << Target->getName() << castType->getPointeeType();
return false;
} else if (castType->isObjCIdType() ||
(S.Context.ObjCObjectAdoptsQTypeProtocols(
@@ -3788,20 +3787,21 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr,
return true;
else {
if (warn) {
- S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge)
- << T << Target->getName() << castType;
- S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
- S.Diag(Target->getLocStart(), diag::note_declared_at);
+ S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
+ << T << Target->getName() << castType;
+ S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
+ S.Diag(Target->getBeginLoc(), diag::note_declared_at);
}
return false;
}
}
} else if (!castType->isObjCIdType()) {
- S.Diag(castExpr->getLocStart(), diag::err_objc_cf_bridged_not_interface)
- << castExpr->getType() << Parm;
- S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ S.Diag(castExpr->getBeginLoc(),
+ diag::err_objc_cf_bridged_not_interface)
+ << castExpr->getType() << Parm;
+ S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
if (Target)
- S.Diag(Target->getLocStart(), diag::note_declared_at);
+ S.Diag(Target->getBeginLoc(), diag::note_declared_at);
}
return true;
}
@@ -3841,9 +3841,10 @@ static bool CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr,
(ExprClass && CastClass->isSuperClassOf(ExprClass)))
return true;
if (warn) {
- S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge_to_cf)
- << castExpr->getType()->getPointeeType() << T;
- S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ S.Diag(castExpr->getBeginLoc(),
+ diag::warn_objc_invalid_bridge_to_cf)
+ << castExpr->getType()->getPointeeType() << T;
+ S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
}
return false;
} else if (castExpr->getType()->isObjCIdType() ||
@@ -3855,20 +3856,22 @@ static bool CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr,
return true;
else {
if (warn) {
- S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge_to_cf)
- << castExpr->getType() << castType;
- S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
- S.Diag(Target->getLocStart(), diag::note_declared_at);
+ S.Diag(castExpr->getBeginLoc(),
+ diag::warn_objc_invalid_bridge_to_cf)
+ << castExpr->getType() << castType;
+ S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
+ S.Diag(Target->getBeginLoc(), diag::note_declared_at);
}
return false;
}
}
}
- S.Diag(castExpr->getLocStart(), diag::err_objc_ns_bridged_invalid_cfobject)
- << castExpr->getType() << castType;
- S.Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ S.Diag(castExpr->getBeginLoc(),
+ diag::err_objc_ns_bridged_invalid_cfobject)
+ << castExpr->getType() << castType;
+ S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
if (Target)
- S.Diag(Target->getLocStart(), diag::note_declared_at);
+ S.Diag(Target->getBeginLoc(), diag::note_declared_at);
return true;
}
return false;
@@ -3945,8 +3948,8 @@ void Sema::CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr) {
ARCConversionTypeClass castExprACTC = classifyTypeForARCConversion(castType);
if (srcExprACTC != ACTC_retainable || castExprACTC != ACTC_coreFoundation)
return;
- CheckObjCBridgeRelatedConversions(castExpr->getLocStart(),
- castType, SrcType, castExpr);
+ CheckObjCBridgeRelatedConversions(castExpr->getBeginLoc(), castType, SrcType,
+ castExpr);
}
bool Sema::CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr,
@@ -3991,7 +3994,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
if (Diagnose) {
Diag(Loc, diag::err_objc_bridged_related_invalid_class) << RCId
<< SrcType << DestType;
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
}
return false;
}
@@ -4002,9 +4005,9 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
if (Diagnose) {
Diag(Loc, diag::err_objc_bridged_related_invalid_class_name) << RCId
<< SrcType << DestType;
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
if (Target)
- Diag(Target->getLocStart(), diag::note_declared_at);
+ Diag(Target->getBeginLoc(), diag::note_declared_at);
}
return false;
}
@@ -4017,7 +4020,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
if (Diagnose) {
Diag(Loc, diag::err_objc_bridged_related_known_method)
<< SrcType << DestType << Sel << false;
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
}
return false;
}
@@ -4031,7 +4034,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
if (Diagnose) {
Diag(Loc, diag::err_objc_bridged_related_known_method)
<< SrcType << DestType << Sel << true;
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
}
return false;
}
@@ -4070,11 +4073,12 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
SourceLocation SrcExprEndLoc = getLocForEndOfToken(SrcExpr->getLocEnd());
// Provide a fixit: [RelatedClass ClassMethod SrcExpr]
Diag(Loc, diag::err_objc_bridged_related_known_method)
- << SrcType << DestType << ClassMethod->getSelector() << false
- << FixItHint::CreateInsertion(SrcExpr->getLocStart(), ExpressionString)
- << FixItHint::CreateInsertion(SrcExprEndLoc, "]");
- Diag(RelatedClass->getLocStart(), diag::note_declared_at);
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ << SrcType << DestType << ClassMethod->getSelector() << false
+ << FixItHint::CreateInsertion(SrcExpr->getBeginLoc(),
+ ExpressionString)
+ << FixItHint::CreateInsertion(SrcExprEndLoc, "]");
+ Diag(RelatedClass->getBeginLoc(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
QualType receiverType = Context.getObjCInterfaceType(RelatedClass);
// Argument.
@@ -4113,11 +4117,11 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
Diag(Loc, diag::err_objc_bridged_related_known_method)
<< SrcType << DestType << InstanceMethod->getSelector() << true
- << FixItHint::CreateInsertion(SrcExpr->getLocStart(), "[")
+ << FixItHint::CreateInsertion(SrcExpr->getBeginLoc(), "[")
<< FixItHint::CreateInsertion(SrcExprEndLoc, ExpressionString);
}
- Diag(RelatedClass->getLocStart(), diag::note_declared_at);
- Diag(TDNDecl->getLocStart(), diag::note_declared_at);
+ Diag(RelatedClass->getBeginLoc(), diag::note_declared_at);
+ Diag(TDNDecl->getBeginLoc(), diag::note_declared_at);
ExprResult msg =
BuildInstanceMessageImplicit(SrcExpr, SrcType,
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 01ef86c656b..8bab240cef7 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -194,15 +194,15 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT,
// [dcl.init.string]p2
if (StrLength > CAT->getSize().getZExtValue())
- S.Diag(Str->getLocStart(),
+ S.Diag(Str->getBeginLoc(),
diag::err_initializer_string_for_char_array_too_long)
- << Str->getSourceRange();
+ << Str->getSourceRange();
} else {
// C99 6.7.8p14.
if (StrLength-1 > CAT->getSize().getZExtValue())
- S.Diag(Str->getLocStart(),
+ S.Diag(Str->getBeginLoc(),
diag::ext_initializer_string_for_char_array_too_long)
- << Str->getSourceRange();
+ << Str->getSourceRange();
}
// Set the type to the actual size that we are initializing. If we have
@@ -917,7 +917,7 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
if (maxElements == 0) {
if (!VerifyOnly)
- SemaRef.Diag(ParentIList->getInit(Index)->getLocStart(),
+ SemaRef.Diag(ParentIList->getInit(Index)->getBeginLoc(),
diag::err_implicit_empty_initializer);
++Index;
hadError = true;
@@ -925,11 +925,10 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
}
// Build a structured initializer list corresponding to this subobject.
- InitListExpr *StructuredSubobjectInitList
- = getStructuredSubobjectInit(ParentIList, Index, T, StructuredList,
- StructuredIndex,
- SourceRange(ParentIList->getInit(Index)->getLocStart(),
- ParentIList->getSourceRange().getEnd()));
+ InitListExpr *StructuredSubobjectInitList = getStructuredSubobjectInit(
+ ParentIList, Index, T, StructuredList, StructuredIndex,
+ SourceRange(ParentIList->getInit(Index)->getBeginLoc(),
+ ParentIList->getSourceRange().getEnd()));
unsigned StructuredSubobjectInitIndex = 0;
// Check the element types and build the structural subobject.
@@ -956,11 +955,11 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity,
if ((T->isArrayType() || T->isRecordType()) &&
!ParentIList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) &&
!isIdiomaticBraceElisionEntity(Entity)) {
- SemaRef.Diag(StructuredSubobjectInitList->getLocStart(),
+ SemaRef.Diag(StructuredSubobjectInitList->getBeginLoc(),
diag::warn_missing_braces)
<< StructuredSubobjectInitList->getSourceRange()
<< FixItHint::CreateInsertion(
- StructuredSubobjectInitList->getLocStart(), "{")
+ StructuredSubobjectInitList->getBeginLoc(), "{")
<< FixItHint::CreateInsertion(
SemaRef.getLocForEndOfToken(
StructuredSubobjectInitList->getLocEnd()),
@@ -1080,8 +1079,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity,
hadError = true;
}
// Special-case
- SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK)
- << IList->getInit(Index)->getSourceRange();
+ SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK)
+ << IList->getInit(Index)->getSourceRange();
} else if (!T->isIncompleteType()) {
// Don't complain for incomplete types, since we'll get an error
// elsewhere
@@ -1103,8 +1102,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity,
hadError = true;
}
- SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK)
- << initKind << IList->getInit(Index)->getSourceRange();
+ SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK)
+ << initKind << IList->getInit(Index)->getSourceRange();
}
}
@@ -1155,21 +1154,20 @@ void InitListChecker::CheckListElementTypes(const InitializedEntity &Entity,
// This type is invalid, issue a diagnostic.
++Index;
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type)
- << DeclType;
+ SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type)
+ << DeclType;
hadError = true;
} else if (DeclType->isReferenceType()) {
CheckReferenceType(Entity, IList, DeclType, Index,
StructuredList, StructuredIndex);
} else if (DeclType->isObjCObjectType()) {
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(), diag::err_init_objc_class)
- << DeclType;
+ SemaRef.Diag(IList->getBeginLoc(), diag::err_init_objc_class) << DeclType;
hadError = true;
} else {
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type)
- << DeclType;
+ SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type)
+ << DeclType;
hadError = true;
}
}
@@ -1232,7 +1230,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
// FIXME: Better EqualLoc?
InitializationKind Kind =
- InitializationKind::CreateCopy(expr->getLocStart(), SourceLocation());
+ InitializationKind::CreateCopy(expr->getBeginLoc(), SourceLocation());
InitializationSequence Seq(SemaRef, Entity, Kind, expr,
/*TopLevelOfInitList*/ true);
@@ -1356,8 +1354,8 @@ void InitListChecker::CheckComplexType(const InitializedEntity &Entity,
// This is an extension in C. (The builtin _Complex type does not exist
// in the C++ standard.)
if (!SemaRef.getLangOpts().CPlusPlus && !VerifyOnly)
- SemaRef.Diag(IList->getLocStart(), diag::ext_complex_component_init)
- << IList->getSourceRange();
+ SemaRef.Diag(IList->getBeginLoc(), diag::ext_complex_component_init)
+ << IList->getSourceRange();
// Initialize the complex number.
QualType elementType = DeclType->getAs<ComplexType>()->getElementType();
@@ -1378,11 +1376,11 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
unsigned &StructuredIndex) {
if (Index >= IList->getNumInits()) {
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(),
- SemaRef.getLangOpts().CPlusPlus11 ?
- diag::warn_cxx98_compat_empty_scalar_initializer :
- diag::err_empty_scalar_initializer)
- << IList->getSourceRange();
+ SemaRef.Diag(IList->getBeginLoc(),
+ SemaRef.getLangOpts().CPlusPlus11
+ ? diag::warn_cxx98_compat_empty_scalar_initializer
+ : diag::err_empty_scalar_initializer)
+ << IList->getSourceRange();
hadError = !SemaRef.getLangOpts().CPlusPlus11;
++Index;
++StructuredIndex;
@@ -1394,18 +1392,17 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
// FIXME: This is invalid, and accepting it causes overload resolution
// to pick the wrong overload in some corner cases.
if (!VerifyOnly)
- SemaRef.Diag(SubIList->getLocStart(),
+ SemaRef.Diag(SubIList->getBeginLoc(),
diag::ext_many_braces_around_scalar_init)
- << SubIList->getSourceRange();
+ << SubIList->getSourceRange();
CheckScalarType(Entity, SubIList, DeclType, Index, StructuredList,
StructuredIndex);
return;
} else if (isa<DesignatedInitExpr>(expr)) {
if (!VerifyOnly)
- SemaRef.Diag(expr->getLocStart(),
- diag::err_designator_for_scalar_init)
- << DeclType << expr->getSourceRange();
+ SemaRef.Diag(expr->getBeginLoc(), diag::err_designator_for_scalar_init)
+ << DeclType << expr->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
@@ -1420,8 +1417,8 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
}
ExprResult Result =
- SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
- /*TopLevelOfInitList=*/true);
+ SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr,
+ /*TopLevelOfInitList=*/true);
Expr *ResultExpr = nullptr;
@@ -1453,10 +1450,9 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
// so that we know the location (or decl) of the "current object" being
// initialized.
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(),
- diag::err_init_reference_member_uninitialized)
- << DeclType
- << IList->getSourceRange();
+ SemaRef.Diag(IList->getBeginLoc(),
+ diag::err_init_reference_member_uninitialized)
+ << DeclType << IList->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
@@ -1466,8 +1462,8 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
Expr *expr = IList->getInit(Index);
if (isa<InitListExpr>(expr) && !SemaRef.getLangOpts().CPlusPlus11) {
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(), diag::err_init_non_aggr_init_list)
- << DeclType << IList->getSourceRange();
+ SemaRef.Diag(IList->getBeginLoc(), diag::err_init_non_aggr_init_list)
+ << DeclType << IList->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
@@ -1482,7 +1478,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
}
ExprResult Result =
- SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr,
+ SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr,
/*TopLevelOfInitList=*/true);
if (Result.isInvalid())
@@ -1529,9 +1525,9 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
return;
}
- ExprResult Result =
- SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(), Init,
- /*TopLevelOfInitList=*/true);
+ ExprResult Result =
+ SemaRef.PerformCopyInitialization(Entity, Init->getBeginLoc(), Init,
+ /*TopLevelOfInitList=*/true);
Expr *ResultExpr = nullptr;
if (Result.isInvalid())
@@ -1586,7 +1582,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
//
// Because of this, explicitly call out that it is non-portable.
//
- SemaRef.Diag(IList->getLocStart(),
+ SemaRef.Diag(IList->getBeginLoc(),
diag::warn_neon_vector_initializer_non_portable);
const char *typeCode;
@@ -1601,11 +1597,11 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
else
llvm_unreachable("Invalid element type!");
- SemaRef.Diag(IList->getLocStart(),
- SemaRef.Context.getTypeSize(VT) > 64 ?
- diag::note_neon_vector_initializer_non_portable_q :
- diag::note_neon_vector_initializer_non_portable)
- << typeCode << typeSize;
+ SemaRef.Diag(IList->getBeginLoc(),
+ SemaRef.Context.getTypeSize(VT) > 64
+ ? diag::note_neon_vector_initializer_non_portable_q
+ : diag::note_neon_vector_initializer_non_portable)
+ << typeCode << typeSize;
}
return;
@@ -1646,9 +1642,9 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
// OpenCL requires all elements to be initialized.
if (numEltsInit != maxElements) {
if (!VerifyOnly)
- SemaRef.Diag(IList->getLocStart(),
+ SemaRef.Diag(IList->getBeginLoc(),
diag::err_vector_incorrect_num_initializers)
- << (numEltsInit < maxElements) << maxElements << numEltsInit;
+ << (numEltsInit < maxElements) << maxElements << numEltsInit;
hadError = true;
}
}
@@ -1686,9 +1682,9 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
// earlier, but I don't know where clang accepts VLAs (gcc accepts
// them in all sorts of strange places).
if (!VerifyOnly)
- SemaRef.Diag(VAT->getSizeExpr()->getLocStart(),
- diag::err_variable_object_no_init)
- << VAT->getSizeExpr()->getSourceRange();
+ SemaRef.Diag(VAT->getSizeExpr()->getBeginLoc(),
+ diag::err_variable_object_no_init)
+ << VAT->getSizeExpr()->getSourceRange();
hadError = true;
++Index;
++StructuredIndex;
@@ -1765,8 +1761,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
if (maxElements == Zero && !Entity.isVariableLengthArrayNew()) {
// Sizing an array implicitly to zero is not allowed by ISO C,
// but is supported by GNU.
- SemaRef.Diag(IList->getLocStart(),
- diag::ext_typecheck_zero_array_size);
+ SemaRef.Diag(IList->getBeginLoc(), diag::ext_typecheck_zero_array_size);
}
DeclType = SemaRef.Context.getConstantArrayType(elementType, maxElements,
@@ -1815,9 +1810,8 @@ bool InitListChecker::CheckFlexibleArrayInit(const InitializedEntity &Entity,
}
if (!VerifyOnly) {
- SemaRef.Diag(InitExpr->getLocStart(),
- FlexArrayDiag)
- << InitExpr->getLocStart();
+ SemaRef.Diag(InitExpr->getBeginLoc(), FlexArrayDiag)
+ << InitExpr->getBeginLoc();
SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
<< Field;
}
@@ -1881,7 +1875,7 @@ void InitListChecker::CheckStructUnionTypes(
// If we have any base classes, they are initialized prior to the fields.
for (auto &Base : Bases) {
Expr *Init = Index < IList->getNumInits() ? IList->getInit(Index) : nullptr;
- SourceLocation InitLoc = Init ? Init->getLocStart() : IList->getLocEnd();
+ SourceLocation InitLoc = Init ? Init->getBeginLoc() : IList->getLocEnd();
// Designated inits always initialize fields, so if we see one, all
// remaining base classes have no explicit initializer.
@@ -1958,8 +1952,8 @@ void InitListChecker::CheckStructUnionTypes(
if (VerifyOnly)
InvalidUse = !SemaRef.CanUseDecl(*Field, TreatUnavailableAsInvalid);
else
- InvalidUse = SemaRef.DiagnoseUseOfDecl(*Field,
- IList->getInit(Index)->getLocStart());
+ InvalidUse = SemaRef.DiagnoseUseOfDecl(
+ *Field, IList->getInit(Index)->getBeginLoc());
if (InvalidUse) {
++Index;
++Field;
@@ -2182,11 +2176,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
ExistingInit = StructuredList->getArrayFiller();
if (!ExistingInit)
- StructuredList =
- getStructuredSubobjectInit(IList, Index, CurrentObjectType,
- StructuredList, StructuredIndex,
- SourceRange(D->getLocStart(),
- DIE->getLocEnd()));
+ StructuredList = getStructuredSubobjectInit(
+ IList, Index, CurrentObjectType, StructuredList, StructuredIndex,
+ SourceRange(D->getBeginLoc(), DIE->getLocEnd()));
else if (InitListExpr *Result = dyn_cast<InitListExpr>(ExistingInit))
StructuredList = Result;
else {
@@ -2194,10 +2186,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
dyn_cast<DesignatedInitUpdateExpr>(ExistingInit))
StructuredList = E->getUpdater();
else {
- DesignatedInitUpdateExpr *DIUE =
- new (SemaRef.Context) DesignatedInitUpdateExpr(SemaRef.Context,
- D->getLocStart(), ExistingInit,
- DIE->getLocEnd());
+ DesignatedInitUpdateExpr *DIUE = new (SemaRef.Context)
+ DesignatedInitUpdateExpr(SemaRef.Context, D->getBeginLoc(),
+ ExistingInit, DIE->getLocEnd());
StructuredList->updateInit(SemaRef.Context, StructuredIndex, DIUE);
StructuredList = DIUE->getUpdater();
}
@@ -2222,14 +2213,13 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
// Here, xs[0].a == 0 and xs[0].b == 3, since the second,
// designated initializer re-initializes the whole
// subobject [0], overwriting previous initializers.
- SemaRef.Diag(D->getLocStart(),
+ SemaRef.Diag(D->getBeginLoc(),
diag::warn_subobject_initializer_overrides)
- << SourceRange(D->getLocStart(), DIE->getLocEnd());
+ << SourceRange(D->getBeginLoc(), DIE->getLocEnd());
- SemaRef.Diag(ExistingInit->getLocStart(),
+ SemaRef.Diag(ExistingInit->getBeginLoc(),
diag::note_previous_initializer)
- << /*FIXME:has side effects=*/0
- << ExistingInit->getSourceRange();
+ << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange();
}
}
}
@@ -2350,10 +2340,10 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
SemaRef.Diag(D->getFieldLoc(),
diag::warn_initializer_overrides)
<< D->getSourceRange();
- SemaRef.Diag(ExistingInit->getLocStart(),
+ SemaRef.Diag(ExistingInit->getBeginLoc(),
diag::note_previous_initializer)
- << /*FIXME:has side effects=*/0
- << ExistingInit->getSourceRange();
+ << /*FIXME:has side effects=*/0
+ << ExistingInit->getSourceRange();
}
// remove existing initializer
@@ -2395,10 +2385,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
if (!VerifyOnly) {
DesignatedInitExpr::Designator *NextD
= DIE->getDesignator(DesigIdx + 1);
- SemaRef.Diag(NextD->getLocStart(),
- diag::err_designator_into_flexible_array_member)
- << SourceRange(NextD->getLocStart(),
- DIE->getLocEnd());
+ SemaRef.Diag(NextD->getBeginLoc(),
+ diag::err_designator_into_flexible_array_member)
+ << SourceRange(NextD->getBeginLoc(), DIE->getLocEnd());
SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
<< *Field;
}
@@ -2409,9 +2398,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
!isa<StringLiteral>(DIE->getInit())) {
// The initializer is not an initializer list.
if (!VerifyOnly) {
- SemaRef.Diag(DIE->getInit()->getLocStart(),
- diag::err_flexible_array_init_needs_braces)
- << DIE->getInit()->getSourceRange();
+ SemaRef.Diag(DIE->getInit()->getBeginLoc(),
+ diag::err_flexible_array_init_needs_braces)
+ << DIE->getInit()->getSourceRange();
SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member)
<< *Field;
}
@@ -2553,10 +2542,10 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
DesignatedEndIndex.setIsUnsigned(MaxElements.isUnsigned());
if (DesignatedEndIndex >= MaxElements) {
if (!VerifyOnly)
- SemaRef.Diag(IndexExpr->getLocStart(),
- diag::err_array_designator_too_large)
- << DesignatedEndIndex.toString(10) << MaxElements.toString(10)
- << IndexExpr->getSourceRange();
+ SemaRef.Diag(IndexExpr->getBeginLoc(),
+ diag::err_array_designator_too_large)
+ << DesignatedEndIndex.toString(10) << MaxElements.toString(10)
+ << IndexExpr->getSourceRange();
++Index;
return true;
}
@@ -2728,10 +2717,8 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index,
SemaRef.Diag(InitRange.getBegin(),
diag::warn_subobject_initializer_overrides)
<< InitRange;
- SemaRef.Diag(ExistingInit->getLocStart(),
- diag::note_previous_initializer)
- << /*FIXME:has side effects=*/0
- << ExistingInit->getSourceRange();
+ SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer)
+ << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange();
}
InitListExpr *Result
@@ -2810,14 +2797,11 @@ void InitListChecker::UpdateStructuredListElement(InitListExpr *StructuredList,
// There is an overwrite taking place because the first braced initializer
// list "{ .a = 2 }' already provides value for .p.b (which is zero).
if (PrevInit->getSourceRange().isValid()) {
- SemaRef.Diag(expr->getLocStart(),
- diag::warn_initializer_overrides)
- << expr->getSourceRange();
+ SemaRef.Diag(expr->getBeginLoc(), diag::warn_initializer_overrides)
+ << expr->getSourceRange();
- SemaRef.Diag(PrevInit->getLocStart(),
- diag::note_previous_initializer)
- << /*FIXME:has side effects=*/0
- << PrevInit->getSourceRange();
+ SemaRef.Diag(PrevInit->getBeginLoc(), diag::note_previous_initializer)
+ << /*FIXME:has side effects=*/0 << PrevInit->getSourceRange();
}
}
@@ -2833,7 +2817,7 @@ void InitListChecker::UpdateStructuredListElement(InitListExpr *StructuredList,
/// value of the constant expression.
static ExprResult
CheckArrayDesignatorExpr(Sema &S, Expr *Index, llvm::APSInt &Value) {
- SourceLocation Loc = Index->getLocStart();
+ SourceLocation Loc = Index->getBeginLoc();
// Make sure this is an integer constant expression.
ExprResult Result = S.VerifyIntegerConstantExpression(Index, &Value);
@@ -2941,8 +2925,8 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
Init.getAs<Expr>());
if (!getLangOpts().C99)
- Diag(DIE->getLocStart(), diag::ext_designated_init)
- << DIE->getSourceRange();
+ Diag(DIE->getBeginLoc(), diag::ext_designated_init)
+ << DIE->getSourceRange();
return DIE;
}
@@ -3583,7 +3567,7 @@ static bool TryInitializerListConstruction(Sema &S,
InitializedEntity HiddenArray =
InitializedEntity::InitializeTemporary(ArrayType);
InitializationKind Kind = InitializationKind::CreateDirectList(
- List->getExprLoc(), List->getLocStart(), List->getLocEnd());
+ List->getExprLoc(), List->getBeginLoc(), List->getLocEnd());
TryListInitialization(S, HiddenArray, Kind, List, Sequence,
TreatUnavailableAsInvalid);
if (Sequence)
@@ -3974,7 +3958,7 @@ static void TryReferenceListInitialization(Sema &S,
T1, Sequence))
return;
- SourceLocation DeclLoc = Initializer->getLocStart();
+ SourceLocation DeclLoc = Initializer->getBeginLoc();
bool dummy1, dummy2, dummy3;
Sema::ReferenceCompareResult RefRelationship
= S.CompareReferenceRelationship(DeclLoc, cv1T1, cv2T2, dummy1,
@@ -4031,7 +4015,7 @@ static void TryListInitialization(Sema &S,
}
if (DestType->isRecordType() &&
- !S.isCompleteType(InitList->getLocStart(), DestType)) {
+ !S.isCompleteType(InitList->getBeginLoc(), DestType)) {
Sequence.setIncompleteTypeFailure(DestType);
return;
}
@@ -4051,7 +4035,7 @@ static void TryListInitialization(Sema &S,
if (DestType->isRecordType()) {
QualType InitType = InitList->getInit(0)->getType();
if (S.Context.hasSameUnqualifiedType(InitType, DestType) ||
- S.IsDerivedFrom(InitList->getLocStart(), InitType, DestType)) {
+ S.IsDerivedFrom(InitList->getBeginLoc(), InitType, DestType)) {
Expr *InitListAsExpr = InitList;
TryConstructorInitialization(S, Entity, Kind, InitListAsExpr, DestType,
DestType, Sequence,
@@ -4218,9 +4202,8 @@ static OverloadingResult TryRefInitWithConversionFunction(
bool DerivedToBase;
bool ObjCConversion;
bool ObjCLifetimeConversion;
- assert(!S.CompareReferenceRelationship(Initializer->getLocStart(),
- T1, T2, DerivedToBase,
- ObjCConversion,
+ assert(!S.CompareReferenceRelationship(Initializer->getBeginLoc(), T1, T2,
+ DerivedToBase, ObjCConversion,
ObjCLifetimeConversion) &&
"Must have incompatible references when binding via conversion");
(void)DerivedToBase;
@@ -4313,7 +4296,7 @@ static OverloadingResult TryRefInitWithConversionFunction(
if (T2RecordType && T2RecordType->getDecl()->isInvalidDecl())
return OR_No_Viable_Function;
- SourceLocation DeclLoc = Initializer->getLocStart();
+ SourceLocation DeclLoc = Initializer->getBeginLoc();
// Perform overload resolution. If it fails, return the failed result.
OverloadCandidateSet::iterator Best;
@@ -4439,7 +4422,7 @@ static void TryReferenceInitializationCore(Sema &S,
Qualifiers T2Quals,
InitializationSequence &Sequence) {
QualType DestType = Entity.getType();
- SourceLocation DeclLoc = Initializer->getLocStart();
+ SourceLocation DeclLoc = Initializer->getBeginLoc();
// Compute some basic properties of the types and the initializer.
bool isLValueRef = DestType->isLValueReferenceType();
bool isRValueRef = !isLValueRef;
@@ -4867,7 +4850,7 @@ static void TryUserDefinedConversion(Sema &S,
}
}
- SourceLocation DeclLoc = Initializer->getLocStart();
+ SourceLocation DeclLoc = Initializer->getBeginLoc();
if (const RecordType *SourceRecordType = SourceType->getAs<RecordType>()) {
// The type we're converting from is a class type, enumerate its conversion
@@ -5310,7 +5293,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
if (Args.size() == 1) {
Initializer = Args[0];
if (S.getLangOpts().ObjC1) {
- if (S.CheckObjCBridgeRelatedConversions(Initializer->getLocStart(),
+ if (S.CheckObjCBridgeRelatedConversions(Initializer->getBeginLoc(),
DestType, Initializer->getType(),
Initializer) ||
S.ConversionToObjCStringLiteralCheck(DestType, Initializer))
@@ -5501,7 +5484,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
if (Kind.getKind() == InitializationKind::IK_Direct ||
(Kind.getKind() == InitializationKind::IK_Copy &&
(Context.hasSameUnqualifiedType(SourceType, DestType) ||
- S.IsDerivedFrom(Initializer->getLocStart(), SourceType, DestType))))
+ S.IsDerivedFrom(Initializer->getBeginLoc(), SourceType, DestType))))
TryConstructorInitialization(S, Entity, Kind, Args,
DestType, DestType, *this);
// - Otherwise (i.e., for the remaining copy-initialization cases),
@@ -5535,7 +5518,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
bool NeedAtomicConversion = false;
if (const AtomicType *Atomic = DestType->getAs<AtomicType>()) {
if (Context.hasSameUnqualifiedType(SourceType, Atomic->getValueType()) ||
- S.IsDerivedFrom(Initializer->getLocStart(), SourceType,
+ S.IsDerivedFrom(Initializer->getBeginLoc(), SourceType,
Atomic->getValueType())) {
DestType = Atomic->getValueType();
NeedAtomicConversion = true;
@@ -5758,7 +5741,7 @@ static SourceLocation getInitializationLoc(const InitializedEntity &Entity,
case InitializedEntity::EK_LambdaToBlockConversionBlockElement:
case InitializedEntity::EK_CompoundLiteralInit:
case InitializedEntity::EK_RelatedResult:
- return Initializer->getLocStart();
+ return Initializer->getBeginLoc();
}
llvm_unreachable("missed an InitializedEntity kind?");
}
@@ -7067,18 +7050,18 @@ static void CheckMoveOnConstruction(Sema &S, const Expr *InitExpr,
return;
}
- S.Diag(CE->getLocStart(), DiagID);
+ S.Diag(CE->getBeginLoc(), DiagID);
// Get all the locations for a fix-it. Don't emit the fix-it if any location
// is within a macro.
- SourceLocation CallBegin = CE->getCallee()->getLocStart();
+ SourceLocation CallBegin = CE->getCallee()->getBeginLoc();
if (CallBegin.isMacroID())
return;
SourceLocation RParen = CE->getRParenLoc();
if (RParen.isMacroID())
return;
SourceLocation LParen;
- SourceLocation ArgLoc = Arg->getLocStart();
+ SourceLocation ArgLoc = Arg->getBeginLoc();
// Special testing for the argument location. Since the fix-it needs the
// location right before the argument, the argument location can be in a
@@ -7093,7 +7076,7 @@ static void CheckMoveOnConstruction(Sema &S, const Expr *InitExpr,
LParen = ArgLoc.getLocWithOffset(-1);
- S.Diag(CE->getLocStart(), diag::note_remove_move)
+ S.Diag(CE->getBeginLoc(), diag::note_remove_move)
<< FixItHint::CreateRemoval(SourceRange(CallBegin, LParen))
<< FixItHint::CreateRemoval(SourceRange(RParen, RParen));
}
@@ -7235,8 +7218,8 @@ InitializationSequence::Perform(Sema &S,
// from an initializer list. For parameters, we produce a better warning
// elsewhere.
Expr *Init = Args[0];
- S.Diag(Init->getLocStart(), diag::warn_cxx98_compat_reference_list_init)
- << Init->getSourceRange();
+ S.Diag(Init->getBeginLoc(), diag::warn_cxx98_compat_reference_list_init)
+ << Init->getSourceRange();
}
// OpenCL v2.0 s6.13.11.1. atomic variables can be initialized in global scope
@@ -7248,8 +7231,9 @@ InitializationSequence::Perform(Sema &S,
if (S.getLangOpts().OpenCLVersion >= 200 &&
ETy->isAtomicType() && !HasGlobalAS &&
Entity.getKind() == InitializedEntity::EK_Variable && Args.size() > 0) {
- S.Diag(Args[0]->getLocStart(), diag::err_opencl_atomic_init) << 1 <<
- SourceRange(Entity.getDecl()->getLocStart(), Args[0]->getLocEnd());
+ S.Diag(Args[0]->getBeginLoc(), diag::err_opencl_atomic_init)
+ << 1
+ << SourceRange(Entity.getDecl()->getBeginLoc(), Args[0]->getLocEnd());
return ExprError();
}
@@ -7365,10 +7349,9 @@ InitializationSequence::Perform(Sema &S,
// Casts to inaccessible base classes are allowed with C-style casts.
bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast();
- if (S.CheckDerivedToBaseConversion(SourceType, Step->Type,
- CurInit.get()->getLocStart(),
- CurInit.get()->getSourceRange(),
- &BasePath, IgnoreBaseAccess))
+ if (S.CheckDerivedToBaseConversion(
+ SourceType, Step->Type, CurInit.get()->getBeginLoc(),
+ CurInit.get()->getSourceRange(), &BasePath, IgnoreBaseAccess))
return ExprError();
ExprValueKind VK =
@@ -7397,7 +7380,7 @@ InitializationSequence::Perform(Sema &S,
if (auto *DRE = dyn_cast<DeclRefExpr>(CurInit.get()->IgnoreParens())) {
if (auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl())) {
if (!S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
- DRE->getLocStart()))
+ DRE->getBeginLoc()))
return ExprError();
}
}
@@ -7458,7 +7441,7 @@ InitializationSequence::Perform(Sema &S,
if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(Fn)) {
// Build a call to the selected constructor.
SmallVector<Expr*, 8> ConstructorArgs;
- SourceLocation Loc = CurInit.get()->getLocStart();
+ SourceLocation Loc = CurInit.get()->getBeginLoc();
// Determine the arguments required to actually perform the constructor
// call.
@@ -7525,10 +7508,10 @@ InitializationSequence::Perform(Sema &S,
if (const RecordType *Record = T->getAs<RecordType>()) {
CXXDestructorDecl *Destructor
= S.LookupDestructor(cast<CXXRecordDecl>(Record->getDecl()));
- S.CheckDestructorAccess(CurInit.get()->getLocStart(), Destructor,
+ S.CheckDestructorAccess(CurInit.get()->getBeginLoc(), Destructor,
S.PDiag(diag::err_access_dtor_temp) << T);
- S.MarkFunctionReferenced(CurInit.get()->getLocStart(), Destructor);
- if (S.DiagnoseUseOfDecl(Destructor, CurInit.get()->getLocStart()))
+ S.MarkFunctionReferenced(CurInit.get()->getBeginLoc(), Destructor);
+ if (S.DiagnoseUseOfDecl(Destructor, CurInit.get()->getBeginLoc()))
return ExprError();
}
}
@@ -8023,7 +8006,7 @@ static bool DiagnoseUninitializedReference(Sema &S, SourceLocation Loc,
}
for (const auto &BI : RD->bases()) {
- if (DiagnoseUninitializedReference(S, BI.getLocStart(), BI.getType())) {
+ if (DiagnoseUninitializedReference(S, BI.getBeginLoc(), BI.getType())) {
S.Diag(Loc, diag::note_value_initialization_here) << RD;
return true;
}
@@ -8078,7 +8061,7 @@ static void diagnoseListInit(Sema &S, const InitializedEntity &Entity,
// inner initialization failed.
QualType T = DestType->getAs<ReferenceType>()->getPointeeType();
diagnoseListInit(S, InitializedEntity::InitializeTemporary(T), InitList);
- SourceLocation Loc = InitList->getLocStart();
+ SourceLocation Loc = InitList->getBeginLoc();
if (auto *D = Entity.getDecl())
Loc = D->getLocation();
S.Diag(Loc, diag::note_in_reference_temporary_list_initializer) << T;
@@ -8128,7 +8111,7 @@ bool InitializationSequence::Diagnose(Sema &S,
(void)Diagnosed;
} else // FIXME: diagnostic below could be better!
S.Diag(Kind.getLocation(), diag::err_reference_has_multiple_inits)
- << SourceRange(Args.front()->getLocStart(), Args.back()->getLocEnd());
+ << SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd());
break;
case FK_ParenthesizedListInitForReference:
S.Diag(Kind.getLocation(), diag::err_list_init_in_parens)
@@ -8157,9 +8140,9 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_PlainStringIntoUTF8Char:
S.Diag(Kind.getLocation(),
diag::err_array_init_plain_string_into_char8_t);
- S.Diag(Args.front()->getLocStart(),
+ S.Diag(Args.front()->getBeginLoc(),
diag::note_array_init_plain_string_into_char8_t)
- << FixItHint::CreateInsertion(Args.front()->getLocStart(), "u8");
+ << FixItHint::CreateInsertion(Args.front()->getBeginLoc(), "u8");
break;
case FK_UTF8StringIntoPlainChar:
S.Diag(Kind.getLocation(),
@@ -8193,7 +8176,7 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_AddressOfUnaddressableFunction: {
auto *FD = cast<FunctionDecl>(cast<DeclRefExpr>(OnlyArg)->getDecl());
S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true,
- OnlyArg->getLocStart());
+ OnlyArg->getBeginLoc());
break;
}
@@ -8374,8 +8357,8 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_ConstructorOverloadFailed: {
SourceRange ArgsRange;
if (Args.size())
- ArgsRange = SourceRange(Args.front()->getLocStart(),
- Args.back()->getLocEnd());
+ ArgsRange =
+ SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd());
if (Failure == FK_ListConstructorOverloadFailed) {
assert(Args.size() == 1 &&
@@ -8910,7 +8893,7 @@ static void DiagnoseNarrowingInInitList(Sema &S,
// This was a floating-to-integer conversion, which is always considered a
// narrowing conversion even if the value is a constant and can be
// represented exactly as an integer.
- S.Diag(PostInit->getLocStart(), NarrowingErrs(S.getLangOpts())
+ S.Diag(PostInit->getBeginLoc(), NarrowingErrs(S.getLangOpts())
? diag::ext_init_list_type_narrowing
: diag::warn_init_list_type_narrowing)
<< PostInit->getSourceRange()
@@ -8920,7 +8903,7 @@ static void DiagnoseNarrowingInInitList(Sema &S,
case NK_Constant_Narrowing:
// A constant value was narrowed.
- S.Diag(PostInit->getLocStart(),
+ S.Diag(PostInit->getBeginLoc(),
NarrowingErrs(S.getLangOpts())
? diag::ext_init_list_constant_narrowing
: diag::warn_init_list_constant_narrowing)
@@ -8931,7 +8914,7 @@ static void DiagnoseNarrowingInInitList(Sema &S,
case NK_Variable_Narrowing:
// A variable's value may have been narrowed.
- S.Diag(PostInit->getLocStart(),
+ S.Diag(PostInit->getBeginLoc(),
NarrowingErrs(S.getLangOpts())
? diag::ext_init_list_variable_narrowing
: diag::warn_init_list_variable_narrowing)
@@ -8959,9 +8942,9 @@ static void DiagnoseNarrowingInInitList(Sema &S,
return;
}
OS << ">(";
- S.Diag(PostInit->getLocStart(), diag::note_init_list_narrowing_silence)
+ S.Diag(PostInit->getBeginLoc(), diag::note_init_list_narrowing_silence)
<< PostInit->getSourceRange()
- << FixItHint::CreateInsertion(PostInit->getLocStart(), OS.str())
+ << FixItHint::CreateInsertion(PostInit->getBeginLoc(), OS.str())
<< FixItHint::CreateInsertion(
S.getLocForEndOfToken(PostInit->getLocEnd()), ")");
}
@@ -8978,8 +8961,8 @@ Sema::CanPerformCopyInitialization(const InitializedEntity &Entity,
Expr *InitE = Init.get();
assert(InitE && "No initialization expression");
- InitializationKind Kind
- = InitializationKind::CreateCopy(InitE->getLocStart(), SourceLocation());
+ InitializationKind Kind =
+ InitializationKind::CreateCopy(InitE->getBeginLoc(), SourceLocation());
InitializationSequence Seq(*this, Entity, Kind, InitE);
return !Seq.Failed();
}
@@ -8997,11 +8980,10 @@ Sema::PerformCopyInitialization(const InitializedEntity &Entity,
assert(InitE && "No initialization expression?");
if (EqualLoc.isInvalid())
- EqualLoc = InitE->getLocStart();
+ EqualLoc = InitE->getBeginLoc();
- InitializationKind Kind = InitializationKind::CreateCopy(InitE->getLocStart(),
- EqualLoc,
- AllowExplicit);
+ InitializationKind Kind = InitializationKind::CreateCopy(
+ InitE->getBeginLoc(), EqualLoc, AllowExplicit);
InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList);
// Prevent infinite recursion when performing parameter copy-initialization.
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 440567e032e..dd979318d9c 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -479,7 +479,7 @@ void Sema::buildLambdaScope(LambdaScopeInfo *LSI,
if (!LSI->ReturnType->isDependentType() &&
!LSI->ReturnType->isVoidType()) {
- if (RequireCompleteType(CallOperator->getLocStart(), LSI->ReturnType,
+ if (RequireCompleteType(CallOperator->getBeginLoc(), LSI->ReturnType,
diag::err_lambda_incomplete_result)) {
// Do nothing.
}
@@ -720,10 +720,9 @@ void Sema::deduceClosureReturnType(CapturingScopeInfo &CSI) {
// FIXME: This is a poor diagnostic for ReturnStmts without expressions.
// TODO: It's possible that the *first* return is the divergent one.
- Diag(RS->getLocStart(),
+ Diag(RS->getBeginLoc(),
diag::err_typecheck_missing_return_type_incompatible)
- << ReturnType << CSI.ReturnType
- << isa<LambdaScopeInfo>(CSI);
+ << ReturnType << CSI.ReturnType << isa<LambdaScopeInfo>(CSI);
// Continue iterating so that we keep emitting diagnostics.
}
}
@@ -762,9 +761,9 @@ QualType Sema::buildLambdaInitCaptureInitialization(SourceLocation Loc,
InitializationKind Kind =
IsDirectInit
? (CXXDirectInit ? InitializationKind::CreateDirect(
- Loc, Init->getLocStart(), Init->getLocEnd())
+ Loc, Init->getBeginLoc(), Init->getLocEnd())
: InitializationKind::CreateDirectList(Loc))
- : InitializationKind::CreateCopy(Loc, Init->getLocStart());
+ : InitializationKind::CreateCopy(Loc, Init->getBeginLoc());
MultiExprArg Args = Init;
if (CXXDirectInit)
@@ -1286,16 +1285,13 @@ static void addFunctionPointerConversion(Sema &S,
for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
ParmVarDecl *From = CallOperator->getParamDecl(I);
- InvokerParams.push_back(ParmVarDecl::Create(S.Context,
- // Temporarily add to the TU. This is set to the invoker below.
- S.Context.getTranslationUnitDecl(),
- From->getLocStart(),
- From->getLocation(),
- From->getIdentifier(),
- From->getType(),
- From->getTypeSourceInfo(),
- From->getStorageClass(),
- /*DefaultArg=*/nullptr));
+ InvokerParams.push_back(ParmVarDecl::Create(
+ S.Context,
+ // Temporarily add to the TU. This is set to the invoker below.
+ S.Context.getTranslationUnitDecl(), From->getBeginLoc(),
+ From->getLocation(), From->getIdentifier(), From->getType(),
+ From->getTypeSourceInfo(), From->getStorageClass(),
+ /*DefaultArg=*/nullptr));
CallOpConvTL.setParam(I, From);
CallOpConvNameTL.setParam(I, From);
}
@@ -1747,14 +1743,11 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
SmallVector<ParmVarDecl *, 4> BlockParams;
for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
ParmVarDecl *From = CallOperator->getParamDecl(I);
- BlockParams.push_back(ParmVarDecl::Create(Context, Block,
- From->getLocStart(),
- From->getLocation(),
- From->getIdentifier(),
- From->getType(),
- From->getTypeSourceInfo(),
- From->getStorageClass(),
- /*DefaultArg=*/nullptr));
+ BlockParams.push_back(ParmVarDecl::Create(
+ Context, Block, From->getBeginLoc(), From->getLocation(),
+ From->getIdentifier(), From->getType(), From->getTypeSourceInfo(),
+ From->getStorageClass(),
+ /*DefaultArg=*/nullptr));
}
Block->setParams(BlockParams);
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 0ab70e9dca3..d0f133e0642 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -4628,7 +4628,7 @@ std::unique_ptr<TypoCorrectionConsumer> Sema::makeTypoCorrectionConsumer(
getLangOpts().ModulesSearchAll) {
// The following has the side effect of loading the missing module.
getModuleLoader().lookupMissingImports(Typo->getName(),
- TypoName.getLocStart());
+ TypoName.getBeginLoc());
}
CorrectionCandidateCallback &CCCRef = *CCC;
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 3e55cf003fc..87d85c1d808 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -614,7 +614,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object)
<< FixItHint::CreateInsertion(StarLoc, "*");
T = Context.getObjCObjectPointerType(T);
- SourceLocation TLoc = TInfo->getTypeLoc().getLocStart();
+ SourceLocation TLoc = TInfo->getTypeLoc().getBeginLoc();
TInfo = Context.getTrivialTypeSourceInfo(T, TLoc);
}
@@ -1061,7 +1061,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
PropertyIvarLoc = PropertyLoc;
SourceLocation PropertyDiagLoc = PropertyLoc;
if (PropertyDiagLoc.isInvalid())
- PropertyDiagLoc = ClassImpDecl->getLocStart();
+ PropertyDiagLoc = ClassImpDecl->getBeginLoc();
ObjCPropertyDecl *property = nullptr;
ObjCInterfaceDecl *IDecl = nullptr;
// Find the class or category class where this property must have
@@ -1497,8 +1497,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
Diag(PropertyDiagLoc,
diag::err_atomic_property_nontrivial_assign_op)
<< property->getType();
- Diag(FuncDecl->getLocStart(),
- diag::note_callee_decl) << FuncDecl;
+ Diag(FuncDecl->getBeginLoc(), diag::note_callee_decl)
+ << FuncDecl;
}
}
PIDecl->setSetterCXXAssignment(Res.getAs<Expr>());
@@ -2100,7 +2100,7 @@ void Sema::diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
!impDecl->getInstanceMethod(getterMethod->getSelector())) {
SourceLocation loc = propertyImpl->getLocation();
if (loc.isInvalid())
- loc = impDecl->getLocStart();
+ loc = impDecl->getBeginLoc();
Diag(loc, diag::warn_null_resettable_setter)
<< setterMethod->getSelector() << property->getDeclName();
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 0b1c3308208..34fb69c1524 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -1789,7 +1789,7 @@ public:
bool VisitDeclRefExpr(const DeclRefExpr *E) {
if (const auto *VD = dyn_cast<VarDecl>(E->getDecl())) {
if (VD->hasLocalStorage()) {
- SemaRef.Diag(E->getLocStart(),
+ SemaRef.Diag(E->getBeginLoc(),
diag::err_omp_local_var_in_threadprivate_init)
<< E->getSourceRange();
SemaRef.Diag(VD->getLocation(), diag::note_defined_here)
@@ -2569,7 +2569,7 @@ static OMPCapturedExprDecl *buildCaptureDecl(Sema &S, IdentifierInfo *Id,
WithInit = true;
}
auto *CED = OMPCapturedExprDecl::Create(C, S.CurContext, Id, Ty,
- CaptureExpr->getLocStart());
+ CaptureExpr->getBeginLoc());
if (!WithInit)
CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C));
S.CurContext->addHiddenDecl(CED);
@@ -2706,20 +2706,20 @@ StmtResult Sema::ActOnOpenMPRegionEnd(StmtResult S,
? SC->getFirstScheduleModifierLoc()
: SC->getSecondScheduleModifierLoc(),
diag::err_omp_schedule_nonmonotonic_ordered)
- << SourceRange(OC->getLocStart(), OC->getLocEnd());
+ << SourceRange(OC->getBeginLoc(), OC->getLocEnd());
ErrorFound = true;
}
if (!LCs.empty() && OC && OC->getNumForLoops()) {
for (const OMPLinearClause *C : LCs) {
- Diag(C->getLocStart(), diag::err_omp_linear_ordered)
- << SourceRange(OC->getLocStart(), OC->getLocEnd());
+ Diag(C->getBeginLoc(), diag::err_omp_linear_ordered)
+ << SourceRange(OC->getBeginLoc(), OC->getLocEnd());
}
ErrorFound = true;
}
if (isOpenMPWorksharingDirective(DSAStack->getCurrentDirective()) &&
isOpenMPSimdDirective(DSAStack->getCurrentDirective()) && OC &&
OC->getNumForLoops()) {
- Diag(OC->getLocStart(), diag::err_omp_ordered_simd)
+ Diag(OC->getBeginLoc(), diag::err_omp_ordered_simd)
<< getOpenMPDirectiveName(DSAStack->getCurrentDirective());
ErrorFound = true;
}
@@ -2998,7 +2998,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
// the directive.
OpenMPDirectiveKind CurNM = IC->getNameModifier();
if (FoundNameModifiers[CurNM]) {
- S.Diag(C->getLocStart(), diag::err_omp_more_one_clause)
+ S.Diag(C->getBeginLoc(), diag::err_omp_more_one_clause)
<< getOpenMPDirectiveName(Kind) << getOpenMPClauseName(OMPC_if)
<< (CurNM != OMPD_unknown) << getOpenMPDirectiveName(CurNM);
ErrorFound = true;
@@ -3032,7 +3032,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
// all if clauses on the directive must include a directive-name-modifier.
if (FoundNameModifiers[OMPD_unknown] && NamedModifiersNumber > 0) {
if (NamedModifiersNumber == AllowedNameModifiers.size()) {
- S.Diag(FoundNameModifiers[OMPD_unknown]->getLocStart(),
+ S.Diag(FoundNameModifiers[OMPD_unknown]->getBeginLoc(),
diag::err_omp_no_more_if_clause);
} else {
std::string Values;
@@ -3054,7 +3054,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
++AllowedCnt;
}
}
- S.Diag(FoundNameModifiers[OMPD_unknown]->getCondition()->getLocStart(),
+ S.Diag(FoundNameModifiers[OMPD_unknown]->getCondition()->getBeginLoc(),
diag::err_omp_unnamed_if_clause)
<< (TotalAllowedNum > 1) << Values;
}
@@ -3813,7 +3813,7 @@ bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) {
return true;
if (!NewStep->isValueDependent()) {
// Check that the step is integer expression.
- SourceLocation StepLoc = NewStep->getLocStart();
+ SourceLocation StepLoc = NewStep->getBeginLoc();
ExprResult Val = SemaRef.PerformOpenMPImplicitIntegerConversion(
StepLoc, getExprAsWritten(NewStep));
if (Val.isInvalid())
@@ -3906,7 +3906,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetInit(Stmt *S, bool EmitDiags) {
if (Var->hasInit() && !Var->getType()->isReferenceType()) {
// Accept non-canonical init form here but emit ext. warning.
if (Var->getInitStyle() != VarDecl::CInit && EmitDiags)
- SemaRef.Diag(S->getLocStart(),
+ SemaRef.Diag(S->getBeginLoc(),
diag::ext_omp_loop_not_canonical_init)
<< S->getSourceRange();
return setLCDeclAndLB(Var, nullptr, Var->getInit());
@@ -3933,7 +3933,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetInit(Stmt *S, bool EmitDiags) {
if (dependent() || SemaRef.CurContext->isDependentContext())
return false;
if (EmitDiags) {
- SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_init)
+ SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_init)
<< S->getSourceRange();
}
return true;
@@ -3973,7 +3973,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetCond(Expr *S) {
return true;
}
S = getExprAsWritten(S);
- SourceLocation CondLoc = S->getLocStart();
+ SourceLocation CondLoc = S->getBeginLoc();
if (auto *BO = dyn_cast<BinaryOperator>(S)) {
if (BO->isRelationalOp()) {
if (getInitLCDecl(BO->getLHS()) == LCDecl)
@@ -4042,7 +4042,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetIncRHS(Expr *RHS) {
}
if (dependent() || SemaRef.CurContext->isDependentContext())
return false;
- SemaRef.Diag(RHS->getLocStart(), diag::err_omp_loop_not_canonical_incr)
+ SemaRef.Diag(RHS->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
<< RHS->getSourceRange() << LCDecl;
return true;
}
@@ -4075,7 +4075,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetInc(Expr *S) {
if (UO->isIncrementDecrementOp() &&
getInitLCDecl(UO->getSubExpr()) == LCDecl)
return setStep(SemaRef
- .ActOnIntegerConstant(UO->getLocStart(),
+ .ActOnIntegerConstant(UO->getBeginLoc(),
(UO->isDecrementOp() ? -1 : 1))
.get(),
/*Subtract=*/false);
@@ -4100,7 +4100,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetInc(Expr *S) {
if (getInitLCDecl(CE->getArg(0)) == LCDecl)
return setStep(SemaRef
.ActOnIntegerConstant(
- CE->getLocStart(),
+ CE->getBeginLoc(),
((CE->getOperator() == OO_MinusMinus) ? -1 : 1))
.get(),
/*Subtract=*/false);
@@ -4120,7 +4120,7 @@ bool OpenMPIterationSpaceChecker::checkAndSetInc(Expr *S) {
}
if (dependent() || SemaRef.CurContext->isDependentContext())
return false;
- SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_incr)
+ SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_incr)
<< S->getSourceRange() << LCDecl;
return true;
}
@@ -4164,7 +4164,7 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations(
if (!Diff.isUsable() && VarType->getAsCXXRecordDecl()) {
// BuildBinOp already emitted error, this one is to point user to upper
// and lower bound, and to tell what is passed to 'operator-'.
- SemaRef.Diag(Upper->getLocStart(), diag::err_omp_loop_diff_cxx)
+ SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx)
<< Upper->getSourceRange() << Lower->getSourceRange();
return nullptr;
}
@@ -4378,7 +4378,7 @@ static bool checkOpenMPIterationSpace(
// for (init-expr; test-expr; incr-expr) structured-block
auto *For = dyn_cast_or_null<ForStmt>(S);
if (!For) {
- SemaRef.Diag(S->getLocStart(), diag::err_omp_not_for)
+ SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for)
<< (CollapseLoopCountExpr != nullptr || OrderedLoopCountExpr != nullptr)
<< getOpenMPDirectiveName(DKind) << NestedLoopCount
<< (CurrentNestedLoopCount > 0) << CurrentNestedLoopCount;
@@ -4423,7 +4423,7 @@ static bool checkOpenMPIterationSpace(
if (!VarType->isDependentType() && !VarType->isIntegerType() &&
!VarType->isPointerType() &&
!(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) {
- SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_variable_type)
+ SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_variable_type)
<< SemaRef.getLangOpts().CPlusPlus;
HasErrors = true;
}
@@ -4461,7 +4461,7 @@ static bool checkOpenMPIterationSpace(
!isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) &&
(DVar.CKind != OMPC_private || DVar.RefExpr != nullptr)) {
- SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
+ SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_var_dsa)
<< getOpenMPClauseName(DVar.CKind) << getOpenMPDirectiveName(DKind)
<< getOpenMPClauseName(PredeterminedCKind);
if (DVar.RefExpr == nullptr)
@@ -5001,7 +5001,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
}
// Loop condition (IV < NumIterations) or (IV <= UB) for worksharing loops.
- SourceLocation CondLoc = AStmt->getLocStart();
+ SourceLocation CondLoc = AStmt->getBeginLoc();
ExprResult Cond =
(isOpenMPWorksharingDirective(DKind) ||
isOpenMPTaskLoopDirective(DKind) || isOpenMPDistributeDirective(DKind))
@@ -5014,7 +5014,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), CombUB.get());
}
// Loop increment (IV = IV + 1)
- SourceLocation IncLoc = AStmt->getLocStart();
+ SourceLocation IncLoc = AStmt->getBeginLoc();
ExprResult Inc =
SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
SemaRef.ActOnIntegerConstant(IncLoc, 1).get());
@@ -5081,7 +5081,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
// directive with for as IV = IV + ST; ensure upper bound expression based
// on PrevUB instead of NumIterations - used to implement 'for' when found
// in combination with 'distribute', like in 'distribute parallel for'
- SourceLocation DistIncLoc = AStmt->getLocStart();
+ SourceLocation DistIncLoc = AStmt->getBeginLoc();
ExprResult DistCond, DistInc, PrevEUB;
if (isOpenMPLoopBoundSharingDirective(DKind)) {
DistCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get());
@@ -5097,7 +5097,7 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
// Build expression: UB = min(UB, prevUB) for #for in composite or combined
// construct
- SourceLocation DistEUBLoc = AStmt->getLocStart();
+ SourceLocation DistEUBLoc = AStmt->getBeginLoc();
ExprResult IsUBGreater =
SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT, UB.get(), PrevUB.get());
ExprResult CondOp = SemaRef.ActOnConditionalOp(
@@ -5475,7 +5475,7 @@ StmtResult Sema::ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) {
if (!SectionStmt || !isa<OMPSectionDirective>(SectionStmt)) {
if (SectionStmt)
- Diag(SectionStmt->getLocStart(),
+ Diag(SectionStmt->getBeginLoc(),
diag::err_omp_sections_substmt_not_section);
return StmtError();
}
@@ -5483,7 +5483,7 @@ StmtResult Sema::ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
->setHasCancel(DSAStack->isCancelRegion());
}
} else {
- Diag(AStmt->getLocStart(), diag::err_omp_sections_not_compound_stmt);
+ Diag(AStmt->getBeginLoc(), diag::err_omp_sections_not_compound_stmt);
return StmtError();
}
@@ -5529,9 +5529,9 @@ StmtResult Sema::ActOnOpenMPSingleDirective(ArrayRef<OMPClause *> Clauses,
else if (Clause->getClauseKind() == OMPC_copyprivate)
Copyprivate = Clause;
if (Copyprivate && Nowait) {
- Diag(Copyprivate->getLocStart(),
+ Diag(Copyprivate->getBeginLoc(),
diag::err_omp_single_copyprivate_with_nowait);
- Diag(Nowait->getLocStart(), diag::note_omp_nowait_clause_here);
+ Diag(Nowait->getBeginLoc(), diag::note_omp_nowait_clause_here);
return StmtError();
}
}
@@ -5567,7 +5567,7 @@ StmtResult Sema::ActOnOpenMPCriticalDirective(
for (const OMPClause *C : Clauses) {
if (C->getClauseKind() == OMPC_hint) {
if (!DirName.getName()) {
- Diag(C->getLocStart(), diag::err_omp_hint_clause_no_name);
+ Diag(C->getBeginLoc(), diag::err_omp_hint_clause_no_name);
ErrorFound = true;
}
Expr *E = cast<OMPHintClause>(C)->getHint();
@@ -5576,7 +5576,7 @@ StmtResult Sema::ActOnOpenMPCriticalDirective(
DependentHint = true;
} else {
Hint = E->EvaluateKnownConstInt(Context);
- HintLoc = C->getLocStart();
+ HintLoc = C->getBeginLoc();
}
}
}
@@ -5592,12 +5592,12 @@ StmtResult Sema::ActOnOpenMPCriticalDirective(
else
Diag(StartLoc, diag::note_omp_critical_no_hint) << 0;
if (const auto *C = Pair.first->getSingleClause<OMPHintClause>()) {
- Diag(C->getLocStart(), diag::note_omp_critical_hint_here)
+ Diag(C->getBeginLoc(), diag::note_omp_critical_hint_here)
<< 1
<< C->getHint()->EvaluateKnownConstInt(Context).toString(
/*Radix=*/10, /*Signed=*/false);
} else {
- Diag(Pair.first->getLocStart(), diag::note_omp_critical_no_hint) << 1;
+ Diag(Pair.first->getBeginLoc(), diag::note_omp_critical_no_hint) << 1;
}
}
}
@@ -5718,7 +5718,7 @@ Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) {
if (!SectionStmt || !isa<OMPSectionDirective>(SectionStmt)) {
if (SectionStmt)
- Diag(SectionStmt->getLocStart(),
+ Diag(SectionStmt->getBeginLoc(),
diag::err_omp_parallel_sections_substmt_not_section);
return StmtError();
}
@@ -5726,7 +5726,7 @@ Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
->setHasCancel(DSAStack->isCancelRegion());
}
} else {
- Diag(AStmt->getLocStart(),
+ Diag(AStmt->getBeginLoc(),
diag::err_omp_parallel_sections_not_compound_stmt);
return StmtError();
}
@@ -5810,7 +5810,7 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
DependFound = C;
if (DC->getDependencyKind() == OMPC_DEPEND_source) {
if (DependSourceClause) {
- Diag(C->getLocStart(), diag::err_omp_more_one_clause)
+ Diag(C->getBeginLoc(), diag::err_omp_more_one_clause)
<< getOpenMPDirectiveName(OMPD_ordered)
<< getOpenMPClauseName(OMPC_depend) << 2;
ErrorFound = true;
@@ -5818,13 +5818,13 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
DependSourceClause = C;
}
if (DependSinkClause) {
- Diag(C->getLocStart(), diag::err_omp_depend_sink_source_not_allowed)
+ Diag(C->getBeginLoc(), diag::err_omp_depend_sink_source_not_allowed)
<< 0;
ErrorFound = true;
}
} else if (DC->getDependencyKind() == OMPC_DEPEND_sink) {
if (DependSourceClause) {
- Diag(C->getLocStart(), diag::err_omp_depend_sink_source_not_allowed)
+ Diag(C->getBeginLoc(), diag::err_omp_depend_sink_source_not_allowed)
<< 1;
ErrorFound = true;
}
@@ -5844,19 +5844,19 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
Diag(StartLoc, diag::err_omp_prohibited_region_simd);
ErrorFound = true;
} else if (DependFound && (TC || SC)) {
- Diag(DependFound->getLocStart(), diag::err_omp_depend_clause_thread_simd)
+ Diag(DependFound->getBeginLoc(), diag::err_omp_depend_clause_thread_simd)
<< getOpenMPClauseName(TC ? TC->getClauseKind() : SC->getClauseKind());
ErrorFound = true;
} else if (DependFound && !DSAStack->getParentOrderedRegionParam()) {
- Diag(DependFound->getLocStart(),
+ Diag(DependFound->getBeginLoc(),
diag::err_omp_ordered_directive_without_param);
ErrorFound = true;
} else if (TC || Clauses.empty()) {
if (const Expr *Param = DSAStack->getParentOrderedRegionParam()) {
- SourceLocation ErrLoc = TC ? TC->getLocStart() : StartLoc;
+ SourceLocation ErrLoc = TC ? TC->getBeginLoc() : StartLoc;
Diag(ErrLoc, diag::err_omp_ordered_directive_with_param)
<< (TC != nullptr);
- Diag(Param->getLocStart(), diag::note_omp_ordered_param);
+ Diag(Param->getBeginLoc(), diag::note_omp_ordered_param);
ErrorFound = true;
}
}
@@ -6077,12 +6077,12 @@ bool OpenMPAtomicUpdateChecker::checkStatement(Stmt *S, unsigned DiagId,
}
} else {
ErrorFound = NotAScalarType;
- NoteLoc = ErrorLoc = AtomicBody->getLocStart();
+ NoteLoc = ErrorLoc = AtomicBody->getBeginLoc();
NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc);
}
} else {
ErrorFound = NotAnExpression;
- NoteLoc = ErrorLoc = S->getLocStart();
+ NoteLoc = ErrorLoc = S->getBeginLoc();
NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc);
}
if (ErrorFound != NoError && DiagId != 0 && NoteId != 0) {
@@ -6134,13 +6134,13 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
C->getClauseKind() == OMPC_update ||
C->getClauseKind() == OMPC_capture) {
if (AtomicKind != OMPC_unknown) {
- Diag(C->getLocStart(), diag::err_omp_atomic_several_clauses)
- << SourceRange(C->getLocStart(), C->getLocEnd());
+ Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses)
+ << SourceRange(C->getBeginLoc(), C->getLocEnd());
Diag(AtomicKindLoc, diag::note_omp_atomic_previous_clause)
<< getOpenMPClauseName(AtomicKind);
} else {
AtomicKind = C->getClauseKind();
- AtomicKindLoc = C->getLocStart();
+ AtomicKindLoc = C->getBeginLoc();
}
}
}
@@ -6228,7 +6228,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
}
} else {
ErrorFound = NotAnExpression;
- NoteLoc = ErrorLoc = Body->getLocStart();
+ NoteLoc = ErrorLoc = Body->getBeginLoc();
NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc);
}
if (ErrorFound != NoError) {
@@ -6290,7 +6290,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
}
} else {
ErrorFound = NotAnExpression;
- NoteLoc = ErrorLoc = Body->getLocStart();
+ NoteLoc = ErrorLoc = Body->getBeginLoc();
NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc);
}
if (ErrorFound != NoError) {
@@ -6474,7 +6474,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
if (!FirstBinOp || FirstBinOp->getOpcode() != BO_Assign) {
ErrorFound = NotAnAssignmentOp;
NoteLoc = ErrorLoc = FirstBinOp ? FirstBinOp->getOperatorLoc()
- : First->getLocStart();
+ : First->getBeginLoc();
NoteRange = ErrorRange = FirstBinOp
? FirstBinOp->getSourceRange()
: SourceRange(ErrorLoc, ErrorLoc);
@@ -6484,7 +6484,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
ErrorFound = NotAnAssignmentOp;
NoteLoc = ErrorLoc = SecondBinOp
? SecondBinOp->getOperatorLoc()
- : Second->getLocStart();
+ : Second->getBeginLoc();
NoteRange = ErrorRange =
SecondBinOp ? SecondBinOp->getSourceRange()
: SourceRange(ErrorLoc, ErrorLoc);
@@ -6518,15 +6518,15 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
}
}
} else {
- NoteLoc = ErrorLoc = Body->getLocStart();
+ NoteLoc = ErrorLoc = Body->getBeginLoc();
NoteRange = ErrorRange =
- SourceRange(Body->getLocStart(), Body->getLocStart());
+ SourceRange(Body->getBeginLoc(), Body->getBeginLoc());
ErrorFound = NotTwoSubstatements;
}
} else {
- NoteLoc = ErrorLoc = Body->getLocStart();
+ NoteLoc = ErrorLoc = Body->getBeginLoc();
NoteRange = ErrorRange =
- SourceRange(Body->getLocStart(), Body->getLocStart());
+ SourceRange(Body->getBeginLoc(), Body->getBeginLoc());
ErrorFound = NotACompoundStatement;
}
if (ErrorFound != NoError) {
@@ -6599,7 +6599,7 @@ StmtResult Sema::ActOnOpenMPTargetDirective(ArrayRef<OMPClause *> Clauses,
Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
Diag(DSAStack->getInnerTeamsRegionLoc(),
diag::note_omp_nested_teams_construct_here);
- Diag(S->getLocStart(), diag::note_omp_nested_statement_here)
+ Diag(S->getBeginLoc(), diag::note_omp_nested_statement_here)
<< isa<OMPExecutableDirective>(S);
return StmtError();
}
@@ -6903,11 +6903,11 @@ static bool checkGrainsizeNumTasksClauses(Sema &S,
if (!PrevClause)
PrevClause = C;
else if (PrevClause->getClauseKind() != C->getClauseKind()) {
- S.Diag(C->getLocStart(),
+ S.Diag(C->getBeginLoc(),
diag::err_omp_grainsize_num_tasks_mutually_exclusive)
<< getOpenMPClauseName(C->getClauseKind())
<< getOpenMPClauseName(PrevClause->getClauseKind());
- S.Diag(PrevClause->getLocStart(),
+ S.Diag(PrevClause->getBeginLoc(),
diag::note_omp_previous_grainsize_num_tasks)
<< getOpenMPClauseName(PrevClause->getClauseKind());
ErrorFound = true;
@@ -6936,8 +6936,8 @@ static bool checkReductionClauseWithNogroup(Sema &S,
}
}
if (ReductionClause && NogroupClause) {
- S.Diag(ReductionClause->getLocStart(), diag::err_omp_reduction_with_nogroup)
- << SourceRange(NogroupClause->getLocStart(),
+ S.Diag(ReductionClause->getBeginLoc(), diag::err_omp_reduction_with_nogroup)
+ << SourceRange(NogroupClause->getBeginLoc(),
NogroupClause->getLocEnd());
return true;
}
@@ -8932,7 +8932,7 @@ OMPClause *Sema::ActOnOpenMPScheduleClause(
if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() &&
!ChunkSize->isInstantiationDependent() &&
!ChunkSize->containsUnexpandedParameterPack()) {
- SourceLocation ChunkSizeLoc = ChunkSize->getLocStart();
+ SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc();
ExprResult Val =
PerformOpenMPImplicitIntegerConversion(ChunkSizeLoc, ChunkSize);
if (Val.isInvalid())
@@ -10439,7 +10439,7 @@ static bool actOnOMPReductionKindClause(
}
if (BOK == BO_Comma && DeclareReductionRef.isUnset()) {
// Not allowed reduction identifier is found.
- S.Diag(ReductionId.getLocStart(),
+ S.Diag(ReductionId.getBeginLoc(),
diag::err_omp_unknown_reduction_identifier)
<< Type << ReductionIdRange;
continue;
@@ -10696,18 +10696,18 @@ static bool actOnOMPReductionKindClause(
CallExpr(Context, OVE, Args, Context.VoidTy, VK_RValue, ELoc);
} else {
ReductionOp = S.BuildBinOp(
- Stack->getCurScope(), ReductionId.getLocStart(), BOK, LHSDRE, RHSDRE);
+ Stack->getCurScope(), ReductionId.getBeginLoc(), BOK, LHSDRE, RHSDRE);
if (ReductionOp.isUsable()) {
if (BOK != BO_LT && BOK != BO_GT) {
ReductionOp =
- S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(),
+ S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(),
BO_Assign, LHSDRE, ReductionOp.get());
} else {
auto *ConditionalOp = new (Context)
ConditionalOperator(ReductionOp.get(), ELoc, LHSDRE, ELoc, RHSDRE,
Type, VK_LValue, OK_Ordinary);
ReductionOp =
- S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(),
+ S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(),
BO_Assign, LHSDRE, ConditionalOp);
}
if (ReductionOp.isUsable())
@@ -10753,7 +10753,7 @@ static bool actOnOMPReductionKindClause(
EmitError = RedId != ParentRedId;
}
if (EmitError) {
- S.Diag(ReductionId.getLocStart(),
+ S.Diag(ReductionId.getBeginLoc(),
diag::err_omp_reduction_identifier_mismatch)
<< ReductionIdRange << RefExpr->getSourceRange();
S.Diag(ParentSR.getBegin(),
@@ -11037,7 +11037,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause(
if (Step && !Step->isValueDependent() && !Step->isTypeDependent() &&
!Step->isInstantiationDependent() &&
!Step->containsUnexpandedParameterPack()) {
- SourceLocation StepLoc = Step->getLocStart();
+ SourceLocation StepLoc = Step->getBeginLoc();
ExprResult Val = PerformOpenMPImplicitIntegerConversion(StepLoc, Step);
if (Val.isInvalid())
return nullptr;
@@ -11138,7 +11138,7 @@ static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV,
InitExpr, IV, Step, /* Subtract */ false);
else
Update = *CurPrivate;
- Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getLocStart(),
+ Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(),
/*DiscardedValue=*/true);
// Build final: Var = InitExpr + NumIterations * Step
@@ -11149,7 +11149,7 @@ static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV,
InitExpr, NumIterations, Step, /*Subtract=*/false);
else
Final = *CurPrivate;
- Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getLocStart(),
+ Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(),
/*DiscardedValue=*/true);
if (!Update.isUsable() || !Final.isUsable()) {
@@ -11302,12 +11302,12 @@ OMPClause *Sema::ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
// operator for the class type.
QualType ElemType = Context.getBaseElementType(Type).getNonReferenceType();
VarDecl *SrcVD =
- buildVarDecl(*this, DE->getLocStart(), ElemType.getUnqualifiedType(),
+ buildVarDecl(*this, DE->getBeginLoc(), ElemType.getUnqualifiedType(),
".copyin.src", VD->hasAttrs() ? &VD->getAttrs() : nullptr);
DeclRefExpr *PseudoSrcExpr = buildDeclRefExpr(
*this, SrcVD, ElemType.getUnqualifiedType(), DE->getExprLoc());
VarDecl *DstVD =
- buildVarDecl(*this, DE->getLocStart(), ElemType, ".copyin.dst",
+ buildVarDecl(*this, DE->getBeginLoc(), ElemType, ".copyin.dst",
VD->hasAttrs() ? &VD->getAttrs() : nullptr);
DeclRefExpr *PseudoDstExpr =
buildDeclRefExpr(*this, DstVD, ElemType, DE->getExprLoc());
@@ -11417,11 +11417,11 @@ OMPClause *Sema::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
Type = Context.getBaseElementType(Type.getNonReferenceType())
.getUnqualifiedType();
VarDecl *SrcVD =
- buildVarDecl(*this, RefExpr->getLocStart(), Type, ".copyprivate.src",
+ buildVarDecl(*this, RefExpr->getBeginLoc(), Type, ".copyprivate.src",
D->hasAttrs() ? &D->getAttrs() : nullptr);
DeclRefExpr *PseudoSrcExpr = buildDeclRefExpr(*this, SrcVD, Type, ELoc);
VarDecl *DstVD =
- buildVarDecl(*this, RefExpr->getLocStart(), Type, ".copyprivate.dst",
+ buildVarDecl(*this, RefExpr->getBeginLoc(), Type, ".copyprivate.dst",
D->hasAttrs() ? &D->getAttrs() : nullptr);
DeclRefExpr *PseudoDstExpr = buildDeclRefExpr(*this, DstVD, Type, ELoc);
ExprResult AssignmentOp = BuildBinOp(
@@ -12794,7 +12794,7 @@ OMPClause *Sema::ActOnOpenMPDistScheduleClause(
if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() &&
!ChunkSize->isInstantiationDependent() &&
!ChunkSize->containsUnexpandedParameterPack()) {
- SourceLocation ChunkSizeLoc = ChunkSize->getLocStart();
+ SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc();
ExprResult Val =
PerformOpenMPImplicitIntegerConversion(ChunkSizeLoc, ChunkSize);
if (Val.isInvalid())
@@ -13021,7 +13021,7 @@ void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
if (!D || D->isInvalidDecl())
return;
SourceRange SR = E ? E->getSourceRange() : D->getSourceRange();
- SourceLocation SL = E ? E->getLocStart() : D->getLocation();
+ SourceLocation SL = E ? E->getBeginLoc() : D->getLocation();
if (auto *VD = dyn_cast<VarDecl>(D)) {
// Only global variables can be marked as declare target.
if (VD->isLocalVarDeclOrParm())
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 6b0837849b9..aad77da2ed0 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -1263,7 +1263,7 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
= S.Context.getCanonicalType(ToType).getUnqualifiedType();
if (Constructor->isCopyConstructor() &&
(FromCanon == ToCanon ||
- S.IsDerivedFrom(From->getLocStart(), FromCanon, ToCanon))) {
+ S.IsDerivedFrom(From->getBeginLoc(), FromCanon, ToCanon))) {
// Turn this into a "standard" conversion sequence, so that it
// gets ranked with standard conversion sequences.
DeclAccessPair Found = ICS.UserDefined.FoundConversionFunction;
@@ -1355,7 +1355,7 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
QualType FromType = From->getType();
if (ToType->getAs<RecordType>() && FromType->getAs<RecordType>() &&
(S.Context.hasSameUnqualifiedType(FromType, ToType) ||
- S.IsDerivedFrom(From->getLocStart(), FromType, ToType))) {
+ S.IsDerivedFrom(From->getBeginLoc(), FromType, ToType))) {
ICS.setStandard();
ICS.Standard.setAsIdentityConversion();
ICS.Standard.setFromType(FromType);
@@ -1418,8 +1418,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
= getLangOpts().ObjCAutoRefCount &&
(Action == AA_Passing || Action == AA_Sending);
if (getLangOpts().ObjC1)
- CheckObjCBridgeRelatedConversions(From->getLocStart(),
- ToType, From->getType(), From);
+ CheckObjCBridgeRelatedConversions(From->getBeginLoc(), ToType,
+ From->getType(), From);
ICS = ::TryImplicitConversion(*this, From, ToType,
/*SuppressUserConversions=*/false,
AllowExplicit,
@@ -2011,7 +2011,7 @@ bool Sema::IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType) {
// We have already pre-calculated the promotion type, so this is trivial.
if (ToType->isIntegerType() &&
- isCompleteType(From->getLocStart(), FromType))
+ isCompleteType(From->getBeginLoc(), FromType))
return Context.hasSameUnqualifiedType(
ToType, FromEnumType->getDecl()->getPromotionType());
@@ -2353,10 +2353,10 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
//
// Note that we do not check for ambiguity or inaccessibility
// here. That is handled by CheckPointerConversion.
- if (getLangOpts().CPlusPlus &&
- FromPointeeType->isRecordType() && ToPointeeType->isRecordType() &&
+ if (getLangOpts().CPlusPlus && FromPointeeType->isRecordType() &&
+ ToPointeeType->isRecordType() &&
!Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) &&
- IsDerivedFrom(From->getLocStart(), FromPointeeType, ToPointeeType)) {
+ IsDerivedFrom(From->getBeginLoc(), FromPointeeType, ToPointeeType)) {
ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr,
ToPointeeType,
ToType, Context);
@@ -2983,7 +2983,7 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
QualType ToClass(ToTypePtr->getClass(), 0);
if (!Context.hasSameUnqualifiedType(FromClass, ToClass) &&
- IsDerivedFrom(From->getLocStart(), ToClass, FromClass)) {
+ IsDerivedFrom(From->getBeginLoc(), ToClass, FromClass)) {
ConvertedType = Context.getMemberPointerType(FromTypePtr->getPointeeType(),
ToClass.getTypePtr());
return true;
@@ -3027,7 +3027,7 @@ bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true,
/*DetectVirtual=*/true);
bool DerivationOkay =
- IsDerivedFrom(From->getLocStart(), ToClass, FromClass, Paths);
+ IsDerivedFrom(From->getBeginLoc(), ToClass, FromClass, Paths);
assert(DerivationOkay &&
"Should not have been called if derivation isn't OK.");
(void)DerivationOkay;
@@ -3242,8 +3242,7 @@ IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType,
OverloadCandidateSet::iterator Best;
switch (auto Result =
- CandidateSet.BestViableFunction(S, From->getLocStart(),
- Best)) {
+ CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) {
case OR_Deleted:
case OR_Success: {
// Record the standard conversion we used and the conversion function.
@@ -3308,7 +3307,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
// the parentheses of the initializer.
if (S.Context.hasSameUnqualifiedType(ToType, From->getType()) ||
(From->getType()->getAs<RecordType>() &&
- S.IsDerivedFrom(From->getLocStart(), From->getType(), ToType)))
+ S.IsDerivedFrom(From->getBeginLoc(), From->getType(), ToType)))
ConstructorsOnly = true;
if (!S.isCompleteType(From->getExprLoc(), ToType)) {
@@ -3376,10 +3375,10 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
// Enumerate conversion functions, if we're allowed to.
if (ConstructorsOnly || isa<InitListExpr>(From)) {
- } else if (!S.isCompleteType(From->getLocStart(), From->getType())) {
+ } else if (!S.isCompleteType(From->getBeginLoc(), From->getType())) {
// No conversion functions from incomplete types.
- } else if (const RecordType *FromRecordType
- = From->getType()->getAs<RecordType>()) {
+ } else if (const RecordType *FromRecordType =
+ From->getType()->getAs<RecordType>()) {
if (CXXRecordDecl *FromRecordDecl
= dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
// Add all of the conversion functions as candidates.
@@ -3416,8 +3415,8 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
bool HadMultipleCandidates = (CandidateSet.size() > 1);
OverloadCandidateSet::iterator Best;
- switch (auto Result = CandidateSet.BestViableFunction(S, From->getLocStart(),
- Best)) {
+ switch (auto Result =
+ CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) {
case OR_Success:
case OR_Deleted:
// Record the standard conversion we used and the conversion function.
@@ -3496,13 +3495,13 @@ Sema::DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType) {
IsUserDefinedConversion(*this, From, ToType, ICS.UserDefined,
CandidateSet, false, false);
if (OvResult == OR_Ambiguous)
- Diag(From->getLocStart(), diag::err_typecheck_ambiguous_condition)
+ Diag(From->getBeginLoc(), diag::err_typecheck_ambiguous_condition)
<< From->getType() << ToType << From->getSourceRange();
else if (OvResult == OR_No_Viable_Function && !CandidateSet.empty()) {
- if (!RequireCompleteType(From->getLocStart(), ToType,
+ if (!RequireCompleteType(From->getBeginLoc(), ToType,
diag::err_typecheck_nonviable_condition_incomplete,
From->getType(), From->getSourceRange()))
- Diag(From->getLocStart(), diag::err_typecheck_nonviable_condition)
+ Diag(From->getBeginLoc(), diag::err_typecheck_nonviable_condition)
<< false << From->getType() << From->getSourceRange() << ToType;
} else
return false;
@@ -4750,7 +4749,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
// We need a complete type for what follows. Incomplete types can never be
// initialized from init lists.
- if (!S.isCompleteType(From->getLocStart(), ToType))
+ if (!S.isCompleteType(From->getBeginLoc(), ToType))
return Result;
// Per DR1467:
@@ -4767,7 +4766,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
if (ToType->isRecordType()) {
QualType InitType = From->getInit(0)->getType();
if (S.Context.hasSameUnqualifiedType(InitType, ToType) ||
- S.IsDerivedFrom(From->getLocStart(), InitType, ToType))
+ S.IsDerivedFrom(From->getBeginLoc(), InitType, ToType))
return TryCopyInitialization(S, From->getInit(0), ToType,
SuppressUserConversions,
InOverloadResolution,
@@ -4823,10 +4822,9 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
break;
}
// Otherwise, look for the worst conversion.
- if (Result.isBad() ||
- CompareImplicitConversionSequences(S, From->getLocStart(), ICS,
- Result) ==
- ImplicitConversionSequence::Worse)
+ if (Result.isBad() || CompareImplicitConversionSequences(
+ S, From->getBeginLoc(), ICS, Result) ==
+ ImplicitConversionSequence::Worse)
Result = ICS;
}
@@ -4920,12 +4918,12 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
bool dummy1 = false;
bool dummy2 = false;
bool dummy3 = false;
- Sema::ReferenceCompareResult RefRelationship
- = S.CompareReferenceRelationship(From->getLocStart(), T1, T2, dummy1,
+ Sema::ReferenceCompareResult RefRelationship =
+ S.CompareReferenceRelationship(From->getBeginLoc(), T1, T2, dummy1,
dummy2, dummy3);
if (RefRelationship >= Sema::Ref_Related) {
- return TryReferenceInit(S, Init, ToType, /*FIXME*/From->getLocStart(),
+ return TryReferenceInit(S, Init, ToType, /*FIXME*/ From->getBeginLoc(),
SuppressUserConversions,
/*AllowExplicit=*/false);
}
@@ -5006,9 +5004,8 @@ TryCopyInitialization(Sema &S, Expr *From, QualType ToType,
if (ToType->isReferenceType())
return TryReferenceInit(S, From, ToType,
- /*FIXME:*/From->getLocStart(),
- SuppressUserConversions,
- AllowExplicit);
+ /*FIXME:*/ From->getBeginLoc(),
+ SuppressUserConversions, AllowExplicit);
return TryImplicitConversion(S, From, ToType,
SuppressUserConversions,
@@ -5177,7 +5174,7 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
// Note that we always use the true parent context when performing
// the actual argument initialization.
ImplicitConversionSequence ICS = TryObjectArgumentInitialization(
- *this, From->getLocStart(), From->getType(), FromClassification, Method,
+ *this, From->getBeginLoc(), From->getType(), FromClassification, Method,
Method->getParent());
if (ICS.isBad()) {
switch (ICS.Bad.Kind) {
@@ -5186,10 +5183,9 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
Qualifiers ToQs = DestType.getQualifiers();
unsigned CVR = FromQs.getCVRQualifiers() & ~ToQs.getCVRQualifiers();
if (CVR) {
- Diag(From->getLocStart(),
- diag::err_member_function_call_bad_cvr)
- << Method->getDeclName() << FromRecordType << (CVR - 1)
- << From->getSourceRange();
+ Diag(From->getBeginLoc(), diag::err_member_function_call_bad_cvr)
+ << Method->getDeclName() << FromRecordType << (CVR - 1)
+ << From->getSourceRange();
Diag(Method->getLocation(), diag::note_previous_decl)
<< Method->getDeclName();
return ExprError();
@@ -5201,9 +5197,9 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
case BadConversionSequence::rvalue_ref_to_lvalue: {
bool IsRValueQualified =
Method->getRefQualifier() == RefQualifierKind::RQ_RValue;
- Diag(From->getLocStart(), diag::err_member_function_call_bad_ref)
- << Method->getDeclName() << FromClassification.isRValue()
- << IsRValueQualified;
+ Diag(From->getBeginLoc(), diag::err_member_function_call_bad_ref)
+ << Method->getDeclName() << FromClassification.isRValue()
+ << IsRValueQualified;
Diag(Method->getLocation(), diag::note_previous_decl)
<< Method->getDeclName();
return ExprError();
@@ -5214,9 +5210,9 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
break;
}
- return Diag(From->getLocStart(),
- diag::err_member_function_call_bad_type)
- << ImplicitParamRecordType << FromRecordType << From->getSourceRange();
+ return Diag(From->getBeginLoc(), diag::err_member_function_call_bad_type)
+ << ImplicitParamRecordType << FromRecordType
+ << From->getSourceRange();
}
if (ICS.Standard.Second == ICK_Derived_To_Base) {
@@ -5257,9 +5253,8 @@ ExprResult Sema::PerformContextuallyConvertToBool(Expr *From) {
return PerformImplicitConversion(From, Context.BoolTy, ICS, AA_Converting);
if (!DiagnoseMultipleUserDefinedConversion(From, Context.BoolTy))
- return Diag(From->getLocStart(),
- diag::err_typecheck_bool_condition)
- << From->getType() << From->getSourceRange();
+ return Diag(From->getBeginLoc(), diag::err_typecheck_bool_condition)
+ << From->getType() << From->getSourceRange();
return ExprError();
}
@@ -5372,9 +5367,9 @@ static ExprResult CheckConvertedConstantExpression(Sema &S, Expr *From,
case ImplicitConversionSequence::AmbiguousConversion:
case ImplicitConversionSequence::BadConversion:
if (!S.DiagnoseMultipleUserDefinedConversion(From, T))
- return S.Diag(From->getLocStart(),
+ return S.Diag(From->getBeginLoc(),
diag::err_typecheck_converted_constant_expression)
- << From->getType() << From->getSourceRange() << T;
+ << From->getType() << From->getSourceRange() << T;
return ExprError();
case ImplicitConversionSequence::EllipsisConversion:
@@ -5383,15 +5378,15 @@ static ExprResult CheckConvertedConstantExpression(Sema &S, Expr *From,
// Check that we would only use permitted conversions.
if (!CheckConvertedConstantConversions(S, *SCS)) {
- return S.Diag(From->getLocStart(),
+ return S.Diag(From->getBeginLoc(),
diag::err_typecheck_converted_constant_expression_disallowed)
- << From->getType() << From->getSourceRange() << T;
+ << From->getType() << From->getSourceRange() << T;
}
// [...] and where the reference binding (if any) binds directly.
if (SCS->ReferenceBinding && !SCS->DirectBinding) {
- return S.Diag(From->getLocStart(),
+ return S.Diag(From->getBeginLoc(),
diag::err_typecheck_converted_constant_expression_indirect)
- << From->getType() << From->getSourceRange() << T;
+ << From->getType() << From->getSourceRange() << T;
}
ExprResult Result =
@@ -5414,14 +5409,14 @@ static ExprResult CheckConvertedConstantExpression(Sema &S, Expr *From,
break;
case NK_Constant_Narrowing:
- S.Diag(From->getLocStart(), diag::ext_cce_narrowing)
- << CCE << /*Constant*/1
- << PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << T;
+ S.Diag(From->getBeginLoc(), diag::ext_cce_narrowing)
+ << CCE << /*Constant*/ 1
+ << PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << T;
break;
case NK_Type_Narrowing:
- S.Diag(From->getLocStart(), diag::ext_cce_narrowing)
- << CCE << /*Constant*/0 << From->getType() << T;
+ S.Diag(From->getBeginLoc(), diag::ext_cce_narrowing)
+ << CCE << /*Constant*/ 0 << From->getType() << T;
break;
}
@@ -5457,8 +5452,8 @@ static ExprResult CheckConvertedConstantExpression(Sema &S, Expr *From,
Notes[0].second.getDiagID() == diag::note_invalid_subexpr_in_const_expr)
S.Diag(Notes[0].first, diag::err_expr_not_cce) << CCE;
else {
- S.Diag(From->getLocStart(), diag::err_expr_not_cce)
- << CCE << From->getSourceRange();
+ S.Diag(From->getBeginLoc(), diag::err_expr_not_cce)
+ << CCE << From->getSourceRange();
for (unsigned I = 0; I < Notes.size(); ++I)
S.Diag(Notes[I].first, Notes[I].second);
}
@@ -5586,7 +5581,7 @@ diagnoseNoViableConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From,
ConvTy.getAsStringInternal(TypeStr, SemaRef.getPrintingPolicy());
Converter.diagnoseExplicitConv(SemaRef, Loc, T, ConvTy)
- << FixItHint::CreateInsertion(From->getLocStart(),
+ << FixItHint::CreateInsertion(From->getBeginLoc(),
"static_cast<" + TypeStr + ">(")
<< FixItHint::CreateInsertion(
SemaRef.getLocForEndOfToken(From->getLocEnd()), ")");
@@ -6009,7 +6004,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function,
QualType ClassType = Context.getTypeDeclType(Constructor->getParent());
if (Args.size() == 1 && Constructor->isSpecializationCopyingObject() &&
(Context.hasSameUnqualifiedType(ClassType, Args[0]->getType()) ||
- IsDerivedFrom(Args[0]->getLocStart(), Args[0]->getType(),
+ IsDerivedFrom(Args[0]->getBeginLoc(), Args[0]->getType(),
ClassType))) {
Candidate.Viable = false;
Candidate.FailureKind = ovl_fail_illegal_constructor;
@@ -6947,15 +6942,15 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
// lvalues/rvalues and the type. Fortunately, we can allocate this
// call on the stack and we don't need its arguments to be
// well-formed.
- DeclRefExpr ConversionRef(Conversion, false, Conversion->getType(),
- VK_LValue, From->getLocStart());
+ DeclRefExpr ConversionRef(Conversion, false, Conversion->getType(), VK_LValue,
+ From->getBeginLoc());
ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack,
Context.getPointerType(Conversion->getType()),
CK_FunctionToPointerDecay,
&ConversionRef, VK_RValue);
QualType ConversionType = Conversion->getConversionType();
- if (!isCompleteType(From->getLocStart(), ConversionType)) {
+ if (!isCompleteType(From->getBeginLoc(), ConversionType)) {
Candidate.Viable = false;
Candidate.FailureKind = ovl_fail_bad_final_conversion;
return;
@@ -6968,7 +6963,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
// allocator).
QualType CallResultType = ConversionType.getNonLValueExprType(Context);
CallExpr Call(Context, &ConversionFn, None, CallResultType, VK,
- From->getLocStart());
+ From->getBeginLoc());
ImplicitConversionSequence ICS =
TryCopyInitialization(*this, &Call, ToType,
/*SuppressUserConversions=*/true,
@@ -9484,7 +9479,7 @@ static bool checkAddressOfFunctionIsAvailable(Sema &S, const FunctionDecl *FD,
if (!isFunctionAlwaysEnabled(S.Context, FD)) {
if (Complain) {
if (InOverloadResolution)
- S.Diag(FD->getLocStart(),
+ S.Diag(FD->getBeginLoc(),
diag::note_addrof_ovl_candidate_disabled_by_enable_if_attr);
else
S.Diag(Loc, diag::err_addrof_function_disabled_by_enable_if_attr) << FD;
@@ -11092,7 +11087,7 @@ private:
// If any candidate has a placeholder return type, trigger its deduction
// now.
- if (completeFunctionType(S, FunDecl, SourceExpr->getLocStart(),
+ if (completeFunctionType(S, FunDecl, SourceExpr->getBeginLoc(),
Complain)) {
HasComplained |= Complain;
return false;
@@ -11168,7 +11163,7 @@ private:
// here, since the no_viable diagnostic has index 0.
UnresolvedSetIterator Result = S.getMostSpecialized(
MatchesCopy.begin(), MatchesCopy.end(), FailedCandidates,
- SourceExpr->getLocStart(), S.PDiag(),
+ SourceExpr->getBeginLoc(), S.PDiag(),
S.PDiag(diag::err_addr_ovl_ambiguous)
<< Matches[0].second->getDeclName(),
S.PDiag(diag::note_ovl_candidate)
@@ -11204,7 +11199,7 @@ private:
public:
void ComplainNoMatchesFound() const {
assert(Matches.empty());
- S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_no_viable)
+ S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_no_viable)
<< OvlExpr->getName() << TargetFunctionType
<< OvlExpr->getSourceRange();
if (FailedCandidates.empty())
@@ -11222,7 +11217,7 @@ public:
if (!functionHasPassObjectSizeParams(Fun))
S.NoteOverloadCandidate(*I, Fun, TargetFunctionType,
/*TakingAddress=*/true);
- FailedCandidates.NoteCandidates(S, OvlExpr->getLocStart());
+ FailedCandidates.NoteCandidates(S, OvlExpr->getBeginLoc());
}
}
@@ -11244,21 +11239,20 @@ public:
}
void ComplainIsStaticMemberFunctionFromBoundPointer() const {
- S.Diag(OvlExpr->getLocStart(),
+ S.Diag(OvlExpr->getBeginLoc(),
diag::err_invalid_form_pointer_member_function)
- << OvlExpr->getSourceRange();
+ << OvlExpr->getSourceRange();
}
void ComplainOfInvalidConversion() const {
- S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_not_func_ptrref)
- << OvlExpr->getName() << TargetType;
+ S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_not_func_ptrref)
+ << OvlExpr->getName() << TargetType;
}
void ComplainMultipleMatchesFound() const {
assert(Matches.size() > 1);
- S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_ambiguous)
- << OvlExpr->getName()
- << OvlExpr->getSourceRange();
+ S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_ambiguous)
+ << OvlExpr->getName() << OvlExpr->getSourceRange();
S.NoteAllOverloadCandidates(OvlExpr, TargetFunctionType,
/*TakingAddress=*/true);
}
@@ -11508,7 +11502,7 @@ bool Sema::ResolveAndFixSingleFunctionTemplateSpecialization(
ExprResult SingleFunctionExpression;
if (FunctionDecl *fn = ResolveSingleFunctionTemplateSpecialization(
ovl.Expression, /*complain*/ false, &found)) {
- if (DiagnoseUseOfDecl(fn, SrcExpr.get()->getLocStart())) {
+ if (DiagnoseUseOfDecl(fn, SrcExpr.get()->getBeginLoc())) {
SrcExpr = ExprError();
return true;
}
@@ -11944,7 +11938,7 @@ bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn,
OverloadCandidateSet::iterator Best;
if (CandidateSet->empty() ||
- CandidateSet->BestViableFunction(*this, Fn->getLocStart(), Best) ==
+ CandidateSet->BestViableFunction(*this, Fn->getBeginLoc(), Best) ==
OR_No_Viable_Function) {
// In Microsoft mode, if we are inside a template class member function then
// create a type dependent CallExpr. The goal is to postpone name lookup
@@ -12021,24 +12015,23 @@ static ExprResult FinishOverloadedCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
}
}
- SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_no_viable_function_in_call)
+ SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_no_viable_function_in_call)
<< ULE->getName() << Fn->getSourceRange();
CandidateSet->NoteCandidates(SemaRef, OCD_AllCandidates, Args);
break;
}
case OR_Ambiguous:
- SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_ambiguous_call)
- << ULE->getName() << Fn->getSourceRange();
+ SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_ambiguous_call)
+ << ULE->getName() << Fn->getSourceRange();
CandidateSet->NoteCandidates(SemaRef, OCD_ViableCandidates, Args);
break;
case OR_Deleted: {
- SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_deleted_call)
- << (*Best)->Function->isDeleted()
- << ULE->getName()
- << SemaRef.getDeletedOrUnavailableSuffix((*Best)->Function)
- << Fn->getSourceRange();
+ SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_deleted_call)
+ << (*Best)->Function->isDeleted() << ULE->getName()
+ << SemaRef.getDeletedOrUnavailableSuffix((*Best)->Function)
+ << Fn->getSourceRange();
CandidateSet->NoteCandidates(SemaRef, OCD_AllCandidates, Args);
// We emitted an error for the unavailable/deleted function call but keep
@@ -12094,7 +12087,7 @@ ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn,
OverloadCandidateSet::iterator Best;
OverloadingResult OverloadResult =
- CandidateSet.BestViableFunction(*this, Fn->getLocStart(), Best);
+ CandidateSet.BestViableFunction(*this, Fn->getBeginLoc(), Best);
return FinishOverloadedCallExpr(*this, S, Fn, ULE, LParenLoc, Args,
RParenLoc, ExecConfig, &CandidateSet,
@@ -12819,7 +12812,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
= new (Context) CXXMemberCallExpr(Context, MemExprE, Args,
resultType, valueKind, RParenLoc);
- if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(),
+ if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getBeginLoc(),
call, nullptr))
return ExprError();
@@ -12905,7 +12898,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
UnbridgedCasts.restore();
OverloadCandidateSet::iterator Best;
- switch (CandidateSet.BestViableFunction(*this, UnresExpr->getLocStart(),
+ switch (CandidateSet.BestViableFunction(*this, UnresExpr->getBeginLoc(),
Best)) {
case OR_Success:
Method = cast<CXXMethodDecl>(Best->Function);
@@ -13022,17 +13015,15 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
if (isa<CXXThisExpr>(MemExpr->getBase()->IgnoreParenCasts()) &&
MemExpr->performsVirtualDispatch(getLangOpts())) {
- Diag(MemExpr->getLocStart(),
+ Diag(MemExpr->getBeginLoc(),
diag::warn_call_to_pure_virtual_member_function_from_ctor_dtor)
- << MD->getDeclName() << isa<CXXDestructorDecl>(CurContext)
- << MD->getParent()->getDeclName();
+ << MD->getDeclName() << isa<CXXDestructorDecl>(CurContext)
+ << MD->getParent()->getDeclName();
- Diag(MD->getLocStart(), diag::note_previous_decl) << MD->getDeclName();
+ Diag(MD->getBeginLoc(), diag::note_previous_decl) << MD->getDeclName();
if (getLangOpts().AppleKext)
- Diag(MemExpr->getLocStart(),
- diag::note_pure_qualified_call_kext)
- << MD->getParent()->getDeclName()
- << MD->getDeclName();
+ Diag(MemExpr->getBeginLoc(), diag::note_pure_qualified_call_kext)
+ << MD->getParent()->getDeclName() << MD->getDeclName();
}
}
@@ -13040,7 +13031,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
dyn_cast<CXXDestructorDecl>(TheCall->getMethodDecl())) {
// a->A::f() doesn't go through the vtable, except in AppleKext mode.
bool CallCanBeVirtual = !MemExpr->hasQualifier() || getLangOpts().AppleKext;
- CheckVirtualDtorCall(DD, MemExpr->getLocStart(), /*IsDelete=*/false,
+ CheckVirtualDtorCall(DD, MemExpr->getBeginLoc(), /*IsDelete=*/false,
CallCanBeVirtual, /*WarnOnNonAbstractTypes=*/true,
MemExpr->getMemberLoc());
}
@@ -13145,7 +13136,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
// Perform overload resolution.
OverloadCandidateSet::iterator Best;
- switch (CandidateSet.BestViableFunction(*this, Object.get()->getLocStart(),
+ switch (CandidateSet.BestViableFunction(*this, Object.get()->getBeginLoc(),
Best)) {
case OR_Success:
// Overload resolution succeeded; we'll build the appropriate call
@@ -13154,30 +13145,26 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
case OR_No_Viable_Function:
if (CandidateSet.empty())
- Diag(Object.get()->getLocStart(), diag::err_ovl_no_oper)
- << Object.get()->getType() << /*call*/ 1
- << Object.get()->getSourceRange();
+ Diag(Object.get()->getBeginLoc(), diag::err_ovl_no_oper)
+ << Object.get()->getType() << /*call*/ 1
+ << Object.get()->getSourceRange();
else
- Diag(Object.get()->getLocStart(),
- diag::err_ovl_no_viable_object_call)
- << Object.get()->getType() << Object.get()->getSourceRange();
+ Diag(Object.get()->getBeginLoc(), diag::err_ovl_no_viable_object_call)
+ << Object.get()->getType() << Object.get()->getSourceRange();
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args);
break;
case OR_Ambiguous:
- Diag(Object.get()->getLocStart(),
- diag::err_ovl_ambiguous_object_call)
- << Object.get()->getType() << Object.get()->getSourceRange();
+ Diag(Object.get()->getBeginLoc(), diag::err_ovl_ambiguous_object_call)
+ << Object.get()->getType() << Object.get()->getSourceRange();
CandidateSet.NoteCandidates(*this, OCD_ViableCandidates, Args);
break;
case OR_Deleted:
- Diag(Object.get()->getLocStart(),
- diag::err_ovl_deleted_object_call)
- << Best->Function->isDeleted()
- << Object.get()->getType()
- << getDeletedOrUnavailableSuffix(Best->Function)
- << Object.get()->getSourceRange();
+ Diag(Object.get()->getBeginLoc(), diag::err_ovl_deleted_object_call)
+ << Best->Function->isDeleted() << Object.get()->getType()
+ << getDeletedOrUnavailableSuffix(Best->Function)
+ << Object.get()->getSourceRange();
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args);
break;
}
@@ -13574,7 +13561,7 @@ Sema::BuildForRangeBeginEndCall(SourceLocation Loc,
}
OverloadCandidateSet::iterator Best;
OverloadingResult OverloadResult =
- CandidateSet->BestViableFunction(*this, Fn->getLocStart(), Best);
+ CandidateSet->BestViableFunction(*this, Fn->getBeginLoc(), Best);
if (OverloadResult == OR_No_Viable_Function) {
*CallExpr = ExprError();
diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp
index a8af75d87c8..ebf1d10aa16 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -977,7 +977,7 @@ ObjCPropertyOpBuilder::buildIncDecOperation(Scope *Sc, SourceLocation opcLoc,
ExprResult ObjCPropertyOpBuilder::complete(Expr *SyntacticForm) {
if (isWeakProperty() && !S.isUnevaluatedContext() &&
!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak,
- SyntacticForm->getLocStart()))
+ SyntacticForm->getBeginLoc()))
S.getCurFunction()->recordUseOfWeak(SyntacticRefExpr,
SyntacticRefExpr->isMessagingGetter());
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 97c178ef42b..c170d74ca5e 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -918,8 +918,8 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// Check the unconverted value is within the range of possible values of
// the switch expression.
- checkCaseValue(*this, Lo->getLocStart(), LoVal,
- CondWidthBeforePromotion, CondIsSignedBeforePromotion);
+ checkCaseValue(*this, Lo->getBeginLoc(), LoVal, CondWidthBeforePromotion,
+ CondIsSignedBeforePromotion);
// FIXME: This duplicates the check performed for warn_not_in_enum below.
checkEnumTypesInSwitchStmt(*this, CondExprBeforePromotion,
@@ -979,17 +979,17 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
CaseVals[i-1].first.toString(CaseValStr);
if (PrevString == CurrString)
- Diag(CaseVals[i].second->getLHS()->getLocStart(),
- diag::err_duplicate_case) <<
- (PrevString.empty() ? StringRef(CaseValStr) : PrevString);
+ Diag(CaseVals[i].second->getLHS()->getBeginLoc(),
+ diag::err_duplicate_case)
+ << (PrevString.empty() ? StringRef(CaseValStr) : PrevString);
else
- Diag(CaseVals[i].second->getLHS()->getLocStart(),
- diag::err_duplicate_case_differing_expr) <<
- (PrevString.empty() ? StringRef(CaseValStr) : PrevString) <<
- (CurrString.empty() ? StringRef(CaseValStr) : CurrString) <<
- CaseValStr;
+ Diag(CaseVals[i].second->getLHS()->getBeginLoc(),
+ diag::err_duplicate_case_differing_expr)
+ << (PrevString.empty() ? StringRef(CaseValStr) : PrevString)
+ << (CurrString.empty() ? StringRef(CaseValStr) : CurrString)
+ << CaseValStr;
- Diag(CaseVals[i-1].second->getLHS()->getLocStart(),
+ Diag(CaseVals[i - 1].second->getLHS()->getBeginLoc(),
diag::note_duplicate_case_prev);
// FIXME: We really want to remove the bogus case stmt from the
// substmt, but we have no way to do this right now.
@@ -1018,7 +1018,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// Check the unconverted value is within the range of possible values of
// the switch expression.
- checkCaseValue(*this, Hi->getLocStart(), HiVal,
+ checkCaseValue(*this, Hi->getBeginLoc(), HiVal,
CondWidthBeforePromotion, CondIsSignedBeforePromotion);
// Convert the value to the same width/sign as the condition.
@@ -1026,9 +1026,8 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// If the low value is bigger than the high value, the case is empty.
if (LoVal > HiVal) {
- Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range)
- << SourceRange(CR->getLHS()->getLocStart(),
- Hi->getLocEnd());
+ Diag(CR->getLHS()->getBeginLoc(), diag::warn_case_empty_range)
+ << SourceRange(CR->getLHS()->getBeginLoc(), Hi->getLocEnd());
CaseRanges.erase(CaseRanges.begin()+i);
--i;
--e;
@@ -1082,9 +1081,9 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
if (OverlapStmt) {
// If we have a duplicate, report it.
- Diag(CR->getLHS()->getLocStart(), diag::err_duplicate_case)
- << OverlapVal.toString(10);
- Diag(OverlapStmt->getLHS()->getLocStart(),
+ Diag(CR->getLHS()->getBeginLoc(), diag::err_duplicate_case)
+ << OverlapVal.toString(10);
+ Diag(OverlapStmt->getLHS()->getBeginLoc(),
diag::note_duplicate_case_prev);
// FIXME: We really want to remove the bogus case stmt from the
// substmt, but we have no way to do this right now.
@@ -1492,7 +1491,7 @@ namespace {
if (!Second) return;
if (S.Diags.isIgnored(diag::warn_variables_not_in_loop_body,
- Second->getLocStart()))
+ Second->getBeginLoc()))
return;
PartialDiagnostic PDiag = S.PDiag(diag::warn_variables_not_in_loop_body);
@@ -1668,7 +1667,7 @@ namespace {
if (!Body || !Third) return;
if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration,
- Third->getLocStart()))
+ Third->getBeginLoc()))
return;
// Get the last statement from the loop body.
@@ -1914,9 +1913,9 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
} else {
Expr *FirstE = cast<Expr>(First);
if (!FirstE->isTypeDependent() && !FirstE->isLValue())
- return StmtError(Diag(First->getLocStart(),
- diag::err_selector_element_not_lvalue)
- << First->getSourceRange());
+ return StmtError(
+ Diag(First->getBeginLoc(), diag::err_selector_element_not_lvalue)
+ << First->getSourceRange());
FirstType = static_cast<Expr*>(First)->getType();
if (FirstType.isConstQualified())
@@ -2087,7 +2086,7 @@ StmtResult Sema::ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc,
// Build auto && __range = range-init
// Divide by 2, since the variables are in the inner scope (loop body).
const auto DepthStr = std::to_string(S->getDepth() / 2);
- SourceLocation RangeLoc = Range->getLocStart();
+ SourceLocation RangeLoc = Range->getBeginLoc();
VarDecl *RangeVar = BuildForRangeVarDecl(*this, RangeLoc,
Context.getAutoRRefDeductType(),
std::string("__range") + DepthStr);
@@ -2169,7 +2168,7 @@ BuildNonArrayForRange(Sema &SemaRef, Expr *BeginRange, Expr *EndRange,
if (RangeStatus != Sema::FRS_Success) {
if (RangeStatus == Sema::FRS_DiagnosticIssued)
- SemaRef.Diag(BeginRange->getLocStart(), diag::note_in_for_range)
+ SemaRef.Diag(BeginRange->getBeginLoc(), diag::note_in_for_range)
<< ColonLoc << BEF_begin << BeginRange->getType();
return RangeStatus;
}
@@ -2195,7 +2194,7 @@ BuildNonArrayForRange(Sema &SemaRef, Expr *BeginRange, Expr *EndRange,
EndRange, EndExpr);
if (RangeStatus != Sema::FRS_Success) {
if (RangeStatus == Sema::FRS_DiagnosticIssued)
- SemaRef.Diag(EndRange->getLocStart(), diag::note_in_for_range)
+ SemaRef.Diag(EndRange->getBeginLoc(), diag::note_in_for_range)
<< ColonLoc << BEF_end << EndRange->getType();
return RangeStatus;
}
@@ -2451,8 +2450,8 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc,
QualType ArrayTy = PVD->getOriginalType();
QualType PointerTy = PVD->getType();
if (PointerTy->isPointerType() && ArrayTy->isArrayType()) {
- Diag(Range->getLocStart(), diag::err_range_on_array_parameter)
- << RangeLoc << PVD << ArrayTy << PointerTy;
+ Diag(Range->getBeginLoc(), diag::err_range_on_array_parameter)
+ << RangeLoc << PVD << ArrayTy << PointerTy;
Diag(PVD->getLocation(), diag::note_declared_at);
return StmtError();
}
@@ -2473,7 +2472,7 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc,
// Otherwise, emit diagnostics if we haven't already.
if (RangeStatus == FRS_NoViableFunction) {
Expr *Range = BEFFailure ? EndRangeRef.get() : BeginRangeRef.get();
- Diag(Range->getLocStart(), diag::err_for_range_invalid)
+ Diag(Range->getBeginLoc(), diag::err_for_range_invalid)
<< RangeLoc << Range->getType() << BEFFailure;
CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Range);
}
@@ -2660,7 +2659,7 @@ static void DiagnoseForRangeReferenceVariableCopies(Sema &SemaRef,
NonReferenceType.removeLocalConst();
QualType NewReferenceType =
SemaRef.Context.getLValueReferenceType(E->getType().withConst());
- SemaRef.Diag(VD->getLocStart(), diag::note_use_type_or_non_reference)
+ SemaRef.Diag(VD->getBeginLoc(), diag::note_use_type_or_non_reference)
<< NonReferenceType << NewReferenceType << VD->getSourceRange();
} else {
// The range always returns a copy, so a temporary is always created.
@@ -2669,7 +2668,7 @@ static void DiagnoseForRangeReferenceVariableCopies(Sema &SemaRef,
<< VD << RangeInitType;
QualType NonReferenceType = VariableType.getNonReferenceType();
NonReferenceType.removeLocalConst();
- SemaRef.Diag(VD->getLocStart(), diag::note_use_non_reference_type)
+ SemaRef.Diag(VD->getBeginLoc(), diag::note_use_non_reference_type)
<< NonReferenceType << VD->getSourceRange();
}
}
@@ -2705,7 +2704,7 @@ static void DiagnoseForRangeConstVariableCopies(Sema &SemaRef,
// if doing so will prevent a copy.
SemaRef.Diag(VD->getLocation(), diag::warn_for_range_copy)
<< VD << VariableType << InitExpr->getType();
- SemaRef.Diag(VD->getLocStart(), diag::note_use_reference_type)
+ SemaRef.Diag(VD->getBeginLoc(), diag::note_use_reference_type)
<< SemaRef.Context.getLValueReferenceType(VariableType)
<< VD->getSourceRange();
}
@@ -2721,11 +2720,11 @@ static void DiagnoseForRangeConstVariableCopies(Sema &SemaRef,
static void DiagnoseForRangeVariableCopies(Sema &SemaRef,
const CXXForRangeStmt *ForStmt) {
if (SemaRef.Diags.isIgnored(diag::warn_for_range_const_reference_copy,
- ForStmt->getLocStart()) &&
+ ForStmt->getBeginLoc()) &&
SemaRef.Diags.isIgnored(diag::warn_for_range_variable_always_copy,
- ForStmt->getLocStart()) &&
+ ForStmt->getBeginLoc()) &&
SemaRef.Diags.isIgnored(diag::warn_for_range_copy,
- ForStmt->getLocStart())) {
+ ForStmt->getBeginLoc())) {
return;
}
@@ -2951,7 +2950,7 @@ static void TryMoveInitialization(Sema& S,
Expr *InitExpr = &AsRvalue;
InitializationKind Kind = InitializationKind::CreateCopy(
- Value->getLocStart(), Value->getLocStart());
+ Value->getBeginLoc(), Value->getBeginLoc());
InitializationSequence Seq(S, Entity, Kind, InitExpr);
@@ -3969,7 +3968,7 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
// declarations that are invalid, since we can't usefully report on them.
if (!H->getExceptionDecl()) {
if (i < NumHandlers - 1)
- return StmtError(Diag(H->getLocStart(), diag::err_early_catch_all));
+ return StmtError(Diag(H->getBeginLoc(), diag::err_early_catch_all));
continue;
} else if (H->getExceptionDecl()->isInvalidDecl())
continue;
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 0db15ea1f64..359bfb44645 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -47,10 +47,10 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) {
const Expr *E2 = E->IgnoreParenNoopCasts(S.Context);
if (E != E2 && E2->isLValue()) {
if (!S.getLangOpts().HeinousExtensions)
- S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue)
+ S.Diag(E2->getBeginLoc(), diag::err_invalid_asm_cast_lvalue)
<< E->getSourceRange();
else
- S.Diag(E2->getLocStart(), diag::warn_invalid_asm_cast_lvalue)
+ S.Diag(E2->getBeginLoc(), diag::warn_invalid_asm_cast_lvalue)
<< E->getSourceRange();
// Accept, even if we emitted an error diagnostic.
return false;
@@ -90,13 +90,13 @@ static bool CheckNakedParmReference(Expr *E, Sema &S) {
while (WorkList.size()) {
Expr *E = WorkList.pop_back_val();
if (isa<CXXThisExpr>(E)) {
- S.Diag(E->getLocStart(), diag::err_asm_naked_this_ref);
+ S.Diag(E->getBeginLoc(), diag::err_asm_naked_this_ref);
S.Diag(Func->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
return true;
}
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
if (isa<ParmVarDecl>(DRE->getDecl())) {
- S.Diag(DRE->getLocStart(), diag::err_asm_naked_parm_ref);
+ S.Diag(DRE->getBeginLoc(), diag::err_asm_naked_parm_ref);
S.Diag(Func->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
return true;
}
@@ -131,7 +131,7 @@ static bool checkExprMemoryConstraintCompat(Sema &S, Expr *E,
EType = ExprGlobalRegVar;
if (EType != ExprSafeType) {
- S.Diag(E->getLocStart(), diag::err_asm_non_addr_value_in_memory_constraint)
+ S.Diag(E->getBeginLoc(), diag::err_asm_non_addr_value_in_memory_constraint)
<< EType << is_input_expr << Info.getConstraintStr()
<< E->getSourceRange();
return true;
@@ -185,7 +185,7 @@ getClobberConflictLocation(MultiExprArg Exprs, StringLiteral **Constraints,
Clobber = Target.getNormalizedGCCRegisterName(Clobber, true);
// Go over the output's registers we collected
if (InOutVars.count(Clobber))
- return Clobbers[i]->getLocStart();
+ return Clobbers[i]->getBeginLoc();
}
return SourceLocation();
}
@@ -226,9 +226,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
TargetInfo::ConstraintInfo Info(Literal->getString(), OutputName);
if (!Context.getTargetInfo().validateOutputConstraint(Info))
- return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_invalid_output_constraint)
- << Info.getConstraintStr());
+ return StmtError(
+ Diag(Literal->getBeginLoc(), diag::err_asm_invalid_output_constraint)
+ << Info.getConstraintStr());
ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
if (ER.isInvalid())
@@ -265,10 +265,10 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
case Expr::MLV_LValueCast: {
const Expr *LVal = OutputExpr->IgnoreParenNoopCasts(Context);
if (!getLangOpts().HeinousExtensions) {
- Diag(LVal->getLocStart(), diag::err_invalid_asm_cast_lvalue)
+ Diag(LVal->getBeginLoc(), diag::err_invalid_asm_cast_lvalue)
<< OutputExpr->getSourceRange();
} else {
- Diag(LVal->getLocStart(), diag::warn_invalid_asm_cast_lvalue)
+ Diag(LVal->getBeginLoc(), diag::warn_invalid_asm_cast_lvalue)
<< OutputExpr->getSourceRange();
}
// Accept, even if we emitted an error diagnostic.
@@ -276,12 +276,12 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
}
case Expr::MLV_IncompleteType:
case Expr::MLV_IncompleteVoidType:
- if (RequireCompleteType(OutputExpr->getLocStart(), Exprs[i]->getType(),
+ if (RequireCompleteType(OutputExpr->getBeginLoc(), Exprs[i]->getType(),
diag::err_dereference_incomplete_type))
return StmtError();
LLVM_FALLTHROUGH;
default:
- return StmtError(Diag(OutputExpr->getLocStart(),
+ return StmtError(Diag(OutputExpr->getBeginLoc(),
diag::err_asm_invalid_lvalue_in_output)
<< OutputExpr->getSourceRange());
}
@@ -289,9 +289,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
unsigned Size = Context.getTypeSize(OutputExpr->getType());
if (!Context.getTargetInfo().validateOutputSize(Literal->getString(),
Size))
- return StmtError(Diag(OutputExpr->getLocStart(),
- diag::err_asm_invalid_output_size)
- << Info.getConstraintStr());
+ return StmtError(
+ Diag(OutputExpr->getBeginLoc(), diag::err_asm_invalid_output_size)
+ << Info.getConstraintStr());
}
SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos;
@@ -307,9 +307,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
TargetInfo::ConstraintInfo Info(Literal->getString(), InputName);
if (!Context.getTargetInfo().validateInputConstraint(OutputConstraintInfos,
Info)) {
- return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_invalid_input_constraint)
- << Info.getConstraintStr());
+ return StmtError(
+ Diag(Literal->getBeginLoc(), diag::err_asm_invalid_input_constraint)
+ << Info.getConstraintStr());
}
ExprResult ER = CheckPlaceholderExpr(Exprs[i]);
@@ -331,7 +331,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
// Only allow void types for memory constraints.
if (Info.allowsMemory() && !Info.allowsRegister()) {
if (CheckAsmLValue(InputExpr, *this))
- return StmtError(Diag(InputExpr->getLocStart(),
+ return StmtError(Diag(InputExpr->getBeginLoc(),
diag::err_asm_invalid_lvalue_in_input)
<< Info.getConstraintStr()
<< InputExpr->getSourceRange());
@@ -339,11 +339,11 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
if (!InputExpr->isValueDependent()) {
llvm::APSInt Result;
if (!InputExpr->EvaluateAsInt(Result, Context))
- return StmtError(
- Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected)
- << Info.getConstraintStr() << InputExpr->getSourceRange());
+ return StmtError(
+ Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected)
+ << Info.getConstraintStr() << InputExpr->getSourceRange());
if (!Info.isValidAsmImmediate(Result))
- return StmtError(Diag(InputExpr->getLocStart(),
+ return StmtError(Diag(InputExpr->getBeginLoc(),
diag::err_invalid_asm_value_for_constraint)
<< Result.toString(10) << Info.getConstraintStr()
<< InputExpr->getSourceRange());
@@ -359,10 +359,10 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
if (Info.allowsRegister()) {
if (InputExpr->getType()->isVoidType()) {
- return StmtError(Diag(InputExpr->getLocStart(),
- diag::err_asm_invalid_type_in_input)
- << InputExpr->getType() << Info.getConstraintStr()
- << InputExpr->getSourceRange());
+ return StmtError(
+ Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_type_in_input)
+ << InputExpr->getType() << Info.getConstraintStr()
+ << InputExpr->getSourceRange());
}
}
@@ -373,16 +373,16 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
continue;
if (!Ty->isVoidType() || !Info.allowsMemory())
- if (RequireCompleteType(InputExpr->getLocStart(), Exprs[i]->getType(),
+ if (RequireCompleteType(InputExpr->getBeginLoc(), Exprs[i]->getType(),
diag::err_dereference_incomplete_type))
return StmtError();
unsigned Size = Context.getTypeSize(Ty);
if (!Context.getTargetInfo().validateInputSize(Literal->getString(),
Size))
- return StmtError(Diag(InputExpr->getLocStart(),
- diag::err_asm_invalid_input_size)
- << Info.getConstraintStr());
+ return StmtError(
+ Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_input_size)
+ << Info.getConstraintStr());
}
// Check that the clobbers are valid.
@@ -393,8 +393,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
StringRef Clobber = Literal->getString();
if (!Context.getTargetInfo().isValidClobber(Clobber))
- return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_unknown_register_name) << Clobber);
+ return StmtError(
+ Diag(Literal->getBeginLoc(), diag::err_asm_unknown_register_name)
+ << Clobber);
}
GCCAsmStmt *NS =
@@ -446,7 +447,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
if (!Context.getTargetInfo().validateConstraintModifier(
Literal->getString(), Piece.getModifier(), Size,
SuggestedModifier)) {
- Diag(Exprs[ConstraintIdx]->getLocStart(),
+ Diag(Exprs[ConstraintIdx]->getBeginLoc(),
diag::warn_asm_mismatched_size_modifier);
if (!SuggestedModifier.empty()) {
@@ -469,7 +470,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
if (NumAlternatives == ~0U)
NumAlternatives = AltCount;
else if (NumAlternatives != AltCount)
- return StmtError(Diag(NS->getOutputExpr(i)->getLocStart(),
+ return StmtError(Diag(NS->getOutputExpr(i)->getBeginLoc(),
diag::err_asm_unexpected_constraint_alternatives)
<< NumAlternatives << AltCount);
}
@@ -482,7 +483,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
if (NumAlternatives == ~0U)
NumAlternatives = AltCount;
else if (NumAlternatives != AltCount)
- return StmtError(Diag(NS->getInputExpr(i)->getLocStart(),
+ return StmtError(Diag(NS->getInputExpr(i)->getBeginLoc(),
diag::err_asm_unexpected_constraint_alternatives)
<< NumAlternatives << AltCount);
@@ -499,10 +500,10 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
// Make sure no more than one input constraint matches each output.
assert(TiedTo < InputMatchedToOutput.size() && "TiedTo value out of range");
if (InputMatchedToOutput[TiedTo] != ~0U) {
- Diag(NS->getInputExpr(i)->getLocStart(),
+ Diag(NS->getInputExpr(i)->getBeginLoc(),
diag::err_asm_input_duplicate_match)
<< TiedTo;
- Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(),
+ Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getBeginLoc(),
diag::note_asm_input_duplicate_first)
<< TiedTo;
return StmtError();
@@ -590,10 +591,9 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
continue;
}
- Diag(InputExpr->getLocStart(),
- diag::err_asm_tying_incompatible_types)
- << InTy << OutTy << OutputExpr->getSourceRange()
- << InputExpr->getSourceRange();
+ Diag(InputExpr->getBeginLoc(), diag::err_asm_tying_incompatible_types)
+ << InTy << OutTy << OutputExpr->getSourceRange()
+ << InputExpr->getSourceRange();
return StmtError();
}
diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp
index 176922dbe85..ba96ba9c23f 100644
--- a/clang/lib/Sema/SemaStmtAttr.cpp
+++ b/clang/lib/Sema/SemaStmtAttr.cpp
@@ -29,7 +29,7 @@ static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const ParsedAttr &A,
A.getAttributeSpellingListIndex());
if (!isa<NullStmt>(St)) {
S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_wrong_target)
- << Attr.getSpelling() << St->getLocStart();
+ << Attr.getSpelling() << St->getBeginLoc();
if (isa<SwitchCase>(St)) {
SourceLocation L = S.getLocForEndOfToken(Range.getEnd());
S.Diag(L, diag::note_fallthrough_insert_semi_fixit)
@@ -100,7 +100,7 @@ static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A,
.Case("unroll_and_jam", "#pragma unroll_and_jam")
.Case("nounroll_and_jam", "#pragma nounroll_and_jam")
.Default("#pragma clang loop");
- S.Diag(St->getLocStart(), diag::err_pragma_loop_precedes_nonloop) << Pragma;
+ S.Diag(St->getBeginLoc(), diag::err_pragma_loop_precedes_nonloop) << Pragma;
return nullptr;
}
@@ -154,7 +154,7 @@ static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const ParsedAttr &A,
Option == LoopHintAttr::InterleaveCount ||
Option == LoopHintAttr::UnrollCount) {
assert(ValueExpr && "Attribute must have a valid value expression.");
- if (S.CheckLoopHintExpr(ValueExpr, St->getLocStart()))
+ if (S.CheckLoopHintExpr(ValueExpr, St->getBeginLoc()))
return nullptr;
State = LoopHintAttr::Numeric;
} else if (Option == LoopHintAttr::Vectorize ||
@@ -333,7 +333,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const ParsedAttr &A,
// if we're here, then we parsed a known attribute, but didn't recognize
// it as a statement attribute => it is declaration attribute
S.Diag(A.getRange().getBegin(), diag::err_decl_attribute_invalid_on_stmt)
- << A.getName() << St->getLocStart();
+ << A.getName() << St->getBeginLoc();
return nullptr;
}
}
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index f31f0d4957a..24e183447fe 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -194,7 +194,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
QualType ObjectType = ObjectTypePtr.get();
- LookupResult R(*this, TName, Name.getLocStart(), LookupOrdinaryName);
+ LookupResult R(*this, TName, Name.getBeginLoc(), LookupOrdinaryName);
if (LookupTemplateName(R, S, SS, ObjectType, EnteringContext,
MemberOfUnknownSpecialization))
return TNK_Non_template;
@@ -539,9 +539,8 @@ void Sema::diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName,
// If this is a dependent-scope lookup, diagnose that the 'template' keyword
// was missing.
if (MissingTemplateKeyword) {
- Diag(NameInfo.getLocStart(), diag::err_template_kw_missing)
- << "" << NameInfo.getName().getAsString()
- << SourceRange(Less, Greater);
+ Diag(NameInfo.getBeginLoc(), diag::err_template_kw_missing)
+ << "" << NameInfo.getName().getAsString() << SourceRange(Less, Greater);
return;
}
@@ -892,7 +891,7 @@ ParsedTemplateArgument Sema::ActOnTemplateTypeArgument(TypeResult ParsedType) {
// convertTypeTemplateArgumentToTemplate.
return ParsedTemplateArgument(ParsedTemplateArgument::Type,
ParsedType.get().getAsOpaquePtr(),
- TInfo->getTypeLoc().getLocStart());
+ TInfo->getTypeLoc().getBeginLoc());
}
/// ActOnTypeParameter - Called when a C++ template type parameter
@@ -1113,12 +1112,10 @@ NamedDecl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
IdentifierInfo *ParamName = D.getIdentifier();
bool IsParameterPack = D.hasEllipsis();
- NonTypeTemplateParmDecl *Param
- = NonTypeTemplateParmDecl::Create(Context, Context.getTranslationUnitDecl(),
- D.getLocStart(),
- D.getIdentifierLoc(),
- Depth, Position, ParamName, T,
- IsParameterPack, TInfo);
+ NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create(
+ Context, Context.getTranslationUnitDecl(), D.getBeginLoc(),
+ D.getIdentifierLoc(), Depth, Position, ParamName, T, IsParameterPack,
+ TInfo);
Param->setAccess(AS_public);
if (Invalid)
@@ -1459,10 +1456,11 @@ DeclResult Sema::CheckClassTemplate(
}();
if (RedeclACMismatch) {
- Diag(CurAC ? CurAC->getLocStart() : NameLoc,
+ Diag(CurAC ? CurAC->getBeginLoc() : NameLoc,
diag::err_template_different_associated_constraints);
- Diag(PrevAC ? PrevAC->getLocStart() : PrevClassTemplate->getLocation(),
- diag::note_template_prev_declaration) << /*declaration*/0;
+ Diag(PrevAC ? PrevAC->getBeginLoc() : PrevClassTemplate->getLocation(),
+ diag::note_template_prev_declaration)
+ << /*declaration*/ 0;
return true;
}
@@ -1763,7 +1761,7 @@ struct ConvertConstructorToDeductionGuideTransform {
TypeSourceInfo *NewTInfo = TLB.getTypeSourceInfo(SemaRef.Context, NewType);
return buildDeductionGuide(TemplateParams, CD->isExplicit(), NewTInfo,
- CD->getLocStart(), CD->getLocation(),
+ CD->getBeginLoc(), CD->getLocation(),
CD->getLocEnd());
}
@@ -1806,8 +1804,8 @@ private:
// TemplateTypeParmDecl's index cannot be changed after creation, so
// substitute it directly.
auto *NewTTP = TemplateTypeParmDecl::Create(
- SemaRef.Context, DC, TTP->getLocStart(), TTP->getLocation(),
- /*Depth*/0, Depth1IndexAdjustment + TTP->getIndex(),
+ SemaRef.Context, DC, TTP->getBeginLoc(), TTP->getLocation(),
+ /*Depth*/ 0, Depth1IndexAdjustment + TTP->getIndex(),
TTP->getIdentifier(), TTP->wasDeclaredWithTypename(),
TTP->isParameterPack());
if (TTP->hasDefaultArgument()) {
@@ -1876,7 +1874,7 @@ private:
EPI.HasTrailingReturn = true;
QualType Result = SemaRef.BuildFunctionType(
- ReturnType, ParamTypes, TL.getLocStart(), DeductionGuideName, EPI);
+ ReturnType, ParamTypes, TL.getBeginLoc(), DeductionGuideName, EPI);
if (Result.isNull())
return QualType();
@@ -3247,13 +3245,11 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
// This is the first time we have referenced this class template
// specialization. Create the canonical declaration and add it to
// the set of specializations.
- Decl = ClassTemplateSpecializationDecl::Create(Context,
- ClassTemplate->getTemplatedDecl()->getTagKind(),
- ClassTemplate->getDeclContext(),
- ClassTemplate->getTemplatedDecl()->getLocStart(),
- ClassTemplate->getLocation(),
- ClassTemplate,
- Converted, nullptr);
+ Decl = ClassTemplateSpecializationDecl::Create(
+ Context, ClassTemplate->getTemplatedDecl()->getTagKind(),
+ ClassTemplate->getDeclContext(),
+ ClassTemplate->getTemplatedDecl()->getBeginLoc(),
+ ClassTemplate->getLocation(), ClassTemplate, Converted, nullptr);
ClassTemplate->AddSpecialization(Decl, InsertPos);
if (ClassTemplate->isOutOfLine())
Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
@@ -4218,12 +4214,12 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
// a "not a template" case. FIXME: Refactor isTemplateName so we don't
// need to do this.
DeclarationNameInfo DNI = GetNameFromUnqualifiedId(Name);
- LookupResult R(*this, DNI.getName(), Name.getLocStart(),
+ LookupResult R(*this, DNI.getName(), Name.getBeginLoc(),
LookupOrdinaryName);
bool MOUS;
if (!LookupTemplateName(R, S, SS, ObjectType.get(), EnteringContext,
MOUS, TemplateKWLoc))
- Diag(Name.getLocStart(), diag::err_no_member)
+ Diag(Name.getBeginLoc(), diag::err_no_member)
<< DNI.getName() << LookupCtx << SS.getRange();
return TNK_Non_template;
} else {
@@ -4241,10 +4237,11 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
// We don't get here if naming the constructor would be valid, so we
// just reject immediately and recover by treating the
// injected-class-name as naming the template.
- Diag(Name.getLocStart(),
+ Diag(Name.getBeginLoc(),
diag::ext_out_of_line_qualified_id_type_names_constructor)
- << Name.Identifier << 0 /*injected-class-name used as template name*/
- << 1 /*'template' keyword was used*/;
+ << Name.Identifier
+ << 0 /*injected-class-name used as template name*/
+ << 1 /*'template' keyword was used*/;
}
return TNK;
}
@@ -4270,11 +4267,9 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
break;
}
- Diag(Name.getLocStart(),
- diag::err_template_kw_refers_to_non_template)
- << GetNameFromUnqualifiedId(Name).getName()
- << Name.getSourceRange()
- << TemplateKWLoc;
+ Diag(Name.getBeginLoc(), diag::err_template_kw_refers_to_non_template)
+ << GetNameFromUnqualifiedId(Name).getName() << Name.getSourceRange()
+ << TemplateKWLoc;
return TNK_Non_template;
}
@@ -5629,7 +5624,7 @@ isNullPointerValueTemplateArgument(Sema &S, NonTypeTemplateParmDecl *Param,
if (Arg->isNullPointerConstant(S.Context, Expr::NPC_NeverValueDependent)) {
std::string Code = "static_cast<" + ParamType.getAsString() + ">(";
S.Diag(Arg->getExprLoc(), diag::err_template_arg_untyped_null_constant)
- << ParamType << FixItHint::CreateInsertion(Arg->getLocStart(), Code)
+ << ParamType << FixItHint::CreateInsertion(Arg->getBeginLoc(), Code)
<< FixItHint::CreateInsertion(S.getLocForEndOfToken(Arg->getLocEnd()),
")");
S.Diag(Param->getLocation(), diag::note_template_param_here);
@@ -5670,9 +5665,9 @@ static bool CheckTemplateArgumentIsCompatibleWithParameter(
unsigned ArgQuals = ArgType.getCVRQualifiers();
if ((ParamQuals | ArgQuals) != ParamQuals) {
- S.Diag(Arg->getLocStart(),
+ S.Diag(Arg->getBeginLoc(),
diag::err_template_arg_ref_bind_ignores_quals)
- << ParamType << Arg->getType() << Arg->getSourceRange();
+ << ParamType << Arg->getType() << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
@@ -5686,11 +5681,11 @@ static bool CheckTemplateArgumentIsCompatibleWithParameter(
ParamType.getNonReferenceType())) {
// We can't perform this conversion or binding.
if (ParamType->isReferenceType())
- S.Diag(Arg->getLocStart(), diag::err_template_arg_no_ref_bind)
- << ParamType << ArgIn->getType() << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_no_ref_bind)
+ << ParamType << ArgIn->getType() << Arg->getSourceRange();
else
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_convertible)
- << ArgIn->getType() << ParamType << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_convertible)
+ << ArgIn->getType() << ParamType << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
@@ -5736,8 +5731,8 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
}
if (FirstOpLoc.isValid()) {
if (ExtWarnMSTemplateArg)
- S.Diag(ArgIn->getLocStart(), diag::ext_ms_deref_template_argument)
- << ArgIn->getSourceRange();
+ S.Diag(ArgIn->getBeginLoc(), diag::ext_ms_deref_template_argument)
+ << ArgIn->getSourceRange();
if (FirstOpKind == UO_AddrOf)
AddressTaken = true;
@@ -5745,8 +5740,8 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
// We cannot let pointers get dereferenced here, that is obviously not a
// constant expression.
assert(FirstOpKind == UO_Deref);
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref)
+ << Arg->getSourceRange();
}
}
} else {
@@ -5770,7 +5765,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
bool ExtraParens = false;
while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) {
if (!Invalid && !ExtraParens) {
- S.Diag(Arg->getLocStart(),
+ S.Diag(Arg->getBeginLoc(),
S.getLangOpts().CPlusPlus11
? diag::warn_cxx98_compat_template_arg_extra_parens
: diag::ext_template_arg_extra_parens)
@@ -5836,16 +5831,16 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
}
if (!DRE) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref)
+ << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
// Cannot refer to non-static data members
if (isa<FieldDecl>(Entity) || isa<IndirectFieldDecl>(Entity)) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_field)
- << Entity << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_field)
+ << Entity << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
@@ -5853,8 +5848,8 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
// Cannot refer to non-static member functions
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Entity)) {
if (!Method->isStatic()) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_method)
- << Method << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_method)
+ << Method << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
@@ -5866,23 +5861,24 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
// A non-type template argument must refer to an object or function.
if (!Func && !Var) {
// We found something, but we don't know specifically what it is.
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_object_or_func)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_object_or_func)
+ << Arg->getSourceRange();
S.Diag(DRE->getDecl()->getLocation(), diag::note_template_arg_refers_here);
return true;
}
// Address / reference template args must have external linkage in C++98.
if (Entity->getFormalLinkage() == InternalLinkage) {
- S.Diag(Arg->getLocStart(), S.getLangOpts().CPlusPlus11 ?
- diag::warn_cxx98_compat_template_arg_object_internal :
- diag::ext_template_arg_object_internal)
- << !Func << Entity << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(),
+ S.getLangOpts().CPlusPlus11
+ ? diag::warn_cxx98_compat_template_arg_object_internal
+ : diag::ext_template_arg_object_internal)
+ << !Func << Entity << Arg->getSourceRange();
S.Diag(Entity->getLocation(), diag::note_template_arg_internal_object)
<< !Func;
} else if (!Entity->hasLinkage()) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_object_no_linkage)
- << !Func << Entity << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_object_no_linkage)
+ << !Func << Entity << Arg->getSourceRange();
S.Diag(Entity->getLocation(), diag::note_template_arg_internal_object)
<< !Func;
return true;
@@ -5914,17 +5910,16 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
} else {
// A value of reference type is not an object.
if (Var->getType()->isReferenceType()) {
- S.Diag(Arg->getLocStart(),
- diag::err_template_arg_reference_var)
- << Var->getType() << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_reference_var)
+ << Var->getType() << Arg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
// A template argument must have static storage duration.
if (Var->getTLSKind()) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_thread_local)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_thread_local)
+ << Arg->getSourceRange();
S.Diag(Var->getLocation(), diag::note_template_arg_refers_here);
return true;
}
@@ -5961,15 +5956,14 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
// taking the address of the entity.
ArgType = S.Context.getPointerType(Var->getType());
if (!S.Context.hasSameUnqualifiedType(ArgType, ParamType)) {
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_address_of)
- << ParamType;
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_address_of)
+ << ParamType;
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
- S.Diag(Arg->getLocStart(), diag::err_template_arg_not_address_of)
- << ParamType
- << FixItHint::CreateInsertion(Arg->getLocStart(), "&");
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_address_of)
+ << ParamType << FixItHint::CreateInsertion(Arg->getBeginLoc(), "&");
S.Diag(Param->getLocation(), diag::note_template_param_here);
}
@@ -5983,7 +5977,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
// Create the template argument.
Converted =
TemplateArgument(cast<ValueDecl>(Entity->getCanonicalDecl()), ParamType);
- S.MarkAnyDeclReferenced(Arg->getLocStart(), Entity, false);
+ S.MarkAnyDeclReferenced(Arg->getBeginLoc(), Entity, false);
return false;
}
@@ -6012,11 +6006,11 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
bool ExtraParens = false;
while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) {
if (!Invalid && !ExtraParens) {
- S.Diag(Arg->getLocStart(),
- S.getLangOpts().CPlusPlus11 ?
- diag::warn_cxx98_compat_template_arg_extra_parens :
- diag::ext_template_arg_extra_parens)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(),
+ S.getLangOpts().CPlusPlus11
+ ? diag::warn_cxx98_compat_template_arg_extra_parens
+ : diag::ext_template_arg_extra_parens)
+ << Arg->getSourceRange();
ExtraParens = true;
}
@@ -6078,16 +6072,16 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
} else if (!S.Context.hasSameUnqualifiedType(
ResultArg->getType(), ParamType.getNonReferenceType())) {
// We can't perform this conversion.
- S.Diag(ResultArg->getLocStart(), diag::err_template_arg_not_convertible)
+ S.Diag(ResultArg->getBeginLoc(), diag::err_template_arg_not_convertible)
<< ResultArg->getType() << ParamType << ResultArg->getSourceRange();
S.Diag(Param->getLocation(), diag::note_template_param_here);
return true;
}
if (!DRE)
- return S.Diag(Arg->getLocStart(),
+ return S.Diag(Arg->getBeginLoc(),
diag::err_template_arg_not_pointer_to_member_form)
- << Arg->getSourceRange();
+ << Arg->getSourceRange();
if (isa<FieldDecl>(DRE->getDecl()) ||
isa<IndirectFieldDecl>(DRE->getDecl()) ||
@@ -6109,9 +6103,8 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
}
// We found something else, but we don't know specifically what it is.
- S.Diag(Arg->getLocStart(),
- diag::err_template_arg_not_pointer_to_member_form)
- << Arg->getSourceRange();
+ S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_pointer_to_member_form)
+ << Arg->getSourceRange();
S.Diag(DRE->getDecl()->getLocation(), diag::note_template_arg_refers_here);
return true;
}
@@ -6127,7 +6120,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
QualType ParamType, Expr *Arg,
TemplateArgument &Converted,
CheckTemplateArgumentKind CTAK) {
- SourceLocation StartLoc = Arg->getLocStart();
+ SourceLocation StartLoc = Arg->getBeginLoc();
// If the parameter type somehow involves auto, deduce the type now.
if (getLangOpts().CPlusPlus17 && ParamType->isUndeducedType()) {
@@ -6248,7 +6241,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// FIXME: We need TemplateArgument representation and mangling for these.
if (!Value.getMemberPointerPath().empty()) {
- Diag(Arg->getLocStart(),
+ Diag(Arg->getBeginLoc(),
diag::err_template_arg_member_ptr_base_derived_not_supported)
<< Value.getMemberPointerDecl() << ParamType
<< Arg->getSourceRange();
@@ -6274,8 +6267,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
Converted = TemplateArgument(ArgResult.get());
break;
}
- Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref)
- << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref)
+ << Arg->getSourceRange();
return ExprError();
}
auto *VD = const_cast<ValueDecl *>(
@@ -6384,9 +6377,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// -- the name of a non-type template-parameter; or
llvm::APSInt Value;
if (!ArgType->isIntegralOrEnumerationType()) {
- Diag(Arg->getLocStart(),
- diag::err_template_arg_not_integral_or_enumeral)
- << ArgType << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::err_template_arg_not_integral_or_enumeral)
+ << ArgType << Arg->getSourceRange();
Diag(Param->getLocation(), diag::note_template_param_here);
return ExprError();
} else if (!Arg->isValueDependent()) {
@@ -6424,9 +6416,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
Arg = ImpCastExprToType(Arg, ParamType, CK_IntegralCast).get();
} else {
// We can't perform this conversion.
- Diag(Arg->getLocStart(),
- diag::err_template_arg_not_convertible)
- << Arg->getType() << ParamType << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::err_template_arg_not_convertible)
+ << Arg->getType() << ParamType << Arg->getSourceRange();
Diag(Param->getLocation(), diag::note_template_param_here);
return ExprError();
}
@@ -6465,9 +6456,9 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
// Complain if an unsigned parameter received a negative value.
if (IntegerType->isUnsignedIntegerOrEnumerationType()
&& (OldValue.isSigned() && OldValue.isNegative())) {
- Diag(Arg->getLocStart(), diag::warn_template_arg_negative)
- << OldValue.toString(10) << Value.toString(10) << Param->getType()
- << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::warn_template_arg_negative)
+ << OldValue.toString(10) << Value.toString(10) << Param->getType()
+ << Arg->getSourceRange();
Diag(Param->getLocation(), diag::note_template_param_here);
}
@@ -6480,10 +6471,9 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
else
RequiredBits = OldValue.getMinSignedBits();
if (RequiredBits > AllowedBits) {
- Diag(Arg->getLocStart(),
- diag::warn_template_arg_too_large)
- << OldValue.toString(10) << Value.toString(10) << Param->getType()
- << Arg->getSourceRange();
+ Diag(Arg->getBeginLoc(), diag::warn_template_arg_too_large)
+ << OldValue.toString(10) << Value.toString(10) << Param->getType()
+ << Arg->getSourceRange();
Diag(Param->getLocation(), diag::note_template_param_here);
}
}
@@ -6526,7 +6516,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
if (FunctionDecl *Fn = ResolveAddressOfOverloadedFunction(Arg, ParamType,
true,
FoundResult)) {
- if (DiagnoseUseOfDecl(Fn, Arg->getLocStart()))
+ if (DiagnoseUseOfDecl(Fn, Arg->getBeginLoc()))
return ExprError();
Arg = FixOverloadedFunctionReference(Arg, FoundResult, Fn);
@@ -6579,7 +6569,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
ParamRefType->getPointeeType(),
true,
FoundResult)) {
- if (DiagnoseUseOfDecl(Fn, Arg->getLocStart()))
+ if (DiagnoseUseOfDecl(Fn, Arg->getBeginLoc()))
return ExprError();
Arg = FixOverloadedFunctionReference(Arg, FoundResult, Fn);
@@ -7357,9 +7347,9 @@ static bool CheckNonTypeTemplatePartialSpecializationArgs(
ParamUseRange = findTemplateParameter(
Param->getDepth(), Param->getTypeSourceInfo()->getTypeLoc());
if (ParamUseRange.isValid()) {
- S.Diag(IsDefaultArgument ? TemplateNameLoc : ArgExpr->getLocStart(),
+ S.Diag(IsDefaultArgument ? TemplateNameLoc : ArgExpr->getBeginLoc(),
diag::err_dependent_typed_non_type_arg_in_partial_spec)
- << Param->getType();
+ << Param->getType();
S.Diag(Param->getLocation(), diag::note_template_param_here)
<< (IsDefaultArgument ? ParamUseRange : SourceRange())
<< ParamUseRange;
@@ -8573,7 +8563,7 @@ static void dllExportImportClassTemplateSpecialization(
for (auto &B : Def->bases()) {
if (auto *BT = dyn_cast_or_null<ClassTemplateSpecializationDecl>(
B.getType()->getAsCXXRecordDecl()))
- S.propagateDLLAttrToBaseClassTemplate(Def, A, BT, B.getLocStart());
+ S.propagateDLLAttrToBaseClassTemplate(Def, A, BT, B.getBeginLoc());
}
S.referenceDLLExportedClassMethods();
@@ -8990,10 +8980,9 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
DeclarationName Name = NameInfo.getName();
if (!Name) {
if (!D.isInvalidType())
- Diag(D.getDeclSpec().getLocStart(),
+ Diag(D.getDeclSpec().getBeginLoc(),
diag::err_explicit_instantiation_requires_name)
- << D.getDeclSpec().getSourceRange()
- << D.getSourceRange();
+ << D.getDeclSpec().getSourceRange() << D.getSourceRange();
return true;
}
@@ -9046,8 +9035,8 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
// A deduction guide is not on the list of entities that can be explicitly
// instantiated.
if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) {
- Diag(D.getDeclSpec().getLocStart(), diag::err_deduction_guide_specialized)
- << /*explicit instantiation*/ 0;
+ Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_specialized)
+ << /*explicit instantiation*/ 0;
return true;
}
@@ -9105,7 +9094,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
//
// This includes auto-typed variable template instantiations.
if (R->isUndeducedType()) {
- Diag(T->getTypeLoc().getLocStart(),
+ Diag(T->getTypeLoc().getBeginLoc(),
diag::err_auto_not_allowed_var_inst);
return true;
}
@@ -9175,7 +9164,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
// Check the new variable specialization against the parsed input.
if (PrevTemplate && Prev && !Context.hasSameType(Prev->getType(), R)) {
- Diag(T->getTypeLoc().getLocStart(),
+ Diag(T->getTypeLoc().getBeginLoc(),
diag::err_invalid_var_template_spec_type)
<< 0 << PrevTemplate << R << Prev->getType();
Diag(PrevTemplate->getLocation(), diag::note_template_declared_here)
@@ -9293,7 +9282,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
PDiag(DiagID) << Specialization->getType(),
PDiag(diag::note_explicit_instantiation_here),
Specialization->getType()->getAs<FunctionProtoType>(),
- Specialization->getLocation(), FPT, D.getLocStart());
+ Specialization->getLocation(), FPT, D.getBeginLoc());
// In Microsoft mode, mismatching exception specifications just cause a
// warning.
if (!getLangOpts().MicrosoftExt && Result)
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index df46d6115a2..192ab8eb242 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -4423,11 +4423,11 @@ Sema::DeduceAutoType(TypeLoc Type, Expr *&Init, QualType &Result,
if (const AutoType *AT = Type.getType()->getAs<AutoType>()) {
if (AT->isDecltypeAuto()) {
if (isa<InitListExpr>(Init)) {
- Diag(Init->getLocStart(), diag::err_decltype_auto_initializer_list);
+ Diag(Init->getBeginLoc(), diag::err_decltype_auto_initializer_list);
return DAR_FailedAlreadyDiagnosed;
}
- QualType Deduced = BuildDecltypeType(Init, Init->getLocStart(), false);
+ QualType Deduced = BuildDecltypeType(Init, Init->getBeginLoc(), false);
if (Deduced.isNull())
return DAR_FailedAlreadyDiagnosed;
// FIXME: Support a non-canonical deduced type for 'auto'.
@@ -4438,7 +4438,7 @@ Sema::DeduceAutoType(TypeLoc Type, Expr *&Init, QualType &Result,
return DAR_Succeeded;
} else if (!getLangOpts().CPlusPlus) {
if (isa<InitListExpr>(Init)) {
- Diag(Init->getLocStart(), diag::err_auto_init_list_from_c);
+ Diag(Init->getBeginLoc(), diag::err_auto_init_list_from_c);
return DAR_FailedAlreadyDiagnosed;
}
}
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 1aa69bd35d6..536f0b79190 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1789,7 +1789,7 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
ExprResult NewArg = SubstExpr(Arg, TemplateArgs);
if (NewArg.isUsable()) {
// It would be nice if we still had this.
- SourceLocation EqualLoc = NewArg.get()->getLocStart();
+ SourceLocation EqualLoc = NewArg.get()->getBeginLoc();
SetParamDefaultArgument(NewParm, NewArg.get(), EqualLoc);
}
} else {
@@ -2337,7 +2337,7 @@ bool Sema::InstantiateInClassInitializer(
Expr *Init = NewInit.get();
assert((!Init || !isa<ParenListExpr>(Init)) && "call-style init in class");
ActOnFinishCXXInClassMemberInitializer(
- Instantiation, Init ? Init->getLocStart() : SourceLocation(), Init);
+ Instantiation, Init ? Init->getBeginLoc() : SourceLocation(), Init);
if (auto *L = getASTMutationListener())
L->DefaultMemberInitializerInstantiated(Instantiation);
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 86492716f68..21c946a6281 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -562,7 +562,7 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D,
RD->getEnclosingNamespaceContext() == SemaRef.getStdNamespace() &&
RD->getIdentifier() && RD->getIdentifier()->isStr("common_type") &&
D->getIdentifier() && D->getIdentifier()->isStr("type") &&
- SemaRef.getSourceManager().isInSystemHeader(D->getLocStart()))
+ SemaRef.getSourceManager().isInSystemHeader(D->getBeginLoc()))
// Fold it to the (non-reference) type which g++ would have produced.
DI = SemaRef.Context.getTrivialTypeSourceInfo(
DI->getType().getNonReferenceType());
@@ -570,10 +570,10 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D,
// Create the new typedef
TypedefNameDecl *Typedef;
if (IsTypeAlias)
- Typedef = TypeAliasDecl::Create(SemaRef.Context, Owner, D->getLocStart(),
+ Typedef = TypeAliasDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
D->getLocation(), D->getIdentifier(), DI);
else
- Typedef = TypedefDecl::Create(SemaRef.Context, Owner, D->getLocStart(),
+ Typedef = TypedefDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
D->getLocation(), D->getIdentifier(), DI);
if (Invalid)
Typedef->setInvalidDecl();
@@ -872,7 +872,7 @@ Decl *TemplateDeclInstantiator::VisitMSPropertyDecl(MSPropertyDecl *D) {
MSPropertyDecl *Property = MSPropertyDecl::Create(
SemaRef.Context, Owner, D->getLocation(), D->getDeclName(), DI->getType(),
- DI, D->getLocStart(), D->getGetterId(), D->getSetterId());
+ DI, D->getBeginLoc(), D->getGetterId(), D->getSetterId());
SemaRef.InstantiateAttrs(TemplateArgs, D, Property, LateAttrs,
StartingScope);
@@ -932,7 +932,7 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) {
if (!InstTy)
return nullptr;
- FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getLocStart(),
+ FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getBeginLoc(),
D->getFriendLoc(), InstTy);
if (!FD)
return nullptr;
@@ -991,10 +991,10 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
PrevDecl = cast<EnumDecl>(Prev);
}
- EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getLocStart(),
- D->getLocation(), D->getIdentifier(),
- PrevDecl, D->isScoped(),
- D->isScopedUsingClassTag(), D->isFixed());
+ EnumDecl *Enum =
+ EnumDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(),
+ D->getLocation(), D->getIdentifier(), PrevDecl,
+ D->isScoped(), D->isScopedUsingClassTag(), D->isFixed());
if (D->isFixed()) {
if (TypeSourceInfo *TI = D->getIntegerTypeSourceInfo()) {
// If we have type source information for the underlying type, it means it
@@ -1250,11 +1250,10 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
}
}
- CXXRecordDecl *RecordInst
- = CXXRecordDecl::Create(SemaRef.Context, Pattern->getTagKind(), DC,
- Pattern->getLocStart(), Pattern->getLocation(),
- Pattern->getIdentifier(), PrevDecl,
- /*DelayTypeCreation=*/true);
+ CXXRecordDecl *RecordInst = CXXRecordDecl::Create(
+ SemaRef.Context, Pattern->getTagKind(), DC, Pattern->getBeginLoc(),
+ Pattern->getLocation(), Pattern->getIdentifier(), PrevDecl,
+ /*DelayTypeCreation=*/true);
if (QualifierLoc)
RecordInst->setQualifierInfo(QualifierLoc);
@@ -1484,10 +1483,9 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
PrevDecl = cast<CXXRecordDecl>(Prev);
}
- CXXRecordDecl *Record
- = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner,
- D->getLocStart(), D->getLocation(),
- D->getIdentifier(), PrevDecl);
+ CXXRecordDecl *Record = CXXRecordDecl::Create(
+ SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(),
+ D->getLocation(), D->getIdentifier(), PrevDecl);
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, Record))
@@ -2119,7 +2117,7 @@ Decl *TemplateDeclInstantiator::VisitTemplateTypeParmDecl(
assert(D->getTypeForDecl()->isTemplateTypeParmType());
TemplateTypeParmDecl *Inst = TemplateTypeParmDecl::Create(
- SemaRef.Context, Owner, D->getLocStart(), D->getLocation(),
+ SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(),
D->getDepth() - TemplateArgs.getNumSubstitutedLevels(), D->getIndex(),
D->getIdentifier(), D->wasDeclaredWithTypename(), D->isParameterPack());
Inst->setAccess(AS_public);
@@ -2931,15 +2929,10 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
}
// Create the class template partial specialization declaration.
- ClassTemplateSpecializationDecl *InstD
- = ClassTemplateSpecializationDecl::Create(SemaRef.Context,
- D->getTagKind(),
- Owner,
- D->getLocStart(),
- D->getLocation(),
- InstClassTemplate,
- Converted,
- PrevDecl);
+ ClassTemplateSpecializationDecl *InstD =
+ ClassTemplateSpecializationDecl::Create(
+ SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(),
+ D->getLocation(), InstClassTemplate, Converted, PrevDecl);
// Add this partial specialization to the set of class template partial
// specializations.
@@ -3008,7 +3001,7 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(
// Check that the template argument list is well-formed for this template.
SmallVector<TemplateArgument, 4> Converted;
if (SemaRef.CheckTemplateArgumentList(
- VarTemplate, VarTemplate->getLocStart(),
+ VarTemplate, VarTemplate->getBeginLoc(),
const_cast<TemplateArgumentListInfo &>(VarTemplateArgsInfo), false,
Converted))
return nullptr;
@@ -3237,18 +3230,11 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
// Create the class template partial specialization declaration.
- ClassTemplatePartialSpecializationDecl *InstPartialSpec
- = ClassTemplatePartialSpecializationDecl::Create(SemaRef.Context,
- PartialSpec->getTagKind(),
- Owner,
- PartialSpec->getLocStart(),
- PartialSpec->getLocation(),
- InstParams,
- ClassTemplate,
- Converted,
- InstTemplateArgs,
- CanonType,
- nullptr);
+ ClassTemplatePartialSpecializationDecl *InstPartialSpec =
+ ClassTemplatePartialSpecializationDecl::Create(
+ SemaRef.Context, PartialSpec->getTagKind(), Owner,
+ PartialSpec->getBeginLoc(), PartialSpec->getLocation(), InstParams,
+ ClassTemplate, Converted, InstTemplateArgs, CanonType, nullptr);
// Substitute the nested name specifier, if any.
if (SubstQualifier(PartialSpec, InstPartialSpec))
return nullptr;
@@ -3823,7 +3809,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
std::make_pair(Function, PointOfInstantiation));
} else if (TSK == TSK_ImplicitInstantiation) {
if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
- !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) {
+ !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) {
Diag(PointOfInstantiation, diag::warn_func_template_missing)
<< Function;
Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
@@ -4366,7 +4352,7 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
} else if (TSK == TSK_ImplicitInstantiation) {
// Warn about missing definition at the end of translation unit.
if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() &&
- !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) {
+ !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) {
Diag(PointOfInstantiation, diag::warn_var_template_missing)
<< Var;
Diag(PatternDecl->getLocation(), diag::note_forward_template_decl);
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp
index 6f9dddf5c05..b95a1391554 100644
--- a/clang/lib/Sema/SemaTemplateVariadic.cpp
+++ b/clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -392,7 +392,7 @@ bool Sema::DiagnoseUnexpandedParameterPack(Expr *E,
SmallVector<UnexpandedParameterPack, 2> Unexpanded;
CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E);
assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs");
- return DiagnoseUnexpandedParameterPacks(E->getLocStart(), UPPC, Unexpanded);
+ return DiagnoseUnexpandedParameterPacks(E->getBeginLoc(), UPPC, Unexpanded);
}
bool Sema::DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS,
@@ -1125,7 +1125,7 @@ static void CheckFoldOperand(Sema &S, Expr *E) {
isa<AbstractConditionalOperator>(E)) {
S.Diag(E->getExprLoc(), diag::err_fold_expression_bad_operand)
<< E->getSourceRange()
- << FixItHint::CreateInsertion(E->getLocStart(), "(")
+ << FixItHint::CreateInsertion(E->getBeginLoc(), "(")
<< FixItHint::CreateInsertion(E->getLocEnd(), ")");
}
}
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index df0da5e7e1d..9e80541709b 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -656,7 +656,7 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state,
// faking up the function chunk is still the right thing to do.
// Otherwise, we need to fake up a function declarator.
- SourceLocation loc = declarator.getLocStart();
+ SourceLocation loc = declarator.getBeginLoc();
// ...and *prepend* it to the declarator.
SourceLocation NoLoc;
@@ -808,17 +808,17 @@ static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,
rangeToRemove = attr.getLocalSourceRange();
if (attr.getTypePtr()->getImmediateNullability()) {
typeArg = attr.getTypePtr()->getModifiedType();
- S.Diag(attr.getLocStart(),
+ S.Diag(attr.getBeginLoc(),
diag::err_objc_type_arg_explicit_nullability)
- << typeArg << FixItHint::CreateRemoval(rangeToRemove);
+ << typeArg << FixItHint::CreateRemoval(rangeToRemove);
diagnosed = true;
}
}
if (!diagnosed) {
- S.Diag(qual.getLocStart(), diag::err_objc_type_arg_qualified)
- << typeArg << typeArg.getQualifiers().getAsString()
- << FixItHint::CreateRemoval(rangeToRemove);
+ S.Diag(qual.getBeginLoc(), diag::err_objc_type_arg_qualified)
+ << typeArg << typeArg.getQualifiers().getAsString()
+ << FixItHint::CreateRemoval(rangeToRemove);
}
}
@@ -878,9 +878,9 @@ static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,
}
// Diagnose the mismatch.
- S.Diag(typeArgInfo->getTypeLoc().getLocStart(),
+ S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(),
diag::err_objc_type_arg_does_not_match_bound)
- << typeArg << bound << typeParam->getDeclName();
+ << typeArg << bound << typeParam->getDeclName();
S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here)
<< typeParam->getDeclName();
@@ -906,9 +906,9 @@ static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,
continue;
// Diagnose the mismatch.
- S.Diag(typeArgInfo->getTypeLoc().getLocStart(),
+ S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(),
diag::err_objc_type_arg_does_not_match_bound)
- << typeArg << bound << typeParam->getDeclName();
+ << typeArg << bound << typeParam->getDeclName();
S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here)
<< typeParam->getDeclName();
@@ -924,10 +924,9 @@ static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,
}
// Diagnose non-id-compatible type arguments.
- S.Diag(typeArgInfo->getTypeLoc().getLocStart(),
+ S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(),
diag::err_objc_type_arg_not_id_compatible)
- << typeArg
- << typeArgInfo->getTypeLoc().getSourceRange();
+ << typeArg << typeArgInfo->getTypeLoc().getSourceRange();
if (failOnError)
return QualType();
@@ -1186,7 +1185,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
DeclSpec &DS = declarator.getMutableDeclSpec();
SourceLocation DeclLoc = declarator.getIdentifierLoc();
if (DeclLoc.isInvalid())
- DeclLoc = DS.getLocStart();
+ DeclLoc = DS.getBeginLoc();
ASTContext &Context = S.Context;
@@ -1268,8 +1267,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
// when one is not allowed.
if (DS.isEmpty()) {
S.Diag(DeclLoc, diag::ext_missing_declspec)
- << DS.getSourceRange()
- << FixItHint::CreateInsertion(DS.getLocStart(), "int");
+ << DS.getSourceRange()
+ << FixItHint::CreateInsertion(DS.getBeginLoc(), "int");
}
} else if (!DS.hasTypeSpecifier()) {
// C99 and C++ require a type specifier. For example, C99 6.7.2p2 says:
@@ -2117,8 +2116,8 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
if (!getLangOpts().CPlusPlus11 &&
ArraySize && !ArraySize->isTypeDependent() &&
!ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) {
- Diag(ArraySize->getLocStart(), diag::err_array_size_non_int)
- << ArraySize->getType() << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int)
+ << ArraySize->getType() << ArraySize->getSourceRange();
return QualType();
}
@@ -2137,8 +2136,8 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
// of a VLA.
if (getLangOpts().CPlusPlus11 &&
!ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) {
- Diag(ArraySize->getLocStart(), diag::err_array_size_non_int)
- << ArraySize->getType() << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int)
+ << ArraySize->getType() << ArraySize->getSourceRange();
return QualType();
}
@@ -2151,25 +2150,25 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
// have a value greater than zero.
if (ConstVal.isSigned() && ConstVal.isNegative()) {
if (Entity)
- Diag(ArraySize->getLocStart(), diag::err_decl_negative_array_size)
- << getPrintableNameForEntity(Entity) << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), diag::err_decl_negative_array_size)
+ << getPrintableNameForEntity(Entity) << ArraySize->getSourceRange();
else
- Diag(ArraySize->getLocStart(), diag::err_typecheck_negative_array_size)
- << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), diag::err_typecheck_negative_array_size)
+ << ArraySize->getSourceRange();
return QualType();
}
if (ConstVal == 0) {
// GCC accepts zero sized static arrays. We allow them when
// we're not in a SFINAE context.
- Diag(ArraySize->getLocStart(),
- isSFINAEContext()? diag::err_typecheck_zero_array_size
- : diag::ext_typecheck_zero_array_size)
- << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), isSFINAEContext()
+ ? diag::err_typecheck_zero_array_size
+ : diag::ext_typecheck_zero_array_size)
+ << ArraySize->getSourceRange();
if (ASM == ArrayType::Static) {
- Diag(ArraySize->getLocStart(),
+ Diag(ArraySize->getBeginLoc(),
diag::warn_typecheck_zero_static_array_size)
- << ArraySize->getSourceRange();
+ << ArraySize->getSourceRange();
ASM = ArrayType::Normal;
}
} else if (!T->isDependentType() && !T->isVariablyModifiedType() &&
@@ -2178,9 +2177,8 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
unsigned ActiveSizeBits
= ConstantArrayType::getNumAddressingBits(Context, T, ConstVal);
if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) {
- Diag(ArraySize->getLocStart(), diag::err_array_too_large)
- << ConstVal.toString(10)
- << ArraySize->getSourceRange();
+ Diag(ArraySize->getBeginLoc(), diag::err_array_too_large)
+ << ConstVal.toString(10) << ArraySize->getSourceRange();
return QualType();
}
}
@@ -2873,9 +2871,9 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
TemplateTypeParmDecl *CorrespondingTemplateParam =
TemplateTypeParmDecl::Create(
SemaRef.Context, SemaRef.Context.getTranslationUnitDecl(),
- /*KeyLoc*/SourceLocation(), /*NameLoc*/D.getLocStart(),
+ /*KeyLoc*/ SourceLocation(), /*NameLoc*/ D.getBeginLoc(),
TemplateParameterDepth, AutoParameterPosition,
- /*Identifier*/nullptr, false, IsParameterPack);
+ /*Identifier*/ nullptr, false, IsParameterPack);
LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam);
// Replace the 'auto' in the function parameter with this invented
// template type parameter.
@@ -3302,8 +3300,8 @@ static void warnAboutRedundantParens(Sema &S, Declarator &D, QualType T) {
<< D.getIdentifier();
// FIXME: A cast to void is probably a better suggestion in cases where it's
// valid (when there is no initializer and we're not in a condition).
- S.Diag(D.getLocStart(), diag::note_function_style_cast_add_parentheses)
- << FixItHint::CreateInsertion(D.getLocStart(), "(")
+ S.Diag(D.getBeginLoc(), diag::note_function_style_cast_add_parentheses)
+ << FixItHint::CreateInsertion(D.getBeginLoc(), "(")
<< FixItHint::CreateInsertion(S.getLocForEndOfToken(D.getLocEnd()), ")");
S.Diag(Paren.Loc, diag::note_remove_parens_for_variable_declaration)
<< FixItHint::CreateRemoval(Paren.Loc)
@@ -4386,14 +4384,13 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
} else if (FTI.hasTrailingReturnType()) {
// T must be exactly 'auto' at this point. See CWG issue 681.
if (isa<ParenType>(T)) {
- S.Diag(D.getLocStart(),
- diag::err_trailing_return_in_parens)
- << T << D.getSourceRange();
+ S.Diag(D.getBeginLoc(), diag::err_trailing_return_in_parens)
+ << T << D.getSourceRange();
D.setInvalidType(true);
} else if (D.getName().getKind() ==
UnqualifiedIdKind::IK_DeductionGuideName) {
if (T != Context.DependentTy) {
- S.Diag(D.getDeclSpec().getLocStart(),
+ S.Diag(D.getDeclSpec().getBeginLoc(),
diag::err_deduction_guide_with_complex_decl)
<< D.getSourceRange();
D.setInvalidType(true);
@@ -4475,7 +4472,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
if (T->isObjCObjectType()) {
SourceLocation DiagLoc, FixitLoc;
if (TInfo) {
- DiagLoc = TInfo->getTypeLoc().getLocStart();
+ DiagLoc = TInfo->getTypeLoc().getBeginLoc();
FixitLoc = S.getLocForEndOfToken(TInfo->getTypeLoc().getLocEnd());
} else {
DiagLoc = D.getDeclSpec().getTypeSpecTypeLoc();
@@ -4887,7 +4884,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
!IsTypedefName &&
D.getContext() != DeclaratorContext::TemplateArgContext &&
D.getContext() != DeclaratorContext::TemplateTypeArgContext) {
- SourceLocation Loc = D.getLocStart();
+ SourceLocation Loc = D.getBeginLoc();
SourceRange RemovalRange;
unsigned I;
if (D.isFunctionDeclarator(I)) {
@@ -7097,8 +7094,9 @@ static void HandleOpenCLAccessAttr(QualType &CurType, const ParsedAttr &Attr,
assert(0 && "Unable to find corresponding image type.");
}
- S.Diag(TypedefTy->getDecl()->getLocStart(),
- diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
+ S.Diag(TypedefTy->getDecl()->getBeginLoc(),
+ diag::note_opencl_typedef_access_qualifier)
+ << PrevAccessQual;
} else if (CurType->isPipeType()) {
if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) {
QualType ElemType = CurType->getAs<PipeType>()->getElementType();
@@ -7362,9 +7360,10 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
case TAL_DeclName:
state.getSema().Diag(attr.getLoc(),
diag::err_objc_kindof_wrong_position)
- << FixItHint::CreateRemoval(attr.getLoc())
- << FixItHint::CreateInsertion(
- state.getDeclarator().getDeclSpec().getLocStart(), "__kindof ");
+ << FixItHint::CreateRemoval(attr.getLoc())
+ << FixItHint::CreateInsertion(
+ state.getDeclarator().getDeclSpec().getBeginLoc(),
+ "__kindof ");
break;
}
@@ -7862,7 +7861,7 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T,
Diag(RD->getLocation(), diag::note_non_literal_virtual_base)
<< getLiteralDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases();
for (const auto &I : RD->vbases())
- Diag(I.getLocStart(), diag::note_constexpr_virtual_base_here)
+ Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here)
<< I.getSourceRange();
} else if (!RD->isAggregate() && !RD->hasConstexprNonCopyMoveConstructor() &&
!RD->hasTrivialDefaultConstructor()) {
@@ -7870,9 +7869,8 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T,
} else if (RD->hasNonLiteralTypeFieldsOrBases()) {
for (const auto &I : RD->bases()) {
if (!I.getType()->isLiteralType(Context)) {
- Diag(I.getLocStart(),
- diag::note_non_literal_base_class)
- << RD << I.getType() << I.getSourceRange();
+ Diag(I.getBeginLoc(), diag::note_non_literal_base_class)
+ << RD << I.getType() << I.getSourceRange();
return true;
}
}
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index de83c1295cc..bf7ff9152a0 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -3394,7 +3394,7 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
// If this was list initialization, revert to syntactic list form.
if (Construct->isListInitialization())
- return getDerived().RebuildInitList(Construct->getLocStart(), NewArgs,
+ return getDerived().RebuildInitList(Construct->getBeginLoc(), NewArgs,
Construct->getLocEnd());
// Build a ParenListExpr to represent anything else.
@@ -6411,16 +6411,10 @@ TreeTransform<Derived>::TransformObjCObjectType(TypeLocBuilder &TLB,
if (getDerived().AlwaysRebuild() || AnyChanged) {
// Rebuild the type.
Result = getDerived().RebuildObjCObjectType(
- BaseType,
- TL.getLocStart(),
- TL.getTypeArgsLAngleLoc(),
- NewTypeArgInfos,
- TL.getTypeArgsRAngleLoc(),
- TL.getProtocolLAngleLoc(),
- llvm::makeArrayRef(TL.getTypePtr()->qual_begin(),
- TL.getNumProtocols()),
- TL.getProtocolLocs(),
- TL.getProtocolRAngleLoc());
+ BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos,
+ TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(),
+ llvm::makeArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()),
+ TL.getProtocolLocs(), TL.getProtocolRAngleLoc());
if (Result.isNull())
return QualType();
@@ -6656,7 +6650,7 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
if (Then.isInvalid())
return StmtError();
} else {
- Then = new (getSema().Context) NullStmt(S->getThen()->getLocStart());
+ Then = new (getSema().Context) NullStmt(S->getThen()->getBeginLoc());
}
// Transform the "else" branch.
@@ -7708,7 +7702,7 @@ StmtResult TreeTransform<Derived>::TransformOMPExecutableDirective(
return getDerived().RebuildOMPExecutableDirective(
D->getDirectiveKind(), DirName, CancelRegion, TClauses,
- AssociatedStmt.get(), D->getLocStart(), D->getLocEnd());
+ AssociatedStmt.get(), D->getBeginLoc(), D->getLocEnd());
}
template <typename Derived>
@@ -7716,7 +7710,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7727,7 +7721,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7738,7 +7732,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPForDirective(OMPForDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_for, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7749,7 +7743,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPForSimdDirective(OMPForSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_for_simd, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7760,7 +7754,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPSectionsDirective(OMPSectionsDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_sections, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7771,7 +7765,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPSectionDirective(OMPSectionDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_section, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7782,7 +7776,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPSingleDirective(OMPSingleDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_single, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7793,7 +7787,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPMasterDirective(OMPMasterDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_master, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7803,7 +7797,7 @@ template <typename Derived>
StmtResult
TreeTransform<Derived>::TransformOMPCriticalDirective(OMPCriticalDirective *D) {
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_critical, D->getDirectiveName(), nullptr, D->getLocStart());
+ OMPD_critical, D->getDirectiveName(), nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7814,7 +7808,7 @@ StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
OMPParallelForDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7825,7 +7819,7 @@ StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
OMPParallelForSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for_simd, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7836,7 +7830,7 @@ StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
OMPParallelSectionsDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_sections, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7847,7 +7841,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPTaskDirective(OMPTaskDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_task, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7858,7 +7852,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTaskyieldDirective(
OMPTaskyieldDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_taskyield, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7869,7 +7863,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPBarrierDirective(OMPBarrierDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_barrier, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7880,7 +7874,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_taskwait, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7891,7 +7885,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTaskgroupDirective(
OMPTaskgroupDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_taskgroup, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7902,7 +7896,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPFlushDirective(OMPFlushDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_flush, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7913,7 +7907,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPOrderedDirective(OMPOrderedDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_ordered, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7924,7 +7918,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPAtomicDirective(OMPAtomicDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_atomic, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7935,7 +7929,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPTargetDirective(OMPTargetDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7946,7 +7940,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetDataDirective(
OMPTargetDataDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_data, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7957,7 +7951,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetEnterDataDirective(
OMPTargetEnterDataDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_enter_data, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7968,7 +7962,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetExitDataDirective(
OMPTargetExitDataDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_exit_data, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7979,7 +7973,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetParallelDirective(
OMPTargetParallelDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -7990,7 +7984,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForDirective(
OMPTargetParallelForDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8001,7 +7995,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetUpdateDirective(
OMPTargetUpdateDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_update, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8012,7 +8006,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPTeamsDirective(OMPTeamsDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_teams, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8023,7 +8017,7 @@ StmtResult TreeTransform<Derived>::TransformOMPCancellationPointDirective(
OMPCancellationPointDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_cancellation_point, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8034,7 +8028,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPCancelDirective(OMPCancelDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_cancel, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8045,7 +8039,7 @@ StmtResult
TreeTransform<Derived>::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8056,7 +8050,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
OMPTaskLoopSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop_simd, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8067,7 +8061,7 @@ StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
OMPDistributeDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8078,7 +8072,7 @@ StmtResult TreeTransform<Derived>::TransformOMPDistributeParallelForDirective(
OMPDistributeParallelForDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_distribute_parallel_for, DirName, nullptr, D->getLocStart());
+ OMPD_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8090,7 +8084,7 @@ TreeTransform<Derived>::TransformOMPDistributeParallelForSimdDirective(
OMPDistributeParallelForSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getLocStart());
+ OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8101,7 +8095,7 @@ StmtResult TreeTransform<Derived>::TransformOMPDistributeSimdDirective(
OMPDistributeSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute_simd, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8111,9 +8105,8 @@ template <typename Derived>
StmtResult TreeTransform<Derived>::TransformOMPTargetParallelForSimdDirective(
OMPTargetParallelForSimdDirective *D) {
DeclarationNameInfo DirName;
- getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for_simd,
- DirName, nullptr,
- D->getLocStart());
+ getDerived().getSema().StartOpenMPDSABlock(
+ OMPD_target_parallel_for_simd, DirName, nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8124,7 +8117,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetSimdDirective(
OMPTargetSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_simd, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8135,7 +8128,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeDirective(
OMPTeamsDistributeDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8146,7 +8139,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeSimdDirective(
OMPTeamsDistributeSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_teams_distribute_simd, DirName, nullptr, D->getLocStart());
+ OMPD_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8157,7 +8150,8 @@ StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForSimdDir
OMPTeamsDistributeParallelForSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_teams_distribute_parallel_for_simd, DirName, nullptr, D->getLocStart());
+ OMPD_teams_distribute_parallel_for_simd, DirName, nullptr,
+ D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8167,8 +8161,8 @@ template <typename Derived>
StmtResult TreeTransform<Derived>::TransformOMPTeamsDistributeParallelForDirective(
OMPTeamsDistributeParallelForDirective *D) {
DeclarationNameInfo DirName;
- getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute_parallel_for,
- DirName, nullptr, D->getLocStart());
+ getDerived().getSema().StartOpenMPDSABlock(
+ OMPD_teams_distribute_parallel_for, DirName, nullptr, D->getBeginLoc());
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8179,7 +8173,7 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDirective(
OMPTargetTeamsDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams, DirName,
- nullptr, D->getLocStart());
+ nullptr, D->getBeginLoc());
auto Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8189,8 +8183,8 @@ template <typename Derived>
StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective(
OMPTargetTeamsDistributeDirective *D) {
DeclarationNameInfo DirName;
- getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams_distribute,
- DirName, nullptr, D->getLocStart());
+ getDerived().getSema().StartOpenMPDSABlock(
+ OMPD_target_teams_distribute, DirName, nullptr, D->getBeginLoc());
auto Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8203,7 +8197,7 @@ TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective(
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
OMPD_target_teams_distribute_parallel_for, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
auto Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8216,7 +8210,7 @@ StmtResult TreeTransform<Derived>::
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
OMPD_target_teams_distribute_parallel_for_simd, DirName, nullptr,
- D->getLocStart());
+ D->getBeginLoc());
auto Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8228,7 +8222,7 @@ TreeTransform<Derived>::TransformOMPTargetTeamsDistributeSimdDirective(
OMPTargetTeamsDistributeSimdDirective *D) {
DeclarationNameInfo DirName;
getDerived().getSema().StartOpenMPDSABlock(
- OMPD_target_teams_distribute_simd, DirName, nullptr, D->getLocStart());
+ OMPD_target_teams_distribute_simd, DirName, nullptr, D->getBeginLoc());
auto Res = getDerived().TransformOMPExecutableDirective(D);
getDerived().getSema().EndOpenMPDSABlock(Res.get());
return Res;
@@ -8244,7 +8238,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *C) {
if (Cond.isInvalid())
return nullptr;
return getDerived().RebuildOMPIfClause(
- C->getNameModifier(), Cond.get(), C->getLocStart(), C->getLParenLoc(),
+ C->getNameModifier(), Cond.get(), C->getBeginLoc(), C->getLParenLoc(),
C->getNameModifierLoc(), C->getColonLoc(), C->getLocEnd());
}
@@ -8253,7 +8247,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPFinalClause(OMPFinalClause *C) {
ExprResult Cond = getDerived().TransformExpr(C->getCondition());
if (Cond.isInvalid())
return nullptr;
- return getDerived().RebuildOMPFinalClause(Cond.get(), C->getLocStart(),
+ return getDerived().RebuildOMPFinalClause(Cond.get(), C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8264,7 +8258,7 @@ TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *C) {
if (NumThreads.isInvalid())
return nullptr;
return getDerived().RebuildOMPNumThreadsClause(
- NumThreads.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8274,7 +8268,7 @@ TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPSafelenClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8284,7 +8278,7 @@ TreeTransform<Derived>::TransformOMPSimdlenClause(OMPSimdlenClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPSimdlenClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8294,14 +8288,14 @@ TreeTransform<Derived>::TransformOMPCollapseClause(OMPCollapseClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPCollapseClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *C) {
return getDerived().RebuildOMPDefaultClause(
- C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getLocStart(),
+ C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8309,7 +8303,7 @@ template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPProcBindClause(OMPProcBindClause *C) {
return getDerived().RebuildOMPProcBindClause(
- C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getLocStart(),
+ C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8321,7 +8315,7 @@ TreeTransform<Derived>::TransformOMPScheduleClause(OMPScheduleClause *C) {
return nullptr;
return getDerived().RebuildOMPScheduleClause(
C->getFirstScheduleModifier(), C->getSecondScheduleModifier(),
- C->getScheduleKind(), E.get(), C->getLocStart(), C->getLParenLoc(),
+ C->getScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
C->getFirstScheduleModifierLoc(), C->getSecondScheduleModifierLoc(),
C->getScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd());
}
@@ -8335,7 +8329,7 @@ TreeTransform<Derived>::TransformOMPOrderedClause(OMPOrderedClause *C) {
if (E.isInvalid())
return nullptr;
}
- return getDerived().RebuildOMPOrderedClause(C->getLocStart(), C->getLocEnd(),
+ return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getLocEnd(),
C->getLParenLoc(), E.get());
}
@@ -8425,7 +8419,7 @@ TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPPrivateClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8440,7 +8434,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPFirstprivateClause(
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPFirstprivateClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8455,7 +8449,7 @@ TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *C) {
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPLastprivateClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8469,7 +8463,7 @@ TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
return nullptr;
Vars.push_back(EVar.get());
}
- return getDerived().RebuildOMPSharedClause(Vars, C->getLocStart(),
+ return getDerived().RebuildOMPSharedClause(Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8516,7 +8510,7 @@ TreeTransform<Derived>::TransformOMPReductionClause(OMPReductionClause *C) {
UnresolvedReductions.push_back(nullptr);
}
return getDerived().RebuildOMPReductionClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(),
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
}
@@ -8561,7 +8555,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPTaskReductionClause(
UnresolvedReductions.push_back(nullptr);
}
return getDerived().RebuildOMPTaskReductionClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(),
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
}
@@ -8606,7 +8600,7 @@ TreeTransform<Derived>::TransformOMPInReductionClause(OMPInReductionClause *C) {
UnresolvedReductions.push_back(nullptr);
}
return getDerived().RebuildOMPInReductionClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(),
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions);
}
@@ -8625,7 +8619,7 @@ TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *C) {
if (Step.isInvalid())
return nullptr;
return getDerived().RebuildOMPLinearClause(
- Vars, Step.get(), C->getLocStart(), C->getLParenLoc(), C->getModifier(),
+ Vars, Step.get(), C->getBeginLoc(), C->getLParenLoc(), C->getModifier(),
C->getModifierLoc(), C->getColonLoc(), C->getLocEnd());
}
@@ -8644,7 +8638,7 @@ TreeTransform<Derived>::TransformOMPAlignedClause(OMPAlignedClause *C) {
if (Alignment.isInvalid())
return nullptr;
return getDerived().RebuildOMPAlignedClause(
- Vars, Alignment.get(), C->getLocStart(), C->getLParenLoc(),
+ Vars, Alignment.get(), C->getBeginLoc(), C->getLParenLoc(),
C->getColonLoc(), C->getLocEnd());
}
@@ -8659,7 +8653,7 @@ TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *C) {
return nullptr;
Vars.push_back(EVar.get());
}
- return getDerived().RebuildOMPCopyinClause(Vars, C->getLocStart(),
+ return getDerived().RebuildOMPCopyinClause(Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8675,7 +8669,7 @@ TreeTransform<Derived>::TransformOMPCopyprivateClause(OMPCopyprivateClause *C) {
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPCopyprivateClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8688,7 +8682,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPFlushClause(OMPFlushClause *C) {
return nullptr;
Vars.push_back(EVar.get());
}
- return getDerived().RebuildOMPFlushClause(Vars, C->getLocStart(),
+ return getDerived().RebuildOMPFlushClause(Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8705,7 +8699,7 @@ TreeTransform<Derived>::TransformOMPDependClause(OMPDependClause *C) {
}
return getDerived().RebuildOMPDependClause(
C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(), Vars,
- C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8714,8 +8708,8 @@ TreeTransform<Derived>::TransformOMPDeviceClause(OMPDeviceClause *C) {
ExprResult E = getDerived().TransformExpr(C->getDevice());
if (E.isInvalid())
return nullptr;
- return getDerived().RebuildOMPDeviceClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ return getDerived().RebuildOMPDeviceClause(E.get(), C->getBeginLoc(),
+ C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8730,7 +8724,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *C) {
}
return getDerived().RebuildOMPMapClause(
C->getMapTypeModifier(), C->getMapType(), C->isImplicitMapType(),
- C->getMapLoc(), C->getColonLoc(), Vars, C->getLocStart(),
+ C->getMapLoc(), C->getColonLoc(), Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8741,7 +8735,7 @@ TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPNumTeamsClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8751,7 +8745,7 @@ TreeTransform<Derived>::TransformOMPThreadLimitClause(OMPThreadLimitClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPThreadLimitClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8761,7 +8755,7 @@ TreeTransform<Derived>::TransformOMPPriorityClause(OMPPriorityClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPPriorityClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8771,7 +8765,7 @@ TreeTransform<Derived>::TransformOMPGrainsizeClause(OMPGrainsizeClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPGrainsizeClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8781,7 +8775,7 @@ TreeTransform<Derived>::TransformOMPNumTasksClause(OMPNumTasksClause *C) {
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPNumTasksClause(
- E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8789,7 +8783,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPHintClause(OMPHintClause *C) {
ExprResult E = getDerived().TransformExpr(C->getHint());
if (E.isInvalid())
return nullptr;
- return getDerived().RebuildOMPHintClause(E.get(), C->getLocStart(),
+ return getDerived().RebuildOMPHintClause(E.get(), C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8800,7 +8794,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPDistScheduleClause(
if (E.isInvalid())
return nullptr;
return getDerived().RebuildOMPDistScheduleClause(
- C->getDistScheduleKind(), E.get(), C->getLocStart(), C->getLParenLoc(),
+ C->getDistScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(),
C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd());
}
@@ -8820,7 +8814,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPToClause(OMPToClause *C) {
return 0;
Vars.push_back(EVar.get());
}
- return getDerived().RebuildOMPToClause(Vars, C->getLocStart(),
+ return getDerived().RebuildOMPToClause(Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8834,7 +8828,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPFromClause(OMPFromClause *C) {
return 0;
Vars.push_back(EVar.get());
}
- return getDerived().RebuildOMPFromClause(Vars, C->getLocStart(),
+ return getDerived().RebuildOMPFromClause(Vars, C->getBeginLoc(),
C->getLParenLoc(), C->getLocEnd());
}
@@ -8850,7 +8844,7 @@ OMPClause *TreeTransform<Derived>::TransformOMPUseDevicePtrClause(
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPUseDevicePtrClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
template <typename Derived>
@@ -8865,7 +8859,7 @@ TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPIsDevicePtrClause(
- Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd());
}
//===----------------------------------------------------------------------===//
@@ -8973,7 +8967,7 @@ template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformUserDefinedLiteral(UserDefinedLiteral *E) {
if (FunctionDecl *FD = E->getDirectCallee())
- SemaRef.MarkFunctionReferenced(E->getLocStart(), FD);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), FD);
return SemaRef.MaybeBindToTemporary(E);
}
@@ -9227,10 +9221,9 @@ TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
RHS.get() == E->getRHS())
return E;
- return getDerived().RebuildArraySubscriptExpr(LHS.get(),
- /*FIXME:*/E->getLHS()->getLocStart(),
- RHS.get(),
- E->getRBracketLoc());
+ return getDerived().RebuildArraySubscriptExpr(
+ LHS.get(),
+ /*FIXME:*/ E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc());
}
template <typename Derived>
@@ -9676,7 +9669,7 @@ template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformImplicitValueInitExpr(
ImplicitValueInitExpr *E) {
- TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
+ TemporaryBase Rebase(*this, E->getBeginLoc(), DeclarationName());
// FIXME: Will we ever have proper type location here? Will we actually
// need to transform the type?
@@ -10008,10 +10001,8 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
TInfo == E->getTypeOperandSourceInfo())
return E;
- return getDerived().RebuildCXXTypeidExpr(E->getType(),
- E->getLocStart(),
- TInfo,
- E->getLocEnd());
+ return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
+ TInfo, E->getLocEnd());
}
// We don't know whether the subexpression is potentially evaluated until
@@ -10030,10 +10021,8 @@ TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
SubExpr.get() == E->getExprOperand())
return E;
- return getDerived().RebuildCXXTypeidExpr(E->getType(),
- E->getLocStart(),
- SubExpr.get(),
- E->getLocEnd());
+ return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(),
+ SubExpr.get(), E->getLocEnd());
}
template<typename Derived>
@@ -10049,10 +10038,8 @@ TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *E) {
TInfo == E->getTypeOperandSourceInfo())
return E;
- return getDerived().RebuildCXXUuidofExpr(E->getType(),
- E->getLocStart(),
- TInfo,
- E->getLocEnd());
+ return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
+ TInfo, E->getLocEnd());
}
EnterExpressionEvaluationContext Unevaluated(
@@ -10066,10 +10053,8 @@ TreeTransform<Derived>::TransformCXXUuidofExpr(CXXUuidofExpr *E) {
SubExpr.get() == E->getExprOperand())
return E;
- return getDerived().RebuildCXXUuidofExpr(E->getType(),
- E->getLocStart(),
- SubExpr.get(),
- E->getLocEnd());
+ return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(),
+ SubExpr.get(), E->getLocEnd());
}
template<typename Derived>
@@ -10092,11 +10077,11 @@ TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
if (!getDerived().AlwaysRebuild() && T == E->getType()) {
// Make sure that we capture 'this'.
- getSema().CheckCXXThisCapture(E->getLocStart());
+ getSema().CheckCXXThisCapture(E->getBeginLoc());
return E;
}
- return getDerived().RebuildCXXThisExpr(E->getLocStart(), T, E->isImplicit());
+ return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit());
}
template<typename Derived>
@@ -10117,9 +10102,8 @@ TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
- ParmVarDecl *Param
- = cast_or_null<ParmVarDecl>(getDerived().TransformDecl(E->getLocStart(),
- E->getParam()));
+ ParmVarDecl *Param = cast_or_null<ParmVarDecl>(
+ getDerived().TransformDecl(E->getBeginLoc(), E->getParam()));
if (!Param)
return ExprError();
@@ -10133,9 +10117,8 @@ TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
- FieldDecl *Field
- = cast_or_null<FieldDecl>(getDerived().TransformDecl(E->getLocStart(),
- E->getField()));
+ FieldDecl *Field = cast_or_null<FieldDecl>(
+ getDerived().TransformDecl(E->getBeginLoc(), E->getField()));
if (!Field)
return ExprError();
@@ -10196,8 +10179,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
FunctionDecl *OperatorNew = nullptr;
if (E->getOperatorNew()) {
OperatorNew = cast_or_null<FunctionDecl>(
- getDerived().TransformDecl(E->getLocStart(),
- E->getOperatorNew()));
+ getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew()));
if (!OperatorNew)
return ExprError();
}
@@ -10205,8 +10187,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
FunctionDecl *OperatorDelete = nullptr;
if (E->getOperatorDelete()) {
OperatorDelete = cast_or_null<FunctionDecl>(
- getDerived().TransformDecl(E->getLocStart(),
- E->getOperatorDelete()));
+ getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
if (!OperatorDelete)
return ExprError();
}
@@ -10221,9 +10202,9 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
// Mark any declarations we need as referenced.
// FIXME: instantiation-specific.
if (OperatorNew)
- SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorNew);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorNew);
if (OperatorDelete)
- SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorDelete);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
if (E->isArray() && !E->getAllocatedType()->isDependentType()) {
QualType ElementType
@@ -10231,7 +10212,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
if (const RecordType *RecordT = ElementType->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(RecordT->getDecl());
if (CXXDestructorDecl *Destructor = SemaRef.LookupDestructor(Record)) {
- SemaRef.MarkFunctionReferenced(E->getLocStart(), Destructor);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Destructor);
}
}
}
@@ -10253,7 +10234,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
= dyn_cast<ConstantArrayType>(ArrayT)) {
ArraySize = IntegerLiteral::Create(SemaRef.Context, ConsArrayT->getSize(),
SemaRef.Context.getSizeType(),
- /*FIXME:*/ E->getLocStart());
+ /*FIXME:*/ E->getBeginLoc());
AllocType = ConsArrayT->getElementType();
} else if (const DependentSizedArrayType *DepArrayT
= dyn_cast<DependentSizedArrayType>(ArrayT)) {
@@ -10264,17 +10245,11 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
}
}
- return getDerived().RebuildCXXNewExpr(E->getLocStart(),
- E->isGlobalNew(),
- /*FIXME:*/E->getLocStart(),
- PlacementArgs,
- /*FIXME:*/E->getLocStart(),
- E->getTypeIdParens(),
- AllocType,
- AllocTypeInfo,
- ArraySize.get(),
- E->getDirectInitRange(),
- NewInit.get());
+ return getDerived().RebuildCXXNewExpr(
+ E->getBeginLoc(), E->isGlobalNew(),
+ /*FIXME:*/ E->getBeginLoc(), PlacementArgs,
+ /*FIXME:*/ E->getBeginLoc(), E->getTypeIdParens(), AllocType,
+ AllocTypeInfo, ArraySize.get(), E->getDirectInitRange(), NewInit.get());
}
template<typename Derived>
@@ -10288,8 +10263,7 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
FunctionDecl *OperatorDelete = nullptr;
if (E->getOperatorDelete()) {
OperatorDelete = cast_or_null<FunctionDecl>(
- getDerived().TransformDecl(E->getLocStart(),
- E->getOperatorDelete()));
+ getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete()));
if (!OperatorDelete)
return ExprError();
}
@@ -10300,14 +10274,14 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
// Mark any declarations we need as referenced.
// FIXME: instantiation-specific.
if (OperatorDelete)
- SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorDelete);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete);
if (!E->getArgument()->isTypeDependent()) {
QualType Destroyed = SemaRef.Context.getBaseElementType(
E->getDestroyedType());
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
- SemaRef.MarkFunctionReferenced(E->getLocStart(),
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(),
SemaRef.LookupDestructor(Record));
}
}
@@ -10315,10 +10289,8 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
return E;
}
- return getDerived().RebuildCXXDeleteExpr(E->getLocStart(),
- E->isGlobalDelete(),
- E->isArrayForm(),
- Operand.get());
+ return getDerived().RebuildCXXDeleteExpr(
+ E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(), Operand.get());
}
template<typename Derived>
@@ -10651,9 +10623,7 @@ TreeTransform<Derived>::TransformTypeTraitExpr(TypeTraitExpr *E) {
if (!getDerived().AlwaysRebuild() && !ArgChanged)
return E;
- return getDerived().RebuildTypeTrait(E->getTrait(),
- E->getLocStart(),
- Args,
+ return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args,
E->getLocEnd());
}
@@ -10680,11 +10650,8 @@ TreeTransform<Derived>::TransformArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
return E;
}
- return getDerived().RebuildArrayTypeTrait(E->getTrait(),
- E->getLocStart(),
- T,
- SubExpr.get(),
- E->getLocEnd());
+ return getDerived().RebuildArrayTypeTrait(E->getTrait(), E->getBeginLoc(), T,
+ SubExpr.get(), E->getLocEnd());
}
template<typename Derived>
@@ -10702,8 +10669,8 @@ TreeTransform<Derived>::TransformExpressionTraitExpr(ExpressionTraitExpr *E) {
return E;
}
- return getDerived().RebuildExpressionTrait(
- E->getTrait(), E->getLocStart(), SubExpr.get(), E->getLocEnd());
+ return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(),
+ SubExpr.get(), E->getLocEnd());
}
template <typename Derived>
@@ -10789,16 +10756,14 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
!E->isListInitialization())
return getDerived().TransformExpr(E->getArg(0));
- TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
+ TemporaryBase Rebase(*this, /*FIXME*/ E->getBeginLoc(), DeclarationName());
QualType T = getDerived().TransformType(E->getType());
if (T.isNull())
return ExprError();
- CXXConstructorDecl *Constructor
- = cast_or_null<CXXConstructorDecl>(
- getDerived().TransformDecl(E->getLocStart(),
- E->getConstructor()));
+ CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
+ getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
if (!Constructor)
return ExprError();
@@ -10814,19 +10779,15 @@ TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
!ArgumentChanged) {
// Mark the constructor as referenced.
// FIXME: Instantiation-specific
- SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
return E;
}
- return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(),
- Constructor,
- E->isElidable(), Args,
- E->hadMultipleCandidates(),
- E->isListInitialization(),
- E->isStdInitListInitialization(),
- E->requiresZeroInitialization(),
- E->getConstructionKind(),
- E->getParenOrBraceRange());
+ return getDerived().RebuildCXXConstructExpr(
+ T, /*FIXME:*/ E->getBeginLoc(), Constructor, E->isElidable(), Args,
+ E->hadMultipleCandidates(), E->isListInitialization(),
+ E->isStdInitListInitialization(), E->requiresZeroInitialization(),
+ E->getConstructionKind(), E->getParenOrBraceRange());
}
template<typename Derived>
@@ -10837,7 +10798,7 @@ ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
return ExprError();
CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
- getDerived().TransformDecl(E->getLocStart(), E->getConstructor()));
+ getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
if (!Constructor)
return ExprError();
@@ -10846,7 +10807,7 @@ ExprResult TreeTransform<Derived>::TransformCXXInheritedCtorInitExpr(
Constructor == E->getConstructor()) {
// Mark the constructor as referenced.
// FIXME: Instantiation-specific
- SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
return E;
}
@@ -10885,10 +10846,8 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
if (!T)
return ExprError();
- CXXConstructorDecl *Constructor
- = cast_or_null<CXXConstructorDecl>(
- getDerived().TransformDecl(E->getLocStart(),
- E->getConstructor()));
+ CXXConstructorDecl *Constructor = cast_or_null<CXXConstructorDecl>(
+ getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor()));
if (!Constructor)
return ExprError();
@@ -10904,7 +10863,7 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
Constructor == E->getConstructor() &&
!ArgumentChanged) {
// FIXME: Instantiation-specific
- SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor);
+ SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor);
return SemaRef.MaybeBindToTemporary(E);
}
@@ -11160,7 +11119,7 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
if (Body.isInvalid()) {
SavedContext.pop();
- getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/nullptr,
+ getSema().ActOnLambdaError(E->getBeginLoc(), /*CurScope=*/nullptr,
/*IsInstantiation=*/true);
return ExprError();
}
@@ -11173,7 +11132,7 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
/*IsInstantiation*/ true);
SavedContext.pop();
- return getSema().BuildLambdaExpr(E->getLocStart(), Body.get()->getLocEnd(),
+ return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getLocEnd(),
&LSICopy);
}
@@ -11620,7 +11579,7 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
return E;
return getDerived().RebuildCXXFoldExpr(
- E->getLocStart(), LHS.get(), E->getOperator(), E->getEllipsisLoc(),
+ E->getBeginLoc(), LHS.get(), E->getOperator(), E->getEllipsisLoc(),
RHS.get(), E->getLocEnd());
}
@@ -11641,7 +11600,7 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
return true;
Result = getDerived().RebuildCXXFoldExpr(
- E->getLocStart(), Out.get(), E->getOperator(), E->getEllipsisLoc(),
+ E->getBeginLoc(), Out.get(), E->getOperator(), E->getEllipsisLoc(),
Result.get(), E->getLocEnd());
if (Result.isInvalid())
return true;
@@ -11657,11 +11616,9 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
if (Out.get()->containsUnexpandedParameterPack()) {
// We still have a pack; retain a pack expansion for this slice.
Result = getDerived().RebuildCXXFoldExpr(
- E->getLocStart(),
- LeftFold ? Result.get() : Out.get(),
+ E->getBeginLoc(), LeftFold ? Result.get() : Out.get(),
E->getOperator(), E->getEllipsisLoc(),
- LeftFold ? Out.get() : Result.get(),
- E->getLocEnd());
+ LeftFold ? Out.get() : Result.get(), E->getLocEnd());
} else if (Result.isUsable()) {
// We've got down to a single element; build a binary operator.
Result = getDerived().RebuildBinaryOperator(
@@ -11685,8 +11642,7 @@ TreeTransform<Derived>::TransformCXXFoldExpr(CXXFoldExpr *E) {
return true;
Result = getDerived().RebuildCXXFoldExpr(
- E->getLocStart(), Result.get(),
- E->getOperator(), E->getEllipsisLoc(),
+ E->getBeginLoc(), Result.get(), E->getOperator(), E->getEllipsisLoc(),
Out.get(), E->getLocEnd());
if (Result.isInvalid())
return true;
@@ -11775,13 +11731,11 @@ TreeTransform<Derived>::TransformObjCDictionaryLiteral(
bool RetainExpansion = false;
Optional<unsigned> OrigNumExpansions = OrigElement.NumExpansions;
Optional<unsigned> NumExpansions = OrigNumExpansions;
- SourceRange PatternRange(OrigElement.Key->getLocStart(),
+ SourceRange PatternRange(OrigElement.Key->getBeginLoc(),
OrigElement.Value->getLocEnd());
- if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
- PatternRange,
- Unexpanded,
- Expand, RetainExpansion,
- NumExpansions))
+ if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc,
+ PatternRange, Unexpanded, Expand,
+ RetainExpansion, NumExpansions))
return ExprError();
if (!Expand) {
@@ -12651,9 +12605,8 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
if (Op == OO_Subscript) {
if (!First->getType()->isOverloadableType() &&
!Second->getType()->isOverloadableType())
- return getSema().CreateBuiltinArraySubscriptExpr(First,
- Callee->getLocStart(),
- Second, OpLoc);
+ return getSema().CreateBuiltinArraySubscriptExpr(
+ First, Callee->getBeginLoc(), Second, OpLoc);
} else if (Op == OO_Arrow) {
// -> is never a builtin operation.
return SemaRef.BuildOverloadedArrowExpr(nullptr, First, OpLoc);
@@ -12727,8 +12680,8 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
RBrace = SourceLocation::getFromRawEncoding(
NameLoc.CXXOperatorName.EndOpNameLoc);
} else {
- LBrace = Callee->getLocStart();
- RBrace = OpLoc;
+ LBrace = Callee->getBeginLoc();
+ RBrace = OpLoc;
}
return SemaRef.CreateOverloadedArraySubscriptExpr(LBrace, RBrace,
@@ -12799,7 +12752,7 @@ TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(Expr *Base,
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformCapturedStmt(CapturedStmt *S) {
- SourceLocation Loc = S->getLocStart();
+ SourceLocation Loc = S->getBeginLoc();
CapturedDecl *CD = S->getCapturedDecl();
unsigned NumParams = CD->getNumParams();
unsigned ContextParamPos = CD->getContextParamPosition();
OpenPOWER on IntegriCloud