34 changes: 17 additions & 17 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class CXXOperatorCallExpr : public CallExpr {
SourceLocation getExprLoc() const LLVM_READONLY {
return (Operator < OO_Plus || Operator >= OO_Arrow ||
Operator == OO_PlusPlus || Operator == OO_MinusMinus)
? getLocStart()
? getBeginLoc()
: getOperatorLoc();
}

Expand Down Expand Up @@ -193,7 +193,7 @@ class CXXMemberCallExpr : public CallExpr {
if (CLoc.isValid())
return CLoc;

return getLocStart();
return getBeginLoc();
}

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -532,7 +532,7 @@ class UserDefinedLiteral : public CallExpr {
SourceLocation getBeginLoc() const {
if (getLiteralOperatorKind() == LOK_Template)
return getRParenLoc();
return getArg(0)->getLocStart();
return getArg(0)->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -643,7 +643,7 @@ class CXXStdInitializerListExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
return SubExpr->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -785,7 +785,7 @@ class MSPropertyRefExpr : public Expr {
MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {}

SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getLocStart(), getLocEnd());
return SourceRange(getBeginLoc(), getLocEnd());
}

bool isImplicitAccess() const {
Expand All @@ -795,7 +795,7 @@ class MSPropertyRefExpr : public Expr {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const {
if (!isImplicitAccess())
return BaseExpr->getLocStart();
return BaseExpr->getBeginLoc();
else if (QualifierLoc)
return QualifierLoc.getBeginLoc();
else
Expand Down Expand Up @@ -865,7 +865,7 @@ class MSPropertySubscriptExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
return getBase()->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -1271,7 +1271,7 @@ class CXXBindTemporaryExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
return SubExpr->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -2397,7 +2397,7 @@ class CXXPseudoDestructorExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return Base->getLocStart();
return Base->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY;
Expand Down Expand Up @@ -2908,7 +2908,7 @@ class UnresolvedLookupExpr final
SourceLocation getBeginLoc() const LLVM_READONLY {
if (NestedNameSpecifierLoc l = getQualifierLoc())
return l.getBeginLoc();
return getNameInfo().getLocStart();
return getNameInfo().getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -3056,7 +3056,7 @@ class DependentScopeDeclRefExpr final
return {getTemplateArgs(), getNumTemplateArgs()};
}

/// Note: getLocStart() is the start of the whole DependentScopeDeclRefExpr,
/// Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr,
/// and differs from getLocation().getStart().
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -3142,7 +3142,7 @@ class ExprWithCleanups final

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
return SubExpr->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -3496,7 +3496,7 @@ class CXXDependentScopeMemberExpr final
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
if (!isImplicitAccess())
return Base->getLocStart();
return Base->getBeginLoc();
if (getQualifier())
return getQualifierLoc().getBeginLoc();
return MemberNameInfo.getBeginLoc();
Expand Down Expand Up @@ -3648,10 +3648,10 @@ class UnresolvedMemberExpr final
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
if (!isImplicitAccess())
return Base->getLocStart();
return Base->getBeginLoc();
if (NestedNameSpecifierLoc l = getQualifierLoc())
return l.getBeginLoc();
return getMemberNameInfo().getLocStart();
return getMemberNameInfo().getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -3802,7 +3802,7 @@ class PackExpansionExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return Pattern->getLocStart();
return Pattern->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -4229,7 +4229,7 @@ class MaterializeTemporaryExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getTemporary()->getLocStart();
return getTemporary()->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down
13 changes: 7 additions & 6 deletions clang/include/clang/AST/ExprObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ class ObjCIvarRefExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return isFreeIvar() ? Loc : getBase()->getLocStart();
return isFreeIvar() ? Loc : getBase()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
Expand Down Expand Up @@ -762,7 +762,8 @@ class ObjCPropertyRefExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return isObjectReceiver() ? getBase()->getLocStart() :getReceiverLocation();
return isObjectReceiver() ? getBase()->getBeginLoc()
: getReceiverLocation();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -860,7 +861,7 @@ class ObjCSubscriptRefExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExprs[BASE]->getLocStart();
return SubExprs[BASE]->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down Expand Up @@ -1386,7 +1387,7 @@ class ObjCMessageExpr final

SourceLocation getSelectorStartLoc() const {
if (isImplicit())
return getLocStart();
return getBeginLoc();
return getSelectorLoc(0);
}

Expand Down Expand Up @@ -1498,7 +1499,7 @@ class ObjCIsaExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
return getBase()->getBeginLoc();
}

SourceLocation getBaseLocEnd() const LLVM_READONLY {
Expand Down Expand Up @@ -1577,7 +1578,7 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
// Source locations are determined by the subexpression.
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return Operand->getLocStart();
return Operand->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/ExprOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class OMPArraySectionExpr : public Expr {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
return getBase()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class LexicallyOrderedRecursiveASTVisitor
LexicallyNestedDeclarations.clear();
for (++I; I != E; ++I) {
Decl *Sibling = *I;
if (!SM.isBeforeInTranslationUnit(Sibling->getLocStart(),
if (!SM.isBeforeInTranslationUnit(Sibling->getBeginLoc(),
Child->getLocEnd()))
break;
if (!BaseType::canIgnoreChildDeclWhileTraversingDeclContext(Sibling))
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/RawCommentList.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class BeforeThanCompare<RawComment> {
explicit BeforeThanCompare(const SourceManager &SM) : SM(SM) { }

bool operator()(const RawComment &LHS, const RawComment &RHS) {
return SM.isBeforeInTranslationUnit(LHS.getLocStart(), RHS.getLocStart());
return SM.isBeforeInTranslationUnit(LHS.getBeginLoc(), RHS.getBeginLoc());
}

bool operator()(const RawComment *LHS, const RawComment *RHS) {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,7 @@ class CapturedStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getCapturedStmt()->getLocStart();
return getCapturedStmt()->getBeginLoc();
}

SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/AST/StmtCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ class CoroutineBodyStmt final

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBody() ? getBody()->getLocStart()
: getPromiseDecl()->getLocStart();
return getBody() ? getBody()->getBeginLoc()
: getPromiseDecl()->getBeginLoc();
}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
Expand Down Expand Up @@ -479,7 +479,7 @@ class CoreturnStmt : public Stmt {
SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getOperand() ? getOperand()->getLocEnd() : getLocStart();
return getOperand() ? getOperand()->getLocEnd() : getBeginLoc();
}

child_range children() {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/StmtDataCollectors.td
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Stmt {
addData(S->getStmtClass());
// This ensures that non-macro-generated code isn't identical to
// macro-generated code.
addData(data_collection::getMacroStack(S->getLocStart(), Context));
addData(data_collection::getMacroStack(S->getBeginLoc(), Context));
addData(data_collection::getMacroStack(S->getLocEnd(), Context));
}];
}
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/ASTMatchers/ASTMatchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ AST_POLYMORPHIC_MATCHER(isExpansionInMainFile,
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) {
auto &SourceManager = Finder->getASTContext().getSourceManager();
return SourceManager.isInMainFile(
SourceManager.getExpansionLoc(Node.getLocStart()));
SourceManager.getExpansionLoc(Node.getBeginLoc()));
}

/// Matches AST nodes that were expanded within system-header-files.
Expand All @@ -265,7 +265,7 @@ AST_POLYMORPHIC_MATCHER(isExpansionInMainFile,
AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader,
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) {
auto &SourceManager = Finder->getASTContext().getSourceManager();
auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart());
auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc());
if (ExpansionLoc.isInvalid()) {
return false;
}
Expand All @@ -291,7 +291,7 @@ AST_POLYMORPHIC_MATCHER_P(isExpansionInFileMatching,
AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc),
std::string, RegExp) {
auto &SourceManager = Finder->getASTContext().getSourceManager();
auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart());
auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc());
if (ExpansionLoc.isInvalid()) {
return false;
}
Expand Down
7 changes: 4 additions & 3 deletions clang/include/clang/Sema/Initialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,11 @@ class InitializationKind {
static InitializationKind CreateForInit(SourceLocation Loc, bool DirectInit,
Expr *Init) {
if (!Init) return CreateDefault(Loc);
if (!DirectInit) return CreateCopy(Loc, Init->getLocStart());
if (!DirectInit)
return CreateCopy(Loc, Init->getBeginLoc());
if (isa<InitListExpr>(Init))
return CreateDirectList(Loc, Init->getLocStart(), Init->getLocEnd());
return CreateDirect(Loc, Init->getLocStart(), Init->getLocEnd());
return CreateDirectList(Loc, Init->getBeginLoc(), Init->getLocEnd());
return CreateDirect(Loc, Init->getBeginLoc(), Init->getLocEnd());
}

/// Determine the initialization kind.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ class PathDiagnosticLocation {
PathDiagnosticLocation() = default;

/// Create a location corresponding to the given statement.
PathDiagnosticLocation(const Stmt *s,
const SourceManager &sm,
PathDiagnosticLocation(const Stmt *s, const SourceManager &sm,
LocationOrAnalysisDeclContext lac)
: K(s->getLocStart().isValid() ? StmtK : SingleLocK),
: K(s->getBeginLoc().isValid() ? StmtK : SingleLocK),
S(K == StmtK ? s : nullptr), SM(&sm),
Loc(genLocation(SourceLocation(), lac)), Range(genRange(lac)) {
assert(K == SingleLocK || S);
Expand Down
31 changes: 16 additions & 15 deletions clang/lib/ARCMigrate/ObjCMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ namespace {
// rewrite getter method expression into: receiver.property or
// (receiver).property
if (NeedsParen) {
commit.insertBefore(receiver->getLocStart(), "(");
commit.insertBefore(receiver->getBeginLoc(), "(");
PropertyDotString = ").";
}
else
Expand All @@ -293,7 +293,7 @@ namespace {
SourceLocation BegLoc =
ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd();
BegLoc = PP.getLocForEndOfToken(BegLoc);
SourceLocation EndLoc = RHS->getLocStart();
SourceLocation EndLoc = RHS->getBeginLoc();
EndLoc = EndLoc.getLocWithOffset(-1);
const char *colon = PP.getSourceManager().getCharacterData(EndLoc);
// Add a space after '=' if there is no space between RHS and '='
Expand Down Expand Up @@ -545,14 +545,14 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter,

SourceLocation EndGetterSelectorLoc =
StartGetterSelectorLoc.getLocWithOffset(GetterSelector.getNameForSlot(0).size());
commit.replace(CharSourceRange::getCharRange(Getter->getLocStart(),
commit.replace(CharSourceRange::getCharRange(Getter->getBeginLoc(),
EndGetterSelectorLoc),
PropertyString);
if (Setter && AvailabilityArgsMatch) {
SourceLocation EndLoc = Setter->getDeclaratorEndLoc();
// Get location past ';'
EndLoc = EndLoc.getLocWithOffset(1);
SourceLocation BeginOfSetterDclLoc = Setter->getLocStart();
SourceLocation BeginOfSetterDclLoc = Setter->getBeginLoc();
// FIXME. This assumes that setter decl; is immediately preceded by eoln.
// It is trying to remove the setter method decl. line entirely.
BeginOfSetterDclLoc = BeginOfSetterDclLoc.getLocWithOffset(-1);
Expand Down Expand Up @@ -720,14 +720,14 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,

ClassString += TypedefDcl->getIdentifier()->getName();
ClassString += ')';
SourceRange R(EnumDcl->getLocStart(), EnumDcl->getLocStart());
SourceRange R(EnumDcl->getBeginLoc(), EnumDcl->getBeginLoc());
commit.replace(R, ClassString);
SourceLocation EndOfEnumDclLoc = EnumDcl->getLocEnd();
EndOfEnumDclLoc = trans::findSemiAfterLocation(EndOfEnumDclLoc,
NS.getASTContext(), /*IsDecl*/true);
if (EndOfEnumDclLoc.isValid()) {
SourceRange EnumDclRange(EnumDcl->getLocStart(), EndOfEnumDclLoc);
commit.insertFromRange(TypedefDcl->getLocStart(), EnumDclRange);
SourceRange EnumDclRange(EnumDcl->getBeginLoc(), EndOfEnumDclLoc);
commit.insertFromRange(TypedefDcl->getBeginLoc(), EnumDclRange);
}
else
return false;
Expand All @@ -736,7 +736,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc,
NS.getASTContext(), /*IsDecl*/true);
if (EndTypedefDclLoc.isValid()) {
SourceRange TDRange(TypedefDcl->getLocStart(), EndTypedefDclLoc);
SourceRange TDRange(TypedefDcl->getBeginLoc(), EndTypedefDclLoc);
commit.remove(TDRange);
}
else
Expand All @@ -745,7 +745,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
EndOfEnumDclLoc = trans::findLocationAfterSemi(EnumDcl->getLocEnd(), NS.getASTContext(),
/*IsDecl*/true);
if (EndOfEnumDclLoc.isValid()) {
SourceLocation BeginOfEnumDclLoc = EnumDcl->getLocStart();
SourceLocation BeginOfEnumDclLoc = EnumDcl->getBeginLoc();
// FIXME. This assumes that enum decl; is immediately preceded by eoln.
// It is trying to remove the enum decl. lines entirely.
BeginOfEnumDclLoc = BeginOfEnumDclLoc.getLocWithOffset(-1);
Expand Down Expand Up @@ -775,7 +775,8 @@ static void rewriteToNSMacroDecl(ASTContext &Ctx,
SourceLocation EndLoc = EnumDcl->getBraceRange().getBegin();
if (EndLoc.isInvalid())
return;
CharSourceRange R = CharSourceRange::getCharRange(EnumDcl->getLocStart(), EndLoc);
CharSourceRange R =
CharSourceRange::getCharRange(EnumDcl->getBeginLoc(), EndLoc);
commit.replace(R, ClassString);
// This is to remove spaces between '}' and typedef name.
SourceLocation StartTypedefLoc = EnumDcl->getLocEnd();
Expand Down Expand Up @@ -928,7 +929,7 @@ bool ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx,
if (const EnumType *EnumTy = qt->getAs<EnumType>()) {
if (EnumTy->getDecl() == EnumDcl) {
bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
if (!InsertFoundation(Ctx, TypedefDcl->getLocStart()))
if (!InsertFoundation(Ctx, TypedefDcl->getBeginLoc()))
return false;
edit::Commit commit(*Editor);
rewriteToNSMacroDecl(Ctx, EnumDcl, TypedefDcl, *NSAPIObj, commit, !NSOptions);
Expand All @@ -941,7 +942,7 @@ bool ObjCMigrateASTConsumer::migrateNSEnumDecl(ASTContext &Ctx,

// We may still use NS_OPTIONS based on what we find in the enumertor list.
bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
if (!InsertFoundation(Ctx, TypedefDcl->getLocStart()))
if (!InsertFoundation(Ctx, TypedefDcl->getBeginLoc()))
return false;
edit::Commit commit(*Editor);
bool Res = rewriteToNSEnumDecl(EnumDcl, TypedefDcl, *NSAPIObj,
Expand All @@ -964,7 +965,7 @@ static void ReplaceWithInstancetype(ASTContext &Ctx,
ClassString = "instancetype";
}
else {
R = SourceRange(OM->getLocStart(), OM->getLocStart());
R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc());
ClassString = OM->isInstanceMethod() ? '-' : '+';
ClassString += " (instancetype)";
}
Expand All @@ -986,7 +987,7 @@ static void ReplaceWithClasstype(const ObjCMigrateASTConsumer &ASTC,
}
}
else {
R = SourceRange(OM->getLocStart(), OM->getLocStart());
R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc());
ClassString = "+ (";
ClassString += IDecl->getName(); ClassString += "*)";
}
Expand Down Expand Up @@ -1395,7 +1396,7 @@ void ObjCMigrateASTConsumer::AnnotateImplicitBridging(ASTContext &Ctx) {
CFFunctionIBCandidates[CFFunctionIBCandidates.size()-1];
const char *PragmaString = "\nCF_IMPLICIT_BRIDGING_ENABLED\n\n";
edit::Commit commit(*Editor);
commit.insertBefore(FirstFD->getLocStart(), PragmaString);
commit.insertBefore(FirstFD->getBeginLoc(), PragmaString);
PragmaString = "\n\nCF_IMPLICIT_BRIDGING_DISABLED\n";
SourceLocation EndLoc = LastFD->getLocEnd();
// get location just past end of function location.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/ARCMigrate/TransAPIUses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class APIChecker : public RecursiveASTVisitor<APIChecker> {
return true;

if (pointee.getObjCLifetime() > Qualifiers::OCL_ExplicitNone)
Pass.TA.report(parm->getLocStart(),
Pass.TA.report(parm->getBeginLoc(),
diag::err_arcmt_nsinvocation_ownership,
parm->getSourceRange())
<< selName;
Expand Down
18 changes: 9 additions & 9 deletions clang/lib/ARCMigrate/TransAutoreleasePool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ class AutoreleasePoolRewriter
"to true?");
Pass.TA.insertAfterToken(afterSemi, "\n}");
Pass.TA.increaseIndentation(
SourceRange(scope.getIndentedRange().getBegin(),
(*retI)->getLocEnd()),
scope.CompoundParent->getLocStart());
SourceRange(scope.getIndentedRange().getBegin(),
(*retI)->getLocEnd()),
scope.CompoundParent->getBeginLoc());
} else {
Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {");
Pass.TA.replaceStmt(*scope.End, "}");
Pass.TA.increaseIndentation(scope.getIndentedRange(),
scope.CompoundParent->getLocStart());
scope.CompoundParent->getBeginLoc());
}
}

Expand Down Expand Up @@ -241,7 +241,7 @@ class AutoreleasePoolRewriter
Stmt::child_iterator rangeE = Begin;
for (Stmt::child_iterator I = rangeS; I != End; ++I)
++rangeE;
return SourceRange((*rangeS)->getLocStart(), (*rangeE)->getLocEnd());
return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getLocEnd());
}
};

Expand All @@ -256,8 +256,8 @@ class AutoreleasePoolRewriter
SourceLocation &declarationLoc)
: Ctx(ctx), referenceLoc(referenceLoc),
declarationLoc(declarationLoc) {
ScopeRange = SourceRange((*scope.Begin)->getLocStart(),
(*scope.End)->getLocStart());
ScopeRange = SourceRange((*scope.Begin)->getBeginLoc(),
(*scope.End)->getBeginLoc());
}

bool VisitDeclRefExpr(DeclRefExpr *E) {
Expand Down Expand Up @@ -328,9 +328,9 @@ class AutoreleasePoolRewriter
"NSAutoreleasePool scope that it was declared in", referenceLoc);
Pass.TA.reportNote("name declared here", declarationLoc);
Pass.TA.reportNote("intended @autoreleasepool scope begins here",
(*scope.Begin)->getLocStart());
(*scope.Begin)->getBeginLoc());
Pass.TA.reportNote("intended @autoreleasepool scope ends here",
(*scope.End)->getLocStart());
(*scope.End)->getBeginLoc());
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/ARCMigrate/TransGCCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GCCollectableCallsChecker :
TransformActions &TA = MigrateCtx.Pass.TA;

if (MigrateCtx.isGCOwnedNonObjC(E->getType())) {
TA.report(E->getLocStart(), diag::warn_arcmt_nsalloc_realloc,
TA.report(E->getBeginLoc(), diag::warn_arcmt_nsalloc_realloc,
E->getSourceRange());
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/ARCMigrate/TransProtectedScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ class CaseCollector : public RecursiveASTVisitor<CaseCollector> {
Curr = S->getSwitchCaseList();
// We iterate over case statements in reverse source-order.
while (Curr) {
Cases.push_back(CaseInfo(Curr,SourceRange(Curr->getLocStart(), NextLoc)));
NextLoc = Curr->getLocStart();
Cases.push_back(
CaseInfo(Curr, SourceRange(Curr->getBeginLoc(), NextLoc)));
NextLoc = Curr->getBeginLoc();
Curr = Curr->getNextSwitchCase();
}
return true;
Expand Down
15 changes: 9 additions & 6 deletions clang/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ class RetainReleaseDeallocRemover :
// will likely die immediately while previously it was kept alive
// by the autorelease pool. This is bad practice in general, leave it
// and emit an error to force the user to restructure their code.
Pass.TA.reportError("it is not safe to remove an unused 'autorelease' "
Pass.TA.reportError(
"it is not safe to remove an unused 'autorelease' "
"message; its receiver may be destroyed immediately",
E->getLocStart(), E->getSourceRange());
E->getBeginLoc(), E->getSourceRange());
return true;
}
}
Expand All @@ -89,7 +90,7 @@ class RetainReleaseDeallocRemover :
std::string err = "it is not safe to remove '";
err += E->getSelector().getAsString() + "' message on "
"an __unsafe_unretained type";
Pass.TA.reportError(err, rec->getLocStart());
Pass.TA.reportError(err, rec->getBeginLoc());
return true;
}

Expand All @@ -98,15 +99,17 @@ class RetainReleaseDeallocRemover :
std::string err = "it is not safe to remove '";
err += E->getSelector().getAsString() + "' message on "
"a global variable";
Pass.TA.reportError(err, rec->getLocStart());
Pass.TA.reportError(err, rec->getBeginLoc());
return true;
}

if (E->getMethodFamily() == OMF_release && isDelegateMessage(rec)) {
Pass.TA.reportError("it is not safe to remove 'retain' "
Pass.TA.reportError(
"it is not safe to remove 'retain' "
"message on the result of a 'delegate' message; "
"the object that was passed to 'setDelegate:' may not be "
"properly retained", rec->getLocStart());
"properly retained",
rec->getBeginLoc());
return true;
}
}
Expand Down
13 changes: 6 additions & 7 deletions clang/lib/ARCMigrate/TransUnbridgedCasts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
// We will remove the compiler diagnostic.
if (!TA.hasDiagnostic(diag::err_arc_mismatched_cast,
diag::err_arc_cast_requires_bridge,
E->getLocStart())) {
E->getBeginLoc())) {
Trans.abort();
return;
}
Expand All @@ -225,13 +225,12 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
}

TA.clearDiagnostic(diag::err_arc_mismatched_cast,
diag::err_arc_cast_requires_bridge,
E->getLocStart());
diag::err_arc_cast_requires_bridge, E->getBeginLoc());
if (Kind == OBC_Bridge || !Pass.CFBridgingFunctionsDefined()) {
if (CStyleCastExpr *CCE = dyn_cast<CStyleCastExpr>(E)) {
TA.insertAfterToken(CCE->getLParenLoc(), bridge);
} else {
SourceLocation insertLoc = E->getSubExpr()->getLocStart();
SourceLocation insertLoc = E->getSubExpr()->getBeginLoc();
SmallString<128> newCast;
newCast += '(';
newCast += bridge;
Expand All @@ -251,7 +250,7 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
SmallString<32> BridgeCall;

Expr *WrapE = E->getSubExpr();
SourceLocation InsertLoc = WrapE->getLocStart();
SourceLocation InsertLoc = WrapE->getBeginLoc();

SourceManager &SM = Pass.Ctx.getSourceManager();
char PrevChar = *SM.getCharacterData(InsertLoc.getLocWithOffset(-1));
Expand Down Expand Up @@ -368,7 +367,7 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
err += family == OMF_autorelease ? "autorelease" : "release";
err += "' message; a __bridge cast may result in a pointer to a "
"destroyed object and a __bridge_retained may leak the object";
Pass.TA.reportError(err, E->getLocStart(),
Pass.TA.reportError(err, E->getBeginLoc(),
E->getSubExpr()->getSourceRange());
Stmt *parent = E;
do {
Expand All @@ -380,7 +379,7 @@ class UnbridgedCastRewriter : public RecursiveASTVisitor<UnbridgedCastRewriter>{
"to '";
note += E->getSubExpr()->getType().getAsString(Pass.Ctx.getPrintingPolicy());
note += "' to have the object automatically autoreleased";
Pass.TA.reportNote(note, retS->getLocStart());
Pass.TA.reportNote(note, retS->getBeginLoc());
}
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/ARCMigrate/TransformActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void TransformActionsImpl::replaceText(SourceLocation loc, StringRef text,
void TransformActionsImpl::replaceStmt(Stmt *S, StringRef text) {
assert(IsInTransaction && "Actions only allowed during a transaction");
text = getUniqueText(text);
insert(S->getLocStart(), text);
insert(S->getBeginLoc(), text);
removeStmt(S);
}

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const {
isa<ObjCPropertyDecl>(D) ||
isa<RedeclarableTemplateDecl>(D) ||
isa<ClassTemplateSpecializationDecl>(D))
DeclLoc = D->getLocStart();
DeclLoc = D->getBeginLoc();
else {
DeclLoc = D->getLocation();
if (DeclLoc.isMacroID()) {
if (isa<TypedefDecl>(D)) {
// If location of the typedef name is in a macro, it is because being
// declared via a macro. Try using declaration's starting location as
// the "declaration location".
DeclLoc = D->getLocStart();
DeclLoc = D->getBeginLoc();
} else if (const auto *TD = dyn_cast<TagDecl>(D)) {
// If location of the tag decl is inside a macro, but the spelling of
// the tag name comes from a macro argument, it looks like a special
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,7 @@ void ASTDumper::VisitOMPExecutableDirective(
<< ClauseName.drop_front() << "Clause";
}
dumpPointer(C);
dumpSourceRange(SourceRange(C->getLocStart(), C->getLocEnd()));
dumpSourceRange(SourceRange(C->getBeginLoc(), C->getLocEnd()));
if (C->isImplicit())
OS << " <implicit>";
for (auto *S : C->children())
Expand Down
70 changes: 33 additions & 37 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ Decl *ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {
if (!ToNamespace) {
if (GetImportedOrCreateDecl(
ToNamespace, D, Importer.getToContext(), DC, D->isInline(),
Importer.Import(D->getLocStart()), Loc, Name.getAsIdentifierInfo(),
Importer.Import(D->getBeginLoc()), Loc, Name.getAsIdentifierInfo(),
/*PrevDecl=*/nullptr))
return ToNamespace;
ToNamespace->setLexicalDeclContext(LexicalDC);
Expand Down Expand Up @@ -1961,7 +1961,7 @@ Decl *ASTNodeImporter::VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias) {

// Create the new typedef node.
TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo());
SourceLocation StartL = Importer.Import(D->getLocStart());
SourceLocation StartL = Importer.Import(D->getBeginLoc());

TypedefNameDecl *ToTypedef;
if (IsAlias) {
Expand Down Expand Up @@ -2070,7 +2070,7 @@ Decl *ASTNodeImporter::VisitLabelDecl(LabelDecl *D) {
? GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC,
Importer.Import(D->getLocation()),
Name.getAsIdentifierInfo(),
Importer.Import(D->getLocStart()))
Importer.Import(D->getBeginLoc()))
: GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC,
Importer.Import(D->getLocation()),
Name.getAsIdentifierInfo()))
Expand Down Expand Up @@ -2139,7 +2139,7 @@ Decl *ASTNodeImporter::VisitEnumDecl(EnumDecl *D) {
// Create the enum declaration.
EnumDecl *D2;
if (GetImportedOrCreateDecl(
D2, D, Importer.getToContext(), DC, Importer.Import(D->getLocStart()),
D2, D, Importer.getToContext(), DC, Importer.Import(D->getBeginLoc()),
Loc, Name.getAsIdentifierInfo(), nullptr, D->isScoped(),
D->isScopedUsingClassTag(), D->isFixed()))
return D2;
Expand Down Expand Up @@ -2300,7 +2300,7 @@ Decl *ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {

// Create the record declaration.
RecordDecl *D2 = AdoptDecl;
SourceLocation StartLoc = Importer.Import(D->getLocStart());
SourceLocation StartLoc = Importer.Import(D->getBeginLoc());
if (!D2) {
CXXRecordDecl *D2CXX = nullptr;
if (auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
Expand Down Expand Up @@ -4239,7 +4239,7 @@ Decl *ASTNodeImporter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
Property->getQueryKind());
if (!ToImpl) {
if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC,
Importer.Import(D->getLocStart()),
Importer.Import(D->getBeginLoc()),
Importer.Import(D->getLocation()), Property,
D->getPropertyImplementation(), Ivar,
Importer.Import(D->getPropertyIvarDeclLoc())))
Expand Down Expand Up @@ -4294,7 +4294,7 @@ Decl *ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
(void)GetImportedOrCreateDecl(
ToD, D, Importer.getToContext(),
Importer.getToContext().getTranslationUnitDecl(),
Importer.Import(D->getLocStart()), Importer.Import(D->getLocation()),
Importer.Import(D->getBeginLoc()), Importer.Import(D->getLocation()),
D->getDepth(), D->getIndex(), Importer.Import(D->getIdentifier()),
D->wasDeclaredWithTypename(), D->isParameterPack());
return ToD;
Expand Down Expand Up @@ -4506,7 +4506,7 @@ Decl *ASTNodeImporter::VisitClassTemplateSpecializationDecl(
}

// Import the location of this declaration.
SourceLocation StartLoc = Importer.Import(D->getLocStart());
SourceLocation StartLoc = Importer.Import(D->getBeginLoc());
SourceLocation IdLoc = Importer.Import(D->getLocation());

// Import template arguments.
Expand Down Expand Up @@ -4734,7 +4734,7 @@ Decl *ASTNodeImporter::VisitVarTemplateSpecializationDecl(
}

// Import the location of this declaration.
SourceLocation StartLoc = Importer.Import(D->getLocStart());
SourceLocation StartLoc = Importer.Import(D->getBeginLoc());
SourceLocation IdLoc = Importer.Import(D->getLocation());

// Import template arguments.
Expand Down Expand Up @@ -4927,8 +4927,8 @@ DeclGroupRef ASTNodeImporter::ImportDeclGroup(DeclGroupRef DG) {
}

Stmt *ASTNodeImporter::VisitStmt(Stmt *S) {
Importer.FromDiag(S->getLocStart(), diag::err_unsupported_ast_node)
<< S->getStmtClassName();
Importer.FromDiag(S->getBeginLoc(), diag::err_unsupported_ast_node)
<< S->getStmtClassName();
return nullptr;
}

Expand Down Expand Up @@ -5444,8 +5444,8 @@ Stmt *ASTNodeImporter::VisitObjCAutoreleasePoolStmt
// Import Expressions
//----------------------------------------------------------------------------
Expr *ASTNodeImporter::VisitExpr(Expr *E) {
Importer.FromDiag(E->getLocStart(), diag::err_unsupported_ast_node)
<< E->getStmtClassName();
Importer.FromDiag(E->getBeginLoc(), diag::err_unsupported_ast_node)
<< E->getStmtClassName();
return nullptr;
}

Expand All @@ -5472,8 +5472,8 @@ Expr *ASTNodeImporter::VisitGNUNullExpr(GNUNullExpr *E) {
if (T.isNull())
return nullptr;

return new (Importer.getToContext()) GNUNullExpr(
T, Importer.Import(E->getLocStart()));
return new (Importer.getToContext())
GNUNullExpr(T, Importer.Import(E->getBeginLoc()));
}

Expr *ASTNodeImporter::VisitPredefinedExpr(PredefinedExpr *E) {
Expand All @@ -5486,7 +5486,7 @@ Expr *ASTNodeImporter::VisitPredefinedExpr(PredefinedExpr *E) {
return nullptr;

return new (Importer.getToContext()) PredefinedExpr(
Importer.Import(E->getLocStart()), T, E->getIdentType(), SL);
Importer.Import(E->getBeginLoc()), T, E->getIdentType(), SL);
}

Expr *ASTNodeImporter::VisitDeclRefExpr(DeclRefExpr *E) {
Expand Down Expand Up @@ -5861,8 +5861,8 @@ Expr *ASTNodeImporter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
return nullptr;

return new (Importer.getToContext()) ArrayTypeTraitExpr(
Importer.Import(E->getLocStart()), E->getTrait(), ToQueried,
E->getValue(), Dim, Importer.Import(E->getLocEnd()), T);
Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried,
E->getValue(), Dim, Importer.Import(E->getLocEnd()), T);
}

Expr *ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
Expand All @@ -5875,8 +5875,8 @@ Expr *ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
return nullptr;

return new (Importer.getToContext()) ExpressionTraitExpr(
Importer.Import(E->getLocStart()), E->getTrait(), ToQueried,
E->getValue(), Importer.Import(E->getLocEnd()), T);
Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried,
E->getValue(), Importer.Import(E->getLocEnd()), T);
}

Expr *ASTNodeImporter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
Expand Down Expand Up @@ -6060,7 +6060,7 @@ Expr *ASTNodeImporter::VisitOffsetOfExpr(OffsetOfExpr *OE) {

switch (Node.getKind()) {
case OffsetOfNode::Array:
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()),
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()),
Node.getArrayExprIndex(),
Importer.Import(Node.getLocEnd())));
break;
Expand All @@ -6076,15 +6076,15 @@ Expr *ASTNodeImporter::VisitOffsetOfExpr(OffsetOfExpr *OE) {
auto *FD = cast_or_null<FieldDecl>(Importer.Import(Node.getField()));
if (!FD)
return nullptr;
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()), FD,
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), FD,
Importer.Import(Node.getLocEnd())));
break;
}
case OffsetOfNode::Identifier: {
IdentifierInfo *ToII = Importer.Import(Node.getFieldName());
if (!ToII)
return nullptr;
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()), ToII,
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), ToII,
Importer.Import(Node.getLocEnd())));
break;
}
Expand Down Expand Up @@ -6124,9 +6124,9 @@ Expr *ASTNodeImporter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
else
CanThrow = E->getValue() ? CT_Can : CT_Cannot;

