Port getLocEnd -> getEndLoc
Reviewers: teemperor!
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50351
llvm-svn: 339386
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index 1716605..1184462 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -2032,7 +2032,7 @@
<< ClauseName.drop_front() << "Clause";
}
dumpPointer(C);
- dumpSourceRange(SourceRange(C->getBeginLoc(), C->getLocEnd()));
+ dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
if (C->isImplicit())
OS << " <implicit>";
for (auto *S : C->children())
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 16ebe83..768b2e5 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -2755,7 +2755,7 @@
ToFunction->setVirtualAsWritten(D->isVirtualAsWritten());
ToFunction->setTrivial(D->isTrivial());
ToFunction->setPure(D->isPure());
- ToFunction->setRangeEnd(Importer.Import(D->getLocEnd()));
+ ToFunction->setRangeEnd(Importer.Import(D->getEndLoc()));
// Set the parameters.
for (auto *Param : Parameters) {
@@ -3409,7 +3409,7 @@
ObjCMethodDecl *ToMethod;
if (GetImportedOrCreateDecl(
ToMethod, D, Importer.getToContext(), Loc,
- Importer.Import(D->getLocEnd()), Name.getObjCSelector(), ResultTy,
+ Importer.Import(D->getEndLoc()), Name.getObjCSelector(), ResultTy,
ReturnTInfo, DC, D->isInstanceMethod(), D->isVariadic(),
D->isPropertyAccessor(), D->isImplicit(), D->isDefined(),
D->getImplementationControl(), D->hasRelatedResultType()))
@@ -5862,7 +5862,7 @@
return new (Importer.getToContext()) ArrayTypeTraitExpr(
Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried,
- E->getValue(), Dim, Importer.Import(E->getLocEnd()), T);
+ E->getValue(), Dim, Importer.Import(E->getEndLoc()), T);
}
Expr *ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
@@ -5876,7 +5876,7 @@
return new (Importer.getToContext()) ExpressionTraitExpr(
Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried,
- E->getValue(), Importer.Import(E->getLocEnd()), T);
+ E->getValue(), Importer.Import(E->getEndLoc()), T);
}
Expr *ASTNodeImporter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
@@ -6062,7 +6062,7 @@
case OffsetOfNode::Array:
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()),
Node.getArrayExprIndex(),
- Importer.Import(Node.getLocEnd())));
+ Importer.Import(Node.getEndLoc())));
break;
case OffsetOfNode::Base: {
@@ -6077,7 +6077,7 @@
if (!FD)
return nullptr;
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), FD,
- Importer.Import(Node.getLocEnd())));
+ Importer.Import(Node.getEndLoc())));
break;
}
case OffsetOfNode::Identifier: {
@@ -6085,7 +6085,7 @@
if (!ToII)
return nullptr;
Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), ToII,
- Importer.Import(Node.getLocEnd())));
+ Importer.Import(Node.getEndLoc())));
break;
}
}
@@ -6126,7 +6126,7 @@
return new (Importer.getToContext())
CXXNoexceptExpr(T, Operand, CanThrow, Importer.Import(E->getBeginLoc()),
- Importer.Import(E->getLocEnd()));
+ Importer.Import(E->getEndLoc()));
}
Expr *ASTNodeImporter::VisitCXXThrowExpr(CXXThrowExpr *E) {
@@ -6729,16 +6729,12 @@
if (ImportContainerChecked(LE->capture_inits(), InitCaptures))
return nullptr;
- return LambdaExpr::Create(Importer.getToContext(), ToClass,
- Importer.Import(LE->getIntroducerRange()),
- LE->getCaptureDefault(),
- Importer.Import(LE->getCaptureDefaultLoc()),
- Captures,
- LE->hasExplicitParameters(),
- LE->hasExplicitResultType(),
- InitCaptures,
- Importer.Import(LE->getLocEnd()),
- LE->containsUnexpandedParameterPack());
+ return LambdaExpr::Create(
+ Importer.getToContext(), ToClass,
+ Importer.Import(LE->getIntroducerRange()), LE->getCaptureDefault(),
+ Importer.Import(LE->getCaptureDefaultLoc()), Captures,
+ LE->hasExplicitParameters(), LE->hasExplicitResultType(), InitCaptures,
+ Importer.Import(LE->getEndLoc()), LE->containsUnexpandedParameterPack());
}
Expr *ASTNodeImporter::VisitInitListExpr(InitListExpr *ILE) {
@@ -6917,7 +6913,7 @@
return TypeTraitExpr::Create(
Importer.getToContext(), ToType, Importer.Import(E->getBeginLoc()),
- E->getTrait(), ToArgs, Importer.Import(E->getLocEnd()), ToValue);
+ E->getTrait(), ToArgs, Importer.Import(E->getEndLoc()), ToValue);
}
Expr *ASTNodeImporter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp
index 4bc98bf..88588a7 100644
--- a/clang/lib/AST/CommentSema.cpp
+++ b/clang/lib/AST/CommentSema.cpp
@@ -703,10 +703,9 @@
SmallString<64> TextToInsert(" ");
TextToInsert += AttributeSpelling;
- Diag(FD->getLocEnd(),
- diag::note_add_deprecation_attr)
- << FixItHint::CreateInsertion(FD->getLocEnd().getLocWithOffset(1),
- TextToInsert);
+ Diag(FD->getEndLoc(), diag::note_add_deprecation_attr)
+ << FixItHint::CreateInsertion(FD->getEndLoc().getLocWithOffset(1),
+ TextToInsert);
}
}
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 263f7ca..8ce960f 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1937,7 +1937,7 @@
SourceRange VarDecl::getSourceRange() const {
if (const Expr *Init = getInit()) {
- SourceLocation InitEnd = Init->getLocEnd();
+ SourceLocation InitEnd = Init->getEndLoc();
// If Init is implicit, ignore its source range and fallback on
// DeclaratorDecl::getSourceRange() to handle postfix elements.
if (InitEnd.isValid() && InitEnd != getLocation())
@@ -2704,7 +2704,7 @@
void FunctionDecl::setBody(Stmt *B) {
Body = B;
if (B)
- EndRangeLoc = B->getLocEnd();
+ EndRangeLoc = B->getEndLoc();
}
void FunctionDecl::setPure(bool P) {
@@ -3781,7 +3781,7 @@
if (!FinalExpr)
FinalExpr = getBitWidth();
if (FinalExpr)
- return SourceRange(getInnerLocStart(), FinalExpr->getLocEnd());
+ return SourceRange(getInnerLocStart(), FinalExpr->getEndLoc());
return DeclaratorDecl::getSourceRange();
}
@@ -4258,7 +4258,7 @@
}
SourceRange BlockDecl::getSourceRange() const {
- return SourceRange(getLocation(), Body? Body->getLocEnd() : getLocation());
+ return SourceRange(getLocation(), Body ? Body->getEndLoc() : getLocation());
}
//===----------------------------------------------------------------------===//
@@ -4474,7 +4474,7 @@
SourceRange EnumConstantDecl::getSourceRange() const {
SourceLocation End = getLocation();
if (Init)
- End = Init->getLocEnd();
+ End = Init->getEndLoc();
return SourceRange(getLocation(), End);
}
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index c19325b..5f21e3d 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -971,7 +971,7 @@
SourceLocation ObjCMethodDecl::getEndLoc() const {
if (Stmt *Body = getBody())
- return Body->getLocEnd();
+ return Body->getEndLoc();
return DeclEndLoc;
}
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp
index 4a3c671..d5afc27 100644
--- a/clang/lib/AST/DeclOpenMP.cpp
+++ b/clang/lib/AST/DeclOpenMP.cpp
@@ -112,5 +112,5 @@
SourceRange OMPCapturedExprDecl::getSourceRange() const {
assert(hasInit());
- return SourceRange(getInit()->getBeginLoc(), getInit()->getLocEnd());
+ return SourceRange(getInit()->getBeginLoc(), getInit()->getEndLoc());
}
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index c1fbebd..6519813 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -192,7 +192,7 @@
// Amusing macro metaprogramming hack: check whether a class provides
// a more specific implementation of getExprLoc().
//
-// See also Stmt.cpp:{getBeginLoc(),getLocEnd()}.
+// See also Stmt.cpp:{getBeginLoc(),getEndLoc()}.
namespace {
/// This implementation is used when a class provides a custom
/// implementation of getExprLoc.
@@ -455,7 +455,7 @@
SourceLocation DeclRefExpr::getEndLoc() const {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
- return getNameInfo().getLocEnd();
+ return getNameInfo().getEndLoc();
}
PredefinedExpr::PredefinedExpr(SourceLocation L, QualType FNTy, IdentType IT,
@@ -1369,11 +1369,11 @@
}
SourceLocation CallExpr::getEndLoc() const {
if (isa<CXXOperatorCallExpr>(this))
- return cast<CXXOperatorCallExpr>(this)->getLocEnd();
+ return cast<CXXOperatorCallExpr>(this)->getEndLoc();
SourceLocation end = getRParenLoc();
if (end.isInvalid() && getNumArgs() > 0 && getArg(getNumArgs() - 1))
- end = getArg(getNumArgs() - 1)->getLocEnd();
+ end = getArg(getNumArgs() - 1)->getEndLoc();
return end;
}
@@ -1548,7 +1548,7 @@
if (hasExplicitTemplateArgs())
EndLoc = getRAngleLoc();
else if (EndLoc.isInvalid())
- EndLoc = getBase()->getLocEnd();
+ EndLoc = getBase()->getEndLoc();
return EndLoc;
}
@@ -2059,7 +2059,7 @@
SourceLocation InitListExpr::getEndLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
- return SyntacticForm->getLocEnd();
+ return SyntacticForm->getEndLoc();
SourceLocation End = RBraceLoc;
if (End.isInvalid()) {
// Find the first non-null initializer from the end.
@@ -2067,7 +2067,7 @@
E = InitExprs.rend();
I != E; ++I) {
if (Stmt *S = *I) {
- End = S->getLocEnd();
+ End = S->getEndLoc();
break;
}
}
@@ -2279,7 +2279,7 @@
if (unsigned NumArgs = CE->getNumArgs())
R2 = SourceRange(CE->getArg(0)->getBeginLoc(),
- CE->getArg(NumArgs - 1)->getLocEnd());
+ CE->getArg(NumArgs - 1)->getEndLoc());
return true;
}
}
@@ -3867,7 +3867,7 @@
if (size() == 1)
return DIE->getDesignator(0)->getSourceRange();
return SourceRange(DIE->getDesignator(0)->getBeginLoc(),
- DIE->getDesignator(size() - 1)->getLocEnd());
+ DIE->getDesignator(size() - 1)->getEndLoc());
}
SourceLocation DesignatedInitExpr::getBeginLoc() const {
@@ -3886,7 +3886,7 @@
}
SourceLocation DesignatedInitExpr::getEndLoc() const {
- return getInit()->getLocEnd();
+ return getInit()->getEndLoc();
}
Expr *DesignatedInitExpr::getArrayIndex(const Designator& D) const {
@@ -3949,7 +3949,7 @@
}
SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
- return getBase()->getLocEnd();
+ return getBase()->getEndLoc();
}
ParenListExpr::ParenListExpr(const ASTContext& C, SourceLocation lparenloc,
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index fb45350..f14f5a3 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -458,7 +458,7 @@
SourceLocation CXXConstructExpr::getEndLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
- return cast<CXXTemporaryObjectExpr>(this)->getLocEnd();
+ return cast<CXXTemporaryObjectExpr>(this)->getEndLoc();
if (ParenOrBraceRange.isValid())
return ParenOrBraceRange.getEnd();
@@ -467,7 +467,7 @@
for (unsigned I = getNumArgs(); I > 0; --I) {
const Expr *Arg = getArg(I-1);
if (!Arg->isDefaultArgument()) {
- SourceLocation NewEnd = Arg->getLocEnd();
+ SourceLocation NewEnd = Arg->getEndLoc();
if (NewEnd.isValid()) {
End = NewEnd;
break;
@@ -483,7 +483,7 @@
if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
if (getNumArgs() == 1)
// Prefix operator
- return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd());
+ return SourceRange(getOperatorLoc(), getArg(0)->getEndLoc());
else
// Postfix operator
return SourceRange(getArg(0)->getBeginLoc(), getOperatorLoc());
@@ -494,9 +494,9 @@
} else if (Kind == OO_Subscript) {
return SourceRange(getArg(0)->getBeginLoc(), getRParenLoc());
} else if (getNumArgs() == 1) {
- return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd());
+ return SourceRange(getOperatorLoc(), getArg(0)->getEndLoc());
} else if (getNumArgs() == 2) {
- return SourceRange(getArg(0)->getBeginLoc(), getArg(1)->getLocEnd());
+ return SourceRange(getArg(0)->getBeginLoc(), getArg(1)->getEndLoc());
} else {
return getOperatorLoc();
}
@@ -712,7 +712,7 @@
}
SourceLocation CXXFunctionalCastExpr::getEndLoc() const {
- return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getLocEnd();
+ return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getEndLoc();
}
UserDefinedLiteral::LiteralOperatorKind
@@ -799,7 +799,7 @@
SourceLocation CXXTemporaryObjectExpr::getEndLoc() const {
SourceLocation Loc = getParenOrBraceRange().getEnd();
if (Loc.isInvalid() && getNumArgs())
- Loc = getArg(getNumArgs()-1)->getLocEnd();
+ Loc = getArg(getNumArgs() - 1)->getEndLoc();
return Loc;
}
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index f48d087..f99d784 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -4453,7 +4453,7 @@
if (ESR == ESR_Succeeded) {
if (Callee->getReturnType()->isVoidType())
return true;
- Info.FFDiag(Callee->getLocEnd(), diag::note_constexpr_no_return);
+ Info.FFDiag(Callee->getEndLoc(), diag::note_constexpr_no_return);
}
return ESR == ESR_Returned;
}
diff --git a/clang/lib/AST/RawCommentList.cpp b/clang/lib/AST/RawCommentList.cpp
index 059f71c..1f504fb 100644
--- a/clang/lib/AST/RawCommentList.cpp
+++ b/clang/lib/AST/RawCommentList.cpp
@@ -316,9 +316,9 @@
(C1.isTrailingComment() && !C2.isTrailingComment() &&
isOrdinaryKind(C2.getKind()) &&
commentsStartOnSameColumn(SourceMgr, C1, C2))) &&
- onlyWhitespaceBetween(SourceMgr, C1.getLocEnd(), C2.getBeginLoc(),
+ onlyWhitespaceBetween(SourceMgr, C1.getEndLoc(), C2.getBeginLoc(),
/*MaxNewlinesAllowed=*/1)) {
- SourceRange MergedRange(C1.getBeginLoc(), C2.getLocEnd());
+ SourceRange MergedRange(C1.getBeginLoc(), C2.getEndLoc());
*Comments.back() = RawComment(SourceMgr, MergedRange, CommentOpts, true);
} else {
Comments.push_back(new (Allocator) RawComment(RC));
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index adae725..5fce633 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -193,20 +193,18 @@
static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); }
typedef SourceLocation getLocEnd_t() const;
- template <class T> good implements_getLocEnd(getLocEnd_t T::*) {
+ template <class T> good implements_getEndLoc(getLocEnd_t T::*) {
return good();
}
LLVM_ATTRIBUTE_UNUSED
- static bad implements_getLocEnd(getLocEnd_t Stmt::*) {
- return bad();
- }
+ static bad implements_getEndLoc(getLocEnd_t Stmt::*) { return bad(); }
#define ASSERT_IMPLEMENTS_children(type) \
(void) is_good(implements_children(&type::children))
#define ASSERT_IMPLEMENTS_getBeginLoc(type) \
(void)is_good(implements_getBeginLoc(&type::getBeginLoc))
-#define ASSERT_IMPLEMENTS_getLocEnd(type) \
- (void) is_good(implements_getLocEnd(&type::getLocEnd))
+#define ASSERT_IMPLEMENTS_getEndLoc(type) \
+ (void)is_good(implements_getEndLoc(&type::getEndLoc))
} // namespace
@@ -218,7 +216,7 @@
#define STMT(type, base) \
ASSERT_IMPLEMENTS_children(type); \
ASSERT_IMPLEMENTS_getBeginLoc(type); \
- ASSERT_IMPLEMENTS_getLocEnd(type);
+ ASSERT_IMPLEMENTS_getEndLoc(type);
#include "clang/AST/StmtNodes.inc"
}
@@ -256,7 +254,7 @@
SourceRange getSourceRangeImpl(const Stmt *stmt,
SourceRange (Stmt::*v)() const) {
return SourceRange(static_cast<const S *>(stmt)->getBeginLoc(),
- static_cast<const S *>(stmt)->getLocEnd());
+ static_cast<const S *>(stmt)->getEndLoc());
}
} // namespace
@@ -290,9 +288,9 @@
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)->getLocEnd();
+#define STMT(type, base) \
+ case Stmt::type##Class: \
+ return static_cast<const type *>(this)->getEndLoc();
#include "clang/AST/StmtNodes.inc"
}
llvm_unreachable("unknown statement kind");
diff --git a/clang/lib/AST/StmtObjC.cpp b/clang/lib/AST/StmtObjC.cpp
index cc4b230..ed21e2d 100644
--- a/clang/lib/AST/StmtObjC.cpp
+++ b/clang/lib/AST/StmtObjC.cpp
@@ -66,8 +66,8 @@
SourceLocation ObjCAtTryStmt::getEndLoc() const {
if (HasFinally)
- return getFinallyStmt()->getLocEnd();
+ return getFinallyStmt()->getEndLoc();
if (NumCatchStmts)
- return getCatchStmt(NumCatchStmts - 1)->getLocEnd();
- return getTryBody()->getLocEnd();
+ return getCatchStmt(NumCatchStmts - 1)->getEndLoc();
+ return getTryBody()->getEndLoc();
}