Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp =================================================================== --- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp +++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp @@ -46,7 +46,7 @@ return NestedNameSpecifier.getBeginLoc(); TLoc = TLoc.getNextTypeLoc(); } - return TLoc.getLocStart(); + return TLoc.getBeginLoc(); } SourceLocation endLocationForType(TypeLoc TLoc) { @@ -275,7 +275,7 @@ // Returns true if \p D is visible at \p Loc with DeclContext \p DeclCtx. bool isDeclVisibleAtLocation(const SourceManager &SM, const Decl *D, const DeclContext *DeclCtx, SourceLocation Loc) { - SourceLocation DeclLoc = SM.getSpellingLoc(D->getLocStart()); + SourceLocation DeclLoc = SM.getSpellingLoc(D->getBeginLoc()); Loc = SM.getSpellingLoc(Loc); return SM.isBeforeInTranslationUnit(DeclLoc, Loc) && (SM.getFileID(DeclLoc) == SM.getFileID(Loc) && @@ -634,7 +634,7 @@ const SourceManager &SM, const LangOptions &LangOpts) { std::unique_ptr Lex = - getLexerStartingFromLoc(NsDecl->getLocStart(), SM, LangOpts); + getLexerStartingFromLoc(NsDecl->getBeginLoc(), SM, LangOpts); assert(Lex.get() && "Failed to create lexer from the beginning of namespace."); if (!Lex.get()) @@ -709,7 +709,7 @@ void ChangeNamespaceTool::moveClassForwardDeclaration( const ast_matchers::MatchFinder::MatchResult &Result, const NamedDecl *FwdDecl) { - SourceLocation Start = FwdDecl->getLocStart(); + SourceLocation Start = FwdDecl->getBeginLoc(); SourceLocation End = FwdDecl->getLocEnd(); const SourceManager &SM = *Result.SourceManager; SourceLocation AfterSemi = Lexer::findLocationAfterToken( @@ -879,7 +879,7 @@ if (!llvm::StringRef(D->getQualifiedNameAsString()) .startswith(OldNamespace + "::")) return false; - auto ExpansionLoc = Result.SourceManager->getExpansionLoc(D->getLocStart()); + auto ExpansionLoc = Result.SourceManager->getExpansionLoc(D->getBeginLoc()); if (ExpansionLoc.isInvalid()) return false; llvm::StringRef Filename = Result.SourceManager->getFilename(ExpansionLoc); @@ -910,7 +910,7 @@ void ChangeNamespaceTool::fixUsingShadowDecl( const ast_matchers::MatchFinder::MatchResult &Result, const UsingDecl *UsingDeclaration) { - SourceLocation Start = UsingDeclaration->getLocStart(); + SourceLocation Start = UsingDeclaration->getBeginLoc(); SourceLocation End = UsingDeclaration->getLocEnd(); if (Start.isInvalid() || End.isInvalid()) return; Index: clang-tools-extra/trunk/clang-doc/Mapper.cpp =================================================================== --- clang-tools-extra/trunk/clang-doc/Mapper.cpp +++ clang-tools-extra/trunk/clang-doc/Mapper.cpp @@ -78,13 +78,13 @@ int MapASTVisitor::getLine(const NamedDecl *D, const ASTContext &Context) const { - return Context.getSourceManager().getPresumedLoc(D->getLocStart()).getLine(); + return Context.getSourceManager().getPresumedLoc(D->getBeginLoc()).getLine(); } llvm::StringRef MapASTVisitor::getFile(const NamedDecl *D, const ASTContext &Context) const { return Context.getSourceManager() - .getPresumedLoc(D->getLocStart()) + .getPresumedLoc(D->getBeginLoc()) .getFilename(); } Index: clang-tools-extra/trunk/clang-move/ClangMove.cpp =================================================================== --- clang-tools-extra/trunk/clang-move/ClangMove.cpp +++ clang-tools-extra/trunk/clang-move/ClangMove.cpp @@ -117,7 +117,7 @@ AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), std::string, AbsoluteFilePath) { auto &SourceManager = Finder->getASTContext().getSourceManager(); - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); + auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc()); if (ExpansionLoc.isInvalid()) return false; auto FileEntry = @@ -323,7 +323,7 @@ getFullRange(const clang::Decl *D, const clang::LangOptions &options = clang::LangOptions()) { const auto &SM = D->getASTContext().getSourceManager(); - clang::SourceRange Full(SM.getExpansionLoc(D->getLocStart()), + clang::SourceRange Full(SM.getExpansionLoc(D->getBeginLoc()), getLocForEndOfDecl(D)); // Expand to comments that are associated with the Decl. if (const auto *Comment = D->getASTContext().getRawCommentForDeclNoCache(D)) { @@ -331,8 +331,8 @@ Full.setEnd(Comment->getLocEnd()); // FIXME: Don't delete a preceding comment, if there are no other entities // it could refer to. - if (SM.isBeforeInTranslationUnit(Comment->getLocStart(), Full.getBegin())) - Full.setBegin(Comment->getLocStart()); + if (SM.isBeforeInTranslationUnit(Comment->getBeginLoc(), Full.getBegin())) + Full.setBegin(Comment->getBeginLoc()); } return clang::CharSourceRange::getCharRange(Full); @@ -351,7 +351,7 @@ const auto &SM = D->getASTContext().getSourceManager(); if (OldHeader.empty()) return false; - auto ExpansionLoc = SM.getExpansionLoc(D->getLocStart()); + auto ExpansionLoc = SM.getExpansionLoc(D->getBeginLoc()); if (ExpansionLoc.isInvalid()) return false; Index: clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/abseil/StringFindStartswithCheck.cpp @@ -71,7 +71,7 @@ ->getImplicitObjectArgument(); assert(Haystack != nullptr); - if (ComparisonExpr->getLocStart().isMacroID()) + if (ComparisonExpr->getBeginLoc().isMacroID()) return; // Get the source code blocks (as characters) for both the string object @@ -94,7 +94,7 @@ // Create the warning message and a FixIt hint replacing the original expr. auto Diagnostic = - diag(ComparisonExpr->getLocStart(), + diag(ComparisonExpr->getBeginLoc(), (StringRef("use ") + StartswithStr + " instead of find() " + ComparisonExpr->getOpcodeStr() + " 0") .str()); @@ -107,7 +107,7 @@ // Create a preprocessor #include FixIt hint (CreateIncludeInsertion checks // whether this already exists). auto IncludeHint = IncludeInserter->CreateIncludeInsertion( - Source.getFileID(ComparisonExpr->getLocStart()), AbseilStringsMatchHeader, + Source.getFileID(ComparisonExpr->getBeginLoc()), AbseilStringsMatchHeader, false); if (IncludeHint) { Diagnostic << *IncludeHint; Index: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp @@ -25,7 +25,7 @@ // end of the string. Else, add . std::string buildFixMsgForStringFlag(const Expr *Arg, const SourceManager &SM, const LangOptions &LangOpts, char Mode) { - if (Arg->getLocStart().isMacroID()) + if (Arg->getBeginLoc().isMacroID()) return (Lexer::getSourceText( CharSourceRange::getTokenRange(Arg->getSourceRange()), SM, LangOpts) + @@ -75,7 +75,7 @@ void CloexecCheck::replaceFunc(const MatchFinder::MatchResult &Result, StringRef WarningMsg, StringRef FixMsg) { const auto *MatchedCall = Result.Nodes.getNodeAs(FuncBindingStr); - diag(MatchedCall->getLocStart(), WarningMsg) + diag(MatchedCall->getBeginLoc(), WarningMsg) << FixItHint::CreateReplacement(MatchedCall->getSourceRange(), FixMsg); } @@ -94,7 +94,7 @@ const std::string &ReplacementText = buildFixMsgForStringFlag( ModeArg, *Result.SourceManager, Result.Context->getLangOpts(), Mode); - diag(ModeArg->getLocStart(), "use %0 mode '%1' to set O_CLOEXEC") + diag(ModeArg->getBeginLoc(), "use %0 mode '%1' to set O_CLOEXEC") << FD << std::string(1, Mode) << FixItHint::CreateReplacement(ModeArg->getSourceRange(), ReplacementText); Index: clang-tools-extra/trunk/clang-tidy/android/ComparisonInTempFailureRetryCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/android/ComparisonInTempFailureRetryCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/android/ComparisonInTempFailureRetryCheck.cpp @@ -21,15 +21,15 @@ namespace { AST_MATCHER(BinaryOperator, isRHSATempFailureRetryArg) { - if (!Node.getLocStart().isMacroID()) + if (!Node.getBeginLoc().isMacroID()) return false; const SourceManager &SM = Finder->getASTContext().getSourceManager(); - if (!SM.isMacroArgExpansion(Node.getRHS()->IgnoreParenCasts()->getLocStart())) + if (!SM.isMacroArgExpansion(Node.getRHS()->IgnoreParenCasts()->getBeginLoc())) return false; const LangOptions &Opts = Finder->getASTContext().getLangOpts(); - SourceLocation LocStart = Node.getLocStart(); + SourceLocation LocStart = Node.getBeginLoc(); while (LocStart.isMacroID()) { SourceLocation Invocation = SM.getImmediateMacroCallerLoc(LocStart); Token Tok; Index: clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/boost/UseToStringCheck.cpp @@ -56,7 +56,7 @@ else return; - auto Loc = Call->getLocStart(); + auto Loc = Call->getBeginLoc(); auto Diag = diag(Loc, "use std::to_%0 instead of boost::lexical_cast") << StringType; @@ -65,8 +65,8 @@ return; Diag << FixItHint::CreateReplacement( - CharSourceRange::getCharRange(Call->getLocStart(), - Call->getArg(0)->getLocStart()), + CharSourceRange::getCharRange(Call->getBeginLoc(), + Call->getArg(0)->getBeginLoc()), (llvm::Twine("std::to_") + StringType + "(").str()); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/ArgumentCommentCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/ArgumentCommentCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/ArgumentCommentCheck.cpp @@ -242,7 +242,7 @@ } CharSourceRange BeforeArgument = - makeFileCharRange(ArgBeginLoc, Args[I]->getLocStart()); + makeFileCharRange(ArgBeginLoc, Args[I]->getBeginLoc()); ArgBeginLoc = Args[I]->getLocEnd(); std::vector> Comments; @@ -251,7 +251,7 @@ } else { // Fall back to parsing back from the start of the argument. CharSourceRange ArgsRange = makeFileCharRange( - Args[I]->getLocStart(), Args[NumArgs - 1]->getLocEnd()); + Args[I]->getBeginLoc(), Args[NumArgs - 1]->getLocEnd()); Comments = getCommentsBeforeLoc(Ctx, ArgsRange.getBegin()); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp @@ -102,7 +102,7 @@ void AssertSideEffectCheck::check(const MatchFinder::MatchResult &Result) { const SourceManager &SM = *Result.SourceManager; const LangOptions LangOpts = getLangOpts(); - SourceLocation Loc = Result.Nodes.getNodeAs("condStmt")->getLocStart(); + SourceLocation Loc = Result.Nodes.getNodeAs("condStmt")->getBeginLoc(); StringRef AssertMacroName; while (Loc.isValid() && Loc.isMacroID()) { Index: clang-tools-extra/trunk/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp @@ -36,7 +36,7 @@ auto *Var = Result.Nodes.getNodeAs("expr"); // Ignore macros. - if (Var->getLocStart().isMacroID()) + if (Var->getBeginLoc().isMacroID()) return; // Only allow variable accesses for now, no function calls or member exprs. @@ -63,9 +63,9 @@ .empty()) return; - diag(Var->getLocStart(), "dubious check of 'bool *' against 'nullptr', did " + diag(Var->getBeginLoc(), "dubious check of 'bool *' against 'nullptr', did " "you mean to dereference it?") - << FixItHint::CreateInsertion(Var->getLocStart(), "*"); + << FixItHint::CreateInsertion(Var->getBeginLoc(), "*"); } } // namespace bugprone Index: clang-tools-extra/trunk/clang-tidy/bugprone/CopyConstructorInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/CopyConstructorInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/CopyConstructorInitCheck.cpp @@ -104,7 +104,7 @@ SourceLocation FixItLoc; // There is no initialization list in this constructor. if (!HasWrittenInitializer) { - FixItLoc = Ctor->getBody()->getLocStart(); + FixItLoc = Ctor->getBody()->getBeginLoc(); FixItMsg = " : " + FixItMsg; } else { // We apply the missing ctors at the beginning of the initialization list. Index: clang-tools-extra/trunk/clang-tidy/bugprone/DanglingHandleCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/DanglingHandleCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/DanglingHandleCheck.cpp @@ -178,7 +178,7 @@ void DanglingHandleCheck::check(const MatchFinder::MatchResult &Result) { auto *Handle = Result.Nodes.getNodeAs("handle"); - diag(Result.Nodes.getNodeAs("bad_stmt")->getLocStart(), + diag(Result.Nodes.getNodeAs("bad_stmt")->getBeginLoc(), "%0 outlives its value") << Handle->getQualifiedNameAsString(); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/InaccurateEraseCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/InaccurateEraseCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/InaccurateEraseCheck.cpp @@ -57,7 +57,7 @@ Result.Nodes.getNodeAs("erase"); const auto *EndExpr = Result.Nodes.getNodeAs("end"); - const SourceLocation Loc = MemberCall->getLocStart(); + const SourceLocation Loc = MemberCall->getBeginLoc(); FixItHint Hint; Index: clang-tools-extra/trunk/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp @@ -61,7 +61,7 @@ void IncorrectRoundingsCheck::check(const MatchFinder::MatchResult &Result) { const auto *CastExpr = Result.Nodes.getNodeAs("CastExpr"); - diag(CastExpr->getLocStart(), + diag(CastExpr->getBeginLoc(), "casting (double + 0.5) to integer leads to incorrect rounding; " "consider using lround (#include ) instead"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/IntegerDivisionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/IntegerDivisionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/IntegerDivisionCheck.cpp @@ -48,7 +48,7 @@ void IntegerDivisionCheck::check(const MatchFinder::MatchResult &Result) { const auto *IntDiv = Result.Nodes.getNodeAs("IntDiv"); - diag(IntDiv->getLocStart(), "result of integer division used in a floating " + diag(IntDiv->getBeginLoc(), "result of integer division used in a floating " "point context; possible loss of precision"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp @@ -102,9 +102,10 @@ StrLen->getSourceRange(), (StrLenBegin + LHSText + StrLenEnd + " + " + RHSText).str()); - diag(Alloc->getLocStart(), + diag(Alloc->getBeginLoc(), "addition operator is applied to the argument of %0 instead of its " - "result") << StrLen->getDirectCallee()->getName() << Hint; + "result") + << StrLen->getDirectCallee()->getName() << Hint; } } // namespace bugprone Index: clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp @@ -185,11 +185,11 @@ const auto *Cast = Result.Nodes.getNodeAs("Cast"); if (!CheckImplicitCasts && isa(Cast)) return; - if (Cast->getLocStart().isMacroID()) + if (Cast->getBeginLoc().isMacroID()) return; const auto *Calc = Result.Nodes.getNodeAs("Calc"); - if (Calc->getLocStart().isMacroID()) + if (Calc->getBeginLoc().isMacroID()) return; if (Cast->isTypeDependent() || Cast->isValueDependent() || @@ -223,7 +223,7 @@ if (Context.getIntWidth(CalcType) >= getMaxCalculationWidth(Context, Calc)) return; - diag(Cast->getLocStart(), "either cast from %0 to %1 is ineffective, or " + diag(Cast->getBeginLoc(), "either cast from %0 to %1 is ineffective, or " "there is loss of precision before the conversion") << CalcType << CastType; } Index: clang-tools-extra/trunk/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp @@ -29,7 +29,7 @@ CharSourceRange CallRange = Lexer::makeFileCharRange(CharSourceRange::getTokenRange( - Callee->getLocStart(), Callee->getLocEnd()), + Callee->getBeginLoc(), Callee->getLocEnd()), SM, LangOpts); if (CallRange.isValid()) { Index: clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp @@ -19,7 +19,7 @@ namespace { -AST_MATCHER(Expr, isInMacro) { return Node.getLocStart().isMacroID(); } +AST_MATCHER(Expr, isInMacro) { return Node.getBeginLoc().isMacroID(); } /// \brief Find the next statement after `S`. const Stmt *nextStmt(const MatchFinder::MatchResult &Result, const Stmt *S) { @@ -73,13 +73,13 @@ if (!Next) return; - SourceLocation OuterLoc = Outer->getLocStart(); + SourceLocation OuterLoc = Outer->getBeginLoc(); if (Result.Nodes.getNodeAs("else")) OuterLoc = cast(Outer)->getElseLoc(); - auto InnerRanges = getExpansionRanges(Inner->getLocStart(), Result); + auto InnerRanges = getExpansionRanges(Inner->getBeginLoc(), Result); auto OuterRanges = getExpansionRanges(OuterLoc, Result); - auto NextRanges = getExpansionRanges(Next->getLocStart(), Result); + auto NextRanges = getExpansionRanges(Next->getBeginLoc(), Result); // Remove all the common ranges, starting from the top (the last ones in the // list). Index: clang-tools-extra/trunk/clang-tidy/bugprone/SizeofContainerCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SizeofContainerCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SizeofContainerCheck.cpp @@ -40,7 +40,7 @@ Result.Nodes.getNodeAs("sizeof"); auto Diag = - diag(SizeOf->getLocStart(), "sizeof() doesn't return the size of the " + diag(SizeOf->getBeginLoc(), "sizeof() doesn't return the size of the " "container; did you mean .size()?"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/SizeofExpressionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SizeofExpressionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SizeofExpressionCheck.cpp @@ -216,29 +216,29 @@ const ASTContext &Ctx = *Result.Context; if (const auto *E = Result.Nodes.getNodeAs("sizeof-constant")) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(K)'; did you mean 'K'?"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-integer-call")) { - diag(E->getLocStart(), "suspicious usage of 'sizeof()' on an expression " + diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression " "that results in an integer"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-this")) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(this)'; did you mean 'sizeof(*this)'"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-charp")) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-pointer-to-aggregate")) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(A*)'; pointer to aggregate"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-compare-constant")) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious comparison of 'sizeof(expr)' to a constant"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-comma-expr")) { - diag(E->getLocStart(), "suspicious usage of 'sizeof(..., ...)'"); + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(..., ...)'"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-divide-expr")) { const auto *NumTy = Result.Nodes.getNodeAs("num-type"); @@ -252,30 +252,30 @@ if (DenominatorSize > CharUnits::Zero() && !NumeratorSize.isMultipleOf(DenominatorSize)) { - diag(E->getLocStart(), "suspicious usage of 'sizeof(...)/sizeof(...)';" + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(...)/sizeof(...)';" " numerator is not a multiple of denominator"); } else if (ElementSize > CharUnits::Zero() && DenominatorSize > CharUnits::Zero() && ElementSize != DenominatorSize) { - diag(E->getLocStart(), "suspicious usage of 'sizeof(...)/sizeof(...)';" + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(...)/sizeof(...)';" " numerator is not a multiple of denominator"); } else if (NumTy && DenomTy && NumTy == DenomTy) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'"); } else if (PointedTy && DenomTy && PointedTy == DenomTy) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'"); } else if (NumTy && DenomTy && NumTy->isPointerType() && DenomTy->isPointerType()) { - diag(E->getLocStart(), + diag(E->getBeginLoc(), "suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'"); } } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-sizeof-expr")) { - diag(E->getLocStart(), "suspicious usage of 'sizeof(sizeof(...))'"); + diag(E->getBeginLoc(), "suspicious usage of 'sizeof(sizeof(...))'"); } else if (const auto *E = Result.Nodes.getNodeAs("sizeof-multiply-sizeof")) { - diag(E->getLocStart(), "suspicious 'sizeof' by 'sizeof' multiplication"); + diag(E->getBeginLoc(), "suspicious 'sizeof' by 'sizeof' multiplication"); } } Index: clang-tools-extra/trunk/clang-tidy/bugprone/StringConstructorCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/StringConstructorCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/StringConstructorCheck.cpp @@ -106,7 +106,7 @@ const ASTContext &Ctx = *Result.Context; const auto *E = Result.Nodes.getNodeAs("constructor"); assert(E && "missing constructor expression"); - SourceLocation Loc = E->getLocStart(); + SourceLocation Loc = E->getBeginLoc(); if (Result.Nodes.getNodeAs("swapped-parameter")) { const Expr *P0 = E->getArg(0); Index: clang-tools-extra/trunk/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp @@ -39,7 +39,7 @@ void StringIntegerAssignmentCheck::check( const MatchFinder::MatchResult &Result) { const auto *Argument = Result.Nodes.getNodeAs("expr"); - SourceLocation Loc = Argument->getLocStart(); + SourceLocation Loc = Argument->getBeginLoc(); auto Diag = diag(Loc, "an integer is interpreted as a character code when assigning " Index: clang-tools-extra/trunk/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp @@ -68,14 +68,14 @@ SL->getCodeUnit(Offset + 1) == 'x' && isDigit(SL->getCodeUnit(Offset + 2)) && isDigit(SL->getCodeUnit(Offset + 3))) { - diag(SL->getLocStart(), "suspicious embedded NUL character"); + diag(SL->getBeginLoc(), "suspicious embedded NUL character"); return; } } } if (const auto *SL = Result.Nodes.getNodeAs("truncated")) { - diag(SL->getLocStart(), + diag(SL->getBeginLoc(), "truncated string literal with embedded NUL character"); } } Index: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp @@ -61,7 +61,7 @@ SourceRange CharRange = CharZeroFill->getSourceRange(); auto Diag = - diag(CharZeroFill->getLocStart(), "memset fill value is char '0', " + diag(CharZeroFill->getBeginLoc(), "memset fill value is char '0', " "potentially mistaken for int 0"); // Only suggest a fix if no macros are involved. @@ -82,7 +82,7 @@ (NumValue >= 0 && NumValue <= UCharMax)) return; - diag(NumFill->getLocStart(), "memset fill value is out of unsigned " + diag(NumFill->getBeginLoc(), "memset fill value is out of unsigned " "character range, gets truncated"); } @@ -110,7 +110,7 @@ // `byte_count` is known to be zero at compile time, and `fill_char` is // either not known or known to be a positive integer. Emit a warning // and fix-its to swap the arguments. - auto D = diag(Call->getLocStart(), + auto D = diag(Call->getBeginLoc(), "memset of size zero, potentially swapped arguments"); StringRef RHSString = tooling::fixit::getText(*ByteCount, *Result.Context); StringRef LHSString = tooling::fixit::getText(*FillChar, *Result.Context); Index: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp @@ -120,7 +120,7 @@ if (double(Count) / Size > RatioThreshold) return; - diag(ConcatenatedLiteral->getLocStart(), + diag(ConcatenatedLiteral->getBeginLoc(), "suspicious string literal, probably missing a comma"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp @@ -34,7 +34,7 @@ return; const auto *Semicolon = Result.Nodes.getNodeAs("semi"); - SourceLocation LocStart = Semicolon->getLocStart(); + SourceLocation LocStart = Semicolon->getBeginLoc(); if (LocStart.isMacroID()) return; @@ -60,7 +60,7 @@ if (Lexer.LexFromRawLexer(Token)) return; - unsigned BaseIndent = SM.getSpellingColumnNumber(Statement->getLocStart()); + unsigned BaseIndent = SM.getSpellingColumnNumber(Statement->getBeginLoc()); unsigned NewTokenIndent = SM.getSpellingColumnNumber(Token.getLocation()); unsigned NewTokenLine = SM.getSpellingLineNumber(Token.getLocation()); Index: clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp @@ -177,7 +177,7 @@ Call->getRParenLoc(), 0, Result.Context->getSourceManager(), getLangOpts()); - diag(Call->getLocStart(), + diag(Call->getBeginLoc(), "function %0 is called without explicitly comparing result") << Decl << FixItHint::CreateInsertion(EndLoc, " != 0"); } @@ -186,29 +186,30 @@ SourceLocation EndLoc = Lexer::getLocForEndOfToken( Call->getRParenLoc(), 0, Result.Context->getSourceManager(), getLangOpts()); - SourceLocation NotLoc = E->getLocStart(); + SourceLocation NotLoc = E->getBeginLoc(); - diag(Call->getLocStart(), + diag(Call->getBeginLoc(), "function %0 is compared using logical not operator") - << Decl << FixItHint::CreateRemoval( - CharSourceRange::getTokenRange(NotLoc, NotLoc)) + << Decl + << FixItHint::CreateRemoval( + CharSourceRange::getTokenRange(NotLoc, NotLoc)) << FixItHint::CreateInsertion(EndLoc, " == 0"); } if (Result.Nodes.getNodeAs("invalid-comparison")) { - diag(Call->getLocStart(), + diag(Call->getBeginLoc(), "function %0 is compared to a suspicious constant") << Decl; } if (const auto *BinOp = Result.Nodes.getNodeAs("suspicious-operator")) { - diag(Call->getLocStart(), "results of function %0 used by operator '%1'") + diag(Call->getBeginLoc(), "results of function %0 used by operator '%1'") << Decl << BinOp->getOpcodeStr(); } if (Result.Nodes.getNodeAs("invalid-conversion")) { - diag(Call->getLocStart(), "function %0 has suspicious implicit cast") + diag(Call->getBeginLoc(), "function %0 has suspicious implicit cast") << Decl; } } Index: clang-tools-extra/trunk/clang-tidy/bugprone/SwappedArgumentsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/SwappedArgumentsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/SwappedArgumentsCheck.cpp @@ -84,7 +84,7 @@ continue; // Emit a warning and fix-its that swap the arguments. - diag(Call->getLocStart(), "argument with implicit conversion from %0 " + diag(Call->getBeginLoc(), "argument with implicit conversion from %0 " "to %1 followed by argument converted from " "%2 to %3, potentially swapped arguments.") << LHS->getType() << LHSFrom->getType() << RHS->getType() Index: clang-tools-extra/trunk/clang-tidy/bugprone/TerminatingContinueCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/TerminatingContinueCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/TerminatingContinueCheck.cpp @@ -39,7 +39,7 @@ const auto *ContStmt = Result.Nodes.getNodeAs("continue"); auto Diag = - diag(ContStmt->getLocStart(), + diag(ContStmt->getBeginLoc(), "'continue' in loop with false condition is equivalent to 'break'") << tooling::fixit::createReplacement(*ContStmt, "break"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp @@ -42,7 +42,7 @@ const auto *TemporaryExpr = Result.Nodes.getNodeAs("temporary-exception-not-thrown"); - diag(TemporaryExpr->getLocStart(), "suspicious exception object created but " + diag(TemporaryExpr->getBeginLoc(), "suspicious exception object created but " "not thrown; did you mean 'throw %0'?") << TemporaryExpr->getType().getBaseTypeIdentifier()->getName(); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp @@ -52,7 +52,7 @@ QualType DestType = Call->getArg(0)->IgnoreImplicit()->getType(); if (!DestType->getPointeeType().isNull()) DestType = DestType->getPointeeType(); - diag(Call->getLocStart(), "undefined behavior, destination object type %0 " + diag(Call->getBeginLoc(), "undefined behavior, destination object type %0 " "is not TriviallyCopyable") << DestType; } @@ -60,7 +60,7 @@ QualType SourceType = Call->getArg(1)->IgnoreImplicit()->getType(); if (!SourceType->getPointeeType().isNull()) SourceType = SourceType->getPointeeType(); - diag(Call->getLocStart(), + diag(Call->getBeginLoc(), "undefined behavior, source object type %0 is not TriviallyCopyable") << SourceType; } Index: clang-tools-extra/trunk/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp @@ -75,7 +75,7 @@ void UndelegatedConstructorCheck::check( const MatchFinder::MatchResult &Result) { const auto *E = Result.Nodes.getNodeAs("construct"); - diag(E->getLocStart(), "did you intend to call a delegated constructor? " + diag(E->getBeginLoc(), "did you intend to call a delegated constructor? " "A temporary object is created here instead"); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp @@ -52,7 +52,7 @@ // We ignore code expanded from macros to reduce the number of false // positives. - if (E->getLocStart().isMacroID()) + if (E->getBeginLoc().isMacroID()) return; // Don't emit a warning for the last statement in the surrounding compund @@ -62,7 +62,7 @@ return; // Emit a warning. - auto D = diag(E->getLocStart(), "object destroyed immediately after " + auto D = diag(E->getBeginLoc(), "object destroyed immediately after " "creation; did you mean to name the object?"); const char *Replacement = " give_me_a_name"; Index: clang-tools-extra/trunk/clang-tidy/bugprone/UnusedReturnValueCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/UnusedReturnValueCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/UnusedReturnValueCheck.cpp @@ -86,10 +86,10 @@ void UnusedReturnValueCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *Matched = Result.Nodes.getNodeAs("match")) { - diag(Matched->getLocStart(), + diag(Matched->getBeginLoc(), "the value returned by this function should be used") << Matched->getSourceRange(); - diag(Matched->getLocStart(), + diag(Matched->getBeginLoc(), "cast the expression to void to silence this warning", DiagnosticIDs::Note); } Index: clang-tools-extra/trunk/clang-tidy/bugprone/VirtualNearMissCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/VirtualNearMissCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/bugprone/VirtualNearMissCheck.cpp @@ -257,7 +257,7 @@ bool ApplyFix = !BaseMD->isTemplateInstantiation() && !DerivedMD->isTemplateInstantiation(); auto Diag = - diag(DerivedMD->getLocStart(), + diag(DerivedMD->getBeginLoc(), "method '%0' has a similar name and the same signature as " "virtual method '%1'; did you mean to override it?") << DerivedMD->getQualifiedNameAsString() Index: clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cert/LimitedRandomnessCheck.cpp @@ -30,7 +30,7 @@ msg = "; use C++11 random library instead"; const auto *MatchedDecl = Result.Nodes.getNodeAs("randomGenerator"); - diag(MatchedDecl->getLocStart(), "rand() has limited randomness" + msg); + diag(MatchedDecl->getBeginLoc(), "rand() has limited randomness" + msg); } } // namespace cert Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp @@ -19,7 +19,7 @@ namespace { AST_MATCHER(GotoStmt, isForwardJumping) { - return Node.getLocStart() < Node.getLabel()->getLocStart(); + return Node.getBeginLoc() < Node.getLabel()->getBeginLoc(); } } // namespace @@ -49,7 +49,7 @@ diag(Goto->getGotoLoc(), "avoid using 'goto' for flow control") << Goto->getSourceRange(); - diag(Goto->getLabel()->getLocStart(), "label defined here", + diag(Goto->getLabel()->getBeginLoc(), "label defined here", DiagnosticIDs::Note); } } // namespace cppcoreguidelines Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp @@ -52,14 +52,14 @@ void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *Op = Result.Nodes.getNodeAs("op")) { - if (Op->getLocStart().isMacroID()) + if (Op->getBeginLoc().isMacroID()) return; diag(Op->getOperatorLoc(), "narrowing conversion from %0 to %1") << Op->getRHS()->getType() << Op->getLHS()->getType(); return; } const auto *Cast = Result.Nodes.getNodeAs("cast"); - if (Cast->getLocStart().isMacroID()) + if (Cast->getBeginLoc().isMacroID()) return; diag(Cast->getExprLoc(), "narrowing conversion from %0 to %1") << Cast->getSubExpr()->getType() << Cast->getType(); Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp @@ -73,8 +73,8 @@ assert(Call && "Unhandled binding in the Matcher"); - diag(Call->getLocStart(), "do not manage memory manually; %0") - << Recommendation << SourceRange(Call->getLocStart(), Call->getLocEnd()); + diag(Call->getBeginLoc(), "do not manage memory manually; %0") + << Recommendation << SourceRange(Call->getBeginLoc(), Call->getLocEnd()); } } // namespace cppcoreguidelines Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp @@ -203,7 +203,7 @@ // Deletion of non-owners, with `delete variable;` if (DeleteStmt) { - diag(DeleteStmt->getLocStart(), + diag(DeleteStmt->getBeginLoc(), "deleting a pointer through a type that is " "not marked 'gsl::owner<>'; consider using a " "smart pointer instead") @@ -212,7 +212,7 @@ // FIXME: The declaration of the variable that was deleted can be // rewritten. const ValueDecl *Decl = DeletedVariable->getDecl(); - diag(Decl->getLocStart(), "variable declared here", DiagnosticIDs::Note) + diag(Decl->getBeginLoc(), "variable declared here", DiagnosticIDs::Note) << Decl->getSourceRange(); return true; @@ -228,7 +228,7 @@ // as a pointer, which should not be an owner. The argument that is an owner // is known and the false positive coming from the filename can be avoided. if (LegacyConsumer) { - diag(LegacyConsumer->getLocStart(), + diag(LegacyConsumer->getBeginLoc(), "calling legacy resource function without passing a 'gsl::owner<>'") << LegacyConsumer->getSourceRange(); return true; @@ -242,7 +242,7 @@ // Expected function argument to be owner. if (ExpectedOwner) { - diag(ExpectedOwner->getLocStart(), + diag(ExpectedOwner->getBeginLoc(), "expected argument of type 'gsl::owner<>'; got %0") << ExpectedOwner->getType() << ExpectedOwner->getSourceRange(); return true; @@ -261,7 +261,7 @@ // Assignments to owners. if (OwnerAssignment) { - diag(OwnerAssignment->getLocStart(), + diag(OwnerAssignment->getBeginLoc(), "expected assignment source to be of type 'gsl::owner<>'; got %0") << OwnerAssignment->getRHS()->getType() << OwnerAssignment->getSourceRange(); @@ -270,7 +270,7 @@ // Initialization of owners. if (OwnerInitialization) { - diag(OwnerInitialization->getLocStart(), + diag(OwnerInitialization->getBeginLoc(), "expected initialization with value of type 'gsl::owner<>'; got %0") << OwnerInitialization->getAnyInitializer()->getType() << OwnerInitialization->getSourceRange(); @@ -306,7 +306,7 @@ // Bad assignments to non-owners, where the RHS is a newly created owner. if (BadOwnerAssignment) { - diag(BadOwnerAssignment->getLocStart(), + diag(BadOwnerAssignment->getBeginLoc(), "assigning newly created 'gsl::owner<>' to non-owner %0") << BadOwnerAssignment->getLHS()->getType() << BadOwnerAssignment->getSourceRange(); @@ -315,7 +315,7 @@ // Bad initialization of non-owners, where the RHS is a newly created owner. if (BadOwnerInitialization) { - diag(BadOwnerInitialization->getLocStart(), + diag(BadOwnerInitialization->getBeginLoc(), "initializing non-owner %0 with a newly created 'gsl::owner<>'") << BadOwnerInitialization->getType() << BadOwnerInitialization->getSourceRange(); @@ -326,7 +326,7 @@ // If the type of the variable was deduced, the wrapping owner typedef is // eliminated, therefore the check emits a special note for that case. if (Nodes.getNodeAs("deduced_type")) { - diag(BadOwnerInitialization->getLocStart(), + diag(BadOwnerInitialization->getBeginLoc(), "type deduction did not result in an owner", DiagnosticIDs::Note); } return true; @@ -337,7 +337,7 @@ if (BadOwnerArgument) { assert(BadOwnerParameter && "parameter for the problematic argument not found"); - diag(BadOwnerArgument->getLocStart(), "initializing non-owner argument of " + diag(BadOwnerArgument->getBeginLoc(), "initializing non-owner argument of " "type %0 with a newly created " "'gsl::owner<>'") << BadOwnerParameter->getType() << BadOwnerArgument->getSourceRange(); @@ -356,7 +356,7 @@ if (BadReturnType) { // The returned value is a resource or variable that was not annotated with // owner<> and the function return type is not owner<>. - diag(BadReturnType->getLocStart(), + diag(BadReturnType->getBeginLoc(), "returning a newly created resource of " "type %0 or 'gsl::owner<>' from a " "function whose return type is not 'gsl::owner<>'") @@ -380,7 +380,7 @@ assert(DeclaredOwnerMember && "match on class with bad destructor but without a declared owner"); - diag(DeclaredOwnerMember->getLocStart(), + diag(DeclaredOwnerMember->getBeginLoc(), "member variable of type 'gsl::owner<>' requires the class %0 to " "implement a destructor to release the owned resource") << BadClass; Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp @@ -46,7 +46,7 @@ MatchedCast->getCastKind() == CK_IntegralToPointer || MatchedCast->getCastKind() == CK_PointerToIntegral || MatchedCast->getCastKind() == CK_ReinterpretMemberPointer) { - diag(MatchedCast->getLocStart(), + diag(MatchedCast->getBeginLoc(), "do not use C-style cast to convert between unrelated types"); return; } @@ -71,7 +71,7 @@ *Result.SourceManager, getLangOpts()); auto diag_builder = diag( - MatchedCast->getLocStart(), + MatchedCast->getBeginLoc(), "do not use C-style cast to downcast from a base to a derived class; " "use dynamic_cast instead"); @@ -90,7 +90,7 @@ diag_builder << FixItHint::CreateReplacement(ParenRange, CastText); } else { diag( - MatchedCast->getLocStart(), + MatchedCast->getBeginLoc(), "do not use C-style cast to downcast from a base to a derived class"); } return; @@ -98,7 +98,7 @@ if (MatchedCast->getCastKind() == CK_NoOp && needsConstCast(SourceType, MatchedCast->getType())) { - diag(MatchedCast->getLocStart(), + diag(MatchedCast->getBeginLoc(), "do not use C-style cast to cast away constness"); } } Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp @@ -120,7 +120,7 @@ switch (Placement) { case InitializerPlacement::New: Location = utils::lexer::getPreviousToken( - Context, Constructor.getBody()->getLocStart()) + Context, Constructor.getBody()->getBeginLoc()) .getLocation(); break; case InitializerPlacement::Before: @@ -230,7 +230,7 @@ const CXXConstructorDecl *Ctor, const SmallPtrSetImpl &DeclsToInit) { // Do not propose fixes in macros since we cannot place them correctly. - if (Ctor->getLocStart().isMacroID()) + if (Ctor->getBeginLoc().isMacroID()) return; SmallVector OrderedDecls; @@ -384,7 +384,7 @@ return; DiagnosticBuilder Diag = - diag(Ctor ? Ctor->getLocStart() : ClassDecl.getLocation(), + diag(Ctor ? Ctor->getBeginLoc() : ClassDecl.getLocation(), IsUnion ? "union constructor should initialize one of these fields: %0" : "constructor does not initialize these fields: %0") @@ -392,7 +392,7 @@ // Do not propose fixes for constructors in macros since we cannot place them // correctly. - if (Ctor && Ctor->getLocStart().isMacroID()) + if (Ctor && Ctor->getBeginLoc().isMacroID()) return; // Collect all fields but only suggest a fix for the first member of unions, @@ -462,7 +462,7 @@ return; DiagnosticBuilder Diag = - diag(Ctor ? Ctor->getLocStart() : ClassDecl.getLocation(), + diag(Ctor ? Ctor->getBeginLoc() : ClassDecl.getLocation(), "constructor does not initialize these bases: %0") << toCommaSeparatedString(AllBases, BasesToInit); @@ -473,7 +473,7 @@ void ProTypeMemberInitCheck::checkUninitializedTrivialType( const ASTContext &Context, const VarDecl *Var) { DiagnosticBuilder Diag = - diag(Var->getLocStart(), "uninitialized record type: %0") << Var; + diag(Var->getBeginLoc(), "uninitialized record type: %0") << Var; Diag << FixItHint::CreateInsertion( getLocationForEndOfToken(Context, Var->getSourceRange().getEnd()), Index: clang-tools-extra/trunk/clang-tidy/fuchsia/DefaultArgumentsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/DefaultArgumentsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/DefaultArgumentsCheck.cpp @@ -27,8 +27,7 @@ Result.Nodes.getNodeAs("stmt")) { diag(S->getUsedLocation(), "calling a function that uses a default argument is disallowed"); - diag(S->getParam()->getLocStart(), - "default parameter was declared here", + diag(S->getParam()->getBeginLoc(), "default parameter was declared here", DiagnosticIDs::Note); } else if (const ParmVarDecl *D = Result.Nodes.getNodeAs("decl")) { @@ -37,11 +36,11 @@ if (DefaultArgRange.getEnd() != D->getLocEnd()) { return; } else if (DefaultArgRange.getBegin().isMacroID()) { - diag(D->getLocStart(), + diag(D->getBeginLoc(), "declaring a parameter with a default argument is disallowed"); } else { - SourceLocation StartLocation = D->getName().empty() ? - D->getLocStart() : D->getLocation(); + SourceLocation StartLocation = + D->getName().empty() ? D->getBeginLoc() : D->getLocation(); SourceRange RemovalRange(Lexer::getLocForEndOfToken( StartLocation, 0, @@ -51,10 +50,9 @@ DefaultArgRange.getEnd() ); - diag(D->getLocStart(), - "declaring a parameter with a default argument is disallowed") - << D - << FixItHint::CreateRemoval(RemovalRange); + diag(D->getBeginLoc(), + "declaring a parameter with a default argument is disallowed") + << D << FixItHint::CreateRemoval(RemovalRange); } } } Index: clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp @@ -120,9 +120,8 @@ } if (NumConcrete > 1) { - diag(D->getLocStart(), - "inheriting mulitple classes that aren't " - "pure virtual is discouraged"); + diag(D->getBeginLoc(), "inheriting mulitple classes that aren't " + "pure virtual is discouraged"); } } } Index: clang-tools-extra/trunk/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp @@ -34,8 +34,8 @@ void OverloadedOperatorCheck::check(const MatchFinder::MatchResult &Result) { const auto *D = Result.Nodes.getNodeAs("decl"); assert(D && "No FunctionDecl captured!"); - - SourceLocation Loc = D->getLocStart(); + + SourceLocation Loc = D->getBeginLoc(); if (Loc.isValid()) diag(Loc, "overloading %0 is disallowed") << D; } Index: clang-tools-extra/trunk/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp @@ -51,7 +51,7 @@ void StaticallyConstructedObjectsCheck::check( const MatchFinder::MatchResult &Result) { if (const auto *D = Result.Nodes.getNodeAs("decl")) - diag(D->getLocStart(), "static objects are disallowed; if possible, use a " + diag(D->getBeginLoc(), "static objects are disallowed; if possible, use a " "constexpr constructor instead"); } Index: clang-tools-extra/trunk/clang-tidy/fuchsia/TrailingReturnCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/TrailingReturnCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/TrailingReturnCheck.cpp @@ -43,7 +43,7 @@ void TrailingReturnCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *D = Result.Nodes.getNodeAs("decl")) - diag(D->getLocStart(), + diag(D->getBeginLoc(), "a trailing return type is disallowed for this type of declaration"); } Index: clang-tools-extra/trunk/clang-tidy/fuchsia/VirtualInheritanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/fuchsia/VirtualInheritanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/fuchsia/VirtualInheritanceCheck.cpp @@ -35,7 +35,7 @@ void VirtualInheritanceCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *D = Result.Nodes.getNodeAs("decl")) - diag(D->getLocStart(), "direct virtual inheritance is disallowed"); + diag(D->getBeginLoc(), "direct virtual inheritance is disallowed"); } } // namespace fuchsia Index: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.cpp @@ -82,7 +82,7 @@ const QualType DestType = DestTypeAsWritten.getCanonicalType(); auto ReplaceRange = CharSourceRange::getCharRange( - CastExpr->getLParenLoc(), CastExpr->getSubExprAsWritten()->getLocStart()); + CastExpr->getLParenLoc(), CastExpr->getSubExprAsWritten()->getBeginLoc()); bool FnToFnCast = isFunction(SourceTypeAsWritten) && isFunction(DestTypeAsWritten); @@ -93,7 +93,7 @@ // in this case. Don't emit "redundant cast" warnings for function // pointer/reference types. if (SourceTypeAsWritten == DestTypeAsWritten) { - diag(CastExpr->getLocStart(), "redundant cast to the same type") + diag(CastExpr->getBeginLoc(), "redundant cast to the same type") << FixItHint::CreateRemoval(ReplaceRange); return; } @@ -116,7 +116,7 @@ // Ignore code in .c files #included in other files (which shouldn't be done, // but people still do this for test and other purposes). - if (SM.getFilename(SM.getSpellingLoc(CastExpr->getLocStart())).endswith(".c")) + if (SM.getFilename(SM.getSpellingLoc(CastExpr->getBeginLoc())).endswith(".c")) return; // Leave type spelling exactly as it was (unlike @@ -128,7 +128,7 @@ SM, getLangOpts()); auto Diag = - diag(CastExpr->getLocStart(), "C-style casts are discouraged; use %0"); + diag(CastExpr->getBeginLoc(), "C-style casts are discouraged; use %0"); auto ReplaceWithCast = [&](std::string CastText) { const Expr *SubExpr = CastExpr->getSubExprAsWritten()->IgnoreImpCasts(); Index: clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.cpp @@ -60,12 +60,12 @@ // make_pair. if (Arg0->getType() != Call->getArg(0)->getType() || Arg1->getType() != Call->getArg(1)->getType()) { - diag(Call->getLocStart(), "for C++11-compatibility, use pair directly") + diag(Call->getBeginLoc(), "for C++11-compatibility, use pair directly") << FixItHint::CreateReplacement( - SourceRange(DeclRef->getLocStart(), DeclRef->getLAngleLoc()), + SourceRange(DeclRef->getBeginLoc(), DeclRef->getLAngleLoc()), "std::pair<"); } else { - diag(Call->getLocStart(), + diag(Call->getBeginLoc(), "for C++11-compatibility, omit template arguments from make_pair") << FixItHint::CreateRemoval( SourceRange(DeclRef->getLAngleLoc(), DeclRef->getRAngleLoc())); Index: clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/GlobalNamesInHeadersCheck.cpp @@ -48,15 +48,15 @@ void GlobalNamesInHeadersCheck::check(const MatchFinder::MatchResult &Result) { const auto *D = Result.Nodes.getNodeAs("using_decl"); // If it comes from a macro, we'll assume it is fine. - if (D->getLocStart().isMacroID()) + if (D->getBeginLoc().isMacroID()) return; // Ignore if it comes from the "main" file ... if (Result.SourceManager->isInMainFile( - Result.SourceManager->getExpansionLoc(D->getLocStart()))) { + Result.SourceManager->getExpansionLoc(D->getBeginLoc()))) { // unless that file is a header. if (!utils::isSpellingLocInHeaderFile( - D->getLocStart(), *Result.SourceManager, HeaderFileExtensions)) + D->getBeginLoc(), *Result.SourceManager, HeaderFileExtensions)) return; } @@ -70,7 +70,7 @@ } } - diag(D->getLocStart(), + diag(D->getBeginLoc(), "using declarations in the global namespace in headers are prohibited"); } Index: clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp @@ -72,7 +72,7 @@ void IntegerTypesCheck::check(const MatchFinder::MatchResult &Result) { auto TL = *Result.Nodes.getNodeAs("tl"); - SourceLocation Loc = TL.getLocStart(); + SourceLocation Loc = TL.getBeginLoc(); if (Loc.isInvalid() || Loc.isMacroID()) return; Index: clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.cpp @@ -43,7 +43,7 @@ void OverloadedUnaryAndCheck::check(const MatchFinder::MatchResult &Result) { const auto *Decl = Result.Nodes.getNodeAs("overload"); - diag(Decl->getLocStart(), + diag(Decl->getBeginLoc(), "do not overload unary operator&, it is dangerous."); } Index: clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp @@ -48,7 +48,7 @@ void UnnamedNamespaceInHeaderCheck::check( const MatchFinder::MatchResult &Result) { const auto *N = Result.Nodes.getNodeAs("anonymousNamespace"); - SourceLocation Loc = N->getLocStart(); + SourceLocation Loc = N->getBeginLoc(); if (!Loc.isValid()) return; Index: clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp @@ -30,7 +30,7 @@ void UsingNamespaceDirectiveCheck::check( const MatchFinder::MatchResult &Result) { const auto *U = Result.Nodes.getNodeAs("usingNamespace"); - SourceLocation Loc = U->getLocStart(); + SourceLocation Loc = U->getBeginLoc(); if (U->isImplicit() || !Loc.isValid()) return; Index: clang-tools-extra/trunk/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp @@ -35,14 +35,14 @@ void ExceptionBaseclassCheck::check(const MatchFinder::MatchResult &Result) { const auto *BadThrow = Result.Nodes.getNodeAs("bad_throw"); - diag(BadThrow->getSubExpr()->getLocStart(), "throwing an exception whose " + diag(BadThrow->getSubExpr()->getBeginLoc(), "throwing an exception whose " "type %0 is not derived from " "'std::exception'") << BadThrow->getSubExpr()->getType() << BadThrow->getSourceRange(); const auto *TypeDecl = Result.Nodes.getNodeAs("decl"); if (TypeDecl != nullptr) - diag(TypeDecl->getLocStart(), "type defined here", DiagnosticIDs::Note); + diag(TypeDecl->getBeginLoc(), "type defined here", DiagnosticIDs::Note); } } // namespace hicpp Index: clang-tools-extra/trunk/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp @@ -94,7 +94,7 @@ void MultiwayPathsCoveredCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *ElseIfWithoutElse = Result.Nodes.getNodeAs("else-if")) { - diag(ElseIfWithoutElse->getLocStart(), + diag(ElseIfWithoutElse->getBeginLoc(), "potentially uncovered codepath; add an ending else statement"); return; } @@ -120,7 +120,7 @@ // FIXME: Evaluate, if emitting a fix-it to simplify that statement is // reasonable. if (!SwitchHasDefault && SwitchCaseCount == 0) { - diag(Switch->getLocStart(), + diag(Switch->getBeginLoc(), "switch statement without labels has no effect"); return; } @@ -132,7 +132,7 @@ assert(CaseCount > 0 && "Switch statement with supposedly one default " "branch did not contain any case labels"); if (CaseCount == 1 || CaseCount == 2) - diag(Switch->getLocStart(), + diag(Switch->getBeginLoc(), CaseCount == 1 ? "degenerated switch with default label only" : "switch could be better written as an if/else statement"); @@ -172,7 +172,7 @@ // FIXME: Transform the 'switch' into an 'if' for CaseCount == 1. if (CaseCount < MaxPathsPossible) - diag(Switch->getLocStart(), + diag(Switch->getBeginLoc(), CaseCount == 1 ? "switch with only one case; use an if statement" : "potential uncovered code path; add a default label"); } Index: clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp @@ -75,14 +75,14 @@ if (const auto *UnaryOp = N.getNodeAs("unary-signed")) { IsUnary = true; - Location = UnaryOp->getLocStart(); + Location = UnaryOp->getBeginLoc(); } else { if (const auto *BinaryOp = N.getNodeAs("binary-no-sign-interference")) - Location = BinaryOp->getLocStart(); + Location = BinaryOp->getBeginLoc(); else if (const auto *BinaryOp = N.getNodeAs("binary-sign-interference")) - Location = BinaryOp->getLocStart(); + Location = BinaryOp->getBeginLoc(); else llvm_unreachable("unexpected matcher result"); } Index: clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp @@ -50,7 +50,7 @@ SourceLocation EndLoc = Lexer::getLocForEndOfToken( VD->getInit()->getLocEnd(), 0, *Result.SourceManager, getLangOpts()); Diag << FixItHint::CreateReplacement(TypeRange, "std::string") - << FixItHint::CreateInsertion(VD->getInit()->getLocStart(), "(") + << FixItHint::CreateInsertion(VD->getInit()->getBeginLoc(), "(") << FixItHint::CreateInsertion(EndLoc, ").str()"); } else { // Just an implicit conversion. Insert the real type. Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp @@ -22,7 +22,7 @@ AST_MATCHER_P(NamedDecl, usesHeaderFileExtension, utils::HeaderFileExtensionsSet, HeaderFileExtensions) { return utils::isExpansionLocInHeaderFile( - Node.getLocStart(), Finder->getASTContext().getSourceManager(), + Node.getBeginLoc(), Finder->getASTContext().getSourceManager(), HeaderFileExtensions); } Index: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -884,7 +884,7 @@ if (exprEvaluatesToZero(Opcode, Value)) { diag(Loc, "expression always evaluates to 0"); } else if (exprEvaluatesToBitwiseNegatedZero(Opcode, Value)) { - SourceRange ConstExprRange(ConstExpr->getLocStart(), + SourceRange ConstExprRange(ConstExpr->getBeginLoc(), ConstExpr->getLocEnd()); StringRef ConstExprText = Lexer::getSourceText( CharSourceRange::getTokenRange(ConstExprRange), *Result.SourceManager, @@ -893,7 +893,7 @@ diag(Loc, "expression always evaluates to '%0'") << ConstExprText; } else if (exprEvaluatesToSymbolic(Opcode, Value)) { - SourceRange SymExprRange(Sym->getLocStart(), Sym->getLocEnd()); + SourceRange SymExprRange(Sym->getBeginLoc(), Sym->getLocEnd()); StringRef ExprText = Lexer::getSourceText( CharSourceRange::getTokenRange(SymExprRange), *Result.SourceManager, Index: clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.cpp @@ -88,7 +88,7 @@ const auto *AssertExprRoot = Result.Nodes.getNodeAs("assertExprRoot"); const auto *CastExpr = Result.Nodes.getNodeAs("castExpr"); - SourceLocation AssertExpansionLoc = CondStmt->getLocStart(); + SourceLocation AssertExpansionLoc = CondStmt->getBeginLoc(); if (!AssertExpansionLoc.isValid() || !AssertExpansionLoc.isMacroID()) return; @@ -129,7 +129,7 @@ FixItHints.push_back(FixItHint::CreateRemoval( SourceRange(AssertExprRoot->getOperatorLoc()))); FixItHints.push_back(FixItHint::CreateRemoval( - SourceRange(AssertMSG->getLocStart(), AssertMSG->getLocEnd()))); + SourceRange(AssertMSG->getBeginLoc(), AssertMSG->getLocEnd()))); StaticAssertMSG = (Twine(", \"") + AssertMSG->getString() + "\"").str(); } Index: clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp @@ -81,7 +81,7 @@ if (declRef && isCatchVariable(declRef)) { return; } - diag(subExpr->getLocStart(), "throw expression throws a pointer; it should " + diag(subExpr->getBeginLoc(), "throw expression throws a pointer; it should " "throw a non-pointer value instead"); } // If the throw statement does not throw by pointer then it throws by value @@ -124,7 +124,7 @@ } } if (emit) - diag(subExpr->getLocStart(), + diag(subExpr->getBeginLoc(), "throw expression should throw anonymous temporary values instead"); } } @@ -144,7 +144,7 @@ // We do not diagnose when catching pointer to strings since we also allow // throwing string literals. if (!PT->getPointeeType()->isAnyCharacterType()) - diag(varDecl->getLocStart(), diagMsgCatchReference); + diag(varDecl->getBeginLoc(), diagMsgCatchReference); } else if (!caughtType->isReferenceType()) { const char *diagMsgCatchReference = "catch handler catches by value; " "should catch by reference instead"; @@ -152,7 +152,7 @@ // value". In this case we should emit a diagnosis message unless the type // is trivial. if (!caughtType.isTrivialType(context)) - diag(varDecl->getLocStart(), diagMsgCatchReference); + diag(varDecl->getBeginLoc(), diagMsgCatchReference); } } Index: clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp @@ -72,7 +72,7 @@ void UnconventionalAssignOperatorCheck::check( const MatchFinder::MatchResult &Result) { if (const auto *RetStmt = Result.Nodes.getNodeAs("returnStmt")) { - diag(RetStmt->getLocStart(), "operator=() should always return '*this'"); + diag(RetStmt->getBeginLoc(), "operator=() should always return '*this'"); } else { static const char *const Messages[][2] = { {"ReturnType", "operator=() should return '%0&'"}, @@ -82,7 +82,7 @@ const auto *Method = Result.Nodes.getNodeAs("method"); for (const auto &Message : Messages) { if (Result.Nodes.getNodeAs(Message[0])) - diag(Method->getLocStart(), Message[1]) + diag(Method->getBeginLoc(), Message[1]) << Method->getParent()->getName() << (Method->isConst() ? "const" : "virtual"); } Index: clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.cpp @@ -34,7 +34,7 @@ void UnusedAliasDeclsCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *AliasDecl = Result.Nodes.getNodeAs("alias")) { FoundDecls[AliasDecl] = CharSourceRange::getCharRange( - AliasDecl->getLocStart(), + AliasDecl->getBeginLoc(), Lexer::findLocationAfterToken( AliasDecl->getLocEnd(), tok::semi, *Result.SourceManager, getLangOpts(), Index: clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.cpp @@ -41,8 +41,8 @@ const T *PrevNode, const T *Node, const T *NextNode) { if (NextNode) - return CharSourceRange::getCharRange(Node->getLocStart(), - NextNode->getLocStart()); + return CharSourceRange::getCharRange(Node->getBeginLoc(), + NextNode->getBeginLoc()); if (PrevNode) return CharSourceRange::getTokenRange( Index: clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp @@ -68,7 +68,7 @@ UsingDeclContext Context(Using); Context.UsingDeclRange = CharSourceRange::getCharRange( - Using->getLocStart(), + Using->getBeginLoc(), Lexer::findLocationAfterToken( Using->getLocEnd(), tok::semi, *Result.SourceManager, getLangOpts(), /*SkipTrailingWhitespaceAndNewLine=*/true)); Index: clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/AvoidBindCheck.cpp @@ -59,7 +59,7 @@ } B.Tokens = Lexer::getSourceText( - CharSourceRange::getTokenRange(E->getLocStart(), E->getLocEnd()), + CharSourceRange::getTokenRange(E->getBeginLoc(), E->getLocEnd()), *Result.SourceManager, Result.Context->getLangOpts()); SmallVector Matches; @@ -131,7 +131,7 @@ void AvoidBindCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedDecl = Result.Nodes.getNodeAs("bind"); - auto Diag = diag(MatchedDecl->getLocStart(), "prefer a lambda to std::bind"); + auto Diag = diag(MatchedDecl->getBeginLoc(), "prefer a lambda to std::bind"); const auto Args = buildBindArguments(Result, MatchedDecl); Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp @@ -199,7 +199,7 @@ const auto *Expr = cast(Reset->getCallee()); SourceLocation OperatorLoc = Expr->getOperatorLoc(); SourceLocation ResetCallStart = Reset->getExprLoc(); - SourceLocation ExprStart = Expr->getLocStart(); + SourceLocation ExprStart = Expr->getBeginLoc(); SourceLocation ExprEnd = Lexer::getLocForEndOfToken(Expr->getLocEnd(), 0, SM, getLangOpts()); @@ -353,7 +353,7 @@ // Has to be replaced with: // smart_ptr(Pair{first, second}); InitRange = SourceRange( - New->getAllocatedTypeSourceInfo()->getTypeLoc().getLocStart(), + New->getAllocatedTypeSourceInfo()->getTypeLoc().getBeginLoc(), New->getInitializer()->getSourceRange().getEnd()); } Diag << FixItHint::CreateRemoval( Index: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp @@ -194,7 +194,7 @@ *Result.Context)) return; - auto Diag = diag(ParamDecl->getLocStart(), "pass by value and use std::move"); + auto Diag = diag(ParamDecl->getBeginLoc(), "pass by value and use std::move"); // Iterate over all declarations of the constructor. for (const ParmVarDecl *ParmDecl : collectParamDecls(Ctor, ParamDecl)) { @@ -206,7 +206,7 @@ continue; TypeLoc ValueTL = RefTL.getPointeeLoc(); - auto TypeRange = CharSourceRange::getTokenRange(ParmDecl->getLocStart(), + auto TypeRange = CharSourceRange::getTokenRange(ParmDecl->getBeginLoc(), ParamTL.getLocEnd()); std::string ValueStr = Lexer::getSourceText(CharSourceRange::getTokenRange( ValueTL.getSourceRange()), Index: clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/RawStringLiteralCheck.cpp @@ -129,14 +129,14 @@ void RawStringLiteralCheck::check(const MatchFinder::MatchResult &Result) { const auto *Literal = Result.Nodes.getNodeAs("lit"); - if (Literal->getLocStart().isMacroID()) + if (Literal->getBeginLoc().isMacroID()) return; if (containsEscapedCharacters(Result, Literal, DisallowedChars)) { std::string Replacement = asRawStringLiteral(Literal, DelimiterStem); if (ReplaceShorterLiterals || Replacement.length() <= - Lexer::MeasureTokenLength(Literal->getLocStart(), + Lexer::MeasureTokenLength(Literal->getBeginLoc(), *Result.SourceManager, getLangOpts())) replaceWithRawStringLiteral(Result, Literal, Replacement); } @@ -148,7 +148,7 @@ CharSourceRange CharRange = Lexer::makeFileCharRange( CharSourceRange::getTokenRange(Literal->getSourceRange()), *Result.SourceManager, getLangOpts()); - diag(Literal->getLocStart(), + diag(Literal->getBeginLoc(), "escaped string literal can be written as a raw string literal") << FixItHint::CreateReplacement(CharRange, Replacement); } Index: clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/RedundantVoidArgCheck.cpp @@ -103,9 +103,9 @@ const MatchFinder::MatchResult &Result, const FunctionDecl *Function) { if (Function->isThisDeclarationADefinition()) { const Stmt *Body = Function->getBody(); - SourceLocation Start = Function->getLocStart(); + SourceLocation Start = Function->getBeginLoc(); SourceLocation End = - Body ? Body->getLocStart().getLocWithOffset(-1) : Function->getLocEnd(); + Body ? Body->getBeginLoc().getLocWithOffset(-1) : Function->getLocEnd(); removeVoidArgumentTokens(Result, SourceRange(Start, End), "function definition"); } else { @@ -198,10 +198,10 @@ void RedundantVoidArgCheck::processVarDecl( const MatchFinder::MatchResult &Result, const VarDecl *Var) { if (protoTypeHasNoParms(Var->getType())) { - SourceLocation Begin = Var->getLocStart(); + SourceLocation Begin = Var->getBeginLoc(); if (Var->hasInit()) { SourceLocation InitStart = - Result.SourceManager->getExpansionLoc(Var->getInit()->getLocStart()) + Result.SourceManager->getExpansionLoc(Var->getInit()->getBeginLoc()) .getLocWithOffset(-1); removeVoidArgumentTokens(Result, SourceRange(Begin, InitStart), "variable declaration with initializer"); @@ -237,7 +237,7 @@ Lambda->hasExplicitParameters()) { SourceLocation Begin = Lambda->getIntroducerRange().getEnd().getLocWithOffset(1); - SourceLocation End = Lambda->getBody()->getLocStart().getLocWithOffset(-1); + SourceLocation End = Lambda->getBody()->getBeginLoc().getLocWithOffset(-1); removeVoidArgumentTokens(Result, SourceRange(Begin, End), "lambda expression"); } Index: clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp @@ -62,13 +62,13 @@ const auto *MatchedArgumentThree = Result.Nodes.getNodeAs("randomFunc"); const auto *MatchedCallExpr = Result.Nodes.getNodeAs("match"); - if (MatchedCallExpr->getLocStart().isMacroID()) + if (MatchedCallExpr->getBeginLoc().isMacroID()) return; auto Diag = [&] { if (MatchedCallExpr->getNumArgs() == 3) { auto DiagL = - diag(MatchedCallExpr->getLocStart(), + diag(MatchedCallExpr->getBeginLoc(), "'std::random_shuffle' has been removed in C++17; use " "'std::shuffle' and an alternative random mechanism instead"); DiagL << FixItHint::CreateReplacement( @@ -76,7 +76,7 @@ "std::mt19937(std::random_device()())"); return DiagL; } else { - auto DiagL = diag(MatchedCallExpr->getLocStart(), + auto DiagL = diag(MatchedCallExpr->getBeginLoc(), "'std::random_shuffle' has been removed in C++17; use " "'std::shuffle' instead"); DiagL << FixItHint::CreateInsertion( @@ -94,12 +94,12 @@ NewName = "std::" + NewName; Diag << FixItHint::CreateRemoval(MatchedDecl->getSourceRange()); - Diag << FixItHint::CreateInsertion(MatchedDecl->getLocStart(), NewName); + Diag << FixItHint::CreateInsertion(MatchedDecl->getBeginLoc(), NewName); if (Optional IncludeFixit = IncludeInserter->CreateIncludeInsertion( Result.Context->getSourceManager().getFileID( - MatchedCallExpr->getLocStart()), + MatchedCallExpr->getBeginLoc()), "random", /*IsAngled=*/true)) Diag << IncludeFixit.getValue(); } Index: clang-tools-extra/trunk/clang-tidy/modernize/ShrinkToFitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/ShrinkToFitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/ShrinkToFitCheck.cpp @@ -59,7 +59,7 @@ const auto *Container = Result.Nodes.getNodeAs("ContainerToShrink"); FixItHint Hint; - if (!MemberCall->getLocStart().isMacroID()) { + if (!MemberCall->getBeginLoc().isMacroID()) { const LangOptions &Opts = getLangOpts(); std::string ReplacementText; if (const auto *UnaryOp = llvm::dyn_cast(Container)) { @@ -79,7 +79,7 @@ ReplacementText); } - diag(MemberCall->getLocStart(), "the shrink_to_fit method should be used " + diag(MemberCall->getBeginLoc(), "the shrink_to_fit method should be used " "to reduce the capacity of a shrinkable " "container") << Hint; Index: clang-tools-extra/trunk/clang-tidy/modernize/UnaryStaticAssertCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UnaryStaticAssertCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UnaryStaticAssertCheck.cpp @@ -32,7 +32,7 @@ SourceLocation Loc = MatchedDecl->getLocation(); if (!AssertMessage || AssertMessage->getLength() || - AssertMessage->getLocStart().isMacroID() || Loc.isMacroID()) + AssertMessage->getBeginLoc().isMacroID() || Loc.isMacroID()) return; diag(Loc, Index: clang-tools-extra/trunk/clang-tidy/modernize/UseBoolLiteralsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseBoolLiteralsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseBoolLiteralsCheck.cpp @@ -57,7 +57,7 @@ const Expr *Expression = Cast ? Cast : Literal; - bool InMacro = Expression->getLocStart().isMacroID(); + bool InMacro = Expression->getBeginLoc().isMacroID(); if (InMacro && IgnoreMacros) return; Index: clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp @@ -202,7 +202,7 @@ const MatchFinder::MatchResult &Result, const CXXCtorInitializer *Init) { const FieldDecl *Field = Init->getAnyMember(); - SourceLocation StartLoc = Field->getLocStart(); + SourceLocation StartLoc = Field->getBeginLoc(); if (StartLoc.isMacroID() && IgnoreMacros) return; Index: clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDefaultCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDefaultCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseEqualsDefaultCheck.cpp @@ -298,7 +298,7 @@ // expansion locations are reported. SourceLocation Location = SpecialFunctionDecl->getLocation(); if (Location.isMacroID()) - Location = Body->getLocStart(); + Location = Body->getBeginLoc(); auto Diag = diag(Location, "use '= default' to define a trivial " + SpecialFunctionName); Index: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp @@ -125,7 +125,7 @@ } bool VisitStmt(Stmt *S) { - if (SM.getFileLoc(S->getLocStart()) != CastLoc) + if (SM.getFileLoc(S->getBeginLoc()) != CastLoc) return true; Visited = true; @@ -214,7 +214,7 @@ return true; } - SourceLocation StartLoc = FirstSubExpr->getLocStart(); + SourceLocation StartLoc = FirstSubExpr->getBeginLoc(); SourceLocation EndLoc = FirstSubExpr->getLocEnd(); // If the location comes from a macro arg expansion, *all* uses of that @@ -269,7 +269,7 @@ /// \brief Tests that all expansions of a macro arg, one of which expands to /// result in \p CE, yield NullTo(Member)Pointer casts. bool allArgUsesValid(const CastExpr *CE) { - SourceLocation CastLoc = CE->getLocStart(); + SourceLocation CastLoc = CE->getBeginLoc(); // Step 1: Get location of macro arg and location of the macro the arg was // provided to. @@ -437,9 +437,9 @@ SourceLocation Loc; if (const auto *D = Parent.get()) - Loc = D->getLocStart(); + Loc = D->getBeginLoc(); else if (const auto *S = Parent.get()) - Loc = S->getLocStart(); + Loc = S->getBeginLoc(); // TypeLoc and NestedNameSpecifierLoc are members of the parent map. Skip // them and keep going up. Index: clang-tools-extra/trunk/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp @@ -85,8 +85,8 @@ Result.Nodes.getNodeAs("FunctorClass"); if (const auto *FuncInst = Result.Nodes.getNodeAs("FuncInst")) { - diag(FuncInst->getLocStart(), Message) - << (FuncClass->getName() + "<>").str(); + diag(FuncInst->getBeginLoc(), Message) + << (FuncClass->getName() + "<>").str(); return; } Index: clang-tools-extra/trunk/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp @@ -57,14 +57,14 @@ bool WarnOnly = false; if (C) { - BeginLoc = C->getLocStart(); + BeginLoc = C->getBeginLoc(); EndLoc = C->getLocEnd(); } else if (const auto *E = Result.Nodes.getNodeAs("call_expr")) { - BeginLoc = E->getLocStart(); + BeginLoc = E->getBeginLoc(); EndLoc = E->getLocEnd(); } else if (const auto *D = Result.Nodes.getNodeAs("decl_ref_expr")) { - BeginLoc = D->getLocStart(); + BeginLoc = D->getBeginLoc(); EndLoc = D->getLocEnd(); WarnOnly = true; } else { Index: clang-tools-extra/trunk/clang-tidy/modernize/UseUsingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseUsingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseUsingCheck.cpp @@ -83,7 +83,7 @@ auto &Context = *Result.Context; auto &SM = *Result.SourceManager; - SourceLocation StartLoc = MatchedDecl->getLocStart(); + SourceLocation StartLoc = MatchedDecl->getBeginLoc(); if (StartLoc.isMacroID() && IgnoreMacros) return; Index: clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp @@ -31,7 +31,7 @@ void AvoidNSErrorInitCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedExpr = Result.Nodes.getNodeAs("nserrorInit"); - diag(MatchedExpr->getLocStart(), + diag(MatchedExpr->getBeginLoc(), "use errorWithDomain:code:userInfo: or initWithDomain:code:userInfo: to " "create a new NSError"); } Index: clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp @@ -27,7 +27,7 @@ void AvoidSpinlockCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedExpr = Result.Nodes.getNodeAs("spinlock"); - diag(MatchedExpr->getLocStart(), + diag(MatchedExpr->getBeginLoc(), "use os_unfair_lock_lock() or dispatch queue APIs instead of the " "deprecated OSSpinLock"); } Index: clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/FasterStringFindCheck.cpp @@ -90,13 +90,14 @@ if (!Replacement) return; - diag(Literal->getLocStart(), "%0 called with a string literal consisting of " + diag(Literal->getBeginLoc(), "%0 called with a string literal consisting of " "a single character; consider using the more " "effective overload accepting a character") - << FindFunc << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(Literal->getLocStart(), - Literal->getLocEnd()), - *Replacement); + << FindFunc + << FixItHint::CreateReplacement( + CharSourceRange::getTokenRange(Literal->getBeginLoc(), + Literal->getLocEnd()), + *Replacement); } } // namespace performance Index: clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/ForRangeCopyCheck.cpp @@ -41,7 +41,7 @@ void ForRangeCopyCheck::check(const MatchFinder::MatchResult &Result) { const auto *Var = Result.Nodes.getNodeAs("loopVar"); // Ignore code in macros since we can't place the fixes correctly. - if (Var->getLocStart().isMacroID()) + if (Var->getBeginLoc().isMacroID()) return; if (handleConstValueCopy(*Var, *Result.Context)) return; Index: clang-tools-extra/trunk/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp @@ -96,7 +96,7 @@ "change the type to the matching one (%1 but 'const auto&' is always a " "valid option) or remove the reference to make it explicit that you are " "creating a new value"; - diag(VD->getLocStart(), Message) << VD << ConstRefType; + diag(VD->getBeginLoc(), Message) << VD << ConstRefType; } } // namespace performance Index: clang-tools-extra/trunk/clang-tidy/performance/InefficientAlgorithmCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/InefficientAlgorithmCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/InefficientAlgorithmCheck.cpp @@ -99,7 +99,7 @@ .getUnqualifiedType() .getCanonicalType(); if (AlgCmp != ContainerCmp) { - diag(Arg->getLocStart(), + diag(Arg->getBeginLoc(), "different comparers used in the algorithm and the container"); return; } @@ -153,7 +153,7 @@ Hint = FixItHint::CreateReplacement(CallRange, ReplacementText); } - diag(AlgCall->getLocStart(), + diag(AlgCall->getBeginLoc(), "this STL algorithm call should be replaced with a container method") << Hint; } Index: clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/InefficientVectorOperationCheck.cpp @@ -168,7 +168,7 @@ // FIXME: make it more intelligent to identify the pre-allocating operations // before the for loop. if (SM.isBeforeInTranslationUnit(Ref->getLocation(), - LoopStmt->getLocStart())) { + LoopStmt->getBeginLoc())) { return; } } @@ -200,13 +200,13 @@ } auto Diag = - diag(VectorAppendCall->getLocStart(), + diag(VectorAppendCall->getBeginLoc(), "%0 is called inside a loop; " "consider pre-allocating the vector capacity before the loop") << VectorAppendCall->getMethodDecl()->getDeclName(); if (!ReserveStmt.empty()) - Diag << FixItHint::CreateInsertion(LoopStmt->getLocStart(), ReserveStmt); + Diag << FixItHint::CreateInsertion(LoopStmt->getBeginLoc(), ReserveStmt); } } // namespace performance Index: clang-tools-extra/trunk/clang-tidy/performance/MoveConstArgCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/MoveConstArgCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/MoveConstArgCheck.cpp @@ -23,7 +23,7 @@ const Expr *Arg = Call->getArg(0); CharSourceRange BeforeArgumentsRange = Lexer::makeFileCharRange( - CharSourceRange::getCharRange(Call->getLocStart(), Arg->getLocStart()), + CharSourceRange::getCharRange(Call->getBeginLoc(), Arg->getBeginLoc()), SM, LangOpts); CharSourceRange AfterArgumentsRange = Lexer::makeFileCharRange( CharSourceRange::getCharRange(Call->getLocEnd(), Index: clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/TypePromotionInMathFnCheck.cpp @@ -195,7 +195,7 @@ // declared in . if (FnInCmath) if (auto IncludeFixit = IncludeInserter->CreateIncludeInsertion( - Result.Context->getSourceManager().getFileID(Call->getLocStart()), + Result.Context->getSourceManager().getFileID(Call->getBeginLoc()), "cmath", /*IsAngled=*/true)) Diag << *IncludeFixit; } Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -156,7 +156,7 @@ // compilation unit as the signature change could introduce build errors. // 4. the function is an explicit template specialization. const auto *Method = llvm::dyn_cast(Function); - if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()) || + if (Param->getBeginLoc().isMacroID() || (Method && Method->isVirtual()) || isReferencedOutsideOfCallExpr(*Function, *Result.Context) || isExplicitTemplateSpecialization(*Function)) return; @@ -189,20 +189,20 @@ void UnnecessaryValueParamCheck::handleMoveFix(const ParmVarDecl &Var, const DeclRefExpr &CopyArgument, const ASTContext &Context) { - auto Diag = diag(CopyArgument.getLocStart(), + auto Diag = diag(CopyArgument.getBeginLoc(), "parameter %0 is passed by value and only copied once; " "consider moving it to avoid unnecessary copies") << &Var; // Do not propose fixes in macros since we cannot place them correctly. - if (CopyArgument.getLocStart().isMacroID()) + if (CopyArgument.getBeginLoc().isMacroID()) return; const auto &SM = Context.getSourceManager(); auto EndLoc = Lexer::getLocForEndOfToken(CopyArgument.getLocation(), 0, SM, Context.getLangOpts()); - Diag << FixItHint::CreateInsertion(CopyArgument.getLocStart(), "std::move(") + Diag << FixItHint::CreateInsertion(CopyArgument.getBeginLoc(), "std::move(") << FixItHint::CreateInsertion(EndLoc, ")"); if (auto IncludeFixit = Inserter->CreateIncludeInsertion( - SM.getFileID(CopyArgument.getLocStart()), "utility", + SM.getFileID(CopyArgument.getBeginLoc()), "utility", /*IsAngled=*/true)) Diag << *IncludeFixit; } Index: clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/AvoidConstParamsInDecls.cpp @@ -22,7 +22,7 @@ SourceRange getTypeRange(const ParmVarDecl &Param) { if (Param.getIdentifier() != nullptr) - return SourceRange(Param.getLocStart(), + return SourceRange(Param.getBeginLoc(), Param.getLocEnd().getLocWithOffset(-1)); return Param.getSourceRange(); } @@ -82,7 +82,7 @@ if (!Param->getType().isLocalConstQualified()) return; - auto Diag = diag(Param->getLocStart(), + auto Diag = diag(Param->getBeginLoc(), "parameter %0 is const-qualified in the function " "declaration; const-qualification of parameters only has an " "effect in function definitions"); @@ -97,7 +97,7 @@ Diag << Param; } - if (Param->getLocStart().isMacroID() != Param->getLocEnd().isMacroID()) { + if (Param->getBeginLoc().isMacroID() != Param->getLocEnd().isMacroID()) { // Do not offer a suggestion if the part of the variable declaration comes // from a macro. return; Index: clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp @@ -174,7 +174,7 @@ const SourceManager &SM, const ASTContext *Context) { // Skip macros. - if (S->getLocStart().isMacroID()) + if (S->getBeginLoc().isMacroID()) return SourceLocation(); SourceLocation CondEndLoc = S->getCond()->getLocEnd(); @@ -232,7 +232,7 @@ // level as the start of the statement. We also need file locations for // Lexer::getLocForEndOfToken working properly. InitialLoc = Lexer::makeFileCharRange( - CharSourceRange::getCharRange(InitialLoc, S->getLocStart()), + CharSourceRange::getCharRange(InitialLoc, S->getBeginLoc()), SM, Context->getLangOpts()) .getBegin(); if (InitialLoc.isInvalid()) Index: clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.cpp @@ -201,12 +201,12 @@ } if (MemberCall) { - diag(MemberCall->getLocStart(), + diag(MemberCall->getBeginLoc(), "the 'empty' method should be used to check " "for emptiness instead of 'size'") << Hint; } else { - diag(BinCmp->getLocStart(), + diag(BinCmp->getBeginLoc(), "the 'empty' method should be used to check " "for emptiness instead of comparing to an empty object") << Hint; Index: clang-tools-extra/trunk/clang-tidy/readability/DeleteNullPointerCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/DeleteNullPointerCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/DeleteNullPointerCheck.cpp @@ -55,14 +55,14 @@ const auto *Compound = Result.Nodes.getNodeAs("compound"); auto Diag = diag( - IfWithDelete->getLocStart(), + IfWithDelete->getBeginLoc(), "'if' statement is unnecessary; deleting null pointer has no effect"); if (IfWithDelete->getElse()) return; // FIXME: generate fixit for this case. Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange( - IfWithDelete->getLocStart(), + IfWithDelete->getBeginLoc(), Lexer::getLocForEndOfToken(IfWithDelete->getCond()->getLocEnd(), 0, *Result.SourceManager, Result.Context->getLangOpts()))); Index: clang-tools-extra/trunk/clang-tidy/readability/DeletedDefaultCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/DeletedDefaultCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/DeletedDefaultCheck.cpp @@ -41,7 +41,7 @@ "either be removed or explicitly deleted"; if (const auto *Constructor = Result.Nodes.getNodeAs("constructor")) { - auto Diag = diag(Constructor->getLocStart(), Message); + auto Diag = diag(Constructor->getBeginLoc(), Message); if (Constructor->isDefaultConstructor()) { Diag << "default constructor" << "a non-static data member or a base class is lacking a default " @@ -56,7 +56,7 @@ } } else if (const auto *Assignment = Result.Nodes.getNodeAs("method-decl")) { - diag(Assignment->getLocStart(), Message) + diag(Assignment->getBeginLoc(), Message) << (Assignment->isCopyAssignmentOperator() ? "copy assignment operator" : "move assignment operator") << "a base class or a non-static data member is not assignable, e.g. " Index: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp @@ -73,7 +73,7 @@ // is already nested NestingThreshold levels deep, record the start location // of this new compound statement. if (CurrentNestingLevel == Info.NestingThreshold) - Info.NestingThresholders.push_back(Node->getLocStart()); + Info.NestingThresholders.push_back(Node->getBeginLoc()); ++CurrentNestingLevel; Base::TraverseCompoundStmt(Node); @@ -162,9 +162,9 @@ // Count the lines including whitespace and comments. Really simple. if (const Stmt *Body = Func->getBody()) { SourceManager *SM = Result.SourceManager; - if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { + if (SM->isWrittenInSameFile(Body->getBeginLoc(), Body->getLocEnd())) { FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - - SM->getSpellingLineNumber(Body->getLocStart()); + SM->getSpellingLineNumber(Body->getBeginLoc()); } } Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -841,7 +841,7 @@ if (StringRef(Fixup).equals(Name)) { if (!IgnoreFailedSplit) { LLVM_DEBUG(llvm::dbgs() - << Decl->getLocStart().printToString(*Result.SourceManager) + << Decl->getBeginLoc().printToString(*Result.SourceManager) << llvm::format(": unable to split words for %s '%s'\n", KindName.c_str(), Name.str().c_str())); } Index: clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolConversionCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -24,14 +24,14 @@ AST_MATCHER(Stmt, isMacroExpansion) { SourceManager &SM = Finder->getASTContext().getSourceManager(); - SourceLocation Loc = Node.getLocStart(); + SourceLocation Loc = Node.getBeginLoc(); return SM.isMacroBodyExpansion(Loc) || SM.isMacroArgExpansion(Loc); } bool isNULLMacroExpansion(const Stmt *Statement, ASTContext &Context) { SourceManager &SM = Context.getSourceManager(); const LangOptions &LO = Context.getLangOpts(); - SourceLocation Loc = Statement->getLocStart(); + SourceLocation Loc = Statement->getBeginLoc(); return SM.isMacroBodyExpansion(Loc) && Lexer::getImmediateMacroName(Loc, SM, LO) == "NULL"; } @@ -97,9 +97,9 @@ bool InvertComparison = Parent != nullptr && isUnaryLogicalNotOperator(Parent); if (InvertComparison) { - SourceLocation ParentStartLoc = Parent->getLocStart(); + SourceLocation ParentStartLoc = Parent->getBeginLoc(); SourceLocation ParentEndLoc = - cast(Parent)->getSubExpr()->getLocStart(); + cast(Parent)->getSubExpr()->getBeginLoc(); Diag << FixItHint::CreateRemoval( CharSourceRange::getCharRange(ParentStartLoc, ParentEndLoc)); @@ -122,7 +122,7 @@ } if (!StartLocInsertion.empty()) { - Diag << FixItHint::CreateInsertion(Cast->getLocStart(), StartLocInsertion); + Diag << FixItHint::CreateInsertion(Cast->getBeginLoc(), StartLocInsertion); } std::string EndLocInsertion; @@ -183,7 +183,7 @@ bool NeedParens = !isa(SubExpr); Diag << FixItHint::CreateInsertion( - Cast->getLocStart(), + Cast->getBeginLoc(), (Twine("static_cast<") + OtherType + ">" + (NeedParens ? "(" : "")) .str()); @@ -354,7 +354,7 @@ return; } - auto Diag = diag(Cast->getLocStart(), "implicit conversion %0 -> bool") + auto Diag = diag(Cast->getBeginLoc(), "implicit conversion %0 -> bool") << Cast->getSubExpr()->getType(); StringRef EquivalentLiteral = @@ -371,7 +371,7 @@ ASTContext &Context) { QualType DestType = NextImplicitCast ? NextImplicitCast->getType() : Cast->getType(); - auto Diag = diag(Cast->getLocStart(), "implicit conversion bool -> %0") + auto Diag = diag(Cast->getBeginLoc(), "implicit conversion bool -> %0") << DestType; if (const auto *BoolLiteral = Index: clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp @@ -324,7 +324,7 @@ return; } - SourceLocation StartLoc = OriginalDeclaration->getLocStart(); + SourceLocation StartLoc = OriginalDeclaration->getBeginLoc(); if (StartLoc.isMacroID() && IgnoreMacros) { markRedeclarationsAsVisited(OriginalDeclaration); return; Index: clang-tools-extra/trunk/clang-tidy/readability/MisleadingIndentationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/MisleadingIndentationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/MisleadingIndentationCheck.cpp @@ -79,15 +79,15 @@ if (isa(Inner)) continue; - SourceLocation InnerLoc = Inner->getLocStart(); - SourceLocation OuterLoc = CurrentStmt->getLocStart(); + SourceLocation InnerLoc = Inner->getBeginLoc(); + SourceLocation OuterLoc = CurrentStmt->getBeginLoc(); if (SM.getExpansionLineNumber(InnerLoc) == SM.getExpansionLineNumber(OuterLoc)) continue; const Stmt *NextStmt = CStmt->body_begin()[i + 1]; - SourceLocation NextLoc = NextStmt->getLocStart(); + SourceLocation NextLoc = NextStmt->getBeginLoc(); if (InnerLoc.isMacroID() || OuterLoc.isMacroID() || NextLoc.isMacroID()) continue; Index: clang-tools-extra/trunk/clang-tidy/readability/MisplacedArrayIndexCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/MisplacedArrayIndexCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/MisplacedArrayIndexCheck.cpp @@ -30,7 +30,7 @@ const auto *ArraySubscriptE = Result.Nodes.getNodeAs("expr"); - auto Diag = diag(ArraySubscriptE->getLocStart(), "confusing array subscript " + auto Diag = diag(ArraySubscriptE->getBeginLoc(), "confusing array subscript " "expression, usually the " "index is inside the []"); Index: clang-tools-extra/trunk/clang-tidy/readability/NamedParameterCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/NamedParameterCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/NamedParameterCheck.cpp @@ -59,7 +59,7 @@ // Sanity check the source locations. if (!Parm->getLocation().isValid() || Parm->getLocation().isMacroID() || - !SM.isWrittenInSameFile(Parm->getLocStart(), Parm->getLocation())) + !SM.isWrittenInSameFile(Parm->getBeginLoc(), Parm->getLocation())) continue; // Skip gmock testing::Unused parameters. @@ -73,7 +73,7 @@ // Look for comments. We explicitly want to allow idioms like // void foo(int /*unused*/) - const char *Begin = SM.getCharacterData(Parm->getLocStart()); + const char *Begin = SM.getCharacterData(Parm->getBeginLoc()); const char *End = SM.getCharacterData(Parm->getLocation()); StringRef Data(Begin, End - Begin); if (Data.find("/*") != StringRef::npos) Index: clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.cpp @@ -69,12 +69,12 @@ const auto *ND = Result.Nodes.getNodeAs("namespace"); const SourceManager &Sources = *Result.SourceManager; - if (!locationsInSameFile(Sources, ND->getLocStart(), ND->getRBraceLoc())) + if (!locationsInSameFile(Sources, ND->getBeginLoc(), ND->getRBraceLoc())) return; // Don't require closing comments for namespaces spanning less than certain // number of lines. - unsigned StartLine = Sources.getSpellingLineNumber(ND->getLocStart()); + unsigned StartLine = Sources.getSpellingLineNumber(ND->getBeginLoc()); unsigned EndLine = Sources.getSpellingLineNumber(ND->getRBraceLoc()); if (EndLine - StartLine + 1 <= ShortNamespaceLines) return; Index: clang-tools-extra/trunk/clang-tidy/readability/NonConstParameterCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/NonConstParameterCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/NonConstParameterCheck.cpp @@ -146,7 +146,7 @@ unsigned Index = Par->getFunctionScopeIndex(); for (FunctionDecl *FnDecl : Function->redecls()) Fixes.push_back(FixItHint::CreateInsertion( - FnDecl->getParamDecl(Index)->getLocStart(), "const ")); + FnDecl->getParamDecl(Index)->getBeginLoc(), "const ")); diag(Par->getLocation(), "pointer parameter '%0' can be pointer to const") << Par->getName() << Fixes; Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp @@ -59,7 +59,7 @@ if (const auto *VD = dyn_cast(D)) { // Is this a multivariable declaration? for (const auto Other : VD->getDeclContext()->decls()) { - if (Other != D && Other->getLocStart() == VD->getLocStart()) { + if (Other != D && Other->getBeginLoc() == VD->getBeginLoc()) { MultiVar = true; break; } Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.cpp @@ -138,7 +138,7 @@ *Result.SourceManager, getLangOpts()); // Replace foo->get() with *foo, and foo.get() with foo. std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str(); - diag(GetCall->getLocStart(), "redundant get() call on smart pointer") + diag(GetCall->getBeginLoc(), "redundant get() call on smart pointer") << FixItHint::CreateReplacement(GetCall->getSourceRange(), Replacement); } Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.cpp @@ -189,7 +189,7 @@ if (ArgText.empty()) return; - diag(Call->getLocStart(), "redundant call to %0") + diag(Call->getBeginLoc(), "redundant call to %0") << Member->getMemberDecl() << FixItHint::CreateReplacement(Call->getSourceRange(), ArgText); } Index: clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp @@ -62,7 +62,7 @@ const CXXBoolLiteralExpr *getBoolLiteral(const MatchFinder::MatchResult &Result, StringRef Id) { const auto *Literal = Result.Nodes.getNodeAs(Id); - return (Literal && Literal->getLocStart().isMacroID()) ? nullptr : Literal; + return (Literal && Literal->getBeginLoc().isMacroID()) ? nullptr : Literal; } internal::Matcher returnsBool(bool Value, StringRef Id = "ignored") { @@ -372,7 +372,7 @@ else return; - if (Bool->getLocStart().isMacroID()) + if (Bool->getBeginLoc().isMacroID()) return; // FIXME: why do we need this? @@ -385,8 +385,8 @@ const Expr *ReplaceWith, bool Negated) { std::string Replacement = replacementExpression(Result, Negated, ReplaceWith); - SourceRange Range(LHS->getLocStart(), RHS->getLocEnd()); - issueDiag(Result, Bool->getLocStart(), SimplifyOperatorDiagnostic, Range, + SourceRange Range(LHS->getBeginLoc(), RHS->getLocEnd()); + issueDiag(Result, Bool->getBeginLoc(), SimplifyOperatorDiagnostic, Range, Replacement); }; @@ -577,7 +577,7 @@ const MatchFinder::MatchResult &Result, const CXXBoolLiteralExpr *TrueConditionRemoved) { const auto *IfStatement = Result.Nodes.getNodeAs(IfStmtId); - issueDiag(Result, TrueConditionRemoved->getLocStart(), + issueDiag(Result, TrueConditionRemoved->getBeginLoc(), SimplifyConditionDiagnostic, IfStatement->getSourceRange(), getText(Result, *IfStatement->getThen())); } @@ -587,7 +587,7 @@ const CXXBoolLiteralExpr *FalseConditionRemoved) { const auto *IfStatement = Result.Nodes.getNodeAs(IfStmtId); const Stmt *ElseStatement = IfStatement->getElse(); - issueDiag(Result, FalseConditionRemoved->getLocStart(), + issueDiag(Result, FalseConditionRemoved->getBeginLoc(), SimplifyConditionDiagnostic, IfStatement->getSourceRange(), ElseStatement ? getText(Result, *ElseStatement) : ""); } @@ -597,7 +597,7 @@ bool Negated) { std::string Replacement = replacementExpression(Result, Negated, Ternary->getCond()); - issueDiag(Result, Ternary->getTrueExpr()->getLocStart(), + issueDiag(Result, Ternary->getTrueExpr()->getBeginLoc(), "redundant boolean literal in ternary expression result", Ternary->getSourceRange(), Replacement); } @@ -608,7 +608,7 @@ std::string Condition = replacementExpression(Result, Negated, If->getCond()); std::string Replacement = ("return " + Condition + Terminator).str(); SourceLocation Start = - Result.Nodes.getNodeAs(ThenLiteralId)->getLocStart(); + Result.Nodes.getNodeAs(ThenLiteralId)->getBeginLoc(); issueDiag(Result, Start, SimplifyConditionalReturnDiagnostic, If->getSourceRange(), Replacement); } @@ -640,8 +640,8 @@ std::string Replacement = "return " + replacementExpression(Result, Negated, Condition); issueDiag( - Result, Lit->getLocStart(), SimplifyConditionalReturnDiagnostic, - SourceRange(If->getLocStart(), Ret->getLocEnd()), Replacement); + Result, Lit->getBeginLoc(), SimplifyConditionalReturnDiagnostic, + SourceRange(If->getBeginLoc(), Ret->getLocEnd()), Replacement); return; } @@ -665,7 +665,7 @@ std::string Replacement = (VariableName + " = " + Condition + Terminator).str(); SourceLocation Location = - Result.Nodes.getNodeAs(IfAssignLocId)->getLocStart(); + Result.Nodes.getNodeAs(IfAssignLocId)->getBeginLoc(); issueDiag(Result, Location, "redundant boolean literal in conditional assignment", Range, Replacement); Index: clang-tools-extra/trunk/clang-tidy/readability/SimplifySubscriptExprCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/SimplifySubscriptExprCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/SimplifySubscriptExprCheck.cpp @@ -60,7 +60,7 @@ "accessing an element of the container does not require a call to " "'data()'; did you mean to use 'operator[]'?"); if (Member->isArrow()) - DiagBuilder << FixItHint::CreateInsertion(Member->getLocStart(), "(*") + DiagBuilder << FixItHint::CreateInsertion(Member->getBeginLoc(), "(*") << FixItHint::CreateInsertion(Member->getOperatorLoc(), ")"); DiagBuilder << FixItHint::CreateRemoval( {Member->getOperatorLoc(), Call->getLocEnd()}); Index: clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp @@ -51,7 +51,7 @@ const auto *MemberExpression = Result.Nodes.getNodeAs("memberExpression"); - if (MemberExpression->getLocStart().isMacroID()) + if (MemberExpression->getBeginLoc().isMacroID()) return; const Expr *BaseExpr = MemberExpression->getBase(); @@ -71,7 +71,7 @@ std::string BaseTypeName = BaseType.getAsString(PrintingPolicyWithSupressedTag); - SourceLocation MemberExprStartLoc = MemberExpression->getLocStart(); + SourceLocation MemberExprStartLoc = MemberExpression->getBeginLoc(); auto Diag = diag(MemberExprStartLoc, "static member accessed through instance"); Index: clang-tools-extra/trunk/clang-tidy/readability/StringCompareCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/StringCompareCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/StringCompareCheck.cpp @@ -51,7 +51,7 @@ void StringCompareCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *Matched = Result.Nodes.getNodeAs("match1")) { - diag(Matched->getLocStart(), CompareMessage); + diag(Matched->getBeginLoc(), CompareMessage); return; } @@ -63,10 +63,10 @@ const auto *Str2 = Result.Nodes.getNodeAs("str2"); const auto *Compare = Result.Nodes.getNodeAs("compare"); - auto Diag = diag(Matched->getLocStart(), CompareMessage); + auto Diag = diag(Matched->getBeginLoc(), CompareMessage); if (Str1->isArrow()) - Diag << FixItHint::CreateInsertion(Str1->getLocStart(), "*"); + Diag << FixItHint::CreateInsertion(Str1->getBeginLoc(), "*"); Diag << tooling::fixit::createReplacement(*Zero, *Str2, Ctx) << tooling::fixit::createReplacement(*Compare, *Str1->getBase(), Index: clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp @@ -42,7 +42,7 @@ const auto *PtrExpr = Result.Nodes.getNodeAs("uptr"); const auto *DeleteExpr = Result.Nodes.getNodeAs("delete"); - if (PtrExpr->getLocStart().isMacroID()) + if (PtrExpr->getBeginLoc().isMacroID()) return; // Ignore dependent types. @@ -54,11 +54,11 @@ SourceLocation AfterPtr = Lexer::getLocForEndOfToken( PtrExpr->getLocEnd(), 0, *Result.SourceManager, getLangOpts()); - diag(DeleteExpr->getLocStart(), + diag(DeleteExpr->getBeginLoc(), "prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> " "objects") << FixItHint::CreateRemoval(CharSourceRange::getCharRange( - DeleteExpr->getLocStart(), PtrExpr->getLocStart())) + DeleteExpr->getBeginLoc(), PtrExpr->getBeginLoc())) << FixItHint::CreateReplacement( CharSourceRange::getTokenRange(AfterPtr, DeleteExpr->getLocEnd()), " = nullptr"); Index: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp +++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp @@ -45,8 +45,8 @@ StringRef FlagName) { // If the Flag is an integer constant, check it. if (isa(Flags)) { - if (!SM.isMacroBodyExpansion(Flags->getLocStart()) && - !SM.isMacroArgExpansion(Flags->getLocStart())) + if (!SM.isMacroBodyExpansion(Flags->getBeginLoc()) && + !SM.isMacroArgExpansion(Flags->getBeginLoc())) return false; // Get the macro name. Index: clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp +++ clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp @@ -70,7 +70,7 @@ (llvm::Twine("\nnamespace ") + Abbreviation + " = " + Namespace + ";") .str(); SourceLocation Loc = - Lexer::getLocForEndOfToken(Function->getBody()->getLocStart(), 0, + Lexer::getLocForEndOfToken(Function->getBody()->getBeginLoc(), 0, SourceMgr, Context.getLangOpts()); AddedAliases[Function][Namespace.str()] = Abbreviation; return FixItHint::CreateInsertion(Loc, Declaration); Index: clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp +++ clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp @@ -41,7 +41,7 @@ return None; SourceLocation InsertLoc = Lexer::getLocForEndOfToken( - Function->getBody()->getLocStart(), 0, SourceMgr, Context.getLangOpts()); + Function->getBody()->getBeginLoc(), 0, SourceMgr, Context.getLangOpts()); // Only use using declarations in the main file, not in includes. if (SourceMgr.getFileID(InsertLoc) != SourceMgr.getMainFileID()) Index: clang-tools-extra/trunk/clangd/CodeComplete.cpp =================================================================== --- clang-tools-extra/trunk/clangd/CodeComplete.cpp +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp @@ -235,7 +235,7 @@ // file e.g. the symbol is forward declared. auto &SM = SemaResult->Declaration->getASTContext().getSourceManager(); for (const Decl *RD : SemaResult->Declaration->redecls()) - if (SM.isInMainFile(SM.getExpansionLoc(RD->getLocStart()))) + if (SM.isInMainFile(SM.getExpansionLoc(RD->getBeginLoc()))) return llvm::None; } return IndexResult->Detail->IncludeHeader; Index: clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp =================================================================== --- clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp +++ clang-tools-extra/trunk/clangd/CodeCompletionStrings.cpp @@ -65,7 +65,7 @@ // Sanity check that the comment does not come from the PCH. We choose to not // write them into PCH, because they are racy and slow to load. - assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getLocStart())); + assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getBeginLoc())); std::string Doc = RC->getFormattedText(Ctx.getSourceManager(), Ctx.getDiagnostics()); if (!looksLikeDocComment(Doc)) return ""; @@ -84,7 +84,7 @@ return ""; // Sanity check that the comment does not come from the PCH. We choose to not // write them into PCH, because they are racy and slow to load. - assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getLocStart())); + assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC->getBeginLoc())); std::string Doc = RC->getFormattedText(Ctx.getSourceManager(), Ctx.getDiagnostics()); if (!looksLikeDocComment(Doc)) return ""; Index: clang-tools-extra/trunk/clangd/XRefs.cpp =================================================================== --- clang-tools-extra/trunk/clangd/XRefs.cpp +++ clang-tools-extra/trunk/clangd/XRefs.cpp @@ -540,7 +540,7 @@ //- auto& i = 1; bool VisitDeclaratorDecl(DeclaratorDecl *D) { if (!D->getTypeSourceInfo() || - D->getTypeSourceInfo()->getTypeLoc().getLocStart() != SearchedLocation) + D->getTypeSourceInfo()->getTypeLoc().getBeginLoc() != SearchedLocation) return true; auto DeclT = D->getType(); Index: clang-tools-extra/trunk/tool-template/ToolTemplate.cpp =================================================================== --- clang-tools-extra/trunk/tool-template/ToolTemplate.cpp +++ clang-tools-extra/trunk/tool-template/ToolTemplate.cpp @@ -66,8 +66,8 @@ auto *D = Result.Nodes.getNodeAs("decl"); assert(D); // Use AtomicChange to get a key. - if (D->getLocStart().isValid()) { - AtomicChange Change(*Result.SourceManager, D->getLocStart()); + if (D->getBeginLoc().isValid()) { + AtomicChange Change(*Result.SourceManager, D->getBeginLoc()); Context.reportResult(Change.getKey(), D->getQualifiedNameAsString()); } } Index: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp =================================================================== --- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp +++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp @@ -45,7 +45,7 @@ } void check(const ast_matchers::MatchFinder::MatchResult &Result) override { - auto Diag = diag(Result.Nodes.getNodeAs("stmt")->getLocStart(), + auto Diag = diag(Result.Nodes.getNodeAs("stmt")->getBeginLoc(), "foo, bar"); for (StringRef header : HeadersToInclude()) { auto Fixit = Inserter->CreateIncludeInsertion( Index: clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp =================================================================== --- clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp +++ clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp @@ -36,13 +36,11 @@ auto Hint = Aliaser->createAlias(*Result.Context, *Call, "::foo::bar", {"b", "some_alias"}); if (Hint.hasValue()) - diag(Call->getLocStart(), "Fix for testing") << Hint.getValue(); + diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue(); - diag(Call->getLocStart(), "insert call") - << FixItHint::CreateInsertion( - Call->getLocStart(), - Aliaser->getNamespaceName(*Result.Context, *Call, "::foo::bar") + - "::"); + diag(Call->getBeginLoc(), "insert call") << FixItHint::CreateInsertion( + Call->getBeginLoc(), + Aliaser->getNamespaceName(*Result.Context, *Call, "::foo::bar") + "::"); } private: Index: clang-tools-extra/trunk/unittests/clang-tidy/OverlappingReplacementsTest.cpp =================================================================== --- clang-tools-extra/trunk/unittests/clang-tidy/OverlappingReplacementsTest.cpp +++ clang-tools-extra/trunk/unittests/clang-tidy/OverlappingReplacementsTest.cpp @@ -33,8 +33,8 @@ } void check(const ast_matchers::MatchFinder::MatchResult &Result) override { auto *VD = Result.Nodes.getNodeAs(BoundDecl); - diag(VD->getLocStart(), "use char") << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(VD->getLocStart(), VD->getLocStart()), + diag(VD->getBeginLoc(), "use char") << FixItHint::CreateReplacement( + CharSourceRange::getTokenRange(VD->getBeginLoc(), VD->getBeginLoc()), "char"); } }; @@ -52,7 +52,7 @@ auto *Cond = If->getCond(); SourceRange Range = Cond->getSourceRange(); if (auto *D = If->getConditionVariable()) { - Range = SourceRange(D->getLocStart(), D->getLocEnd()); + Range = SourceRange(D->getBeginLoc(), D->getLocEnd()); } diag(Range.getBegin(), "the cake is a lie") << FixItHint::CreateReplacement( CharSourceRange::getTokenRange(Range), "false"); Index: clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp =================================================================== --- clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp +++ clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp @@ -39,9 +39,9 @@ Inserter->createUsingDeclaration(*Result.Context, *Call, "::foo::func"); if (Hint.hasValue()) - diag(Call->getLocStart(), "Fix for testing") << Hint.getValue(); + diag(Call->getBeginLoc(), "Fix for testing") << Hint.getValue(); - diag(Call->getLocStart(), "insert call") + diag(Call->getBeginLoc(), "insert call") << clang::FixItHint::CreateReplacement( Call->getCallee()->getSourceRange(), Inserter->getShortName(*Result.Context, *Call, "::foo::func"));