return new (Importer.getToContext()) CXXNoexceptExpr(
T, Operand, CanThrow,
Importer.Import(E->getLocStart()), Importer.Import(E->getLocEnd()));
return new (Importer.getToContext())
CXXNoexceptExpr(T, Operand, CanThrow, Importer.Import(E->getBeginLoc()),
Importer.Import(E->getLocEnd()));
}

Expr *ASTNodeImporter::VisitCXXThrowExpr(CXXThrowExpr *E) {
Expand Down Expand Up @@ -6326,13 +6326,9 @@ Expr *ASTNodeImporter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {
return nullptr;

return new (Importer.getToContext()) CXXDeleteExpr(
T, E->isGlobalDelete(),
E->isArrayForm(),
E->isArrayFormAsWritten(),
E->doesUsualArrayDeleteWantSize(),
OperatorDeleteDecl,
ToArg,
Importer.Import(E->getLocStart()));
T, E->isGlobalDelete(), E->isArrayForm(), E->isArrayFormAsWritten(),
E->doesUsualArrayDeleteWantSize(), OperatorDeleteDecl, ToArg,
Importer.Import(E->getBeginLoc()));
}

Expr *ASTNodeImporter::VisitCXXConstructExpr(CXXConstructExpr *E) {
Expand Down Expand Up @@ -6847,7 +6843,7 @@ Expr *ASTNodeImporter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *DIE) {
return nullptr;

return CXXDefaultInitExpr::Create(
Importer.getToContext(), Importer.Import(DIE->getLocStart()), ToField);
Importer.getToContext(), Importer.Import(DIE->getBeginLoc()), ToField);
}

