Index: include/clang/AST/Comment.h =================================================================== --- include/clang/AST/Comment.h +++ include/clang/AST/Comment.h @@ -349,7 +349,7 @@ } SourceRange getCommandNameRange() const { - return SourceRange(getBeginLoc().getLocWithOffset(-1), getLocEnd()); + return SourceRange(getBeginLoc().getLocWithOffset(-1), getEndLoc()); } RenderKind getRenderKind() const { @@ -564,7 +564,7 @@ ParagraphCommentBits.IsWhitespaceValid = false; setSourceRange(SourceRange(Content.front()->getBeginLoc(), - Content.back()->getLocEnd())); + Content.back()->getEndLoc())); setLocation(Content.front()->getBeginLoc()); } @@ -699,7 +699,7 @@ void setParagraph(ParagraphComment *PC) { Paragraph = PC; - SourceLocation NewLocEnd = PC->getLocEnd(); + SourceLocation NewLocEnd = PC->getEndLoc(); if (NewLocEnd.isValid()) setSourceRange(SourceRange(getBeginLoc(), NewLocEnd)); } @@ -975,7 +975,7 @@ } SourceRange getTextRange() const { - return SourceRange(TextBegin, getLocEnd()); + return SourceRange(TextBegin, getEndLoc()); } }; @@ -1103,7 +1103,7 @@ return; setSourceRange( - SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getLocEnd())); + SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getEndLoc())); setLocation(Blocks.front()->getBeginLoc()); } Index: include/clang/AST/Decl.h =================================================================== --- include/clang/AST/Decl.h +++ include/clang/AST/Decl.h @@ -4201,11 +4201,11 @@ return RBraceLoc; // No braces: get the end location of the (only) declaration in context // (if present). - return decls_empty() ? getLocation() : decls_begin()->getLocEnd(); + return decls_empty() ? getLocation() : decls_begin()->getEndLoc(); } SourceRange getSourceRange() const override LLVM_READONLY { - return SourceRange(getLocation(), getLocEnd()); + return SourceRange(getLocation(), getEndLoc()); } static bool classof(const Decl *D) { return classofKind(D->getKind()); } Index: include/clang/AST/DeclCXX.h =================================================================== --- include/clang/AST/DeclCXX.h +++ include/clang/AST/DeclCXX.h @@ -2878,11 +2878,11 @@ return getRBraceLoc(); // No braces: get the end location of the (only) declaration in context // (if present). - return decls_empty() ? getLocation() : decls_begin()->getLocEnd(); + return decls_empty() ? getLocation() : decls_begin()->getEndLoc(); } SourceRange getSourceRange() const override LLVM_READONLY { - return SourceRange(ExternLoc, getLocEnd()); + return SourceRange(ExternLoc, getEndLoc()); } static bool classof(const Decl *D) { return classofKind(D->getKind()); } Index: include/clang/AST/DeclFriend.h =================================================================== --- include/clang/AST/DeclFriend.h +++ include/clang/AST/DeclFriend.h @@ -158,7 +158,7 @@ if (DD->getOuterLocStart() != DD->getInnerLocStart()) return DD->getSourceRange(); } - return SourceRange(getFriendLoc(), ND->getLocEnd()); + return SourceRange(getFriendLoc(), ND->getEndLoc()); } else if (TypeSourceInfo *TInfo = getFriendType()) { SourceLocation StartL = Index: include/clang/AST/DeclObjC.h =================================================================== --- include/clang/AST/DeclObjC.h +++ include/clang/AST/DeclObjC.h @@ -285,7 +285,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY; SourceRange getSourceRange() const override LLVM_READONLY { - return SourceRange(getLocation(), getLocEnd()); + return SourceRange(getLocation(), getEndLoc()); } SourceLocation getSelectorStartLoc() const { Index: include/clang/AST/DeclarationName.h =================================================================== --- include/clang/AST/DeclarationName.h +++ include/clang/AST/DeclarationName.h @@ -639,7 +639,7 @@ /// getSourceRange - The range of the declaration name. SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getBeginLoc(), getLocEnd()); + return SourceRange(getBeginLoc(), getEndLoc()); } SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } Index: include/clang/AST/Expr.h =================================================================== --- include/clang/AST/Expr.h +++ include/clang/AST/Expr.h @@ -910,7 +910,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SourceExpr ? SourceExpr->getLocEnd() : Loc; + return SourceExpr ? SourceExpr->getEndLoc() : Loc; } SourceLocation getExprLoc() const LLVM_READONLY { if (SourceExpr) return SourceExpr->getExprLoc(); @@ -1553,7 +1553,7 @@ return Val->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } - SourceLocation getEndLoc() const LLVM_READONLY { return Val->getLocEnd(); } + SourceLocation getEndLoc() const LLVM_READONLY { return Val->getEndLoc(); } static bool classof(const Stmt *T) { return T->getStmtClass() == ImaginaryLiteralClass; @@ -1900,7 +1900,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return isPostfix() ? Loc : Val->getLocEnd(); + return isPostfix() ? Loc : Val->getEndLoc(); } SourceLocation getExprLoc() const LLVM_READONLY { return Loc; } @@ -2806,7 +2806,7 @@ // FIXME: Init should never be null. if (!Init) return SourceLocation(); - return Init->getLocEnd(); + return Init->getEndLoc(); } static bool classof(const Stmt *T) { @@ -3002,7 +3002,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getSubExpr()->getLocEnd(); + return getSubExpr()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -3111,7 +3111,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return LPLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getSubExpr()->getLocEnd(); + return getSubExpr()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -3195,7 +3195,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getRHS()->getLocEnd(); + return getRHS()->getEndLoc(); } /// getOpcodeStr - Turn an Opcode enum value into the punctuation char it @@ -3480,7 +3480,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getRHS()->getLocEnd(); + return getRHS()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -3570,7 +3570,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getFalseExpr()->getLocEnd(); + return getFalseExpr()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -4471,7 +4471,7 @@ return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc(); } SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getBeginLoc(), getLocEnd()); + return SourceRange(getBeginLoc(), getEndLoc()); } }; @@ -4714,7 +4714,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getCommonExpr()->getLocEnd(); + return getCommonExpr()->getEndLoc(); } child_range children() { @@ -5077,7 +5077,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getBody()->getLocEnd(); + return getBody()->getEndLoc(); } /// getFunctionType - Return the underlying function type for this block. @@ -5280,7 +5280,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getSyntacticForm()->getLocEnd(); + return getSyntacticForm()->getEndLoc(); } child_range children() { Index: include/clang/AST/ExprCXX.h =================================================================== --- include/clang/AST/ExprCXX.h +++ include/clang/AST/ExprCXX.h @@ -648,7 +648,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExpr->getLocEnd(); + return SubExpr->getEndLoc(); } /// Retrieve the source range of the expression. @@ -785,7 +785,7 @@ MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {} SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getBeginLoc(), getLocEnd()); + return SourceRange(getBeginLoc(), getEndLoc()); } bool isImplicitAccess() const { @@ -1066,7 +1066,7 @@ SourceLocation getEndLoc() const LLVM_READONLY { if (!getSubExpr()) return ThrowLoc; - return getSubExpr()->getLocEnd(); + return getSubExpr()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -1276,7 +1276,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExpr->getLocEnd(); + return SubExpr->getEndLoc(); } // Implement isa/cast/dyncast/etc. @@ -2209,7 +2209,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return Argument->getLocEnd(); + return Argument->getEndLoc(); } static bool classof(const Stmt *T) { @@ -2915,7 +2915,7 @@ SourceLocation getEndLoc() const LLVM_READONLY { if (hasExplicitTemplateArgs()) return getRAngleLoc(); - return getNameInfo().getLocEnd(); + return getNameInfo().getEndLoc(); } child_range children() { @@ -3147,7 +3147,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExpr->getLocEnd(); + return SubExpr->getEndLoc(); } // Implement isa/cast/dyncast/etc. @@ -3275,7 +3275,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { if (!RParenLoc.isValid() && NumArgs > 0) - return getArg(NumArgs - 1)->getLocEnd(); + return getArg(NumArgs - 1)->getEndLoc(); return RParenLoc; } @@ -3658,7 +3658,7 @@ SourceLocation getEndLoc() const LLVM_READONLY { if (hasExplicitTemplateArgs()) return getRAngleLoc(); - return getMemberNameInfo().getLocEnd(); + return getMemberNameInfo().getEndLoc(); } static bool classof(const Stmt *T) { @@ -4234,7 +4234,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getTemporary()->getLocEnd(); + return getTemporary()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -4402,7 +4402,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getCommonExpr()->getLocEnd(); + return getCommonExpr()->getEndLoc(); } child_range children() { @@ -4490,7 +4490,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getOperand()->getLocEnd(); + return getOperand()->getEndLoc(); } child_range children() { return child_range(SubExprs, SubExprs + 2); } Index: include/clang/AST/ExprObjC.h =================================================================== --- include/clang/AST/ExprObjC.h +++ include/clang/AST/ExprObjC.h @@ -70,7 +70,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } - SourceLocation getEndLoc() const LLVM_READONLY { return String->getLocEnd(); } + SourceLocation getEndLoc() const LLVM_READONLY { return String->getEndLoc(); } // Iterators child_range children() { return child_range(&String, &String+1); } @@ -1503,7 +1503,7 @@ } SourceLocation getBaseLocEnd() const LLVM_READONLY { - return getBase()->getLocEnd(); + return getBase()->getEndLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -1582,7 +1582,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return Operand->getLocEnd(); + return Operand->getEndLoc(); } SourceLocation getExprLoc() const LLVM_READONLY { @@ -1647,7 +1647,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getSubExpr()->getLocEnd(); + return getSubExpr()->getEndLoc(); } static bool classof(const Stmt *T) { Index: include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h =================================================================== --- include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h +++ include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h @@ -100,7 +100,7 @@ for (++I; I != E; ++I) { Decl *Sibling = *I; if (!SM.isBeforeInTranslationUnit(Sibling->getBeginLoc(), - Child->getLocEnd())) + Child->getEndLoc())) break; if (!BaseType::canIgnoreChildDeclWhileTraversingDeclContext(Sibling)) LexicallyNestedDeclarations.push_back(Sibling); Index: include/clang/AST/Stmt.h =================================================================== --- include/clang/AST/Stmt.h +++ include/clang/AST/Stmt.h @@ -816,7 +816,7 @@ while (const auto *CS2 = dyn_cast(CS->getSubStmt())) CS = CS2; - return CS->getSubStmt()->getLocEnd(); + return CS->getSubStmt()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -853,7 +853,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubStmt->getLocEnd(); + return SubStmt->getEndLoc(); } static bool classof(const Stmt *T) { @@ -866,8 +866,8 @@ inline SourceLocation SwitchCase::getEndLoc() const { if (const auto *CS = dyn_cast(this)) - return CS->getLocEnd(); - return cast(this)->getLocEnd(); + return CS->getEndLoc(); + return cast(this)->getEndLoc(); } /// LabelStmt - Represents a label, which has a substatement. For example: @@ -901,7 +901,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return IdentLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubStmt->getLocEnd(); + return SubStmt->getEndLoc(); } child_range children() { return child_range(&SubStmt, &SubStmt+1); } @@ -960,7 +960,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return AttrLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubStmt->getLocEnd(); + return SubStmt->getEndLoc(); } child_range children() { return child_range(&SubStmt, &SubStmt + 1); } @@ -1034,9 +1034,9 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { if (SubExprs[ELSE]) - return SubExprs[ELSE]->getLocEnd(); + return SubExprs[ELSE]->getEndLoc(); else - return SubExprs[THEN]->getLocEnd(); + return SubExprs[THEN]->getEndLoc(); } // Iterators over subexpressions. The iterators will include iterating @@ -1130,7 +1130,8 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd(); + return SubExprs[BODY] ? SubExprs[BODY]->getEndLoc() + : SubExprs[COND]->getEndLoc(); } // Iterators @@ -1188,7 +1189,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExprs[BODY]->getLocEnd(); + return SubExprs[BODY]->getEndLoc(); } static bool classof(const Stmt *T) { @@ -1312,7 +1313,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExprs[BODY]->getLocEnd(); + return SubExprs[BODY]->getEndLoc(); } static bool classof(const Stmt *T) { @@ -1396,7 +1397,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } - SourceLocation getEndLoc() const LLVM_READONLY { return Target->getLocEnd(); } + SourceLocation getEndLoc() const LLVM_READONLY { return Target->getEndLoc(); } static bool classof(const Stmt *T) { return T->getStmtClass() == IndirectGotoStmtClass; @@ -1508,7 +1509,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return RetExpr ? RetExpr->getLocEnd() : RetLoc; + return RetExpr ? RetExpr->getEndLoc() : RetLoc; } static bool classof(const Stmt *T) { @@ -1982,7 +1983,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getExceptLoc() const { return Loc; } - SourceLocation getEndLoc() const { return getBlock()->getLocEnd(); } + SourceLocation getEndLoc() const { return getBlock()->getEndLoc(); } Expr *getFilterExpr() const { return reinterpret_cast(Children[FILTER_EXPR]); @@ -2021,7 +2022,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getFinallyLoc() const { return Loc; } - SourceLocation getEndLoc() const { return Block->getLocEnd(); } + SourceLocation getEndLoc() const { return Block->getEndLoc(); } CompoundStmt *getBlock() const { return cast(Block); } @@ -2061,7 +2062,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getTryLoc() const { return TryLoc; } - SourceLocation getEndLoc() const { return Children[HANDLER]->getLocEnd(); } + SourceLocation getEndLoc() const { return Children[HANDLER]->getEndLoc(); } bool getIsCXXTry() const { return IsCXXTry; } @@ -2321,7 +2322,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getCapturedStmt()->getLocEnd(); + return getCapturedStmt()->getEndLoc(); } SourceRange getSourceRange() const LLVM_READONLY { Index: include/clang/AST/StmtCXX.h =================================================================== --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -45,7 +45,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return CatchLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return HandlerBlock->getLocEnd(); + return HandlerBlock->getEndLoc(); } SourceLocation getCatchLoc() const { return CatchLoc; } @@ -94,7 +94,7 @@ SourceLocation getTryLoc() const { return TryLoc; } SourceLocation getEndLoc() const { - return getStmts()[NumHandlers]->getLocEnd(); + return getStmts()[NumHandlers]->getEndLoc(); } CompoundStmt *getTryBlock() { @@ -201,7 +201,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExprs[BODY]->getLocEnd(); + return SubExprs[BODY]->getEndLoc(); } static bool classof(const Stmt *T) { @@ -289,7 +289,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubStmt->getLocEnd(); + return SubStmt->getEndLoc(); } child_range children() { @@ -415,7 +415,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getBody() ? getBody()->getLocEnd() : getPromiseDecl()->getLocEnd(); + return getBody() ? getBody()->getEndLoc() : getPromiseDecl()->getEndLoc(); } child_range children() { @@ -479,7 +479,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getOperand() ? getOperand()->getLocEnd() : getBeginLoc(); + return getOperand() ? getOperand()->getEndLoc() : getBeginLoc(); } child_range children() { Index: include/clang/AST/StmtDataCollectors.td =================================================================== --- include/clang/AST/StmtDataCollectors.td +++ include/clang/AST/StmtDataCollectors.td @@ -4,7 +4,7 @@ // This ensures that non-macro-generated code isn't identical to // macro-generated code. addData(data_collection::getMacroStack(S->getBeginLoc(), Context)); - addData(data_collection::getMacroStack(S->getLocEnd(), Context)); + addData(data_collection::getMacroStack(S->getEndLoc(), Context)); }]; } Index: include/clang/AST/StmtObjC.h =================================================================== --- include/clang/AST/StmtObjC.h +++ include/clang/AST/StmtObjC.h @@ -59,7 +59,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubExprs[BODY]->getLocEnd(); + return SubExprs[BODY]->getEndLoc(); } static bool classof(const Stmt *T) { @@ -109,7 +109,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { return AtCatchLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } - SourceLocation getEndLoc() const LLVM_READONLY { return Body->getLocEnd(); } + SourceLocation getEndLoc() const LLVM_READONLY { return Body->getEndLoc(); } bool hasEllipsis() const { return getCatchParamDecl() == nullptr; } @@ -141,7 +141,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return AtFinallyLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return AtFinallyStmt->getLocEnd(); + return AtFinallyStmt->getEndLoc(); } SourceLocation getAtFinallyLoc() const { return AtFinallyLoc; } @@ -307,7 +307,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return AtSynchronizedLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getSynchBody()->getLocEnd(); + return getSynchBody()->getEndLoc(); } static bool classof(const Stmt *T) { @@ -343,7 +343,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return AtThrowLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return Throw ? Throw->getLocEnd() : AtThrowLoc; + return Throw ? Throw->getEndLoc() : AtThrowLoc; } static bool classof(const Stmt *T) { @@ -373,7 +373,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return SubStmt->getLocEnd(); + return SubStmt->getEndLoc(); } SourceLocation getAtLoc() const { return AtLoc; } Index: include/clang/Sema/Initialization.h =================================================================== --- include/clang/Sema/Initialization.h +++ include/clang/Sema/Initialization.h @@ -674,8 +674,8 @@ if (!DirectInit) return CreateCopy(Loc, Init->getBeginLoc()); if (isa(Init)) - return CreateDirectList(Loc, Init->getBeginLoc(), Init->getLocEnd()); - return CreateDirect(Loc, Init->getBeginLoc(), Init->getLocEnd()); + return CreateDirectList(Loc, Init->getBeginLoc(), Init->getEndLoc()); + return CreateDirect(Loc, Init->getBeginLoc(), Init->getEndLoc()); } /// Determine the initialization kind. Index: include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -793,7 +793,7 @@ ProgramStateRef St, const LocationContext *LCtx) : CXXInstanceCall(DD, St, LCtx) { Data = DtorDataTy(Target, IsBaseDestructor).getOpaqueValue(); - Location = Trigger->getLocEnd(); + Location = Trigger->getEndLoc(); } CXXDestructorCall(const CXXDestructorCall &Other) = default; Index: include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h =================================================================== --- include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h +++ include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h @@ -74,7 +74,7 @@ for (unsigned I = 0, E = S->getNumComponents(); I != E; ++I) { const OffsetOfNode &Component = S->getComponent(I); if (Component.getKind() == OffsetOfNode::Field) { - if (!visit(Component.getField(), Component.getLocEnd())) + if (!visit(Component.getField(), Component.getEndLoc())) return false; } // FIXME: Try to resolve dependent field references. Index: lib/ARCMigrate/ObjCMT.cpp =================================================================== --- lib/ARCMigrate/ObjCMT.cpp +++ lib/ARCMigrate/ObjCMT.cpp @@ -261,7 +261,7 @@ if (IsGetter) { // Find space location range between receiver expression and getter method. SourceLocation BegLoc = - ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd(); + ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getEndLoc(); BegLoc = PP.getLocForEndOfToken(BegLoc); SourceLocation EndLoc = Msg->getSelectorLoc(0); SourceRange SpaceRange(BegLoc, EndLoc); @@ -291,7 +291,7 @@ if (!RHS) return false; SourceLocation BegLoc = - ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd(); + ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getEndLoc(); BegLoc = PP.getLocForEndOfToken(BegLoc); SourceLocation EndLoc = RHS->getBeginLoc(); EndLoc = EndLoc.getLocWithOffset(-1); @@ -722,7 +722,7 @@ ClassString += ')'; SourceRange R(EnumDcl->getBeginLoc(), EnumDcl->getBeginLoc()); commit.replace(R, ClassString); - SourceLocation EndOfEnumDclLoc = EnumDcl->getLocEnd(); + SourceLocation EndOfEnumDclLoc = EnumDcl->getEndLoc(); EndOfEnumDclLoc = trans::findSemiAfterLocation(EndOfEnumDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndOfEnumDclLoc.isValid()) { @@ -732,7 +732,7 @@ else return false; - SourceLocation EndTypedefDclLoc = TypedefDcl->getLocEnd(); + SourceLocation EndTypedefDclLoc = TypedefDcl->getEndLoc(); EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndTypedefDclLoc.isValid()) { @@ -742,8 +742,9 @@ else return false; - EndOfEnumDclLoc = trans::findLocationAfterSemi(EnumDcl->getLocEnd(), NS.getASTContext(), - /*IsDecl*/true); + EndOfEnumDclLoc = + trans::findLocationAfterSemi(EnumDcl->getEndLoc(), NS.getASTContext(), + /*IsDecl*/ true); if (EndOfEnumDclLoc.isValid()) { SourceLocation BeginOfEnumDclLoc = EnumDcl->getBeginLoc(); // FIXME. This assumes that enum decl; is immediately preceded by eoln. @@ -779,9 +780,9 @@ CharSourceRange::getCharRange(EnumDcl->getBeginLoc(), EndLoc); commit.replace(R, ClassString); // This is to remove spaces between '}' and typedef name. - SourceLocation StartTypedefLoc = EnumDcl->getLocEnd(); + SourceLocation StartTypedefLoc = EnumDcl->getEndLoc(); StartTypedefLoc = StartTypedefLoc.getLocWithOffset(+1); - SourceLocation EndTypedefLoc = TypedefDcl->getLocEnd(); + SourceLocation EndTypedefLoc = TypedefDcl->getEndLoc(); commit.remove(SourceRange(StartTypedefLoc, EndTypedefLoc)); } @@ -812,7 +813,7 @@ } if (AllHexdecimalEnumerator && EnumVal) { bool FoundHexdecimalEnumerator = false; - SourceLocation EndLoc = Enumerator->getLocEnd(); + SourceLocation EndLoc = Enumerator->getEndLoc(); Token Tok; if (!PP.getRawToken(EndLoc, Tok, /*IgnoreWhiteSpace=*/true)) if (Tok.isLiteral() && Tok.getLength() > 2) { @@ -1258,7 +1259,7 @@ return; edit::Commit commit(*Editor); - commit.insertBefore(OM->getLocEnd(), " NS_RETURNS_INNER_POINTER"); + commit.insertBefore(OM->getEndLoc(), " NS_RETURNS_INNER_POINTER"); Editor->commit(commit); } @@ -1270,7 +1271,7 @@ !NSAPIObj->isMacroDefined("NS_RETURNS_INNER_POINTER")) return; edit::Commit commit(*Editor); - commit.insertBefore(P->getLocEnd(), " NS_RETURNS_INNER_POINTER "); + commit.insertBefore(P->getEndLoc(), " NS_RETURNS_INNER_POINTER "); Editor->commit(commit); } @@ -1398,7 +1399,7 @@ edit::Commit commit(*Editor); commit.insertBefore(FirstFD->getBeginLoc(), PragmaString); PragmaString = "\n\nCF_IMPLICIT_BRIDGING_DISABLED\n"; - SourceLocation EndLoc = LastFD->getLocEnd(); + SourceLocation EndLoc = LastFD->getEndLoc(); // get location just past end of function location. EndLoc = PP.getLocForEndOfToken(EndLoc); if (isa(LastFD)) { @@ -1473,7 +1474,7 @@ if (AnnotationString) { edit::Commit commit(*Editor); - commit.insertAfterToken(FuncDecl->getLocEnd(), AnnotationString); + commit.insertAfterToken(FuncDecl->getEndLoc(), AnnotationString); Editor->commit(commit); } } @@ -1599,7 +1600,7 @@ if (AnnotationString) { edit::Commit commit(*Editor); - commit.insertBefore(MethodDecl->getLocEnd(), AnnotationString); + commit.insertBefore(MethodDecl->getEndLoc(), AnnotationString); Editor->commit(commit); } } @@ -1637,7 +1638,7 @@ MethodDecl->getMethodFamily() != OMF_release && NSAPIObj->isMacroDefined("NS_CONSUMES_SELF")) { edit::Commit commit(*Editor); - commit.insertBefore(MethodDecl->getLocEnd(), " NS_CONSUMES_SELF"); + commit.insertBefore(MethodDecl->getEndLoc(), " NS_CONSUMES_SELF"); Editor->commit(commit); } @@ -1714,7 +1715,7 @@ continue; if (hasSuperInitCall(MD)) { edit::Commit commit(*Editor); - commit.insert(IFaceM->getLocEnd(), " NS_DESIGNATED_INITIALIZER"); + commit.insert(IFaceM->getEndLoc(), " NS_DESIGNATED_INITIALIZER"); Editor->commit(commit); } } Index: lib/ARCMigrate/TransAutoreleasePool.cpp =================================================================== --- lib/ARCMigrate/TransAutoreleasePool.cpp +++ lib/ARCMigrate/TransAutoreleasePool.cpp @@ -128,15 +128,15 @@ Pass.TA.removeStmt(*scope.End); Stmt::child_iterator retI = scope.End; ++retI; - SourceLocation afterSemi = findLocationAfterSemi((*retI)->getLocEnd(), - Pass.Ctx); + SourceLocation afterSemi = + findLocationAfterSemi((*retI)->getEndLoc(), Pass.Ctx); assert(afterSemi.isValid() && "Didn't we check before setting IsFollowedBySimpleReturnStmt " "to true?"); Pass.TA.insertAfterToken(afterSemi, "\n}"); Pass.TA.increaseIndentation( SourceRange(scope.getIndentedRange().getBegin(), - (*retI)->getLocEnd()), + (*retI)->getEndLoc()), scope.CompoundParent->getBeginLoc()); } else { Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {"); @@ -241,7 +241,7 @@ Stmt::child_iterator rangeE = Begin; for (Stmt::child_iterator I = rangeS; I != End; ++I) ++rangeE; - return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getLocEnd()); + return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getEndLoc()); } }; @@ -307,7 +307,7 @@ if (ReturnStmt *retS = dyn_cast(*SI)) if ((retS->getRetValue() == nullptr || isa(retS->getRetValue()->IgnoreParenCasts())) && - findLocationAfterSemi(retS->getLocEnd(), Pass.Ctx).isValid()) { + findLocationAfterSemi(retS->getEndLoc(), Pass.Ctx).isValid()) { scope.IsFollowedBySimpleReturnStmt = true; ++SI; // the return will be included in scope, don't check it. } Index: lib/ARCMigrate/TransProtectedScope.cpp =================================================================== --- lib/ARCMigrate/TransProtectedScope.cpp +++ lib/ARCMigrate/TransProtectedScope.cpp @@ -73,7 +73,7 @@ Curr = Curr->getNextSwitchCase(); } - SourceLocation NextLoc = S->getLocEnd(); + SourceLocation NextLoc = S->getEndLoc(); Curr = S->getSwitchCaseList(); // We iterate over case statements in reverse source-order. while (Curr) { Index: lib/ARCMigrate/TransUnbridgedCasts.cpp =================================================================== --- lib/ARCMigrate/TransUnbridgedCasts.cpp +++ lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -242,7 +242,7 @@ } else { newCast += '('; TA.insert(insertLoc, newCast.str()); - TA.insertAfterToken(E->getLocEnd(), ")"); + TA.insertAfterToken(E->getEndLoc(), ")"); } } } else { @@ -267,7 +267,7 @@ } else { BridgeCall += '('; TA.insert(InsertLoc, BridgeCall); - TA.insertAfterToken(WrapE->getLocEnd(), ")"); + TA.insertAfterToken(WrapE->getEndLoc(), ")"); } } } Index: lib/AST/ASTDumper.cpp =================================================================== --- lib/AST/ASTDumper.cpp +++ 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 << " "; for (auto *S : C->children()) Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ 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) { Index: lib/AST/CommentSema.cpp =================================================================== --- lib/AST/CommentSema.cpp +++ 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); } } Index: lib/AST/Decl.cpp =================================================================== --- lib/AST/Decl.cpp +++ 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); } Index: lib/AST/DeclObjC.cpp =================================================================== --- lib/AST/DeclObjC.cpp +++ lib/AST/DeclObjC.cpp @@ -971,7 +971,7 @@ SourceLocation ObjCMethodDecl::getEndLoc() const { if (Stmt *Body = getBody()) - return Body->getLocEnd(); + return Body->getEndLoc(); return DeclEndLoc; } Index: lib/AST/DeclOpenMP.cpp =================================================================== --- lib/AST/DeclOpenMP.cpp +++ 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()); } Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ 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(this)) - return cast(this)->getLocEnd(); + return cast(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, Index: lib/AST/ExprCXX.cpp =================================================================== --- lib/AST/ExprCXX.cpp +++ lib/AST/ExprCXX.cpp @@ -458,7 +458,7 @@ SourceLocation CXXConstructExpr::getEndLoc() const { if (isa(this)) - return cast(this)->getLocEnd(); + return cast(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; } Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ 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; } Index: lib/AST/RawCommentList.cpp =================================================================== --- lib/AST/RawCommentList.cpp +++ 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)); Index: lib/AST/Stmt.cpp =================================================================== --- lib/AST/Stmt.cpp +++ lib/AST/Stmt.cpp @@ -193,20 +193,18 @@ static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); } typedef SourceLocation getLocEnd_t() const; - template good implements_getLocEnd(getLocEnd_t T::*) { + template 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(stmt)->getBeginLoc(), - static_cast(stmt)->getLocEnd()); + static_cast(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(this)->getLocEnd(); +#define STMT(type, base) \ + case Stmt::type##Class: \ + return static_cast(this)->getEndLoc(); #include "clang/AST/StmtNodes.inc" } llvm_unreachable("unknown statement kind"); Index: lib/AST/StmtObjC.cpp =================================================================== --- lib/AST/StmtObjC.cpp +++ 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(); } Index: lib/Analysis/CloneDetection.cpp =================================================================== --- lib/Analysis/CloneDetection.cpp +++ lib/Analysis/CloneDetection.cpp @@ -81,7 +81,7 @@ return front()->getBeginLoc(); } -SourceLocation StmtSequence::getEndLoc() const { return back()->getLocEnd(); } +SourceLocation StmtSequence::getEndLoc() const { return back()->getEndLoc(); } SourceRange StmtSequence::getSourceRange() const { return SourceRange(getBeginLoc(), getEndLoc()); Index: lib/Analysis/Consumed.cpp =================================================================== --- lib/Analysis/Consumed.cpp +++ lib/Analysis/Consumed.cpp @@ -1363,7 +1363,7 @@ case CFGElement::AutomaticObjectDtor: { const CFGAutomaticObjDtor &DTor = B.castAs(); - SourceLocation Loc = DTor.getTriggerStmt()->getLocEnd(); + SourceLocation Loc = DTor.getTriggerStmt()->getEndLoc(); const VarDecl *Var = DTor.getVarDecl(); Visitor.checkCallability(PropagationInfo(Var), Index: lib/Analysis/ThreadSafety.cpp =================================================================== --- lib/Analysis/ThreadSafety.cpp +++ lib/Analysis/ThreadSafety.cpp @@ -2396,7 +2396,7 @@ // Create a dummy expression, auto *VD = const_cast(AD.getVarDecl()); DeclRefExpr DRE(VD, false, VD->getType().getNonReferenceType(), - VK_LValue, AD.getTriggerStmt()->getLocEnd()); + VK_LValue, AD.getTriggerStmt()->getEndLoc()); LocksetBuilder.handleCall(&DRE, DD); break; } Index: lib/CodeGen/CGBlocks.cpp =================================================================== --- lib/CodeGen/CGBlocks.cpp +++ lib/CodeGen/CGBlocks.cpp @@ -1338,7 +1338,7 @@ CurGD = GD; - CurEHLocation = blockInfo.getBlockExpr()->getLocEnd(); + CurEHLocation = blockInfo.getBlockExpr()->getEndLoc(); BlockInfo = &blockInfo; Index: lib/CodeGen/CGClass.cpp =================================================================== --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -829,7 +829,7 @@ // delegation optimization. if (CtorType == Ctor_Complete && IsConstructorDelegationValid(Ctor) && CGM.getTarget().getCXXABI().hasConstructorVariants()) { - EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args, Ctor->getLocEnd()); + EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args, Ctor->getEndLoc()); return; } Index: lib/CodeGen/CGException.cpp =================================================================== --- lib/CodeGen/CGException.cpp +++ lib/CodeGen/CGException.cpp @@ -1893,7 +1893,7 @@ FilterExpr->getType()->isSignedIntegerType()); Builder.CreateStore(R, ReturnValue); - FinishFunction(FilterExpr->getLocEnd()); + FinishFunction(FilterExpr->getEndLoc()); return CurFn; } @@ -1907,7 +1907,7 @@ // Emit the original filter expression, convert to i32, and return. EmitStmt(FinallyBlock); - FinishFunction(FinallyBlock->getLocEnd()); + FinishFunction(FinallyBlock->getEndLoc()); return CurFn; } Index: lib/CodeGen/CGObjC.cpp =================================================================== --- lib/CodeGen/CGObjC.cpp +++ lib/CodeGen/CGObjC.cpp @@ -548,7 +548,7 @@ args.append(OMD->param_begin(), OMD->param_end()); CurGD = OMD; - CurEHLocation = OMD->getLocEnd(); + CurEHLocation = OMD->getEndLoc(); StartFunction(OMD, OMD->getReturnType(), Fn, FI, args, OMD->getLocation(), StartLoc); Index: lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- lib/CodeGen/CGOpenMPRuntime.cpp +++ lib/CodeGen/CGOpenMPRuntime.cpp @@ -8864,7 +8864,7 @@ llvm::Value *RTLFn = createRuntimeFunction(OMPRTL__kmpc_doacross_init); CGF.EmitRuntimeCall(RTLFn, Args); llvm::Value *FiniArgs[DoacrossCleanupTy::DoacrossFinArgs] = { - emitUpdateLocation(CGF, D.getLocEnd()), getThreadID(CGF, D.getLocEnd())}; + emitUpdateLocation(CGF, D.getEndLoc()), getThreadID(CGF, D.getEndLoc())}; llvm::Value *FiniRTLFn = createRuntimeFunction(OMPRTL__kmpc_doacross_fini); CGF.EHStack.pushCleanup(NormalAndEHCleanup, FiniRTLFn, llvm::makeArrayRef(FiniArgs)); Index: lib/CodeGen/CGStmtOpenMP.cpp =================================================================== --- lib/CodeGen/CGStmtOpenMP.cpp +++ lib/CodeGen/CGStmtOpenMP.cpp @@ -1183,7 +1183,7 @@ // Emit nowait reduction if nowait clause is present or directive is a // parallel directive (it always has implicit barrier). CGM.getOpenMPRuntime().emitReduction( - *this, D.getLocEnd(), Privates, LHSExprs, RHSExprs, ReductionOps, + *this, D.getEndLoc(), Privates, LHSExprs, RHSExprs, ReductionOps, {WithNowait, SimpleReduction, ReductionKind}); } } @@ -1851,7 +1851,7 @@ // Tell the runtime we are done. auto &&CodeGen = [DynamicOrOrdered, &S](CodeGenFunction &CGF) { if (!DynamicOrOrdered) - CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getLocEnd(), + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getEndLoc(), S.getDirectiveKind()); }; OMPCancelStack.emitExit(*this, S.getDirectiveKind(), CodeGen); @@ -2332,7 +2332,7 @@ EmitBlock(LoopExit.getBlock()); // Tell the runtime we are done. auto &&CodeGen = [&S](CodeGenFunction &CGF) { - CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getLocEnd(), + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getEndLoc(), S.getDirectiveKind()); }; OMPCancelStack.emitExit(*this, S.getDirectiveKind(), CodeGen); @@ -2564,7 +2564,7 @@ [](CodeGenFunction &) {}); // Tell the runtime we are done. auto &&CodeGen = [&S](CodeGenFunction &CGF) { - CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getLocEnd(), + CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, S.getEndLoc(), S.getDirectiveKind()); }; CGF.OMPCancelStack.emitExit(CGF, S.getDirectiveKind(), CodeGen); Index: lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- lib/CodeGen/CoverageMappingGen.cpp +++ lib/CodeGen/CoverageMappingGen.cpp @@ -213,7 +213,7 @@ /// Get the end of \c S ignoring macro arguments and builtin macros. SourceLocation getEnd(const Stmt *S) { - SourceLocation Loc = S->getLocEnd(); + SourceLocation Loc = S->getEndLoc(); while (SM.isMacroArgExpansion(Loc) || isInBuiltin(Loc)) Loc = SM.getImmediateExpansionRange(Loc).getBegin(); return getPreciseTokenLocEnd(Loc); Index: lib/Edit/RewriteObjCFoundationAPI.cpp =================================================================== --- lib/Edit/RewriteObjCFoundationAPI.cpp +++ lib/Edit/RewriteObjCFoundationAPI.cpp @@ -421,7 +421,7 @@ return true; } SourceRange ArgRange(Msg->getArg(0)->getBeginLoc(), - Msg->getArg(Msg->getNumArgs() - 2)->getLocEnd()); + Msg->getArg(Msg->getNumArgs() - 2)->getEndLoc()); commit.replaceWithInner(MsgRange, ArgRange); commit.insertWrap("@[", ArgRange, "]"); return true; @@ -551,7 +551,7 @@ // The sentinel and first value are cut off, the value will move after the // key. SourceRange ArgRange(Msg->getArg(1)->getBeginLoc(), - Msg->getArg(SentinelIdx - 1)->getLocEnd()); + Msg->getArg(SentinelIdx - 1)->getEndLoc()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; @@ -591,7 +591,7 @@ } // Range of arguments up until and including the last key. // The first value is cut off, the value will move after the key. - SourceRange ArgRange(Keys.front()->getBeginLoc(), Keys.back()->getLocEnd()); + SourceRange ArgRange(Keys.front()->getBeginLoc(), Keys.back()->getEndLoc()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; Index: lib/Frontend/Rewrite/RewriteModernObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -932,7 +932,7 @@ assert((*semiBuf == ';') && "@synthesize: can't find ';'"); startGetterSetterLoc = startLoc.getLocWithOffset(semiBuf-startBuf+1); } else - startGetterSetterLoc = IMD ? IMD->getLocEnd() : CID->getLocEnd(); + startGetterSetterLoc = IMD ? IMD->getEndLoc() : CID->getEndLoc(); if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) return; // FIXME: is this correct? @@ -1109,7 +1109,7 @@ if (Method->isImplicit()) return; SourceLocation LocStart = Method->getBeginLoc(); - SourceLocation LocEnd = Method->getLocEnd(); + SourceLocation LocEnd = Method->getEndLoc(); if (SM->getExpansionLineNumber(LocEnd) > SM->getExpansionLineNumber(LocStart)) { @@ -1371,7 +1371,7 @@ for (auto *I : IMD ? IMD->property_impls() : CID->property_impls()) RewritePropertyImplDecl(I, IMD, CID); - InsertText(IMD ? IMD->getLocEnd() : CID->getLocEnd(), "// "); + InsertText(IMD ? IMD->getEndLoc() : CID->getEndLoc(), "// "); } void RewriteModernObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { @@ -1879,7 +1879,7 @@ buf += "\n\tid sync_exit;"; buf += "\n\t} _sync_exit(_sync_obj);\n"; - // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since + // We can't use S->getSynchExpr()->getEndLoc() to find the end location, since // the sync expression is typically a message expression that's already // been rewritten! (which implies the SourceLocation's are invalid). SourceLocation RParenExprLoc = S->getSynchBody()->getBeginLoc(); @@ -1892,7 +1892,7 @@ assert (*LBraceLocBuf == '{'); ReplaceText(RParenExprLoc, (LBraceLocBuf - SM->getCharacterData(RParenExprLoc) + 1), buf); - SourceLocation startRBraceLoc = S->getSynchBody()->getLocEnd(); + SourceLocation startRBraceLoc = S->getSynchBody()->getEndLoc(); assert((*SM->getCharacterData(startRBraceLoc) == '}') && "bogus @synchronized block"); @@ -2020,7 +2020,7 @@ Write_RethrowObject(buf); ReplaceText(startFinalBodyLoc, 1, buf); - SourceLocation endFinalBodyLoc = body->getLocEnd(); + SourceLocation endFinalBodyLoc = body->getEndLoc(); ReplaceText(endFinalBodyLoc, 1, "}\n}"); // Now check for any return/continue/go statements within the @try. WarnAboutReturnGotoStmts(S->getTryBody()); @@ -2051,7 +2051,7 @@ assert((*wBuf == 'w') && "@throw: can't find 'w'"); ReplaceText(startLoc, wBuf-startBuf+1, buf); - SourceLocation endLoc = S->getLocEnd(); + SourceLocation endLoc = S->getEndLoc(); const char *endBuf = SM->getCharacterData(endLoc); const char *semiBuf = strchr(endBuf, ';'); assert((*semiBuf == ';') && "@throw: can't find ';'"); @@ -2170,7 +2170,7 @@ EndLoc = ECE->getRParenLoc(); } else { Loc = E->getBeginLoc(); - EndLoc = E->getLocEnd(); + EndLoc = E->getEndLoc(); } // This will defend against trying to rewrite synthesized expressions. if (Loc.isInvalid() || EndLoc.isInvalid()) @@ -2301,7 +2301,7 @@ ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); } else { - SourceLocation X = ND->getLocEnd(); + SourceLocation X = ND->getEndLoc(); X = SM->getExpansionLoc(X); const char *endBuf = SM->getCharacterData(X); ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); @@ -2625,7 +2625,7 @@ FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; SourceLocation StartLoc = Exp->getBeginLoc(); - SourceLocation EndLoc = Exp->getLocEnd(); + SourceLocation EndLoc = Exp->getEndLoc(); // Synthesize a call to objc_msgSend(). SmallVector MsgExprs; @@ -2709,7 +2709,7 @@ FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; SourceLocation StartLoc = Exp->getBeginLoc(); - SourceLocation EndLoc = Exp->getLocEnd(); + SourceLocation EndLoc = Exp->getEndLoc(); // Build the expression: __NSContainer_literal(int, ...).arr QualType IntQT = Context->IntTy; @@ -2832,7 +2832,7 @@ FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; SourceLocation StartLoc = Exp->getBeginLoc(); - SourceLocation EndLoc = Exp->getLocEnd(); + SourceLocation EndLoc = Exp->getEndLoc(); // Build the expression: __NSContainer_literal(int, ...).arr QualType IntQT = Context->IntTy; @@ -3563,7 +3563,7 @@ Stmt *RewriteModernObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { Stmt *ReplacingStmt = - SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); + SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getEndLoc()); // Now do the actual rewrite. ReplaceStmt(Exp, ReplacingStmt); @@ -5035,7 +5035,7 @@ // Use variable's location which is good for this case. DeclLoc = ND->getLocation(); const char *startBuf = SM->getCharacterData(DeclLoc); - SourceLocation X = ND->getLocEnd(); + SourceLocation X = ND->getEndLoc(); X = SM->getExpansionLoc(X); const char *endBuf = SM->getCharacterData(X); std::string Name(ND->getNameAsString()); @@ -5537,7 +5537,7 @@ #if 0 // Before we rewrite it, put the original message expression in a comment. SourceLocation startLoc = MessExpr->getBeginLoc(); - SourceLocation endLoc = MessExpr->getLocEnd(); + SourceLocation endLoc = MessExpr->getEndLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *endBuf = SM->getCharacterData(endLoc); Index: lib/Frontend/Rewrite/RewriteObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteObjC.cpp +++ lib/Frontend/Rewrite/RewriteObjC.cpp @@ -946,7 +946,7 @@ if (Method->isImplicit()) return; SourceLocation LocStart = Method->getBeginLoc(); - SourceLocation LocEnd = Method->getLocEnd(); + SourceLocation LocEnd = Method->getEndLoc(); if (SM->getExpansionLineNumber(LocEnd) > SM->getExpansionLineNumber(LocStart)) { @@ -1191,7 +1191,7 @@ for (auto *I : IMD ? IMD->property_impls() : CID->property_impls()) RewritePropertyImplDecl(I, IMD, CID); - InsertText(IMD ? IMD->getLocEnd() : CID->getLocEnd(), "// "); + InsertText(IMD ? IMD->getEndLoc() : CID->getEndLoc(), "// "); } void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { @@ -1651,7 +1651,7 @@ const char *lparenBuf = startBuf; while (*lparenBuf != '(') lparenBuf++; ReplaceText(startLoc, lparenBuf-startBuf+1, buf); - // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since + // We can't use S->getSynchExpr()->getEndLoc() to find the end location, since // the sync expression is typically a message expression that's already // been rewritten! (which implies the SourceLocation's are invalid). SourceLocation endLoc = S->getSynchBody()->getBeginLoc(); @@ -1667,7 +1667,7 @@ buf += "objc_exception_try_enter(&_stack);\n"; buf += "if (!_setjmp(_stack.buf)) /* @try block continue */\n"; ReplaceText(rparenLoc, 1, buf); - startLoc = S->getSynchBody()->getLocEnd(); + startLoc = S->getSynchBody()->getEndLoc(); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '}') && "bogus @synchronized block"); @@ -1798,7 +1798,7 @@ ReplaceText(startLoc, 4, buf); - startLoc = S->getTryBody()->getLocEnd(); + startLoc = S->getTryBody()->getEndLoc(); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '}') && "bogus @try block"); @@ -1881,7 +1881,7 @@ } // Complete the catch list... if (lastCatchBody) { - SourceLocation bodyLoc = lastCatchBody->getLocEnd(); + SourceLocation bodyLoc = lastCatchBody->getEndLoc(); assert(*SM->getCharacterData(bodyLoc) == '}' && "bogus @catch body location"); @@ -1897,7 +1897,7 @@ InsertText(bodyLoc, buf); // Set lastCurlyLoc - lastCurlyLoc = lastCatchBody->getLocEnd(); + lastCurlyLoc = lastCatchBody->getEndLoc(); } if (ObjCAtFinallyStmt *finalStmt = S->getFinallyStmt()) { startLoc = finalStmt->getBeginLoc(); @@ -1908,7 +1908,7 @@ Stmt *body = finalStmt->getFinallyBody(); SourceLocation startLoc = body->getBeginLoc(); - SourceLocation endLoc = body->getLocEnd(); + SourceLocation endLoc = body->getEndLoc(); assert(*SM->getCharacterData(startLoc) == '{' && "bogus @finally body location"); assert(*SM->getCharacterData(endLoc) == '}' && @@ -1920,7 +1920,7 @@ InsertText(endLoc, " if (_rethrow) objc_exception_throw(_rethrow);\n"); // Set lastCurlyLoc - lastCurlyLoc = body->getLocEnd(); + lastCurlyLoc = body->getEndLoc(); // Now check for any return/continue/go statements within the @try. WarnAboutReturnGotoStmts(S->getTryBody()); @@ -2083,7 +2083,7 @@ EndLoc = ECE->getRParenLoc(); } else { Loc = E->getBeginLoc(); - EndLoc = E->getLocEnd(); + EndLoc = E->getEndLoc(); } // This will defend against trying to rewrite synthesized expressions. if (Loc.isInvalid() || EndLoc.isInvalid()) @@ -2210,7 +2210,7 @@ ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); } else { - SourceLocation X = ND->getLocEnd(); + SourceLocation X = ND->getEndLoc(); X = SM->getExpansionLoc(X); const char *endBuf = SM->getCharacterData(X); ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); @@ -3009,7 +3009,7 @@ Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { Stmt *ReplacingStmt = - SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); + SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getEndLoc()); // Now do the actual rewrite. ReplaceStmt(Exp, ReplacingStmt); @@ -4179,7 +4179,7 @@ // Use variable's location which is good for this case. DeclLoc = ND->getLocation(); const char *startBuf = SM->getCharacterData(DeclLoc); - SourceLocation X = ND->getLocEnd(); + SourceLocation X = ND->getEndLoc(); X = SM->getExpansionLoc(X); const char *endBuf = SM->getCharacterData(X); std::string Name(ND->getNameAsString()); @@ -4633,7 +4633,7 @@ #if 0 // Before we rewrite it, put the original message expression in a comment. SourceLocation startLoc = MessExpr->getBeginLoc(); - SourceLocation endLoc = MessExpr->getLocEnd(); + SourceLocation endLoc = MessExpr->getEndLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *endBuf = SM->getCharacterData(endLoc); @@ -5874,7 +5874,7 @@ IV->getBase()); // Don't forget the parens to enforce the proper binding. ParenExpr *PE = new (Context) ParenExpr( - IV->getBase()->getBeginLoc(), IV->getBase()->getLocEnd(), castExpr); + IV->getBase()->getBeginLoc(), IV->getBase()->getEndLoc(), castExpr); // Cannot delete IV->getBase(), since PE points to it. // Replace the old base with the cast. This is important when doing // embedded rewrites. For example, [newInv->_container addObject:0]. Index: lib/Index/IndexBody.cpp =================================================================== --- lib/Index/IndexBody.cpp +++ lib/Index/IndexBody.cpp @@ -432,7 +432,7 @@ for (unsigned I = 0, E = S->getNumComponents(); I != E; ++I) { const OffsetOfNode &Component = S->getComponent(I); if (Component.getKind() == OffsetOfNode::Field) - IndexCtx.handleReference(Component.getField(), Component.getLocEnd(), + IndexCtx.handleReference(Component.getField(), Component.getEndLoc(), Parent, ParentDC, SymbolRoleSet(), {}); // FIXME: Try to resolve dependent field references. } Index: lib/Parse/ParseDecl.cpp =================================================================== --- lib/Parse/ParseDecl.cpp +++ lib/Parse/ParseDecl.cpp @@ -2841,7 +2841,7 @@ return false; const PrintingPolicy &PPol = Actions.getASTContext().getPrintingPolicy(); - Diag(PP.getLocForEndOfToken(DS.getRepAsDecl()->getLocEnd()), + Diag(PP.getLocForEndOfToken(DS.getRepAsDecl()->getEndLoc()), diag::err_expected_after) << DeclSpec::getSpecifierName(DS.getTypeSpecType(), PPol) << tok::semi; @@ -5363,7 +5363,7 @@ // Sema will have to catch (syntactically invalid) pointers into global // scope. It has to catch pointers into namespace scope anyway. D.AddTypeInfo(DeclaratorChunk::getMemberPointer( - SS, DS.getTypeQualifiers(), DS.getLocEnd()), + SS, DS.getTypeQualifiers(), DS.getEndLoc()), std::move(DS.getAttributes()), /* Don't replace range end. */ SourceLocation()); return; @@ -6693,7 +6693,7 @@ if (NeedParens) { // Create a DeclaratorChunk for the inserted parens. - SourceLocation EndLoc = PP.getLocForEndOfToken(D.getLocEnd()); + SourceLocation EndLoc = PP.getLocForEndOfToken(D.getEndLoc()); D.AddTypeInfo(DeclaratorChunk::getParen(SuggestParenLoc, EndLoc), SourceLocation()); } @@ -6709,11 +6709,11 @@ if (!D.getIdentifier() && !NeedParens) return; - SourceLocation EndBracketLoc = TempDeclarator.getLocEnd(); + SourceLocation EndBracketLoc = TempDeclarator.getEndLoc(); // Generate the move bracket error message. SourceRange BracketRange(StartBracketLoc, EndBracketLoc); - SourceLocation EndLoc = PP.getLocForEndOfToken(D.getLocEnd()); + SourceLocation EndLoc = PP.getLocForEndOfToken(D.getEndLoc()); if (NeedParens) { Diag(EndLoc, diag::err_brackets_go_after_unqualified_id) Index: lib/Parse/ParseExprCXX.cpp =================================================================== --- lib/Parse/ParseExprCXX.cpp +++ lib/Parse/ParseExprCXX.cpp @@ -1675,7 +1675,7 @@ Expr *InitList = Init.get(); return Actions.ActOnCXXTypeConstructExpr( TypeRep, InitList->getBeginLoc(), MultiExprArg(&InitList, 1), - InitList->getLocEnd(), /*ListInitialization=*/true); + InitList->getEndLoc(), /*ListInitialization=*/true); } else { BalancedDelimiterTracker T(*this, tok::l_paren); T.consumeOpen(); @@ -1685,10 +1685,10 @@ if (Tok.isNot(tok::r_paren)) { if (ParseExpressionList(Exprs, CommaLocs, [&] { - Actions.CodeCompleteConstructor(getCurScope(), - TypeRep.get()->getCanonicalTypeInternal(), - DS.getLocEnd(), Exprs); - })) { + Actions.CodeCompleteConstructor( + getCurScope(), TypeRep.get()->getCanonicalTypeInternal(), + DS.getEndLoc(), Exprs); + })) { SkipUntil(tok::r_paren, StopAtSemi); return ExprError(); } @@ -2819,10 +2819,9 @@ if (ParseExpressionList(ConstructorArgs, CommaLocs, [&] { ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get(); - Actions.CodeCompleteConstructor(getCurScope(), - TypeRep.get()->getCanonicalTypeInternal(), - DeclaratorInfo.getLocEnd(), - ConstructorArgs); + Actions.CodeCompleteConstructor( + getCurScope(), TypeRep.get()->getCanonicalTypeInternal(), + DeclaratorInfo.getEndLoc(), ConstructorArgs); })) { SkipUntil(tok::semi, StopAtSemi | StopBeforeMatch); return ExprError(); Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -651,7 +651,7 @@ // Short circuit for compilation speed. if (CD.checkDiagnostics(Diags, ReturnsVoid, HasNoReturn)) return; - SourceLocation LBrace = Body->getBeginLoc(), RBrace = Body->getLocEnd(); + SourceLocation LBrace = Body->getBeginLoc(), RBrace = Body->getEndLoc(); auto EmitDiag = [&](SourceLocation Loc, unsigned DiagID) { if (IsCoroutine) S.Diag(Loc, DiagID) << FSI->CoroutinePromise->getType(); @@ -748,10 +748,10 @@ return false; // Don't suggest a fixit inside macros. - if (VD->getLocEnd().isMacroID()) + if (VD->getEndLoc().isMacroID()) return false; - SourceLocation Loc = S.getLocForEndOfToken(VD->getLocEnd()); + SourceLocation Loc = S.getLocForEndOfToken(VD->getEndLoc()); // Suggest possible initialization (if any). std::string Init = S.getFixItZeroInitializerForType(VariableTy, Loc); @@ -773,9 +773,9 @@ Fixit1 = FixItHint::CreateRemoval( CharSourceRange::getCharRange(If->getBeginLoc(), Then->getBeginLoc())); if (Else) { - SourceLocation ElseKwLoc = S.getLocForEndOfToken(Then->getLocEnd()); - Fixit2 = FixItHint::CreateRemoval( - SourceRange(ElseKwLoc, Else->getLocEnd())); + SourceLocation ElseKwLoc = S.getLocForEndOfToken(Then->getEndLoc()); + Fixit2 = + FixItHint::CreateRemoval(SourceRange(ElseKwLoc, Else->getEndLoc())); } } else { // If condition is always false, remove all but the 'else'. @@ -2142,7 +2142,7 @@ // Check for thread safety violations if (P.enableThreadSafetyAnalysis) { SourceLocation FL = AC.getDecl()->getLocation(); - SourceLocation FEL = AC.getDecl()->getLocEnd(); + SourceLocation FEL = AC.getDecl()->getEndLoc(); threadSafety::ThreadSafetyReporter Reporter(S, FL, FEL); if (!Diags.isIgnored(diag::warn_thread_safety_beta, D->getBeginLoc())) Reporter.setIssueBetaWarnings(true); Index: lib/Sema/SemaCast.cpp =================================================================== --- lib/Sema/SemaCast.cpp +++ lib/Sema/SemaCast.cpp @@ -2723,7 +2723,7 @@ Expr *CastExpr) { CastOperation Op(*this, CastTypeInfo->getType(), CastExpr); Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange(); - Op.OpRange = SourceRange(LPLoc, CastExpr->getLocEnd()); + Op.OpRange = SourceRange(LPLoc, CastExpr->getEndLoc()); if (getLangOpts().CPlusPlus) { Op.CheckCXXCStyleCast(/*FunctionalStyle=*/ false, @@ -2751,7 +2751,7 @@ assert(LPLoc.isValid() && "List-initialization shouldn't get here."); CastOperation Op(*this, Type, CastExpr); Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange(); - Op.OpRange = SourceRange(Op.DestRange.getBegin(), CastExpr->getLocEnd()); + Op.OpRange = SourceRange(Op.DestRange.getBegin(), CastExpr->getEndLoc()); Op.CheckCXXCStyleCast(/*FunctionalStyle=*/true, /*ListInit=*/false); if (Op.SrcExpr.isInvalid()) Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -112,13 +112,13 @@ if (argCount == desiredArgCount) return false; if (argCount < desiredArgCount) - return S.Diag(call->getLocEnd(), diag::err_typecheck_call_too_few_args) - << 0 /*function call*/ << desiredArgCount << argCount - << call->getSourceRange(); + return S.Diag(call->getEndLoc(), diag::err_typecheck_call_too_few_args) + << 0 /*function call*/ << desiredArgCount << argCount + << call->getSourceRange(); // Highlight all the excess arguments. SourceRange range(call->getArg(desiredArgCount)->getBeginLoc(), - call->getArg(argCount - 1)->getLocEnd()); + call->getArg(argCount - 1)->getEndLoc()); return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << desiredArgCount << argCount @@ -156,7 +156,7 @@ static bool SemaBuiltinMSVCAnnotation(Sema &S, CallExpr *TheCall) { // We need at least one argument. if (TheCall->getNumArgs() < 1) { - S.Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args_at_least) + S.Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) << 0 << 1 << TheCall->getNumArgs() << TheCall->getCallee()->getSourceRange(); return true; @@ -4308,9 +4308,9 @@ ++AdjustedNumArgs; // Check we have the right number of arguments. if (TheCall->getNumArgs() < AdjustedNumArgs) { - Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) - << 0 << AdjustedNumArgs << TheCall->getNumArgs() - << TheCall->getCallee()->getSourceRange(); + Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args) + << 0 << AdjustedNumArgs << TheCall->getNumArgs() + << TheCall->getCallee()->getSourceRange(); return ExprError(); } else if (TheCall->getNumArgs() > AdjustedNumArgs) { Diag(TheCall->getArg(AdjustedNumArgs)->getBeginLoc(), @@ -4628,9 +4628,9 @@ // Ensure that we have at least one argument to do type inference from. if (TheCall->getNumArgs() < 1) { - Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args_at_least) - << 0 << 1 << TheCall->getNumArgs() - << TheCall->getCallee()->getSourceRange(); + Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) + << 0 << 1 << TheCall->getNumArgs() + << TheCall->getCallee()->getSourceRange(); return ExprError(); } @@ -4905,15 +4905,15 @@ // Now that we know how many fixed arguments we expect, first check that we // have at least that many. if (TheCall->getNumArgs() < 1+NumFixed) { - Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args_at_least) - << 0 << 1+NumFixed << TheCall->getNumArgs() - << TheCall->getCallee()->getSourceRange(); + Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) + << 0 << 1 + NumFixed << TheCall->getNumArgs() + << TheCall->getCallee()->getSourceRange(); return ExprError(); } if (WarnAboutSemanticsChange) { - Diag(TheCall->getLocEnd(), diag::warn_sync_fetch_and_nand_semantics_change) - << TheCall->getCallee()->getSourceRange(); + Diag(TheCall->getEndLoc(), diag::warn_sync_fetch_and_nand_semantics_change) + << TheCall->getCallee()->getSourceRange(); } // Get the decl for the concrete builtin from this, we can tell what the @@ -5204,14 +5204,14 @@ << 0 /*function call*/ << 2 << TheCall->getNumArgs() << Fn->getSourceRange() << SourceRange(TheCall->getArg(2)->getBeginLoc(), - (*(TheCall->arg_end() - 1))->getLocEnd()); + (*(TheCall->arg_end() - 1))->getEndLoc()); return true; } if (TheCall->getNumArgs() < 2) { - return Diag(TheCall->getLocEnd(), - diag::err_typecheck_call_too_few_args_at_least) - << 0 /*function call*/ << 2 << TheCall->getNumArgs(); + return Diag(TheCall->getEndLoc(), + diag::err_typecheck_call_too_few_args_at_least) + << 0 /*function call*/ << 2 << TheCall->getNumArgs(); } // Type-check the first argument normally. @@ -5278,7 +5278,7 @@ Expr *Func = Call->getCallee(); if (Call->getNumArgs() < 3) - return Diag(Call->getLocEnd(), + return Diag(Call->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) << 0 /*function call*/ << 3 << Call->getNumArgs(); @@ -5323,14 +5323,14 @@ /// friends. This is declared to take (...), so we have to check everything. bool Sema::SemaBuiltinUnorderedCompare(CallExpr *TheCall) { if (TheCall->getNumArgs() < 2) - return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) - << 0 << 2 << TheCall->getNumArgs()/*function call*/; + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args) + << 0 << 2 << TheCall->getNumArgs() /*function call*/; if (TheCall->getNumArgs() > 2) return Diag(TheCall->getArg(2)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << 2 << TheCall->getNumArgs() << SourceRange(TheCall->getArg(2)->getBeginLoc(), - (*(TheCall->arg_end() - 1))->getLocEnd()); + (*(TheCall->arg_end() - 1))->getEndLoc()); ExprResult OrigArg0 = TheCall->getArg(0); ExprResult OrigArg1 = TheCall->getArg(1); @@ -5357,7 +5357,7 @@ diag::err_typecheck_call_invalid_ordered_compare) << OrigArg0.get()->getType() << OrigArg1.get()->getType() << SourceRange(OrigArg0.get()->getBeginLoc(), - OrigArg1.get()->getLocEnd()); + OrigArg1.get()->getEndLoc()); return false; } @@ -5368,14 +5368,14 @@ /// value. bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) { if (TheCall->getNumArgs() < NumArgs) - return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) - << 0 << NumArgs << TheCall->getNumArgs()/*function call*/; + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args) + << 0 << NumArgs << TheCall->getNumArgs() /*function call*/; if (TheCall->getNumArgs() > NumArgs) return Diag(TheCall->getArg(NumArgs)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << NumArgs << TheCall->getNumArgs() << SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(), - (*(TheCall->arg_end() - 1))->getLocEnd()); + (*(TheCall->arg_end() - 1))->getEndLoc()); Expr *OrigArg = TheCall->getArg(NumArgs-1); @@ -5420,13 +5420,13 @@ bool Sema::SemaBuiltinVSX(CallExpr *TheCall) { unsigned ExpectedNumArgs = 3; if (TheCall->getNumArgs() < ExpectedNumArgs) - return Diag(TheCall->getLocEnd(), + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) - << 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs() + << 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs() << TheCall->getSourceRange(); if (TheCall->getNumArgs() > ExpectedNumArgs) - return Diag(TheCall->getLocEnd(), + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_many_args_at_most) << 0 /*function call*/ << ExpectedNumArgs << TheCall->getNumArgs() << TheCall->getSourceRange(); @@ -5438,7 +5438,7 @@ diag::err_vsx_builtin_nonconstant_argument) << 3 /* argument index */ << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(2)->getBeginLoc(), - TheCall->getArg(2)->getLocEnd()); + TheCall->getArg(2)->getEndLoc()); QualType Arg1Ty = TheCall->getArg(0)->getType(); QualType Arg2Ty = TheCall->getArg(1)->getType(); @@ -5450,7 +5450,7 @@ return Diag(BuiltinLoc, diag::err_vec_builtin_non_vector) << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(0)->getBeginLoc(), - TheCall->getArg(1)->getLocEnd()); + TheCall->getArg(1)->getEndLoc()); } // Check the first two arguments are the same type. @@ -5458,7 +5458,7 @@ return Diag(BuiltinLoc, diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(0)->getBeginLoc(), - TheCall->getArg(1)->getLocEnd()); + TheCall->getArg(1)->getEndLoc()); } // When default clang type checking is turned off and the customized type @@ -5473,7 +5473,7 @@ // This is declared to take (...), so we have to check everything. ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) { if (TheCall->getNumArgs() < 2) - return ExprError(Diag(TheCall->getLocEnd(), + return ExprError(Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args_at_least) << 0 /*function call*/ << 2 << TheCall->getNumArgs() << TheCall->getSourceRange()); @@ -5494,7 +5494,7 @@ Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_non_vector) << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(0)->getBeginLoc(), - TheCall->getArg(1)->getLocEnd())); + TheCall->getArg(1)->getEndLoc())); numElements = LHSType->getAs()->getNumElements(); unsigned numResElements = TheCall->getNumArgs() - 2; @@ -5509,13 +5509,13 @@ diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(1)->getBeginLoc(), - TheCall->getArg(1)->getLocEnd())); + TheCall->getArg(1)->getEndLoc())); } else if (!Context.hasSameUnqualifiedType(LHSType, RHSType)) { return ExprError(Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() << SourceRange(TheCall->getArg(0)->getBeginLoc(), - TheCall->getArg(1)->getLocEnd())); + TheCall->getArg(1)->getEndLoc())); } else if (numElements != numResElements) { QualType eltType = LHSType->getAs()->getElementType(); resType = Context.getVectorType(eltType, numResElements, @@ -5593,10 +5593,9 @@ unsigned NumArgs = TheCall->getNumArgs(); if (NumArgs > 3) - return Diag(TheCall->getLocEnd(), - diag::err_typecheck_call_too_many_args_at_most) - << 0 /*function call*/ << 3 << NumArgs - << TheCall->getSourceRange(); + return Diag(TheCall->getEndLoc(), + diag::err_typecheck_call_too_many_args_at_most) + << 0 /*function call*/ << 3 << NumArgs << TheCall->getSourceRange(); // Argument 0 is checked for us and the remaining arguments must be // constant integers. @@ -5661,10 +5660,9 @@ unsigned NumArgs = TheCall->getNumArgs(); if (NumArgs > 3) - return Diag(TheCall->getLocEnd(), - diag::err_typecheck_call_too_many_args_at_most) - << 0 /*function call*/ << 3 << NumArgs - << TheCall->getSourceRange(); + return Diag(TheCall->getEndLoc(), + diag::err_typecheck_call_too_many_args_at_most) + << 0 /*function call*/ << 3 << NumArgs << TheCall->getSourceRange(); // The alignment must be a constant integer. Expr *Arg = TheCall->getArg(1); @@ -5700,12 +5698,12 @@ unsigned NumArgs = TheCall->getNumArgs(); unsigned NumRequiredArgs = IsSizeCall ? 1 : 2; if (NumArgs < NumRequiredArgs) { - return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_few_args) << 0 /* function call */ << NumRequiredArgs << NumArgs << TheCall->getSourceRange(); } if (NumArgs >= NumRequiredArgs + 0x100) { - return Diag(TheCall->getLocEnd(), + return Diag(TheCall->getEndLoc(), diag::err_typecheck_call_too_many_args_at_most) << 0 /* function call */ << (NumRequiredArgs + 0xff) << NumArgs << TheCall->getSourceRange(); @@ -5743,7 +5741,7 @@ return true; CharUnits ArgSize = Context.getTypeSizeInChars(Arg.get()->getType()); if (ArgSize.getQuantity() >= 0x100) { - return Diag(Arg.get()->getLocEnd(), diag::err_os_log_argument_too_big) + return Diag(Arg.get()->getEndLoc(), diag::err_os_log_argument_too_big) << i << (int)ArgSize.getQuantity() << 0xff << TheCall->getSourceRange(); } @@ -5948,7 +5946,7 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) { if (!Context.getTargetInfo().hasSjLjLowering()) return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_unsupported) - << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd()); + << SourceRange(TheCall->getBeginLoc(), TheCall->getEndLoc()); Expr *Arg = TheCall->getArg(1); llvm::APSInt Result; @@ -5959,7 +5957,7 @@ if (Result != 1) return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_invalid_val) - << SourceRange(Arg->getBeginLoc(), Arg->getLocEnd()); + << SourceRange(Arg->getBeginLoc(), Arg->getEndLoc()); return false; } @@ -5969,7 +5967,7 @@ bool Sema::SemaBuiltinSetjmp(CallExpr *TheCall) { if (!Context.getTargetInfo().hasSjLjLowering()) return Diag(TheCall->getBeginLoc(), diag::err_builtin_setjmp_unsupported) - << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd()); + << SourceRange(TheCall->getBeginLoc(), TheCall->getEndLoc()); return false; } @@ -6119,7 +6117,7 @@ } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } - SourceLocation getEndLoc() const LLVM_READONLY { return FExpr->getLocEnd(); } + SourceLocation getEndLoc() const LLVM_READONLY { return FExpr->getEndLoc(); } }; } // namespace @@ -7270,7 +7268,7 @@ if (Method->getMinRequiredArguments() == 0 && AT.matchesType(S.Context, Method->getReturnType())) { // FIXME: Suggest parens if the expression needs them. - SourceLocation EndLoc = S.getLocForEndOfToken(E->getLocEnd()); + SourceLocation EndLoc = S.getLocForEndOfToken(E->getEndLoc()); S.Diag(E->getBeginLoc(), diag::note_printf_c_str) << "c_str()" << FixItHint::CreateInsertion(EndLoc, ".c_str()"); return true; @@ -7748,7 +7746,7 @@ Hints.push_back( FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str())); - SourceLocation After = S.getLocForEndOfToken(E->getLocEnd()); + SourceLocation After = S.getLocForEndOfToken(E->getEndLoc()); Hints.push_back(FixItHint::CreateInsertion(After, ")")); } @@ -8572,8 +8570,9 @@ S.Diag(Size->getOperatorLoc(), diag::warn_memsize_comparison) << SizeRange << FnName; S.Diag(FnLoc, diag::note_memsize_comparison_paren) - << FnName << FixItHint::CreateInsertion( - S.getLocForEndOfToken(Size->getLHS()->getLocEnd()), ")") + << FnName + << FixItHint::CreateInsertion( + S.getLocForEndOfToken(Size->getLHS()->getEndLoc()), ")") << FixItHint::CreateRemoval(RParenLoc); S.Diag(SizeRange.getBegin(), diag::note_memsize_comparison_cast_silence) << FixItHint::CreateInsertion(SizeRange.getBegin(), "(size_t)(") @@ -11294,7 +11293,7 @@ return; } Diag(E->getExprLoc(), diag::note_function_to_function_call) - << FixItHint::CreateInsertion(getLocForEndOfToken(E->getLocEnd()), "()"); + << FixItHint::CreateInsertion(getLocForEndOfToken(E->getEndLoc()), "()"); } /// Diagnoses "dangerous" implicit conversions within the given Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -1735,8 +1735,9 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint) { if (isa(D)) { - SourceLocation AfterColon = Lexer::findLocationAfterToken(D->getLocEnd(), - tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), true); + SourceLocation AfterColon = Lexer::findLocationAfterToken( + D->getEndLoc(), tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), + true); if (AfterColon.isInvalid()) return; Hint = FixItHint::CreateRemoval( @@ -8005,7 +8006,7 @@ return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), isExplicit, NameInfo, R, TInfo, - D.getLocEnd()); + D.getEndLoc()); } else if (DC->isRecord()) { // If the name of the function is the same as the name of the record, // then this must be an invalid constructor that has a return type. @@ -12479,7 +12480,7 @@ // passed by reference. if (T->isObjCObjectType()) { SourceLocation TypeEndLoc = - getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd()); + getLocForEndOfToken(TSInfo->getTypeLoc().getEndLoc()); Diag(NameLoc, diag::err_object_cannot_be_passed_returned_by_value) << 1 << T << FixItHint::CreateInsertion(TypeEndLoc, "*"); @@ -13128,8 +13129,8 @@ computeNRVO(Body, getCurFunction()); } if (getCurFunction()->ObjCShouldCallSuper) { - Diag(MD->getLocEnd(), diag::warn_objc_missing_super_call) - << MD->getSelector().getAsString(); + Diag(MD->getEndLoc(), diag::warn_objc_missing_super_call) + << MD->getSelector().getAsString(); getCurFunction()->ObjCShouldCallSuper = false; } if (getCurFunction()->ObjCWarnForNoDesignatedInitChain) { Index: lib/Sema/SemaDeclAttr.cpp =================================================================== --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -7056,7 +7056,7 @@ StringRef Suffix; static AttributeInsertion createInsertionAfter(const NamedDecl *D) { - return {" ", D->getLocEnd(), ""}; + return {" ", D->getEndLoc(), ""}; } static AttributeInsertion createInsertionAfter(SourceLocation Loc) { return {" ", Loc, ""}; @@ -7586,19 +7586,19 @@ bool VisitObjCMessageExpr(ObjCMessageExpr *Msg) { if (ObjCMethodDecl *D = Msg->getMethodDecl()) DiagnoseDeclAvailability( - D, SourceRange(Msg->getSelectorStartLoc(), Msg->getLocEnd())); + D, SourceRange(Msg->getSelectorStartLoc(), Msg->getEndLoc())); return true; } bool VisitDeclRefExpr(DeclRefExpr *DRE) { DiagnoseDeclAvailability(DRE->getDecl(), - SourceRange(DRE->getBeginLoc(), DRE->getLocEnd())); + SourceRange(DRE->getBeginLoc(), DRE->getEndLoc())); return true; } bool VisitMemberExpr(MemberExpr *ME) { DiagnoseDeclAvailability(ME->getMemberDecl(), - SourceRange(ME->getBeginLoc(), ME->getLocEnd())); + SourceRange(ME->getBeginLoc(), ME->getEndLoc())); return true; } @@ -7695,7 +7695,7 @@ SM.getExpansionLoc(StmtOfUse->getBeginLoc()); SourceLocation StmtEndLoc = SM.getExpansionRange( - (LastStmtOfUse ? LastStmtOfUse : StmtOfUse)->getLocEnd()) + (LastStmtOfUse ? LastStmtOfUse : StmtOfUse)->getEndLoc()) .getEnd(); if (SM.getFileID(IfInsertionLoc) != SM.getFileID(StmtEndLoc)) return; Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -3650,7 +3650,7 @@ FD->getInClassInitStyle() == ICIS_ListInit ? InitializationKind::CreateDirectList(InitExpr->getBeginLoc(), InitExpr->getBeginLoc(), - InitExpr->getLocEnd()) + InitExpr->getEndLoc()) : InitializationKind::CreateCopy(InitExpr->getBeginLoc(), InitLoc); InitializationSequence Seq(*this, Entity, Kind, InitExpr); Init = Seq.Perform(*this, Entity, Kind, InitExpr); @@ -3998,7 +3998,7 @@ nullptr); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( - IdLoc, Init->getBeginLoc(), Init->getLocEnd()) + IdLoc, Init->getBeginLoc(), Init->getEndLoc()) : InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(), InitRange.getEnd()); @@ -4051,7 +4051,7 @@ QualType(ClassDecl->getTypeForDecl(), 0)); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( - NameLoc, Init->getBeginLoc(), Init->getLocEnd()) + NameLoc, Init->getBeginLoc(), Init->getEndLoc()) : InitializationKind::CreateDirect(NameLoc, InitRange.getBegin(), InitRange.getEnd()); InitializationSequence InitSeq(*this, DelegationEntity, Kind, Args); @@ -8444,7 +8444,7 @@ // If we can provide a correct fix-it hint, do so. if (After.isInvalid() && ConvTSI) { SourceLocation InsertLoc = - getLocForEndOfToken(ConvTSI->getTypeLoc().getLocEnd()); + getLocForEndOfToken(ConvTSI->getTypeLoc().getEndLoc()); DB << FixItHint::CreateInsertion(InsertLoc, " ") << FixItHint::CreateInsertionFromRange( InsertLoc, CharSourceRange::getTokenRange(Before)) @@ -10237,8 +10237,7 @@ " = "); } else { // Convert 'using X::Y;' to 'typedef X::Y Y;'. - SourceLocation InsertLoc = - getLocForEndOfToken(NameInfo.getLocEnd()); + SourceLocation InsertLoc = getLocForEndOfToken(NameInfo.getEndLoc()); Diag(InsertLoc, diag::note_using_decl_class_member_workaround) << 1 // typedef declaration << FixItHint::CreateReplacement(UsingLoc, "typedef") @@ -10873,8 +10872,8 @@ return; } - SourceLocation Loc = Constructor->getLocEnd().isValid() - ? Constructor->getLocEnd() + SourceLocation Loc = Constructor->getEndLoc().isValid() + ? Constructor->getEndLoc() : Constructor->getLocation(); Constructor->setBody(new (Context) CompoundStmt(Loc)); Constructor->markUsed(Context); @@ -11156,8 +11155,8 @@ return; } - SourceLocation Loc = Destructor->getLocEnd().isValid() - ? Destructor->getLocEnd() + SourceLocation Loc = Destructor->getEndLoc().isValid() + ? Destructor->getEndLoc() : Destructor->getLocation(); Destructor->setBody(new (Context) CompoundStmt(Loc)); Destructor->markUsed(Context); @@ -11828,8 +11827,8 @@ } // Our location for everything implicitly-generated. - SourceLocation Loc = CopyAssignOperator->getLocEnd().isValid() - ? CopyAssignOperator->getLocEnd() + SourceLocation Loc = CopyAssignOperator->getEndLoc().isValid() + ? CopyAssignOperator->getEndLoc() : CopyAssignOperator->getLocation(); // Builds a DeclRefExpr for the "other" object. @@ -12184,8 +12183,8 @@ "Bad argument type of defaulted move assignment"); // Our location for everything implicitly-generated. - SourceLocation Loc = MoveAssignOperator->getLocEnd().isValid() - ? MoveAssignOperator->getLocEnd() + SourceLocation Loc = MoveAssignOperator->getEndLoc().isValid() + ? MoveAssignOperator->getEndLoc() : MoveAssignOperator->getLocation(); // Builds a reference to the "other" object. @@ -12469,8 +12468,8 @@ if (SetCtorInitializers(CopyConstructor, /*AnyErrors=*/false)) { CopyConstructor->setInvalidDecl(); } else { - SourceLocation Loc = CopyConstructor->getLocEnd().isValid() - ? CopyConstructor->getLocEnd() + SourceLocation Loc = CopyConstructor->getEndLoc().isValid() + ? CopyConstructor->getEndLoc() : CopyConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); CopyConstructor->setBody( @@ -12592,8 +12591,8 @@ if (SetCtorInitializers(MoveConstructor, /*AnyErrors=*/false)) { MoveConstructor->setInvalidDecl(); } else { - SourceLocation Loc = MoveConstructor->getLocEnd().isValid() - ? MoveConstructor->getLocEnd() + SourceLocation Loc = MoveConstructor->getEndLoc().isValid() + ? MoveConstructor->getEndLoc() : MoveConstructor->getLocation(); Sema::CompoundScopeRAII CompoundScope(*this); MoveConstructor->setBody(ActOnCompoundStmt( @@ -12896,7 +12895,7 @@ RecordDecl *OutermostClass = ParentRD->getOuterLexicalRecordContext(); Diag(Loc, diag::err_in_class_initializer_not_yet_parsed) << OutermostClass << Field; - Diag(Field->getLocEnd(), diag::note_in_class_initializer_not_yet_parsed); + Diag(Field->getEndLoc(), diag::note_in_class_initializer_not_yet_parsed); // Recover by marking the field invalid, unless we're in a SFINAE context. if (!isSFINAEContext()) Field->setInvalidDecl(); Index: lib/Sema/SemaDeclObjC.cpp =================================================================== --- lib/Sema/SemaDeclObjC.cpp +++ lib/Sema/SemaDeclObjC.cpp @@ -653,7 +653,7 @@ } IDecl->setSuperClass(SuperClassTInfo); - IDecl->setEndOfDefinitionLoc(SuperClassTInfo->getTypeLoc().getLocEnd()); + IDecl->setEndOfDefinitionLoc(SuperClassTInfo->getTypeLoc().getEndLoc()); } } @@ -829,7 +829,7 @@ if (newTypeParams->size() > prevTypeParams->size()) { diagLoc = newTypeParams->begin()[prevTypeParams->size()]->getLocation(); } else { - diagLoc = S.getLocForEndOfToken(newTypeParams->back()->getLocEnd()); + diagLoc = S.getLocForEndOfToken(newTypeParams->back()->getEndLoc()); } S.Diag(diagLoc, diag::err_objc_type_param_arity_mismatch) Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -387,8 +387,7 @@ // or 'NULL' if those are actually defined in the context. Only use // 'nil' for ObjC methods, where it's much more likely that the // variadic arguments form a list of object pointers. - SourceLocation MissingNilLoc - = getLocForEndOfToken(sentinelExpr->getLocEnd()); + SourceLocation MissingNilLoc = getLocForEndOfToken(sentinelExpr->getEndLoc()); std::string NullValue; if (calleeType == CT_Method && PP.isMacroDefined("nil")) NullValue = "nil"; @@ -502,7 +501,7 @@ &S.Context.Idents.get("object_setClass"), SourceLocation(), S.LookupOrdinaryName); if (ObjectSetClass) { - SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getLocEnd()); + SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getEndLoc()); S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign) << FixItHint::CreateInsertion(OIRE->getBeginLoc(), "object_setClass(") @@ -522,7 +521,7 @@ << FixItHint::CreateInsertion(OIRE->getBeginLoc(), "object_getClass(") << FixItHint::CreateReplacement( - SourceRange(OIRE->getOpLoc(), OIRE->getLocEnd()), ")"); + SourceRange(OIRE->getOpLoc(), OIRE->getEndLoc()), ")"); else S.Diag(OIRE->getLocation(), diag::warn_objc_isa_use); } @@ -897,7 +896,7 @@ return ExprError(); ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), - None, E->getLocEnd()); + None, E->getEndLoc()); if (Call.isInvalid()) return ExprError(); @@ -4842,7 +4841,7 @@ << FnKind << FDecl->getParamDecl(0) << static_cast(Args.size()) << Fn->getSourceRange() << SourceRange(Args[NumParams]->getBeginLoc(), - Args.back()->getLocEnd()); + Args.back()->getEndLoc()); else Diag(Args[NumParams]->getBeginLoc(), MinArgs == NumParams @@ -4851,7 +4850,7 @@ << FnKind << NumParams << static_cast(Args.size()) << Fn->getSourceRange() << SourceRange(Args[NumParams]->getBeginLoc(), - Args.back()->getLocEnd()); + Args.back()->getEndLoc()); // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) @@ -5317,7 +5316,7 @@ Diag(Fn->getBeginLoc(), diag::err_pseudo_dtor_call_with_args) << FixItHint::CreateRemoval( SourceRange(ArgExprs.front()->getBeginLoc(), - ArgExprs.back()->getLocEnd())); + ArgExprs.back()->getEndLoc())); } return new (Context) @@ -7214,11 +7213,11 @@ Self, OpLoc, Self.PDiag(diag::note_precedence_silence) << BinaryOperator::getOpcodeStr(CondOpcode), - SourceRange(Condition->getBeginLoc(), Condition->getLocEnd())); + SourceRange(Condition->getBeginLoc(), Condition->getEndLoc())); SuggestParentheses(Self, OpLoc, Self.PDiag(diag::note_precedence_conditional_first), - SourceRange(CondRHS->getBeginLoc(), RHSExpr->getLocEnd())); + SourceRange(CondRHS->getBeginLoc(), RHSExpr->getEndLoc())); } /// Compute the nullability of a conditional expression. @@ -8915,13 +8914,13 @@ return; } - SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); + SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getEndLoc()); Self.Diag(OpLoc, diag::warn_string_plus_int) << DiagRange << IndexExpr->IgnoreImpCasts()->getType(); // Only print a fixit for "str" + int, not for int + "str". if (IndexExpr == RHSExpr) { - SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd()); + SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getEndLoc()); Self.Diag(OpLoc, diag::note_string_plus_scalar_silence) << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&") << FixItHint::CreateReplacement(SourceRange(OpLoc), "[") @@ -8956,7 +8955,7 @@ return; ASTContext &Ctx = Self.getASTContext(); - SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); + SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getEndLoc()); const QualType CharType = CharExpr->getType(); if (!CharType->isAnyCharacterType() && @@ -8971,7 +8970,7 @@ // Only print a fixit for str + char, not for char + str. if (isa(RHSExpr->IgnoreImpCasts())) { - SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd()); + SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getEndLoc()); Self.Diag(OpLoc, diag::note_string_plus_scalar_silence) << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&") << FixItHint::CreateReplacement(SourceRange(OpLoc), "[") @@ -9646,7 +9645,7 @@ if (BinaryOperator::isEqualityOp(Opc) && hasIsEqualMethod(S, LHS.get(), RHS.get())) { SourceLocation Start = LHS.get()->getBeginLoc(); - SourceLocation End = S.getLocForEndOfToken(RHS.get()->getLocEnd()); + SourceLocation End = S.getLocForEndOfToken(RHS.get()->getEndLoc()); CharSourceRange OpRange = CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc)); @@ -9679,7 +9678,7 @@ // First note suggest !(x < y) SourceLocation FirstOpen = SubExpr->getBeginLoc(); - SourceLocation FirstClose = RHS.get()->getLocEnd(); + SourceLocation FirstClose = RHS.get()->getEndLoc(); FirstClose = S.getLocForEndOfToken(FirstClose); if (FirstClose.isInvalid()) FirstOpen = SourceLocation(); @@ -9690,7 +9689,7 @@ // Second note suggests (!x) < y SourceLocation SecondOpen = LHS.get()->getBeginLoc(); - SourceLocation SecondClose = LHS.get()->getLocEnd(); + SourceLocation SecondClose = LHS.get()->getEndLoc(); SecondClose = S.getLocForEndOfToken(SecondClose); if (SecondClose.isInvalid()) SecondOpen = SourceLocation(); @@ -10619,8 +10618,8 @@ // Suggest replacing "Foo() && kNonZero" with "Foo()" Diag(Loc, diag::note_logical_instead_of_bitwise_remove_constant) << FixItHint::CreateRemoval( - SourceRange(getLocForEndOfToken(LHS.get()->getLocEnd()), - RHS.get()->getLocEnd())); + SourceRange(getLocForEndOfToken(LHS.get()->getEndLoc()), + RHS.get()->getEndLoc())); } } @@ -11265,7 +11264,7 @@ << FixItHint::CreateInsertion(LHS->getBeginLoc(), LangOpts.CPlusPlus ? "static_cast(" : "(void)(") - << FixItHint::CreateInsertion(PP.getLocForEndOfToken(LHS->getLocEnd()), + << FixItHint::CreateInsertion(PP.getLocForEndOfToken(LHS->getEndLoc()), ")"); } @@ -11997,7 +11996,7 @@ // The meaning of x = {v} [...] is that of x = T(v) [...]. The meaning // of x = {} is x = T(). InitializationKind Kind = InitializationKind::CreateDirectList( - RHSExpr->getBeginLoc(), RHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); + RHSExpr->getBeginLoc(), RHSExpr->getBeginLoc(), RHSExpr->getEndLoc()); InitializedEntity Entity = InitializedEntity::InitializeTemporary(LHSExpr->getType()); InitializationSequence InitSeq(*this, Entity, Kind, RHSExpr); @@ -12026,7 +12025,7 @@ // OpenCLC v2.0 s6.13.11.1 allows atomic variables to be initialized by // the ATOMIC_VAR_INIT macro. if (LHSTy->isAtomicType() || RHSTy->isAtomicType()) { - SourceRange SR(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); + SourceRange SR(LHSExpr->getBeginLoc(), RHSExpr->getEndLoc()); if (BO_Assign == Opc) Diag(OpLoc, diag::err_opencl_atomic_init) << 0 << SR; else @@ -12188,7 +12187,7 @@ &Context.Idents.get("object_setClass"), SourceLocation(), LookupOrdinaryName); if (ObjectSetClass && isa(LHS.get())) { - SourceLocation RHSLocEnd = getLocForEndOfToken(RHS.get()->getLocEnd()); + SourceLocation RHSLocEnd = getLocForEndOfToken(RHS.get()->getEndLoc()); Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign) << FixItHint::CreateInsertion(LHS.get()->getBeginLoc(), "object_setClass(") @@ -12253,12 +12252,12 @@ SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getBeginLoc(), OpLoc) - : SourceRange(OpLoc, RHSExpr->getLocEnd()); + : SourceRange(OpLoc, RHSExpr->getEndLoc()); StringRef OpStr = isLeftComp ? LHSBO->getOpcodeStr() : RHSBO->getOpcodeStr(); SourceRange ParensRange = isLeftComp - ? SourceRange(LHSBO->getRHS()->getBeginLoc(), RHSExpr->getLocEnd()) - : SourceRange(LHSExpr->getBeginLoc(), RHSBO->getLHS()->getLocEnd()); + ? SourceRange(LHSBO->getRHS()->getBeginLoc(), RHSExpr->getEndLoc()) + : SourceRange(LHSExpr->getBeginLoc(), RHSBO->getLHS()->getEndLoc()); Self.Diag(OpLoc, diag::warn_precedence_bitwise_rel) << DiagRange << BinaryOperator::getOpcodeStr(Opc) << OpStr; @@ -12394,7 +12393,7 @@ OCE->getSourceRange()); SuggestParentheses( S, OpLoc, S.PDiag(diag::note_evaluate_comparison_first), - SourceRange(OCE->getArg(1)->getBeginLoc(), RHSExpr->getLocEnd())); + SourceRange(OCE->getArg(1)->getBeginLoc(), RHSExpr->getEndLoc())); } /// DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -1698,15 +1698,9 @@ if (ParenListExpr *List = dyn_cast_or_null(Initializer)) DirectInitRange = List->getSourceRange(); - return BuildCXXNew(SourceRange(StartLoc, D.getLocEnd()), UseGlobal, - PlacementLParen, - PlacementArgs, - PlacementRParen, - TypeIdParens, - AllocType, - TInfo, - ArraySize, - DirectInitRange, + return BuildCXXNew(SourceRange(StartLoc, D.getEndLoc()), UseGlobal, + PlacementLParen, PlacementArgs, PlacementRParen, + TypeIdParens, AllocType, TInfo, ArraySize, DirectInitRange, Initializer); } @@ -1804,7 +1798,7 @@ : initStyle == CXXNewExpr::ListInit ? InitializationKind::CreateDirectList( TypeRange.getBegin(), Initializer->getBeginLoc(), - Initializer->getLocEnd()) + Initializer->getEndLoc()) : InitializationKind::CreateDirect(TypeRange.getBegin(), DirectInitRange.getBegin(), DirectInitRange.getEnd()); @@ -2087,7 +2081,7 @@ // dialect distinction. if (ArraySize && !isLegalArrayNewInitializer(initStyle, Initializer)) { SourceRange InitRange(Inits[0]->getBeginLoc(), - Inits[NumInits - 1]->getLocEnd()); + Inits[NumInits - 1]->getEndLoc()); Diag(StartLoc, diag::err_new_array_init_args) << InitRange; return ExprError(); } @@ -2594,7 +2588,7 @@ SourceRange R = PlaceArgs.empty() ? SourceRange() : SourceRange(PlaceArgs.front()->getBeginLoc(), - PlaceArgs.back()->getLocEnd()); + PlaceArgs.back()->getEndLoc()); Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R; if (!OperatorDelete->isImplicit()) Diag(OperatorDelete->getLocation(), diag::note_previous_decl) @@ -5421,7 +5415,7 @@ CXXCastPath BasePath; if (CheckDerivedToBaseConversion( LHSType, Class, Loc, - SourceRange(LHS.get()->getBeginLoc(), RHS.get()->getLocEnd()), + SourceRange(LHS.get()->getBeginLoc(), RHS.get()->getEndLoc()), &BasePath)) return QualType(); @@ -7159,9 +7153,8 @@ ExprValueKind VK = Expr::getValueKindForType(ResultType); ResultType = ResultType.getNonLValueExprType(Context); - CXXMemberCallExpr *CE = - new (Context) CXXMemberCallExpr(Context, ME, None, ResultType, VK, - Exp.get()->getLocEnd()); + CXXMemberCallExpr *CE = new (Context) CXXMemberCallExpr( + Context, ME, None, ResultType, VK, Exp.get()->getEndLoc()); if (CheckFunctionCall(Method, CE, Method->getType()->castAs())) Index: lib/Sema/SemaExprObjC.cpp =================================================================== --- lib/Sema/SemaExprObjC.cpp +++ lib/Sema/SemaExprObjC.cpp @@ -1034,7 +1034,7 @@ Diag(Element.EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) << SourceRange(Element.Key->getBeginLoc(), - Element.Value->getLocEnd()); + Element.Value->getEndLoc()); return ExprError(); } @@ -1697,7 +1697,7 @@ << 2 /*method*/ << NumNamedArgs << static_cast(Args.size()) << Method->getSourceRange() << SourceRange(Args[NumNamedArgs]->getBeginLoc(), - Args.back()->getLocEnd()); + Args.back()->getEndLoc()); } } @@ -4070,7 +4070,8 @@ ExpressionString += RelatedClass->getNameAsString(); ExpressionString += " "; ExpressionString += ClassMethod->getSelector().getAsString(); - SourceLocation SrcExprEndLoc = getLocForEndOfToken(SrcExpr->getLocEnd()); + SourceLocation SrcExprEndLoc = + getLocForEndOfToken(SrcExpr->getEndLoc()); // Provide a fixit: [RelatedClass ClassMethod SrcExpr] Diag(Loc, diag::err_objc_bridged_related_known_method) << SrcType << DestType << ClassMethod->getSelector() << false @@ -4098,7 +4099,7 @@ if (Diagnose) { std::string ExpressionString; SourceLocation SrcExprEndLoc = - getLocForEndOfToken(SrcExpr->getLocEnd()); + getLocForEndOfToken(SrcExpr->getEndLoc()); if (InstanceMethod->isPropertyAccessor()) if (const ObjCPropertyDecl *PDecl = InstanceMethod->findPropertyDecl()) { Index: lib/Sema/SemaInit.cpp =================================================================== --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -518,10 +518,10 @@ if (!ILE->getInit(Init)) { ExprResult BaseInit = - FillWithNoInit ? new (SemaRef.Context) NoInitExpr(Base.getType()) - : PerformEmptyInit(SemaRef, ILE->getLocEnd(), BaseEntity, - /*VerifyOnly*/ false, - TreatUnavailableAsInvalid); + FillWithNoInit + ? new (SemaRef.Context) NoInitExpr(Base.getType()) + : PerformEmptyInit(SemaRef, ILE->getEndLoc(), BaseEntity, + /*VerifyOnly*/ false, TreatUnavailableAsInvalid); if (BaseInit.isInvalid()) { hadError = true; return; @@ -545,7 +545,7 @@ InitListExpr *ILE, bool &RequiresSecondPass, bool FillWithNoInit) { - SourceLocation Loc = ILE->getLocEnd(); + SourceLocation Loc = ILE->getEndLoc(); unsigned NumInits = ILE->getNumInits(); InitializedEntity MemberEntity = InitializedEntity::InitializeMember(Field, &ParentEntity); @@ -765,10 +765,9 @@ if (FillWithNoInit) Filler = new (SemaRef.Context) NoInitExpr(ElementType); else { - ExprResult ElementInit = PerformEmptyInit(SemaRef, ILE->getLocEnd(), - ElementEntity, - /*VerifyOnly*/false, - TreatUnavailableAsInvalid); + ExprResult ElementInit = + PerformEmptyInit(SemaRef, ILE->getEndLoc(), ElementEntity, + /*VerifyOnly*/ false, TreatUnavailableAsInvalid); if (ElementInit.isInvalid()) { hadError = true; return; @@ -962,7 +961,7 @@ StructuredSubobjectInitList->getBeginLoc(), "{") << FixItHint::CreateInsertion( SemaRef.getLocForEndOfToken( - StructuredSubobjectInitList->getLocEnd()), + StructuredSubobjectInitList->getEndLoc()), "}"); } } @@ -1509,7 +1508,7 @@ if (VerifyOnly) CheckEmptyInitializable( InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity), - IList->getLocEnd()); + IList->getEndLoc()); return; } @@ -1556,7 +1555,7 @@ // Don't attempt to go past the end of the init list if (Index >= IList->getNumInits()) { if (VerifyOnly) - CheckEmptyInitializable(ElementEntity, IList->getLocEnd()); + CheckEmptyInitializable(ElementEntity, IList->getEndLoc()); break; } @@ -1775,9 +1774,9 @@ // FIXME: This needs to detect holes left by designated initializers too. if ((maxElementsKnown && elementIndex < maxElements) || Entity.isVariableLengthArrayNew()) - CheckEmptyInitializable(InitializedEntity::InitializeElement( - SemaRef.Context, 0, Entity), - IList->getLocEnd()); + CheckEmptyInitializable( + InitializedEntity::InitializeElement(SemaRef.Context, 0, Entity), + IList->getEndLoc()); } } @@ -1861,7 +1860,7 @@ if (VerifyOnly) CheckEmptyInitializable( InitializedEntity::InitializeMember(*Field, &Entity), - IList->getLocEnd()); + IList->getEndLoc()); else StructuredList->setInitializedFieldInUnion(*Field); break; @@ -1875,7 +1874,7 @@ // If we have any base classes, they are initialized prior to the fields. for (auto &Base : Bases) { Expr *Init = Index < IList->getNumInits() ? IList->getInit(Index) : nullptr; - SourceLocation InitLoc = Init ? Init->getBeginLoc() : IList->getLocEnd(); + SourceLocation InitLoc = Init ? Init->getBeginLoc() : IList->getEndLoc(); // Designated inits always initialize fields, so if we see one, all // remaining base classes have no explicit initializer. @@ -1999,7 +1998,7 @@ if (!Field->isUnnamedBitfield() && !Field->hasInClassInitializer()) CheckEmptyInitializable( InitializedEntity::InitializeMember(*Field, &Entity), - IList->getLocEnd()); + IList->getEndLoc()); } } @@ -2178,7 +2177,7 @@ if (!ExistingInit) StructuredList = getStructuredSubobjectInit( IList, Index, CurrentObjectType, StructuredList, StructuredIndex, - SourceRange(D->getBeginLoc(), DIE->getLocEnd())); + SourceRange(D->getBeginLoc(), DIE->getEndLoc())); else if (InitListExpr *Result = dyn_cast(ExistingInit)) StructuredList = Result; else { @@ -2188,7 +2187,7 @@ else { DesignatedInitUpdateExpr *DIUE = new (SemaRef.Context) DesignatedInitUpdateExpr(SemaRef.Context, D->getBeginLoc(), - ExistingInit, DIE->getLocEnd()); + ExistingInit, DIE->getEndLoc()); StructuredList->updateInit(SemaRef.Context, StructuredIndex, DIUE); StructuredList = DIUE->getUpdater(); } @@ -2215,7 +2214,7 @@ // subobject [0], overwriting previous initializers. SemaRef.Diag(D->getBeginLoc(), diag::warn_subobject_initializer_overrides) - << SourceRange(D->getBeginLoc(), DIE->getLocEnd()); + << SourceRange(D->getBeginLoc(), DIE->getEndLoc()); SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer) @@ -2387,7 +2386,7 @@ = DIE->getDesignator(DesigIdx + 1); SemaRef.Diag(NextD->getBeginLoc(), diag::err_designator_into_flexible_array_member) - << SourceRange(NextD->getBeginLoc(), DIE->getLocEnd()); + << SourceRange(NextD->getBeginLoc(), DIE->getEndLoc()); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << *Field; } @@ -3491,11 +3490,11 @@ return false; VarDecl *VD = cast(Entity.getDecl()); - if (VD->getInit() || VD->getLocEnd().isMacroID()) + if (VD->getInit() || VD->getEndLoc().isMacroID()) return false; QualType VariableTy = VD->getType().getCanonicalType(); - SourceLocation Loc = S.getLocForEndOfToken(VD->getLocEnd()); + SourceLocation Loc = S.getLocForEndOfToken(VD->getEndLoc()); std::string Init = S.getFixItZeroInitializerForType(VariableTy, Loc); if (!Init.empty()) { Sequence.AddZeroInitializationStep(Entity.getType()); @@ -3567,7 +3566,7 @@ InitializedEntity HiddenArray = InitializedEntity::InitializeTemporary(ArrayType); InitializationKind Kind = InitializationKind::CreateDirectList( - List->getExprLoc(), List->getBeginLoc(), List->getLocEnd()); + List->getExprLoc(), List->getBeginLoc(), List->getEndLoc()); TryListInitialization(S, HiddenArray, Kind, List, Sequence, TreatUnavailableAsInvalid); if (Sequence) @@ -7233,7 +7232,7 @@ Entity.getKind() == InitializedEntity::EK_Variable && Args.size() > 0) { S.Diag(Args[0]->getBeginLoc(), diag::err_opencl_atomic_init) << 1 - << SourceRange(Entity.getDecl()->getBeginLoc(), Args[0]->getLocEnd()); + << SourceRange(Entity.getDecl()->getBeginLoc(), Args[0]->getEndLoc()); return ExprError(); } @@ -8111,7 +8110,7 @@ (void)Diagnosed; } else // FIXME: diagnostic below could be better! S.Diag(Kind.getLocation(), diag::err_reference_has_multiple_inits) - << SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd()); + << SourceRange(Args.front()->getBeginLoc(), Args.back()->getEndLoc()); break; case FK_ParenthesizedListInitForReference: S.Diag(Kind.getLocation(), diag::err_list_init_in_parens) @@ -8322,10 +8321,10 @@ auto *InitList = dyn_cast(Args[0]); if (InitList && InitList->getNumInits() >= 1) { - R = SourceRange(InitList->getInit(0)->getLocEnd(), InitList->getLocEnd()); + R = SourceRange(InitList->getInit(0)->getEndLoc(), InitList->getEndLoc()); } else { assert(Args.size() > 1 && "Expected multiple initializers!"); - R = SourceRange(Args.front()->getLocEnd(), Args.back()->getLocEnd()); + R = SourceRange(Args.front()->getEndLoc(), Args.back()->getEndLoc()); } R.setBegin(S.getLocForEndOfToken(R.getBegin())); @@ -8358,7 +8357,7 @@ SourceRange ArgsRange; if (Args.size()) ArgsRange = - SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd()); + SourceRange(Args.front()->getBeginLoc(), Args.back()->getEndLoc()); if (Failure == FK_ListConstructorOverloadFailed) { assert(Args.size() == 1 && @@ -8946,7 +8945,7 @@ << PostInit->getSourceRange() << FixItHint::CreateInsertion(PostInit->getBeginLoc(), OS.str()) << FixItHint::CreateInsertion( - S.getLocForEndOfToken(PostInit->getLocEnd()), ")"); + S.getLocForEndOfToken(PostInit->getEndLoc()), ")"); } //===----------------------------------------------------------------------===// Index: lib/Sema/SemaLambda.cpp =================================================================== --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -761,7 +761,7 @@ InitializationKind Kind = IsDirectInit ? (CXXDirectInit ? InitializationKind::CreateDirect( - Loc, Init->getBeginLoc(), Init->getLocEnd()) + Loc, Init->getBeginLoc(), Init->getEndLoc()) : InitializationKind::CreateDirectList(Loc)) : InitializationKind::CreateCopy(Loc, Init->getBeginLoc()); @@ -1296,15 +1296,12 @@ CallOpConvNameTL.setParam(I, From); } - CXXConversionDecl *Conversion - = CXXConversionDecl::Create(S.Context, Class, Loc, - DeclarationNameInfo(ConversionName, - Loc, ConvNameLoc), - ConvTy, - ConvTSI, - /*isInline=*/true, /*isExplicit=*/false, - /*isConstexpr=*/S.getLangOpts().CPlusPlus17, - CallOperator->getBody()->getLocEnd()); + CXXConversionDecl *Conversion = CXXConversionDecl::Create( + S.Context, Class, Loc, + DeclarationNameInfo(ConversionName, Loc, ConvNameLoc), ConvTy, ConvTSI, + /*isInline=*/true, /*isExplicit=*/false, + /*isConstexpr=*/S.getLangOpts().CPlusPlus17, + CallOperator->getBody()->getEndLoc()); Conversion->setAccess(AS_public); Conversion->setImplicit(true); @@ -1339,14 +1336,11 @@ // trailing return type of the invoker would require a visitor to rebuild // the trailing return type and adjusting all back DeclRefExpr's to refer // to the new static invoker parameters - not the call operator's. - CXXMethodDecl *Invoke - = CXXMethodDecl::Create(S.Context, Class, Loc, - DeclarationNameInfo(InvokerName, Loc), - InvokerFunctionTy, - CallOperator->getTypeSourceInfo(), - SC_Static, /*IsInline=*/true, - /*IsConstexpr=*/false, - CallOperator->getBody()->getLocEnd()); + CXXMethodDecl *Invoke = CXXMethodDecl::Create( + S.Context, Class, Loc, DeclarationNameInfo(InvokerName, Loc), + InvokerFunctionTy, CallOperator->getTypeSourceInfo(), SC_Static, + /*IsInline=*/true, + /*IsConstexpr=*/false, CallOperator->getBody()->getEndLoc()); for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) InvokerParams[I]->setOwningFunction(Invoke); Invoke->setParams(InvokerParams); @@ -1388,14 +1382,11 @@ S.Context.getCanonicalType(BlockPtrTy)); DeclarationNameLoc NameLoc; NameLoc.NamedType.TInfo = S.Context.getTrivialTypeSourceInfo(BlockPtrTy, Loc); - CXXConversionDecl *Conversion - = CXXConversionDecl::Create(S.Context, Class, Loc, - DeclarationNameInfo(Name, Loc, NameLoc), - ConvTy, - S.Context.getTrivialTypeSourceInfo(ConvTy, Loc), - /*isInline=*/true, /*isExplicit=*/false, - /*isConstexpr=*/false, - CallOperator->getBody()->getLocEnd()); + CXXConversionDecl *Conversion = CXXConversionDecl::Create( + S.Context, Class, Loc, DeclarationNameInfo(Name, Loc, NameLoc), ConvTy, + S.Context.getTrivialTypeSourceInfo(ConvTy, Loc), + /*isInline=*/true, /*isExplicit=*/false, + /*isConstexpr=*/false, CallOperator->getBody()->getEndLoc()); Conversion->setAccess(AS_public); Conversion->setImplicit(true); Class->addDecl(Conversion); @@ -1438,7 +1429,7 @@ Scope *CurScope) { LambdaScopeInfo LSI = *cast(FunctionScopes.back()); ActOnFinishFunctionBody(LSI.CallOperator, Body); - return BuildLambdaExpr(StartLoc, Body->getLocEnd(), &LSI); + return BuildLambdaExpr(StartLoc, Body->getEndLoc(), &LSI); } static LambdaCaptureDefault Index: lib/Sema/SemaObjCProperty.cpp =================================================================== --- lib/Sema/SemaObjCProperty.cpp +++ lib/Sema/SemaObjCProperty.cpp @@ -609,7 +609,7 @@ } if (T->isObjCObjectType()) { - SourceLocation StarLoc = TInfo->getTypeLoc().getLocEnd(); + SourceLocation StarLoc = TInfo->getTypeLoc().getEndLoc(); StarLoc = getLocForEndOfToken(StarLoc); Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object) << FixItHint::CreateInsertion(StarLoc, "*"); @@ -2235,7 +2235,7 @@ if (getterRedecl->getDeclContext() != PD->getDeclContext()) continue; noteLoc = getterRedecl->getLocation(); - fixItLoc = getterRedecl->getLocEnd(); + fixItLoc = getterRedecl->getEndLoc(); } Preprocessor &PP = getPreprocessor(); Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -2706,13 +2706,13 @@ ? SC->getFirstScheduleModifierLoc() : SC->getSecondScheduleModifierLoc(), diag::err_omp_schedule_nonmonotonic_ordered) - << SourceRange(OC->getBeginLoc(), OC->getLocEnd()); + << SourceRange(OC->getBeginLoc(), OC->getEndLoc()); ErrorFound = true; } if (!LCs.empty() && OC && OC->getNumForLoops()) { for (const OMPLinearClause *C : LCs) { Diag(C->getBeginLoc(), diag::err_omp_linear_ordered) - << SourceRange(OC->getBeginLoc(), OC->getLocEnd()); + << SourceRange(OC->getBeginLoc(), OC->getEndLoc()); } ErrorFound = true; } @@ -6135,7 +6135,7 @@ C->getClauseKind() == OMPC_capture) { if (AtomicKind != OMPC_unknown) { Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses) - << SourceRange(C->getBeginLoc(), C->getLocEnd()); + << SourceRange(C->getBeginLoc(), C->getEndLoc()); Diag(AtomicKindLoc, diag::note_omp_atomic_previous_clause) << getOpenMPClauseName(AtomicKind); } else { @@ -6938,7 +6938,7 @@ if (ReductionClause && NogroupClause) { S.Diag(ReductionClause->getBeginLoc(), diag::err_omp_reduction_with_nogroup) << SourceRange(NogroupClause->getBeginLoc(), - NogroupClause->getLocEnd()); + NogroupClause->getEndLoc()); return true; } return false; Index: lib/Sema/SemaOverload.cpp =================================================================== --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -5584,7 +5584,7 @@ << FixItHint::CreateInsertion(From->getBeginLoc(), "static_cast<" + TypeStr + ">(") << FixItHint::CreateInsertion( - SemaRef.getLocForEndOfToken(From->getLocEnd()), ")"); + SemaRef.getLocForEndOfToken(From->getEndLoc()), ")"); Converter.noteExplicitConv(SemaRef, Conversion, ConvTy); // If we aren't in a SFINAE context, build a call to the Index: lib/Sema/SemaStmt.cpp =================================================================== --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -556,7 +556,7 @@ CommaVisitor(*this).Visit(CondExpr); if (!elseStmt) - DiagnoseEmptyStmtBody(CondExpr->getLocEnd(), thenStmt, + DiagnoseEmptyStmtBody(CondExpr->getEndLoc(), thenStmt, diag::warn_empty_if_body); return BuildIfStmt(IfLoc, IsConstexpr, InitStmt, Cond, thenStmt, ElseLoc, @@ -1027,7 +1027,7 @@ // If the low value is bigger than the high value, the case is empty. if (LoVal > HiVal) { Diag(CR->getLHS()->getBeginLoc(), diag::warn_case_empty_range) - << SourceRange(CR->getLHS()->getBeginLoc(), Hi->getLocEnd()); + << SourceRange(CR->getLHS()->getBeginLoc(), Hi->getEndLoc()); CaseRanges.erase(CaseRanges.begin()+i); --i; --e; @@ -1208,7 +1208,7 @@ } if (BodyStmt) - DiagnoseEmptyStmtBody(CondExpr->getLocEnd(), BodyStmt, + DiagnoseEmptyStmtBody(CondExpr->getEndLoc(), BodyStmt, diag::warn_empty_switch_body); // FIXME: If the case list was broken is some way, we don't have a good system Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -1762,7 +1762,7 @@ return buildDeductionGuide(TemplateParams, CD->isExplicit(), NewTInfo, CD->getBeginLoc(), CD->getLocation(), - CD->getLocEnd()); + CD->getEndLoc()); } /// Build a deduction guide with the specified parameter types. @@ -5625,7 +5625,7 @@ std::string Code = "static_cast<" + ParamType.getAsString() + ">("; S.Diag(Arg->getExprLoc(), diag::err_template_arg_untyped_null_constant) << ParamType << FixItHint::CreateInsertion(Arg->getBeginLoc(), Code) - << FixItHint::CreateInsertion(S.getLocForEndOfToken(Arg->getLocEnd()), + << FixItHint::CreateInsertion(S.getLocForEndOfToken(Arg->getEndLoc()), ")"); S.Diag(Param->getLocation(), diag::note_template_param_here); return NPV_NullPointer; Index: lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- lib/Sema/SemaTemplateInstantiate.cpp +++ lib/Sema/SemaTemplateInstantiate.cpp @@ -1708,7 +1708,7 @@ Proto->getExtProtoInfo().ExceptionSpec; SmallVector ExceptionStorage; - if (SubstExceptionSpec(New->getTypeSourceInfo()->getTypeLoc().getLocEnd(), + if (SubstExceptionSpec(New->getTypeSourceInfo()->getTypeLoc().getEndLoc(), ESI, ExceptionStorage, Args)) // On error, recover by dropping the exception specification. ESI.Type = EST_None; @@ -2303,7 +2303,7 @@ Diag(PointOfInstantiation, diag::err_in_class_initializer_not_yet_parsed) << OutermostClass << Pattern; - Diag(Pattern->getLocEnd(), diag::note_in_class_initializer_not_yet_parsed); + Diag(Pattern->getEndLoc(), diag::note_in_class_initializer_not_yet_parsed); Instantiation->setInvalidDecl(); return true; } Index: lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- lib/Sema/SemaTemplateInstantiateDecl.cpp +++ lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1943,26 +1943,23 @@ Constructor->isExplicit(), Constructor->isInlineSpecified(), false, Constructor->isConstexpr()); - Method->setRangeEnd(Constructor->getLocEnd()); + Method->setRangeEnd(Constructor->getEndLoc()); } else if (CXXDestructorDecl *Destructor = dyn_cast(D)) { Method = CXXDestructorDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, Destructor->isInlineSpecified(), false); - Method->setRangeEnd(Destructor->getLocEnd()); + Method->setRangeEnd(Destructor->getEndLoc()); } else if (CXXConversionDecl *Conversion = dyn_cast(D)) { - Method = CXXConversionDecl::Create(SemaRef.Context, Record, - StartLoc, NameInfo, T, TInfo, - Conversion->isInlineSpecified(), - Conversion->isExplicit(), - Conversion->isConstexpr(), - Conversion->getLocEnd()); + Method = CXXConversionDecl::Create( + SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, + Conversion->isInlineSpecified(), Conversion->isExplicit(), + Conversion->isConstexpr(), Conversion->getEndLoc()); } else { StorageClass SC = D->isStatic() ? SC_Static : SC_None; - Method = CXXMethodDecl::Create(SemaRef.Context, Record, - StartLoc, NameInfo, T, TInfo, - SC, D->isInlineSpecified(), - D->isConstexpr(), D->getLocEnd()); + Method = CXXMethodDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, + T, TInfo, SC, D->isInlineSpecified(), + D->isConstexpr(), D->getEndLoc()); } if (D->isInlined()) Index: lib/Sema/SemaTemplateVariadic.cpp =================================================================== --- lib/Sema/SemaTemplateVariadic.cpp +++ lib/Sema/SemaTemplateVariadic.cpp @@ -1126,7 +1126,7 @@ S.Diag(E->getExprLoc(), diag::err_fold_expression_bad_operand) << E->getSourceRange() << FixItHint::CreateInsertion(E->getBeginLoc(), "(") - << FixItHint::CreateInsertion(E->getLocEnd(), ")"); + << FixItHint::CreateInsertion(E->getEndLoc(), ")"); } } Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3302,7 +3302,7 @@ // valid (when there is no initializer and we're not in a condition). S.Diag(D.getBeginLoc(), diag::note_function_style_cast_add_parentheses) << FixItHint::CreateInsertion(D.getBeginLoc(), "(") - << FixItHint::CreateInsertion(S.getLocForEndOfToken(D.getLocEnd()), ")"); + << FixItHint::CreateInsertion(S.getLocForEndOfToken(D.getEndLoc()), ")"); S.Diag(Paren.Loc, diag::note_remove_parens_for_variable_declaration) << FixItHint::CreateRemoval(Paren.Loc) << FixItHint::CreateRemoval(Paren.EndLoc); @@ -4182,7 +4182,7 @@ if (auto *attr = inferPointerNullability( pointerKind, D.getDeclSpec().getTypeSpecTypeLoc(), - D.getDeclSpec().getLocEnd(), + D.getDeclSpec().getEndLoc(), D.getMutableDeclSpec().getAttributes())) { T = Context.getAttributedType( AttributedType::getNullabilityAttrKind(*inferNullability),T,T); @@ -4473,10 +4473,10 @@ SourceLocation DiagLoc, FixitLoc; if (TInfo) { DiagLoc = TInfo->getTypeLoc().getBeginLoc(); - FixitLoc = S.getLocForEndOfToken(TInfo->getTypeLoc().getLocEnd()); + FixitLoc = S.getLocForEndOfToken(TInfo->getTypeLoc().getEndLoc()); } else { DiagLoc = D.getDeclSpec().getTypeSpecTypeLoc(); - FixitLoc = S.getLocForEndOfToken(D.getDeclSpec().getLocEnd()); + FixitLoc = S.getLocForEndOfToken(D.getDeclSpec().getEndLoc()); } S.Diag(DiagLoc, diag::err_object_cannot_be_passed_returned_by_value) << 0 << T @@ -5298,7 +5298,7 @@ // FIXME. We should have DS.getTypeSpecTypeEndLoc(). But, it requires // addition field. What we have is good enough for dispay of location // of 'fixit' on interface name. - TL.setNameEndLoc(DS.getLocEnd()); + TL.setNameEndLoc(DS.getEndLoc()); } void VisitObjCObjectTypeLoc(ObjCObjectTypeLoc TL) { TypeSourceInfo *RepTInfo = nullptr; Index: lib/Sema/TreeTransform.h =================================================================== --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -3395,7 +3395,7 @@ // If this was list initialization, revert to syntactic list form. if (Construct->isListInitialization()) return getDerived().RebuildInitList(Construct->getBeginLoc(), NewArgs, - Construct->getLocEnd()); + Construct->getEndLoc()); // Build a ParenListExpr to represent anything else. SourceRange Parens = Construct->getParenOrBraceRange(); @@ -7702,7 +7702,7 @@ return getDerived().RebuildOMPExecutableDirective( D->getDirectiveKind(), DirName, CancelRegion, TClauses, - AssociatedStmt.get(), D->getBeginLoc(), D->getLocEnd()); + AssociatedStmt.get(), D->getBeginLoc(), D->getEndLoc()); } template @@ -8239,7 +8239,7 @@ return nullptr; return getDerived().RebuildOMPIfClause( C->getNameModifier(), Cond.get(), C->getBeginLoc(), C->getLParenLoc(), - C->getNameModifierLoc(), C->getColonLoc(), C->getLocEnd()); + C->getNameModifierLoc(), C->getColonLoc(), C->getEndLoc()); } template @@ -8248,7 +8248,7 @@ if (Cond.isInvalid()) return nullptr; return getDerived().RebuildOMPFinalClause(Cond.get(), C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8258,7 +8258,7 @@ if (NumThreads.isInvalid()) return nullptr; return getDerived().RebuildOMPNumThreadsClause( - NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8268,7 +8268,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPSafelenClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8278,7 +8278,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPSimdlenClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8288,7 +8288,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPCollapseClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8296,7 +8296,7 @@ TreeTransform::TransformOMPDefaultClause(OMPDefaultClause *C) { return getDerived().RebuildOMPDefaultClause( C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8304,7 +8304,7 @@ TreeTransform::TransformOMPProcBindClause(OMPProcBindClause *C) { return getDerived().RebuildOMPProcBindClause( C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8317,7 +8317,7 @@ C->getFirstScheduleModifier(), C->getSecondScheduleModifier(), C->getScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getFirstScheduleModifierLoc(), C->getSecondScheduleModifierLoc(), - C->getScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd()); + C->getScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc()); } template @@ -8329,7 +8329,7 @@ if (E.isInvalid()) return nullptr; } - return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getLocEnd(), + return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getEndLoc(), C->getLParenLoc(), E.get()); } @@ -8419,7 +8419,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPPrivateClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8434,7 +8434,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPFirstprivateClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8449,7 +8449,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPLastprivateClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8464,7 +8464,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPSharedClause(Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8511,7 +8511,7 @@ } return getDerived().RebuildOMPReductionClause( Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), - C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); + C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } template @@ -8556,7 +8556,7 @@ } return getDerived().RebuildOMPTaskReductionClause( Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), - C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); + C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } template @@ -8601,7 +8601,7 @@ } return getDerived().RebuildOMPInReductionClause( Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), - C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); + C->getEndLoc(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } template @@ -8620,7 +8620,7 @@ return nullptr; return getDerived().RebuildOMPLinearClause( Vars, Step.get(), C->getBeginLoc(), C->getLParenLoc(), C->getModifier(), - C->getModifierLoc(), C->getColonLoc(), C->getLocEnd()); + C->getModifierLoc(), C->getColonLoc(), C->getEndLoc()); } template @@ -8639,7 +8639,7 @@ return nullptr; return getDerived().RebuildOMPAlignedClause( Vars, Alignment.get(), C->getBeginLoc(), C->getLParenLoc(), - C->getColonLoc(), C->getLocEnd()); + C->getColonLoc(), C->getEndLoc()); } template @@ -8654,7 +8654,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPCopyinClause(Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8669,7 +8669,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPCopyprivateClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8683,7 +8683,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPFlushClause(Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8699,7 +8699,7 @@ } return getDerived().RebuildOMPDependClause( C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(), Vars, - C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8709,7 +8709,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPDeviceClause(E.get(), C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8725,7 +8725,7 @@ return getDerived().RebuildOMPMapClause( C->getMapTypeModifier(), C->getMapType(), C->isImplicitMapType(), C->getMapLoc(), C->getColonLoc(), Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8735,7 +8735,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPNumTeamsClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8745,7 +8745,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPThreadLimitClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8755,7 +8755,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPPriorityClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8765,7 +8765,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPGrainsizeClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8775,7 +8775,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPNumTasksClause( - E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8784,7 +8784,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPHintClause(E.get(), C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8795,7 +8795,7 @@ return nullptr; return getDerived().RebuildOMPDistScheduleClause( C->getDistScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(), - C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd()); + C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getEndLoc()); } template @@ -8815,7 +8815,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPToClause(Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8829,7 +8829,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPFromClause(Vars, C->getBeginLoc(), - C->getLParenLoc(), C->getLocEnd()); + C->getLParenLoc(), C->getEndLoc()); } template @@ -8844,7 +8844,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPUseDevicePtrClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } template @@ -8859,7 +8859,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPIsDevicePtrClause( - Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); } //===----------------------------------------------------------------------===// @@ -9252,7 +9252,7 @@ return E; return getDerived().RebuildOMPArraySectionExpr( - Base.get(), E->getBase()->getLocEnd(), LowerBound.get(), E->getColonLoc(), + Base.get(), E->getBase()->getEndLoc(), LowerBound.get(), E->getColonLoc(), Length.get(), E->getRBracketLoc()); } @@ -9505,9 +9505,9 @@ // type-as-written, but that's okay, because it should always be // derivable from the initializer. - return getDerived().RebuildCompoundLiteralExpr(E->getLParenLoc(), NewT, - /*FIXME:*/E->getInitializer()->getLocEnd(), - Init.get()); + return getDerived().RebuildCompoundLiteralExpr( + E->getLParenLoc(), NewT, + /*FIXME:*/ E->getInitializer()->getEndLoc(), Init.get()); } template @@ -9523,7 +9523,7 @@ // FIXME: Bad source location SourceLocation FakeOperatorLoc = - SemaRef.getLocForEndOfToken(E->getBase()->getLocEnd()); + SemaRef.getLocForEndOfToken(E->getBase()->getEndLoc()); return getDerived().RebuildExtVectorElementExpr(Base.get(), FakeOperatorLoc, E->getAccessorLoc(), E->getAccessor()); @@ -9811,7 +9811,7 @@ // FIXME: Poor location information SourceLocation FakeLParenLoc = SemaRef.getLocForEndOfToken( - static_cast(Object.get())->getLocEnd()); + static_cast(Object.get())->getEndLoc()); // Transform the call arguments. SmallVector Args; @@ -9819,9 +9819,8 @@ Args)) return ExprError(); - return getDerived().RebuildCallExpr(Object.get(), FakeLParenLoc, - Args, - E->getLocEnd()); + return getDerived().RebuildCallExpr(Object.get(), FakeLParenLoc, Args, + E->getEndLoc()); } #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \ @@ -10002,7 +10001,7 @@ return E; return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(), - TInfo, E->getLocEnd()); + TInfo, E->getEndLoc()); } // We don't know whether the subexpression is potentially evaluated until @@ -10022,7 +10021,7 @@ return E; return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(), - SubExpr.get(), E->getLocEnd()); + SubExpr.get(), E->getEndLoc()); } template @@ -10039,7 +10038,7 @@ return E; return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(), - TInfo, E->getLocEnd()); + TInfo, E->getEndLoc()); } EnterExpressionEvaluationContext Unevaluated( @@ -10054,7 +10053,7 @@ return E; return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(), - SubExpr.get(), E->getLocEnd()); + SubExpr.get(), E->getEndLoc()); } template @@ -10624,7 +10623,7 @@ return E; return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args, - E->getLocEnd()); + E->getEndLoc()); } template @@ -10651,7 +10650,7 @@ } return getDerived().RebuildArrayTypeTrait(E->getTrait(), E->getBeginLoc(), T, - SubExpr.get(), E->getLocEnd()); + SubExpr.get(), E->getEndLoc()); } template @@ -10670,7 +10669,7 @@ } return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(), - SubExpr.get(), E->getLocEnd()); + SubExpr.get(), E->getEndLoc()); } template @@ -10871,7 +10870,7 @@ // prepared to handle list-initialization without a child InitListExpr. SourceLocation LParenLoc = T->getTypeLoc().getEndLoc(); return getDerived().RebuildCXXTemporaryObjectExpr( - T, LParenLoc, Args, E->getLocEnd(), + T, LParenLoc, Args, E->getEndLoc(), /*ListInitialization=*/LParenLoc.isInvalid()); } @@ -10955,7 +10954,7 @@ // Build the call operator. CXXMethodDecl *NewCallOperator = getSema().startLambdaDefinition( Class, E->getIntroducerRange(), NewCallOpTSI, - E->getCallOperator()->getLocEnd(), + E->getCallOperator()->getEndLoc(), NewCallOpTSI->getTypeLoc().castAs().getParams(), E->getCallOperator()->isConstexpr()); @@ -11132,7 +11131,7 @@ /*IsInstantiation*/ true); SavedContext.pop(); - return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getLocEnd(), + return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getEndLoc(), &LSICopy); } @@ -11580,7 +11579,7 @@ return getDerived().RebuildCXXFoldExpr( E->getBeginLoc(), LHS.get(), E->getOperator(), E->getEllipsisLoc(), - RHS.get(), E->getLocEnd()); + RHS.get(), E->getEndLoc()); } // The transform has determined that we should perform an elementwise @@ -11601,7 +11600,7 @@ Result = getDerived().RebuildCXXFoldExpr( E->getBeginLoc(), Out.get(), E->getOperator(), E->getEllipsisLoc(), - Result.get(), E->getLocEnd()); + Result.get(), E->getEndLoc()); if (Result.isInvalid()) return true; } @@ -11618,7 +11617,7 @@ Result = getDerived().RebuildCXXFoldExpr( E->getBeginLoc(), LeftFold ? Result.get() : Out.get(), E->getOperator(), E->getEllipsisLoc(), - LeftFold ? Out.get() : Result.get(), E->getLocEnd()); + LeftFold ? Out.get() : Result.get(), E->getEndLoc()); } else if (Result.isUsable()) { // We've got down to a single element; build a binary operator. Result = getDerived().RebuildBinaryOperator( @@ -11643,7 +11642,7 @@ Result = getDerived().RebuildCXXFoldExpr( E->getBeginLoc(), Result.get(), E->getOperator(), E->getEllipsisLoc(), - Out.get(), E->getLocEnd()); + Out.get(), E->getEndLoc()); if (Result.isInvalid()) return true; } @@ -11732,7 +11731,7 @@ Optional OrigNumExpansions = OrigElement.NumExpansions; Optional NumExpansions = OrigNumExpansions; SourceRange PatternRange(OrigElement.Key->getBeginLoc(), - OrigElement.Value->getLocEnd()); + OrigElement.Value->getEndLoc()); if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc, PatternRange, Unexpanded, Expand, RetainExpansion, NumExpansions)) Index: lib/Serialization/ASTReader.cpp =================================================================== --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -9694,7 +9694,7 @@ if (NumBases == 0) return SourceRange(); auto bases = DD->bases(); return SourceRange(bases[0].getBeginLoc(), - bases[NumBases - 1].getLocEnd()); + bases[NumBases - 1].getEndLoc()); }; if (FirstNumBases != SecondNumBases) { Index: lib/Serialization/ASTWriterDecl.cpp =================================================================== --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -549,7 +549,7 @@ Record.push_back(D->isMultiVersion()); Record.push_back(D->isLateTemplateParsed()); Record.push_back(D->getLinkageInternal()); - Record.AddSourceLocation(D->getLocEnd()); + Record.AddSourceLocation(D->getEndLoc()); Record.push_back(D->getODRHash()); @@ -664,7 +664,7 @@ Record.push_back(D->hasRelatedResultType()); Record.AddTypeRef(D->getReturnType()); Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo()); - Record.AddSourceLocation(D->getLocEnd()); + Record.AddSourceLocation(D->getEndLoc()); Record.push_back(D->param_size()); for (const auto *P : D->parameters()) Record.AddDeclRef(P); @@ -1343,7 +1343,7 @@ ArrayRef IdentifierLocs = D->getIdentifierLocs(); Record.push_back(!IdentifierLocs.empty()); if (IdentifierLocs.empty()) { - Record.AddSourceLocation(D->getLocEnd()); + Record.AddSourceLocation(D->getEndLoc()); Record.push_back(1); } else { for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I) Index: lib/Serialization/ASTWriterStmt.cpp =================================================================== --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1824,7 +1824,7 @@ Record.push_back(C->getClauseKind()); Visit(C); Record.AddSourceLocation(C->getBeginLoc()); - Record.AddSourceLocation(C->getLocEnd()); + Record.AddSourceLocation(C->getEndLoc()); } void OMPClauseWriter::VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C) { @@ -2279,7 +2279,7 @@ //===----------------------------------------------------------------------===// void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) { Record.AddSourceLocation(E->getBeginLoc()); - Record.AddSourceLocation(E->getLocEnd()); + Record.AddSourceLocation(E->getEndLoc()); OMPClauseWriter ClauseWriter(Record); for (unsigned i = 0; i < E->getNumClauses(); ++i) { ClauseWriter.writeClause(E->getClause(i)); Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -2027,7 +2027,7 @@ // Use heuristics to determine if Ex is a macro expending to a literal and // if so, use the macro's name. SourceLocation LocStart = Ex->getBeginLoc(); - SourceLocation LocEnd = Ex->getLocEnd(); + SourceLocation LocEnd = Ex->getEndLoc(); if (LocStart.isMacroID() && LocEnd.isMacroID() && (isa(Ex) || isa(Ex) || Index: lib/StaticAnalyzer/Core/CheckerHelpers.cpp =================================================================== --- lib/StaticAnalyzer/Core/CheckerHelpers.cpp +++ lib/StaticAnalyzer/Core/CheckerHelpers.cpp @@ -24,7 +24,7 @@ if (S->getBeginLoc().isMacroID()) return true; - if (S->getLocEnd().isMacroID()) + if (S->getEndLoc().isMacroID()) return true; for (const Stmt *Child : S->children()) Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp =================================================================== --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -536,7 +536,7 @@ static SourceLocation getValidSourceLocation(const Stmt* S, LocationOrAnalysisDeclContext LAC, bool UseEnd = false) { - SourceLocation L = UseEnd ? S->getLocEnd() : S->getBeginLoc(); + SourceLocation L = UseEnd ? S->getEndLoc() : S->getBeginLoc(); assert(!LAC.isNull() && "A valid LocationContext or AnalysisDeclContext should " "be passed to PathDiagnosticLocation upon creation."); @@ -564,11 +564,11 @@ if (Body) L = Body->getBeginLoc(); else - L = ADC->getDecl()->getLocEnd(); + L = ADC->getDecl()->getEndLoc(); break; } - L = UseEnd ? Parent->getLocEnd() : Parent->getBeginLoc(); + L = UseEnd ? Parent->getEndLoc() : Parent->getBeginLoc(); } while (!L.isValid()); } Index: lib/Tooling/Refactoring/Extract/Extract.cpp =================================================================== --- lib/Tooling/Refactoring/Extract/Extract.cpp +++ lib/Tooling/Refactoring/Extract/Extract.cpp @@ -103,7 +103,7 @@ // Compute the source range of the code that should be extracted. SourceRange ExtractedRange(Code[0]->getBeginLoc(), - Code[Code.size() - 1]->getLocEnd()); + Code[Code.size() - 1]->getEndLoc()); // FIXME (Alex L): Add code that accounts for macro locations. ASTContext &AST = Context.getASTContext(); Index: lib/Tooling/Refactoring/Rename/USRFinder.cpp =================================================================== --- lib/Tooling/Refactoring/Rename/USRFinder.cpp +++ lib/Tooling/Refactoring/Rename/USRFinder.cpp @@ -84,7 +84,7 @@ // looking for the point cannot be inside of this decl. Don't even look at it. for (auto *CurrDecl : Context.getTranslationUnitDecl()->decls()) { SourceLocation StartLoc = CurrDecl->getBeginLoc(); - SourceLocation EndLoc = CurrDecl->getLocEnd(); + SourceLocation EndLoc = CurrDecl->getEndLoc(); if (StartLoc.isValid() && EndLoc.isValid() && SM.isBeforeInTranslationUnit(StartLoc, Point) != SM.isBeforeInTranslationUnit(EndLoc, Point)) Index: lib/Tooling/Refactoring/Rename/USRLocFinder.cpp =================================================================== --- lib/Tooling/Refactoring/Rename/USRLocFinder.cpp +++ lib/Tooling/Refactoring/Rename/USRLocFinder.cpp @@ -260,7 +260,7 @@ // restrict the end of location to just before the `<` character. SourceLocation EndLoc = Expr->hasExplicitTemplateArgs() ? Expr->getLAngleLoc().getLocWithOffset(-1) - : Expr->getLocEnd(); + : Expr->getEndLoc(); if (const auto *MD = llvm::dyn_cast(Decl)) { if (isInUSRSet(MD)) { @@ -576,7 +576,7 @@ // Hanlde using declarations explicitly as "using a::Foo" don't trigger // typeLoc for "a::Foo". for (const auto *Using : Finder.getUsingDecls()) - Replace(Using->getBeginLoc(), Using->getLocEnd(), "using " + NewName.str()); + Replace(Using->getBeginLoc(), Using->getEndLoc(), "using " + NewName.str()); return AtomicChanges; } Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1049,8 +1049,8 @@ SourceLocation L_A = A->getBeginLoc(); SourceLocation L_B = B->getBeginLoc(); return L_A != L_B ? SM.isBeforeInTranslationUnit(L_A, L_B) - : SM.isBeforeInTranslationUnit(A->getLocEnd(), - B->getLocEnd()); + : SM.isBeforeInTranslationUnit(A->getEndLoc(), + B->getEndLoc()); }); // Now visit the decls.