Expr *ASTNodeImporter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {
Expand Down Expand Up @@ -6920,7 +6916,7 @@ Expr *ASTNodeImporter::VisitTypeTraitExpr(TypeTraitExpr *E) {
ToValue = E->getValue();

return TypeTraitExpr::Create(
Importer.getToContext(), ToType, Importer.Import(E->getLocStart()),
Importer.getToContext(), ToType, Importer.Import(E->getBeginLoc()),
E->getTrait(), ToArgs, Importer.Import(E->getLocEnd()), ToValue);
}

Expand Down Expand Up @@ -7000,8 +6996,8 @@ TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) {
if (T.isNull())
return nullptr;

return ToContext.getTrivialTypeSourceInfo(T,
Import(FromTSI->getTypeLoc().getLocStart()));
return ToContext.getTrivialTypeSourceInfo(
T, Import(FromTSI->getTypeLoc().getBeginLoc()));
}

Attr *ASTImporter::Import(const Attr *FromAttr) {
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/AST/ASTStructuralEquivalence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
Context.Diag2(D2->getLocation(),
diag::warn_odr_tag_type_inconsistent)
<< Context.ToCtx.getTypeDeclType(D2);
Context.Diag2(Base2->getLocStart(), diag::note_odr_base)
Context.Diag2(Base2->getBeginLoc(), diag::note_odr_base)
<< Base2->getType() << Base2->getSourceRange();
Context.Diag1(Base1->getLocStart(), diag::note_odr_base)
Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base)
<< Base1->getType() << Base1->getSourceRange();
}
return false;
Expand All @@ -1075,9 +1075,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
Context.Diag2(D2->getLocation(),
diag::warn_odr_tag_type_inconsistent)
<< Context.ToCtx.getTypeDeclType(D2);
Context.Diag2(Base2->getLocStart(), diag::note_odr_virtual_base)
Context.Diag2(Base2->getBeginLoc(), diag::note_odr_virtual_base)
<< Base2->isVirtual() << Base2->getSourceRange();
Context.Diag1(Base1->getLocStart(), diag::note_odr_base)
Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base)
<< Base1->isVirtual() << Base1->getSourceRange();
}
return false;
Expand Down Expand Up @@ -1126,7 +1126,7 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent)
<< Context.ToCtx.getTypeDeclType(D2);
const CXXBaseSpecifier *Base1 = D1CXX->bases_begin();
Context.Diag1(Base1->getLocStart(), diag::note_odr_base)
Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base)
<< Base1->getType() << Base1->getSourceRange();
Context.Diag2(D2->getLocation(), diag::note_odr_missing_base);
}
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,7 @@ SourceRange ParmVarDecl::getSourceRange() const {
// DeclaratorDecl considers the range of postfix types as overlapping with the
// declaration name, but this is not the case with parameters in ObjC methods.
if (isa<ObjCMethodDecl>(getDeclContext()))
return SourceRange(DeclaratorDecl::getLocStart(), getLocation());
return SourceRange(DeclaratorDecl::getBeginLoc(), getLocation());

return DeclaratorDecl::getSourceRange();
}
Expand Down Expand Up @@ -3159,7 +3159,7 @@ SourceRange FunctionDecl::getReturnTypeSourceRange() const {
// Skip self-referential return types.
const SourceManager &SM = getASTContext().getSourceManager();
SourceRange RTRange = FTL.getReturnLoc().getSourceRange();
SourceLocation Boundary = getNameInfo().getLocStart();
SourceLocation Boundary = getNameInfo().getBeginLoc();
if (RTRange.isInvalid() || Boundary.isInvalid() ||
!SM.isBeforeInTranslationUnit(RTRange.getEnd(), Boundary))
return SourceRange();
Expand Down Expand Up @@ -4548,14 +4548,14 @@ SourceRange TypedefDecl::getSourceRange() const {
if (typeIsPostfix(TInfo->getType()))
RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
}
return SourceRange(getLocStart(), RangeEnd);
return SourceRange(getBeginLoc(), RangeEnd);
}

SourceRange TypeAliasDecl::getSourceRange() const {
SourceLocation RangeEnd = getLocStart();
SourceLocation RangeEnd = getBeginLoc();
if (TypeSourceInfo *TInfo = getTypeSourceInfo())
RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
return SourceRange(getLocStart(), RangeEnd);
return SourceRange(getBeginLoc(), RangeEnd);
}

void FileScopeAsmDecl::anchor() {}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::getSuperClass() const {

SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const {
if (TypeSourceInfo *superTInfo = getSuperClassTInfo())
return superTInfo->getTypeLoc().getLocStart();
return superTInfo->getTypeLoc().getBeginLoc();

return SourceLocation();
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ OMPCapturedExprDecl *OMPCapturedExprDecl::CreateDeserialized(ASTContext &C,

SourceRange OMPCapturedExprDecl::getSourceRange() const {
assert(hasInit());
return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd());
return SourceRange(getInit()->getBeginLoc(), getInit()->getLocEnd());
}
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ SourceLocation TemplateTypeParmDecl::getDefaultArgumentLoc() const {

SourceRange TemplateTypeParmDecl::getSourceRange() const {
if (hasDefaultArgument() && !defaultArgumentWasInherited())
return SourceRange(getLocStart(),
return SourceRange(getBeginLoc(),
getDefaultArgumentInfo()->getTypeLoc().getEndLoc());
else
return TypeDecl::getSourceRange();
Expand Down
34 changes: 17 additions & 17 deletions clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool Expr::isKnownToHaveBooleanValue() const {
// Amusing macro metaprogramming hack: check whether a class provides
// a more specific implementation of getExprLoc().
//
// See also Stmt.cpp:{getLocStart(),getLocEnd()}.
// See also Stmt.cpp:{getBeginLoc(),getLocEnd()}.
namespace {
/// This implementation is used when a class provides a custom
/// implementation of getExprLoc.
Expand All @@ -209,7 +209,7 @@ namespace {
template <class E>
SourceLocation getExprLocImpl(const Expr *expr,
SourceLocation (Expr::*v)() const) {
return static_cast<const E*>(expr)->getLocStart();
return static_cast<const E *>(expr)->getBeginLoc();
}
}

Expand Down Expand Up @@ -450,7 +450,7 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(const ASTContext &Context,
SourceLocation DeclRefExpr::getBeginLoc() const {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
return getNameInfo().getLocStart();
return getNameInfo().getBeginLoc();
}
SourceLocation DeclRefExpr::getEndLoc() const {
if (hasExplicitTemplateArgs())
Expand Down Expand Up @@ -1360,11 +1360,11 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const {

SourceLocation CallExpr::getBeginLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocStart();
return cast<CXXOperatorCallExpr>(this)->getBeginLoc();

SourceLocation begin = getCallee()->getLocStart();
SourceLocation begin = getCallee()->getBeginLoc();
if (begin.isInvalid() && getNumArgs() > 0 && getArg(0))
begin = getArg(0)->getLocStart();
begin = getArg(0)->getBeginLoc();
return begin;
}
SourceLocation CallExpr::getEndLoc() const {
Expand Down Expand Up @@ -1538,7 +1538,7 @@ SourceLocation MemberExpr::getBeginLoc() const {

// FIXME: We don't want this to happen. Rather, we should be able to
// detect all kinds of implicit accesses more cleanly.
SourceLocation BaseStartLoc = getBase()->getLocStart();
SourceLocation BaseStartLoc = getBase()->getBeginLoc();
if (BaseStartLoc.isValid())
return BaseStartLoc;
return MemberLoc;
Expand Down Expand Up @@ -2041,15 +2041,15 @@ bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions &LangOpts) const

SourceLocation InitListExpr::getBeginLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocStart();
return SyntacticForm->getBeginLoc();
SourceLocation Beg = LBraceLoc;
if (Beg.isInvalid()) {
// Find the first non-null initializer.
for (InitExprsTy::const_iterator I = InitExprs.begin(),
E = InitExprs.end();
I != E; ++I) {
if (Stmt *S = *I) {
Beg = S->getLocStart();
Beg = S->getBeginLoc();
break;
}
}
Expand Down Expand Up @@ -2274,12 +2274,12 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
if (HasWarnUnusedResultAttr ||
FD->hasAttr<PureAttr>() || FD->hasAttr<ConstAttr>()) {
WarnE = this;
Loc = CE->getCallee()->getLocStart();
Loc = CE->getCallee()->getBeginLoc();
R1 = CE->getCallee()->getSourceRange();

if (unsigned NumArgs = CE->getNumArgs())
R2 = SourceRange(CE->getArg(0)->getLocStart(),
CE->getArg(NumArgs-1)->getLocEnd());
R2 = SourceRange(CE->getArg(0)->getBeginLoc(),
CE->getArg(NumArgs - 1)->getLocEnd());
return true;
}
}
Expand All @@ -2296,7 +2296,7 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
if (const CXXRecordDecl *Type = getType()->getAsCXXRecordDecl()) {
if (Type->hasAttr<WarnUnusedAttr>()) {
WarnE = this;
Loc = getLocStart();
Loc = getBeginLoc();
R1 = getSourceRange();
return true;
}
Expand Down Expand Up @@ -2396,7 +2396,7 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
WarnE = this;
if (const CXXFunctionalCastExpr *CXXCE =
dyn_cast<CXXFunctionalCastExpr>(this)) {
Loc = CXXCE->getLocStart();
Loc = CXXCE->getBeginLoc();
R1 = CXXCE->getSubExpr()->getSourceRange();
} else {
const CStyleCastExpr *CStyleCE = cast<CStyleCastExpr>(this);
Expand Down Expand Up @@ -3866,8 +3866,8 @@ SourceRange DesignatedInitExpr::getDesignatorsSourceRange() const {
DesignatedInitExpr *DIE = const_cast<DesignatedInitExpr*>(this);
if (size() == 1)
return DIE->getDesignator(0)->getSourceRange();
return SourceRange(DIE->getDesignator(0)->getLocStart(),
DIE->getDesignator(size()-1)->getLocEnd());
return SourceRange(DIE->getDesignator(0)->getBeginLoc(),
DIE->getDesignator(size() - 1)->getLocEnd());
}

SourceLocation DesignatedInitExpr::getBeginLoc() const {
Expand Down Expand Up @@ -3945,7 +3945,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
}

SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const {
return getBase()->getLocStart();
return getBase()->getBeginLoc();
}

SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &C,

SourceLocation CXXConstructExpr::getBeginLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocStart();
return cast<CXXTemporaryObjectExpr>(this)->getBeginLoc();
return Loc;
}

Expand Down Expand Up @@ -486,17 +486,17 @@ SourceRange CXXOperatorCallExpr::getSourceRangeImpl() const {
return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd());
else
// Postfix operator
return SourceRange(getArg(0)->getLocStart(), getOperatorLoc());
return SourceRange(getArg(0)->getBeginLoc(), getOperatorLoc());
} else if (Kind == OO_Arrow) {
return getArg(0)->getSourceRange();
} else if (Kind == OO_Call) {
return SourceRange(getArg(0)->getLocStart(), getRParenLoc());
return SourceRange(getArg(0)->getBeginLoc(), getRParenLoc());
} else if (Kind == OO_Subscript) {
return SourceRange(getArg(0)->getLocStart(), getRParenLoc());
return SourceRange(getArg(0)->getBeginLoc(), getRParenLoc());
} else if (getNumArgs() == 1) {
return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd());
} else if (getNumArgs() == 2) {
return SourceRange(getArg(0)->getLocStart(), getArg(1)->getLocEnd());
return SourceRange(getArg(0)->getBeginLoc(), getArg(1)->getLocEnd());
} else {
return getOperatorLoc();
}
Expand Down Expand Up @@ -708,7 +708,7 @@ CXXFunctionalCastExpr::CreateEmpty(const ASTContext &C, unsigned PathSize) {
}

SourceLocation CXXFunctionalCastExpr::getBeginLoc() const {
return getTypeInfoAsWritten()->getTypeLoc().getLocStart();
return getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
}

SourceLocation CXXFunctionalCastExpr::getEndLoc() const {
Expand Down
53 changes: 27 additions & 26 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ namespace {

bool nextStep(const Stmt *S) {
if (!StepsLeft) {
FFDiag(S->getLocStart(), diag::note_constexpr_step_limit_exceeded);
FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
return false;
}
--StepsLeft;
Expand Down Expand Up @@ -2554,8 +2554,8 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E,
if (Info.checkingPotentialConstantExpression())
return false;
// FIXME: implement capture evaluation during constant expr evaluation.
Info.FFDiag(E->getLocStart(),
diag::note_unimplemented_constexpr_lambda_feature_ast)
Info.FFDiag(E->getBeginLoc(),
diag::note_unimplemented_constexpr_lambda_feature_ast)
<< "captures not currently allowed";
return false;
}
Expand Down Expand Up @@ -3845,8 +3845,8 @@ static bool EvaluateVarDecl(EvalInfo &Info, const VarDecl *VD) {

const Expr *InitE = VD->getInit();
if (!InitE) {
Info.FFDiag(VD->getLocStart(), diag::note_constexpr_uninitialized)
<< false << VD->getType();
Info.FFDiag(VD->getBeginLoc(), diag::note_constexpr_uninitialized)
<< false << VD->getType();
Val = APValue();
return false;
}
Expand Down Expand Up @@ -3991,7 +3991,8 @@ static EvalStmtResult EvaluateSwitch(StmtResult &Result, EvalInfo &Info,
case ESR_CaseNotFound:
// This can only happen if the switch case is nested within a statement
// expression. We have no intention of supporting that.
Info.FFDiag(Found->getLocStart(), diag::note_constexpr_stmt_expr_unsupported);
Info.FFDiag(Found->getBeginLoc(),
diag::note_constexpr_stmt_expr_unsupported);
return ESR_Failed;
}
llvm_unreachable("Invalid EvalStmtResult!");
Expand Down Expand Up @@ -4082,7 +4083,7 @@ static EvalStmtResult EvaluateStmt(StmtResult &Result, EvalInfo &Info,
return ESR_Succeeded;
}

Info.FFDiag(S->getLocStart());
Info.FFDiag(S->getBeginLoc());
return ESR_Failed;

case Stmt::NullStmtClass:
Expand Down Expand Up @@ -5077,8 +5078,8 @@ class ExprEvaluatorBase
if (BI + 1 == BE) {
const Expr *FinalExpr = dyn_cast<Expr>(*BI);
if (!FinalExpr) {
Info.FFDiag((*BI)->getLocStart(),
diag::note_constexpr_stmt_expr_unsupported);
Info.FFDiag((*BI)->getBeginLoc(),
diag::note_constexpr_stmt_expr_unsupported);
return false;
}
return this->Visit(FinalExpr);
Expand All @@ -5092,8 +5093,8 @@ class ExprEvaluatorBase
// 'break', or 'continue', it would be nice to propagate that to
// the outer statement evaluation rather than bailing out.
if (ESR != ESR_Failed)
Info.FFDiag((*BI)->getLocStart(),
diag::note_constexpr_stmt_expr_unsupported);
Info.FFDiag((*BI)->getBeginLoc(),
diag::note_constexpr_stmt_expr_unsupported);
return false;
}
}
Expand Down Expand Up @@ -10901,15 +10902,15 @@ static ICEDiag CheckEvalInICE(const Expr* E, const ASTContext &Ctx) {
Expr::EvalResult EVResult;
if (!E->EvaluateAsRValue(EVResult, Ctx) || EVResult.HasSideEffects ||
!EVResult.Val.isInt())
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());

return NoDiag();
}

static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
assert(!E->isValueDependent() && "Should not see value dependent exprs!");
if (!E->getType()->isIntegralOrEnumerationType())
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());

switch (E->getStmtClass()) {
#define ABSTRACT_STMT(Node)
Expand Down Expand Up @@ -10993,7 +10994,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
case Expr::CoawaitExprClass:
case Expr::DependentCoawaitExprClass:
case Expr::CoyieldExprClass:
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());

case Expr::InitListExprClass: {
// C++03 [dcl.init]p13: If T is a scalar type, then a declaration of the
Expand All @@ -11003,7 +11004,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
if (E->isRValue())
if (cast<InitListExpr>(E)->getNumInits() == 1)
return CheckICE(cast<InitListExpr>(E)->getInit(0), Ctx);
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
}

case Expr::SizeOfPackExprClass:
Expand Down Expand Up @@ -11038,7 +11039,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
const CallExpr *CE = cast<CallExpr>(E);
if (CE->getBuiltinCallee())
return CheckEvalInICE(E, Ctx);
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
}
case Expr::DeclRefExprClass: {
if (isa<EnumConstantDecl>(cast<DeclRefExpr>(E)->getDecl()))
Expand Down Expand Up @@ -11068,7 +11069,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
return ICEDiag(IK_NotICE, cast<DeclRefExpr>(E)->getLocation());
}
}
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
}
case Expr::UnaryOperatorClass: {
const UnaryOperator *Exp = cast<UnaryOperator>(E);
Expand All @@ -11083,7 +11084,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
// C99 6.6/3 allows increment and decrement within unevaluated
// subexpressions of constant expressions, but they can never be ICEs
// because an ICE cannot contain an lvalue operand.
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
case UO_Extension:
case UO_LNot:
case UO_Plus:
Expand All @@ -11110,7 +11111,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
const UnaryExprOrTypeTraitExpr *Exp = cast<UnaryExprOrTypeTraitExpr>(E);
if ((Exp->getKind() == UETT_SizeOf) &&
Exp->getTypeOfArgument()->isVariableArrayType())
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
return NoDiag();
}
case Expr::BinaryOperatorClass: {
Expand All @@ -11132,7 +11133,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
// C99 6.6/3 allows assignments within unevaluated subexpressions of
// constant expressions, but they can never be ICEs because an ICE cannot
// contain an lvalue operand.
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());

case BO_Mul:
case BO_Div:
Expand Down Expand Up @@ -11161,11 +11162,11 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
if (LHSResult.Kind == IK_ICE && RHSResult.Kind == IK_ICE) {
llvm::APSInt REval = Exp->getRHS()->EvaluateKnownConstInt(Ctx);
if (REval == 0)
return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart());
return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc());
if (REval.isSigned() && REval.isAllOnesValue()) {
llvm::APSInt LEval = Exp->getLHS()->EvaluateKnownConstInt(Ctx);
if (LEval.isMinSignedValue())
return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart());
return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc());
}
}
}
Expand All @@ -11174,10 +11175,10 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
// C99 6.6p3 introduces a strange edge case: comma can be in an ICE
// if it isn't evaluated.
if (LHSResult.Kind == IK_ICE && RHSResult.Kind == IK_ICE)
return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart());
return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc());
} else {
// In both C89 and C++, commas in ICEs are illegal.
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
}
}
return Worst(LHSResult, RHSResult);
Expand Down Expand Up @@ -11222,7 +11223,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
if (FL->getValue().convertToInteger(IgnoredVal,
llvm::APFloat::rmTowardZero,
&Ignored) & APFloat::opInvalidOp)
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
return NoDiag();
}
}
Expand All @@ -11235,7 +11236,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) {
case CK_IntegralCast:
return CheckICE(SubExpr, Ctx);
default:
return ICEDiag(IK_NotICE, E->getLocStart());
return ICEDiag(IK_NotICE, E->getBeginLoc());
}
}
case Expr::BinaryConditionalOperatorClass: {
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/AST/RawCommentList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ bool mergedCommentIsTrailingComment(StringRef Comment) {
/// column.
bool commentsStartOnSameColumn(const SourceManager &SM, const RawComment &R1,
const RawComment &R2) {
SourceLocation L1 = R1.getLocStart();
SourceLocation L2 = R2.getLocStart();
SourceLocation L1 = R1.getBeginLoc();
SourceLocation L2 = R2.getBeginLoc();
bool Invalid = false;
unsigned C1 = SM.getPresumedColumnNumber(L1, &Invalid);
if (!Invalid) {
Expand Down Expand Up @@ -278,8 +278,8 @@ void RawCommentList::addComment(const RawComment &RC,

// Check if the comments are not in source order.
while (!Comments.empty() &&
!SourceMgr.isBeforeInTranslationUnit(Comments.back()->getLocStart(),
RC.getLocStart())) {
!SourceMgr.isBeforeInTranslationUnit(Comments.back()->getBeginLoc(),
RC.getBeginLoc())) {
// If they are, just pop a few last comments that don't fit.
// This happens if an \#include directive contains comments.
Comments.pop_back();
Expand Down Expand Up @@ -316,9 +316,9 @@ void RawCommentList::addComment(const RawComment &RC,
(C1.isTrailingComment() && !C2.isTrailingComment() &&
isOrdinaryKind(C2.getKind()) &&
commentsStartOnSameColumn(SourceMgr, C1, C2))) &&
onlyWhitespaceBetween(SourceMgr, C1.getLocEnd(), C2.getLocStart(),
onlyWhitespaceBetween(SourceMgr, C1.getLocEnd(), C2.getBeginLoc(),
/*MaxNewlinesAllowed=*/1)) {
SourceRange MergedRange(C1.getLocStart(), C2.getLocEnd());
SourceRange MergedRange(C1.getBeginLoc(), C2.getLocEnd());
*Comments.back() = RawComment(SourceMgr, MergedRange, CommentOpts, true);
} else {
Comments.push_back(new (Allocator) RawComment(RC));
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/SelectorLocationsKind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ SourceLocation getArgLoc(T* Arg);

template <>
SourceLocation getArgLoc<Expr>(Expr *Arg) {
return Arg->getLocStart();
return Arg->getBeginLoc();
}

template <>
SourceLocation getArgLoc<ParmVarDecl>(ParmVarDecl *Arg) {
SourceLocation Loc = Arg->getLocStart();
SourceLocation Loc = Arg->getBeginLoc();
if (Loc.isInvalid())
return Loc;
// -1 to point to left paren of the method parameter's type.
Expand Down
28 changes: 13 additions & 15 deletions clang/lib/AST/Stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,12 @@ namespace {
return bad();
}

typedef SourceLocation getLocStart_t() const;
template <class T> good implements_getLocStart(getLocStart_t T::*) {
typedef SourceLocation getBeginLoc_t() const;
template <class T> good implements_getBeginLoc(getBeginLoc_t T::*) {
return good();
}
LLVM_ATTRIBUTE_UNUSED
static bad implements_getLocStart(getLocStart_t Stmt::*) {
return bad();
}
static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); }

typedef SourceLocation getLocEnd_t() const;
template <class T> good implements_getLocEnd(getLocEnd_t T::*) {
Expand All @@ -205,8 +203,8 @@ namespace {

#define ASSERT_IMPLEMENTS_children(type) \
(void) is_good(implements_children(&type::children))
#define ASSERT_IMPLEMENTS_getLocStart(type) \
(void) is_good(implements_getLocStart(&type::getLocStart))
#define ASSERT_IMPLEMENTS_getBeginLoc(type) \
(void)is_good(implements_getBeginLoc(&type::getBeginLoc))
#define ASSERT_IMPLEMENTS_getLocEnd(type) \
(void) is_good(implements_getLocEnd(&type::getLocEnd))

Expand All @@ -217,9 +215,9 @@ namespace {
LLVM_ATTRIBUTE_UNUSED
static inline void check_implementations() {
#define ABSTRACT_STMT(type)
#define STMT(type, base) \
ASSERT_IMPLEMENTS_children(type); \
ASSERT_IMPLEMENTS_getLocStart(type); \
#define STMT(type, base) \
ASSERT_IMPLEMENTS_children(type); \
ASSERT_IMPLEMENTS_getBeginLoc(type); \
ASSERT_IMPLEMENTS_getLocEnd(type);
#include "clang/AST/StmtNodes.inc"
}
Expand Down Expand Up @@ -257,8 +255,8 @@ namespace {
template <class S>
SourceRange getSourceRangeImpl(const Stmt *stmt,
SourceRange (Stmt::*v)() const) {
return SourceRange(static_cast<const S*>(stmt)->getLocStart(),
static_cast<const S*>(stmt)->getLocEnd());
return SourceRange(static_cast<const S *>(stmt)->getBeginLoc(),
static_cast<const S *>(stmt)->getLocEnd());
}

} // namespace
Expand All @@ -280,9 +278,9 @@ SourceLocation Stmt::getBeginLoc() const {
switch (getStmtClass()) {
case Stmt::NoStmtClass: llvm_unreachable("statement without class");
#define ABSTRACT_STMT(type)
#define STMT(type, base) \
case Stmt::type##Class: \
return static_cast<const type*>(this)->getLocStart();
#define STMT(type, base) \
case Stmt::type##Class: \
return static_cast<const type *>(this)->getBeginLoc();
#include "clang/AST/StmtNodes.inc"
}
llvm_unreachable("unknown statement kind");
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/StmtPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ static bool isImplicitSelf(const Expr *E) {
if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
if (const auto *PD = dyn_cast<ImplicitParamDecl>(DRE->getDecl())) {
if (PD->getParameterKind() == ImplicitParamDecl::ObjCSelf &&
DRE->getLocStart().isInvalid())
DRE->getBeginLoc().isInvalid())
return true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Analysis/AnalysisDeclContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool AnalysisDeclContext::isBodyAutosynthesized() const {
bool AnalysisDeclContext::isBodyAutosynthesizedFromModelFile() const {
bool Tmp;
Stmt *Body = getBody(Tmp);
return Tmp && Body->getLocStart().isValid();
return Tmp && Body->getBeginLoc().isValid();
}

/// Returns true if \param VD is an Objective-C implicit 'self' parameter.
Expand Down Expand Up @@ -500,7 +500,7 @@ void LocationContext::dumpStack(
OS << "Calling anonymous code";
if (const Stmt *S = cast<StackFrameContext>(LCtx)->getCallSite()) {
OS << " at ";
printLocation(OS, SM, S->getLocStart());
printLocation(OS, SM, S->getBeginLoc());
}
break;
case Scope:
Expand All @@ -510,7 +510,7 @@ void LocationContext::dumpStack(
OS << "Invoking block";
if (const Decl *D = cast<BlockInvocationContext>(LCtx)->getDecl()) {
OS << " defined at ";
printLocation(OS, SM, D->getLocStart());
printLocation(OS, SM, D->getBeginLoc());
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Analysis/CloneDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ASTContext &StmtSequence::getASTContext() const {
}

SourceLocation StmtSequence::getBeginLoc() const {
return front()->getLocStart();
return front()->getBeginLoc();
}

SourceLocation StmtSequence::getEndLoc() const { return back()->getLocEnd(); }
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Analysis/Consumed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static SourceLocation getFirstStmtLoc(const CFGBlock *Block) {
// is not empty.
for (const auto &B : *Block)
if (Optional<CFGStmt> CS = B.getAs<CFGStmt>())
return CS->getStmt()->getLocStart();
return CS->getStmt()->getBeginLoc();

// Block is empty.
// If we have one successor, return the first statement in that block
Expand All @@ -78,12 +78,12 @@ static SourceLocation getLastStmtLoc(const CFGBlock *Block) {
// Find the source location of the last statement in the block, if the block
// is not empty.
if (const Stmt *StmtNode = Block->getTerminator()) {
return StmtNode->getLocStart();
return StmtNode->getBeginLoc();
} else {
for (CFGBlock::const_reverse_iterator BI = Block->rbegin(),
BE = Block->rend(); BI != BE; ++BI) {
if (Optional<CFGStmt> CS = BI->getAs<CFGStmt>())
return CS->getStmt()->getLocStart();
return CS->getStmt()->getBeginLoc();
}
}

Expand Down Expand Up @@ -893,7 +893,7 @@ void ConsumedStmtVisitor::VisitReturnStmt(const ReturnStmt *Ret) {
}
}

StateMap->checkParamsForReturnTypestate(Ret->getLocStart(),
StateMap->checkParamsForReturnTypestate(Ret->getBeginLoc(),
Analyzer.WarningsHandler);
}

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Analysis/LiveVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ void LiveVariablesImpl::dumpBlockLiveness(const SourceManager &M) {

llvm::sort(declVec.begin(), declVec.end(),
[](const Decl *A, const Decl *B) {
return A->getLocStart() < B->getLocStart();
});
return A->getBeginLoc() < B->getBeginLoc();
});

for (std::vector<const VarDecl*>::iterator di = declVec.begin(),
de = declVec.end(); di != de; ++di) {
Expand Down
20 changes: 10 additions & 10 deletions clang/lib/Analysis/ReachableCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static bool isExpandedFromConfigurationMacro(const Stmt *S,
// value comes from a macro, but we can do much better. This is likely
// to be over conservative. This logic is factored into a separate function
// so that we can refine it later.
SourceLocation L = S->getLocStart();
SourceLocation L = S->getBeginLoc();
if (L.isMacroID()) {
SourceManager &SM = PP.getSourceManager();
if (IgnoreYES_NO) {
Expand Down Expand Up @@ -200,7 +200,7 @@ static bool isConfigurationValue(const Stmt *S,

// Special case looking for the sigil '()' around an integer literal.
if (const ParenExpr *PE = dyn_cast<ParenExpr>(S))
if (!PE->getLocStart().isMacroID())
if (!PE->getBeginLoc().isMacroID())
return isConfigurationValue(PE->getSubExpr(), PP, SilenceableCondVal,
IncludeIntegers, true);

Expand Down Expand Up @@ -446,7 +446,7 @@ bool DeadCodeScan::isDeadCodeRoot(const clang::CFGBlock *Block) {
}

static bool isValidDeadStmt(const Stmt *S) {
if (S->getLocStart().isInvalid())
if (S->getBeginLoc().isInvalid())
return false;
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(S))
return BO->getOpcode() != BO_Comma;
Expand Down Expand Up @@ -474,9 +474,9 @@ const Stmt *DeadCodeScan::findDeadCode(const clang::CFGBlock *Block) {

static int SrcCmp(const std::pair<const CFGBlock *, const Stmt *> *p1,
const std::pair<const CFGBlock *, const Stmt *> *p2) {
if (p1->second->getLocStart() < p2->second->getLocStart())
if (p1->second->getBeginLoc() < p2->second->getBeginLoc())
return -1;
if (p2->second->getLocStart() < p1->second->getLocStart())
if (p2->second->getBeginLoc() < p1->second->getBeginLoc())
return 1;
return 0;
}
Expand Down Expand Up @@ -509,7 +509,7 @@ unsigned DeadCodeScan::scanBackwards(const clang::CFGBlock *Start,
}

// Specially handle macro-expanded code.
if (S->getLocStart().isMacroID()) {
if (S->getBeginLoc().isMacroID()) {
count += scanMaybeReachableFromBlock(Block, PP, Reachable);
continue;
}
Expand Down Expand Up @@ -592,7 +592,7 @@ static SourceLocation GetUnreachableLoc(const Stmt *S,
case Expr::CXXFunctionalCastExprClass: {
const CXXFunctionalCastExpr *CE = cast <CXXFunctionalCastExpr>(S);
R1 = CE->getSubExpr()->getSourceRange();
return CE->getLocStart();
return CE->getBeginLoc();
}
case Stmt::CXXTryStmtClass: {
return cast<CXXTryStmt>(S)->getHandler(0)->getCatchLoc();
Expand All @@ -605,7 +605,7 @@ static SourceLocation GetUnreachableLoc(const Stmt *S,
default: ;
}
R1 = S->getSourceRange();
return S->getLocStart();
return S->getBeginLoc();
}

void DeadCodeScan::reportDeadCode(const CFGBlock *B,
Expand All @@ -631,12 +631,12 @@ void DeadCodeScan::reportDeadCode(const CFGBlock *B,
// a for/for-range loop. This is the block that contains
// the increment code.
if (const Stmt *LoopTarget = B->getLoopTarget()) {
SourceLocation Loc = LoopTarget->getLocStart();
SourceLocation Loc = LoopTarget->getBeginLoc();
SourceRange R1(Loc, Loc), R2;

if (const ForStmt *FS = dyn_cast<ForStmt>(LoopTarget)) {
const Expr *Inc = FS->getInc();
Loc = Inc->getLocStart();
Loc = Inc->getBeginLoc();
R2 = Inc->getSourceRange();
}

Expand Down
8 changes: 4 additions & 4 deletions clang/lib/Analysis/ThreadSafety.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,13 @@ static void findBlockLocations(CFG *CFGraph,
// Find the source location of the last statement in the block, if the
// block is not empty.
if (const Stmt *S = CurrBlock->getTerminator()) {
CurrBlockInfo->EntryLoc = CurrBlockInfo->ExitLoc = S->getLocStart();
CurrBlockInfo->EntryLoc = CurrBlockInfo->ExitLoc = S->getBeginLoc();
} else {
for (CFGBlock::const_reverse_iterator BI = CurrBlock->rbegin(),
BE = CurrBlock->rend(); BI != BE; ++BI) {
// FIXME: Handle other CFGElement kinds.
if (Optional<CFGStmt> CS = BI->getAs<CFGStmt>()) {
CurrBlockInfo->ExitLoc = CS->getStmt()->getLocStart();
CurrBlockInfo->ExitLoc = CS->getStmt()->getBeginLoc();
break;
}
}
Expand All @@ -837,7 +837,7 @@ static void findBlockLocations(CFG *CFGraph,
for (const auto &BI : *CurrBlock) {
// FIXME: Handle other CFGElement kinds.
if (Optional<CFGStmt> CS = BI.getAs<CFGStmt>()) {
CurrBlockInfo->EntryLoc = CS->getStmt()->getLocStart();
CurrBlockInfo->EntryLoc = CS->getStmt()->getBeginLoc();
break;
}
}
Expand Down Expand Up @@ -2080,7 +2080,7 @@ void BuildLockset::VisitDeclStmt(DeclStmt *S) {
CXXConstructorDecl *CtorD = findConstructorForByValueReturn(RD);
if (!CtorD || !CtorD->hasAttrs())
continue;
handleCall(buildFakeCtorCall(CtorD, {E}, E->getLocStart()), CtorD, VD);
handleCall(buildFakeCtorCall(CtorD, {E}, E->getBeginLoc()), CtorD, VD);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGAtomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
getContext().toBits(sizeChars) > MaxInlineWidthInBits);

if (UseLibcall)
CGM.getDiags().Report(E->getLocStart(), diag::warn_atomic_op_misaligned);
CGM.getDiags().Report(E->getBeginLoc(), diag::warn_atomic_op_misaligned);

llvm::Value *Order = EmitScalarExpr(E->getOrder());
llvm::Value *Scope =
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CodeGen/CGBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D,
}
}

SourceLocation StartLoc = BlockInfo->getBlockExpr()->getBody()->getLocStart();
SourceLocation StartLoc = BlockInfo->getBlockExpr()->getBody()->getBeginLoc();
ApplyDebugLocation Scope(*this, StartLoc);

// Instead of messing around with LocalDeclMap, just set the value
Expand Down Expand Up @@ -1403,7 +1403,7 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD,
// Begin generating the function.
StartFunction(blockDecl, fnType->getReturnType(), fn, fnInfo, args,
blockDecl->getLocation(),
blockInfo.getBlockExpr()->getBody()->getLocStart());
blockInfo.getBlockExpr()->getBody()->getBeginLoc());

// Okay. Undo some of what StartFunction did.

Expand Down Expand Up @@ -1712,7 +1712,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);

StartFunction(FD, C.VoidTy, Fn, FI, args);
ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getLocStart()};
ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};
llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();

Address src = GetAddrOfLocalVar(&SrcDecl);
Expand Down Expand Up @@ -1898,7 +1898,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);

StartFunction(FD, C.VoidTy, Fn, FI, args);
ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getLocStart()};
ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()};

llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type,
assert(DIter != LocalDeclMap.end());

return EmitLoadOfScalar(DIter->second, /*volatile=*/false,
getContext().getSizeType(), E->getLocStart());
getContext().getSizeType(), E->getBeginLoc());
}
}

Expand Down
8 changes: 4 additions & 4 deletions clang/lib/CodeGen/CGCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
} else {
// Load scalar value from indirect argument.
llvm::Value *V =
EmitLoadOfScalar(ParamAddr, false, Ty, Arg->getLocStart());
EmitLoadOfScalar(ParamAddr, false, Ty, Arg->getBeginLoc());

if (isPromoted)
V = emitArgumentDemotion(*this, Arg, V);
Expand Down Expand Up @@ -2490,7 +2490,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// Match to what EmitParmDecl is expecting for this type.
if (CodeGenFunction::hasScalarEvaluationKind(Ty)) {
llvm::Value *V =
EmitLoadOfScalar(Alloca, false, Ty, Arg->getLocStart());
EmitLoadOfScalar(Alloca, false, Ty, Arg->getBeginLoc());
if (isPromoted)
V = emitArgumentDemotion(*this, Arg, V);
ArgVals.push_back(ParamValue::forDirect(V));
Expand Down Expand Up @@ -4502,8 +4502,8 @@ CGCallee CGCallee::prepareConcreteCallee(CodeGenFunction &CGF) const {
if (isVirtual()) {
const CallExpr *CE = getVirtualCallExpr();
return CGF.CGM.getCXXABI().getVirtualFunctionPointer(
CGF, getVirtualMethodDecl(), getThisAddress(),
getFunctionType(), CE ? CE->getLocStart() : SourceLocation());
CGF, getVirtualMethodDecl(), getThisAddress(), getFunctionType(),
CE ? CE->getBeginLoc() : SourceLocation());
}

return *this;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2844,7 +2844,7 @@ void CodeGenFunction::EmitLambdaBlockInvokeBody() {

// Add the rest of the parameters.
for (auto param : BD->parameters())
EmitDelegateCallArg(CallArgs, param, param->getLocStart());
EmitDelegateCallArg(CallArgs, param, param->getBeginLoc());

assert(!Lambda->isGenericLambda() &&
"generic lambda interconversion to block not implemented");
Expand All @@ -2863,7 +2863,7 @@ void CodeGenFunction::EmitLambdaDelegatingInvokeBody(const CXXMethodDecl *MD) {

// Add the rest of the parameters.
for (auto Param : MD->parameters())
EmitDelegateCallArg(CallArgs, Param, Param->getLocStart());
EmitDelegateCallArg(CallArgs, Param, Param->getBeginLoc());

const CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator();
// For a generic lambda, find the corresponding call operator specialization
Expand Down
14 changes: 7 additions & 7 deletions clang/lib/CodeGen/CGCoroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ static void createCoroData(CodeGenFunction &CGF,
CallExpr const *CoroIdExpr = nullptr) {
if (CurCoro.Data) {
if (CurCoro.Data->CoroIdExpr)
CGF.CGM.Error(CoroIdExpr->getLocStart(),
CGF.CGM.Error(CoroIdExpr->getBeginLoc(),
"only one __builtin_coro_id can be used in a function");
else if (CoroIdExpr)
CGF.CGM.Error(CoroIdExpr->getLocStart(),
CGF.CGM.Error(CoroIdExpr->getBeginLoc(),
"__builtin_coro_id shall not be used in a C++ coroutine");
else
llvm_unreachable("EmitCoroutineBodyStatement called twice?");
Expand Down Expand Up @@ -444,7 +444,7 @@ struct CallCoroDelete final : public EHScopeStack::Cleanup {
// We should have captured coro.free from the emission of deallocate.
auto *CoroFree = CGF.CurCoro.Data->LastCoroFree;
if (!CoroFree) {
CGF.CGM.Error(Deallocate->getLocStart(),
CGF.CGM.Error(Deallocate->getBeginLoc(),
"Deallocation expressoin does not refer to coro.free");
return;
}
Expand Down Expand Up @@ -654,7 +654,7 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
EmitBlock(BodyBB);
}

auto Loc = S.getLocStart();
auto Loc = S.getBeginLoc();
CXXCatchStmt Catch(Loc, /*exDecl=*/nullptr,
CurCoro.Data->ExceptionHandler);
auto *TryStmt =
Expand Down Expand Up @@ -707,8 +707,8 @@ RValue CodeGenFunction::EmitCoroutineIntrinsic(const CallExpr *E,
if (CurCoro.Data && CurCoro.Data->CoroBegin) {
return RValue::get(CurCoro.Data->CoroBegin);
}
CGM.Error(E->getLocStart(), "this builtin expect that __builtin_coro_begin "
"has been used earlier in this function");
CGM.Error(E->getBeginLoc(), "this builtin expect that __builtin_coro_begin "
"has been used earlier in this function");
auto NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy());
return RValue::get(NullPtr);
}
Expand All @@ -722,7 +722,7 @@ RValue CodeGenFunction::EmitCoroutineIntrinsic(const CallExpr *E,
Args.push_back(CurCoro.Data->CoroId);
break;
}
CGM.Error(E->getLocStart(), "this builtin expect that __builtin_coro_id has"
CGM.Error(E->getBeginLoc(), "this builtin expect that __builtin_coro_id has"
" been used earlier in this function");
// Fallthrough to the next case to add TokenNone as the first argument.
LLVM_FALLTHROUGH;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
if (D->hasAttr<NoDebugAttr>())
DebugInfo = nullptr; // disable debug info indefinitely for this function

CurEHLocation = D->getLocStart();
CurEHLocation = D->getBeginLoc();

StartFunction(GlobalDecl(D), getContext().VoidTy, Fn,
getTypes().arrangeNullaryFunction(),
Expand Down Expand Up @@ -679,7 +679,7 @@ llvm::Function *CodeGenFunction::generateDestroyHelper(
llvm::Function *fn = CGM.CreateGlobalInitOrDestructFunction(
FTy, "__cxx_global_array_dtor", FI, VD->getLocation());

CurEHLocation = VD->getLocStart();
CurEHLocation = VD->getBeginLoc();

StartFunction(VD, getContext().VoidTy, fn, FI, args);

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ void CodeGenFunction::EmitCapturedLocals(CodeGenFunction &ParentCGF,
void CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
bool IsFilter,
const Stmt *OutlinedStmt) {
SourceLocation StartLoc = OutlinedStmt->getLocStart();
SourceLocation StartLoc = OutlinedStmt->getBeginLoc();

// Get the mangled function name.
SmallString<128> Name;
Expand Down Expand Up @@ -1871,7 +1871,7 @@ void CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
IsOutlinedSEHHelper = true;

StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args,
OutlinedStmt->getLocStart(), OutlinedStmt->getLocStart());
OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc());
CurSEHParent = ParentCGF.CurSEHParent;

CGM.SetLLVMFunctionAttributes(nullptr, FnInfo, CurFn);
Expand Down
18 changes: 8 additions & 10 deletions clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ Address CodeGenFunction::EmitPointerWithAlignment(const Expr *E,
EmitVTablePtrCheckForCast(PT->getPointeeType(), Addr.getPointer(),
/*MayBeNull=*/true,
CodeGenFunction::CFITCK_UnrelatedCast,
CE->getLocStart());
CE->getBeginLoc());
}
return CE->getCastKind() != CK_AddressSpaceConversion
? Builder.CreateBitCast(Addr, ConvertType(E->getType()))
Expand Down Expand Up @@ -4226,8 +4226,8 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {

if (SanOpts.has(SanitizerKind::CFIDerivedCast))
EmitVTablePtrCheckForCast(E->getType(), Derived.getPointer(),
/*MayBeNull=*/false,
CFITCK_DerivedCast, E->getLocStart());
/*MayBeNull=*/false, CFITCK_DerivedCast,
E->getBeginLoc());

return MakeAddrLValue(Derived, E->getType(), LV.getBaseInfo(),
CGM.getTBAAInfoForSubobject(LV, E->getType()));
Expand All @@ -4243,8 +4243,8 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {

if (SanOpts.has(SanitizerKind::CFIUnrelatedCast))
EmitVTablePtrCheckForCast(E->getType(), V.getPointer(),
/*MayBeNull=*/false,
CFITCK_UnrelatedCast, E->getLocStart());
/*MayBeNull=*/false, CFITCK_UnrelatedCast,
E->getBeginLoc());

return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(),
CGM.getTBAAInfoForSubobject(LV, E->getType()));
Expand Down Expand Up @@ -4653,10 +4653,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
DecodeAddrUsedInPrologue(CalleePtr, CalleeRTTIEncoded);
llvm::Value *CalleeRTTIMatch =
Builder.CreateICmpEQ(CalleeRTTI, FTRTTIConst);
llvm::Constant *StaticData[] = {
EmitCheckSourceLocation(E->getLocStart()),
EmitCheckTypeDescriptor(CalleeType)
};
llvm::Constant *StaticData[] = {EmitCheckSourceLocation(E->getBeginLoc()),
EmitCheckTypeDescriptor(CalleeType)};
EmitCheck(std::make_pair(CalleeRTTIMatch, SanitizerKind::Function),
SanitizerHandler::FunctionTypeMismatch, StaticData, CalleePtr);

Expand Down Expand Up @@ -4690,7 +4688,7 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
auto CrossDsoTypeId = CGM.CreateCrossDsoCfiTypeId(MD);
llvm::Constant *StaticData[] = {
llvm::ConstantInt::get(Int8Ty, CFITCK_ICall),
EmitCheckSourceLocation(E->getLocStart()),
EmitCheckSourceLocation(E->getBeginLoc()),
EmitCheckTypeDescriptor(QualType(FnType, 0)),
};
if (CGM.getCodeGenOpts().SanitizeCfiCrossDso && CrossDsoTypeId) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ RValue CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(
std::tie(VTable, RD) =
CGM.getCXXABI().LoadVTablePtr(*this, This.getAddress(),
MD->getParent());
EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getLocStart());
EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getBeginLoc());
}

if (getLangOpts().AppleKext && MD->isVirtual() && HasQualifier)
Expand Down
11 changes: 5 additions & 6 deletions clang/lib/CodeGen/CGExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
CGF.EmitVTablePtrCheckForCast(PT->getPointeeType(), Src,
/*MayBeNull=*/true,
CodeGenFunction::CFITCK_UnrelatedCast,
CE->getLocStart());
CE->getBeginLoc());
}

if (CGF.CGM.getCodeGenOpts().StrictVTablePointers) {
Expand Down Expand Up @@ -1745,11 +1745,10 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
Derived.getPointer(), DestTy->getPointeeType());

if (CGF.SanOpts.has(SanitizerKind::CFIDerivedCast))
CGF.EmitVTablePtrCheckForCast(DestTy->getPointeeType(),
Derived.getPointer(),
/*MayBeNull=*/true,
CodeGenFunction::CFITCK_DerivedCast,
CE->getLocStart());
CGF.EmitVTablePtrCheckForCast(
DestTy->getPointeeType(), Derived.getPointer(),
/*MayBeNull=*/true, CodeGenFunction::CFITCK_DerivedCast,
CE->getBeginLoc());

return Derived.getPointer();
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
llvm::Constant *Constant =
CGM.CreateRuntimeVariable(ConvertType(IdTy), ConstantName);
LValue LV = MakeNaturalAlignAddrLValue(Constant, IdTy);
llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getLocStart());
llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc());
cast<llvm::LoadInst>(Ptr)->setMetadata(
CGM.getModule().getMDKindID("invariant.load"),
llvm::MDNode::get(getLLVMContext(), None));
Expand Down Expand Up @@ -531,7 +531,7 @@ struct FinishARCDealloc final : EHScopeStack::Cleanup {
/// CodeGenFunction.
void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD,
const ObjCContainerDecl *CD) {
SourceLocation StartLoc = OMD->getLocStart();
SourceLocation StartLoc = OMD->getBeginLoc();
FunctionArgList args;
// Check if we should generate debug info for this method.
if (OMD->hasAttr<NoDebugAttr>())
Expand Down
24 changes: 12 additions & 12 deletions clang/lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,8 @@ llvm::Value *CGOpenMPRuntime::emitTaskOutlinedFunction(
bool Tied, unsigned &NumberOfParts) {
auto &&UntiedCodeGen = [this, &D, TaskTVar](CodeGenFunction &CGF,
PrePostActionTy &) {
llvm::Value *ThreadID = getThreadID(CGF, D.getLocStart());
llvm::Value *UpLoc = emitUpdateLocation(CGF, D.getLocStart());
llvm::Value *ThreadID = getThreadID(CGF, D.getBeginLoc());
llvm::Value *UpLoc = emitUpdateLocation(CGF, D.getBeginLoc());
llvm::Value *TaskArgs[] = {
UpLoc, ThreadID,
CGF.EmitLoadOfPointerLValue(CGF.GetAddrOfLocalVar(TaskTVar),
Expand Down Expand Up @@ -2648,7 +2648,7 @@ bool CGOpenMPRuntime::emitDeclareTargetVarDefinition(const VarDecl *VD,

QualType ASTTy = VD->getType();

SourceLocation Loc = VD->getCanonicalDecl()->getLocStart();
SourceLocation Loc = VD->getCanonicalDecl()->getBeginLoc();
// Produce the unique prefix to identify the new target regions. We use
// the source location of the variable declaration which we know to not
// conflict with any target region.
Expand Down Expand Up @@ -5788,7 +5788,7 @@ static std::string generateUniqueName(CodeGenModule &CGM, StringRef Prefix,
std::string Name = CGM.getOpenMPRuntime().getName(
{D->isLocalVarDeclOrParm() ? D->getName() : CGM.getMangledName(D)});
Out << Prefix << Name << "_"
<< D->getCanonicalDecl()->getLocStart().getRawEncoding();
<< D->getCanonicalDecl()->getBeginLoc().getRawEncoding();
return Out.str();
}

Expand Down Expand Up @@ -6286,7 +6286,7 @@ void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(
unsigned DeviceID;
unsigned FileID;
unsigned Line;
getTargetEntryUniqueInfo(CGM.getContext(), D.getLocStart(), DeviceID, FileID,
getTargetEntryUniqueInfo(CGM.getContext(), D.getBeginLoc(), DeviceID, FileID,
Line);
SmallString<64> EntryFnName;
{
Expand Down Expand Up @@ -7802,7 +7802,7 @@ void CGOpenMPRuntime::emitTargetCall(CodeGenFunction &CGF,
CapturedVars.clear();
CGF.GenerateOpenMPCapturedVars(CS, CapturedVars);
}
emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedFn, CapturedVars);
emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedFn, CapturedVars);
CGF.EmitBranch(OffloadContBlock);

CGF.EmitBlock(OffloadContBlock, /*IsFinished=*/true);
Expand All @@ -7816,7 +7816,7 @@ void CGOpenMPRuntime::emitTargetCall(CodeGenFunction &CGF,
CapturedVars.clear();
CGF.GenerateOpenMPCapturedVars(CS, CapturedVars);
}
emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedFn, CapturedVars);
emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedFn, CapturedVars);
};

auto &&TargetThenGen = [this, &ThenGen, &D, &InputInfo, &MapTypesArray,
Expand Down Expand Up @@ -7947,7 +7947,7 @@ void CGOpenMPRuntime::scanForTargetRegionsFunctions(const Stmt *S,
unsigned DeviceID;
unsigned FileID;
unsigned Line;
getTargetEntryUniqueInfo(CGM.getContext(), E.getLocStart(), DeviceID,
getTargetEntryUniqueInfo(CGM.getContext(), E.getBeginLoc(), DeviceID,
FileID, Line);

// Is this a target region that should not be emitted as an entry point? If
Expand Down Expand Up @@ -8855,8 +8855,8 @@ void CGOpenMPRuntime::emitDoacrossInit(CodeGenFunction &CGF,

// Build call void __kmpc_doacross_init(ident_t *loc, kmp_int32 gtid,
// kmp_int32 num_dims, struct kmp_dim * dims);
llvm::Value *Args[] = {emitUpdateLocation(CGF, D.getLocStart()),
getThreadID(CGF, D.getLocStart()),
llvm::Value *Args[] = {emitUpdateLocation(CGF, D.getBeginLoc()),
getThreadID(CGF, D.getBeginLoc()),
llvm::ConstantInt::getSigned(CGM.Int32Ty, 1),
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
DimsAddr.getPointer(), CGM.VoidPtrTy)};
Expand All @@ -8881,8 +8881,8 @@ void CGOpenMPRuntime::emitDoacrossOrdered(CodeGenFunction &CGF,
CounterVal->getExprLoc());
Address CntAddr = CGF.CreateMemTemp(Int64Ty, ".cnt.addr");
CGF.EmitStoreOfScalar(CntVal, CntAddr, /*Volatile=*/false, Int64Ty);
llvm::Value *Args[] = {emitUpdateLocation(CGF, C->getLocStart()),
getThreadID(CGF, C->getLocStart()),
llvm::Value *Args[] = {emitUpdateLocation(CGF, C->getBeginLoc()),
getThreadID(CGF, C->getBeginLoc()),
CntAddr.getPointer()};
llvm::Value *RTLFn;
if (C->getDependencyKind() == OMPC_DEPEND_source) {
Expand Down
16 changes: 8 additions & 8 deletions clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ void CGOpenMPRuntimeNVPTX::emitNonSPMDKernel(const OMPExecutableDirective &D,
const RegionCodeGenTy &CodeGen) {
ExecutionModeRAII ModeRAII(CurrentExecutionMode, /*IsSPMD=*/false);
EntryFunctionState EST;
WorkerFunctionState WST(CGM, D.getLocStart());
WorkerFunctionState WST(CGM, D.getBeginLoc());
Work.clear();
WrapperFunctionsMap.clear();

Expand Down Expand Up @@ -1600,7 +1600,7 @@ llvm::Value *CGOpenMPRuntimeNVPTX::emitParallelOutlinedFunction(
llvm::Value *CGOpenMPRuntimeNVPTX::emitTeamsOutlinedFunction(
const OMPExecutableDirective &D, const VarDecl *ThreadIDVar,
OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) {
SourceLocation Loc = D.getLocStart();
SourceLocation Loc = D.getBeginLoc();

// Emit target region as a standalone region.
class NVPTXPrePostActionTy : public PrePostActionTy {
Expand Down Expand Up @@ -3478,7 +3478,7 @@ CGOpenMPRuntimeNVPTX::translateParameter(const FieldDecl *FD,
return ParmVarDecl::Create(
CGM.getContext(),
const_cast<DeclContext *>(NativeParam->getDeclContext()),
NativeParam->getLocStart(), NativeParam->getLocation(),
NativeParam->getBeginLoc(), NativeParam->getLocation(),
NativeParam->getIdentifier(), ArgType,
/*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr);
}
Expand Down Expand Up @@ -3556,10 +3556,10 @@ llvm::Function *CGOpenMPRuntimeNVPTX::createParallelDataSharingWrapper(
Ctx.getIntTypeForBitwidth(/*DestWidth=*/16, /*Signed=*/false);
QualType Int32QTy =
Ctx.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/false);
ImplicitParamDecl ParallelLevelArg(Ctx, /*DC=*/nullptr, D.getLocStart(),
ImplicitParamDecl ParallelLevelArg(Ctx, /*DC=*/nullptr, D.getBeginLoc(),
/*Id=*/nullptr, Int16QTy,
ImplicitParamDecl::Other);
ImplicitParamDecl WrapperArg(Ctx, /*DC=*/nullptr, D.getLocStart(),
ImplicitParamDecl WrapperArg(Ctx, /*DC=*/nullptr, D.getBeginLoc(),
/*Id=*/nullptr, Int32QTy,
ImplicitParamDecl::Other);
WrapperArgs.emplace_back(&ParallelLevelArg);
Expand All @@ -3577,7 +3577,7 @@ llvm::Function *CGOpenMPRuntimeNVPTX::createParallelDataSharingWrapper(

CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);
CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, Fn, CGFI, WrapperArgs,
D.getLocStart(), D.getLocStart());
D.getBeginLoc(), D.getBeginLoc());

const auto *RD = CS.getCapturedRecordDecl();
auto CurField = RD->field_begin();
Expand Down Expand Up @@ -3662,7 +3662,7 @@ llvm::Function *CGOpenMPRuntimeNVPTX::createParallelDataSharingWrapper(
}
}

emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedParallelFn, Args);
emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedParallelFn, Args);
CGF.FinishFunction();
return Fn;
}
Expand Down Expand Up @@ -3710,7 +3710,7 @@ void CGOpenMPRuntimeNVPTX::emitFunctionProlog(CodeGenFunction &CGF,
Data.insert(std::make_pair(VD, std::make_pair(FD, Address::invalid())));
}
if (!NeedToDelayGlobalization) {
emitGenericVarsProlog(CGF, D->getLocStart());
emitGenericVarsProlog(CGF, D->getBeginLoc());
struct GlobalizationScope final : EHScopeStack::Cleanup {
GlobalizationScope() = default;

Expand Down
18 changes: 9 additions & 9 deletions clang/lib/CodeGen/CGStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace CodeGen;
void CodeGenFunction::EmitStopPoint(const Stmt *S) {
if (CGDebugInfo *DI = getDebugInfo()) {
SourceLocation Loc;
Loc = S->getLocStart();
Loc = S->getBeginLoc();
DI->EmitLocation(Builder, Loc);

LastStopPoint = Loc;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) {
/// non-void. Fun stuff :).
void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
if (requiresReturnValueCheck()) {
llvm::Constant *SLoc = EmitCheckSourceLocation(S.getLocStart());
llvm::Constant *SLoc = EmitCheckSourceLocation(S.getBeginLoc());
auto *SLocPtr =
new llvm::GlobalVariable(CGM.getModule(), SLoc->getType(), false,
llvm::GlobalVariable::PrivateLinkage, SLoc);
Expand Down Expand Up @@ -1848,7 +1848,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str,
SmallVector<llvm::Metadata *, 8> Locs;
// Add the location of the first line to the MDNode.
Locs.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
CGF.Int32Ty, Str->getLocStart().getRawEncoding())));
CGF.Int32Ty, Str->getBeginLoc().getRawEncoding())));
StringRef StrVal = Str->getString();
if (!StrVal.empty()) {
const SourceManager &SM = CGF.CGM.getContext().getSourceManager();
Expand Down Expand Up @@ -2272,7 +2272,7 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) {
"CapturedStmtInfo should be set when generating the captured function");
const CapturedDecl *CD = S.getCapturedDecl();
const RecordDecl *RD = S.getCapturedRecordDecl();
SourceLocation Loc = S.getLocStart();
SourceLocation Loc = S.getBeginLoc();
assert(CD->hasBody() && "missing CapturedDecl body");

// Build the argument list.
Expand All @@ -2293,9 +2293,8 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) {
F->addFnAttr(llvm::Attribute::NoUnwind);

// Generate the function.
StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args,
CD->getLocation(),
CD->getBody()->getLocStart());
StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, CD->getLocation(),
CD->getBody()->getBeginLoc());
// Set the context parameter in CapturedStmtInfo.
Address DeclPtr = GetAddrOfLocalVar(CD->getContextParam());
CapturedStmtInfo->setContextValue(Builder.CreateLoad(DeclPtr));
Expand All @@ -2305,8 +2304,9 @@ CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) {
Ctx.getTagDeclType(RD));
for (auto *FD : RD->fields()) {
if (FD->hasCapturedVLAType()) {
auto *ExprArg = EmitLoadOfLValue(EmitLValueForField(Base, FD),
S.getLocStart()).getScalarVal();
auto *ExprArg =
EmitLoadOfLValue(EmitLValueForField(Base, FD), S.getBeginLoc())
.getScalarVal();
auto VAT = FD->getCapturedVLAType();
VLASizeMap[VAT->getSizeExpr()] = ExprArg;
}
Expand Down
Loading