Index: docs/RAVFrontendAction.rst =================================================================== --- docs/RAVFrontendAction.rst +++ docs/RAVFrontendAction.rst @@ -128,7 +128,7 @@ if (Declaration->getQualifiedNameAsString() == "n::m::C") { // getFullLoc uses the ASTContext's SourceManager to resolve the source // location and break it up into its line and column parts. - FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getLocStart()); + FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getBeginLoc()); if (FullLocation.isValid()) llvm::outs() << "Found declaration at " << FullLocation.getSpellingLineNumber() << ":" @@ -160,7 +160,7 @@ bool VisitCXXRecordDecl(CXXRecordDecl *Declaration) { if (Declaration->getQualifiedNameAsString() == "n::m::C") { - FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getLocStart()); + FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getBeginLoc()); if (FullLocation.isValid()) llvm::outs() << "Found declaration at " << FullLocation.getSpellingLineNumber() << ":" Index: include/clang/AST/Comment.h =================================================================== --- include/clang/AST/Comment.h +++ include/clang/AST/Comment.h @@ -353,7 +353,7 @@ } SourceRange getCommandNameRange() const { - return SourceRange(getLocStart().getLocWithOffset(-1), + return SourceRange(getBeginLoc().getLocWithOffset(-1), getLocEnd()); } @@ -568,9 +568,9 @@ ParagraphCommentBits.IsWhitespaceValid = false; - setSourceRange(SourceRange(Content.front()->getLocStart(), + setSourceRange(SourceRange(Content.front()->getBeginLoc(), Content.back()->getLocEnd())); - setLocation(Content.front()->getLocStart()); + setLocation(Content.front()->getBeginLoc()); } static bool classof(const Comment *C) { @@ -664,13 +664,13 @@ } SourceLocation getCommandNameBeginLoc() const { - return getLocStart().getLocWithOffset(1); + return getBeginLoc().getLocWithOffset(1); } SourceRange getCommandNameRange(const CommandTraits &Traits) const { StringRef Name = getCommandName(Traits); return SourceRange(getCommandNameBeginLoc(), - getLocStart().getLocWithOffset(1 + Name.size())); + getBeginLoc().getLocWithOffset(1 + Name.size())); } unsigned getNumArgs() const { @@ -690,7 +690,7 @@ if (Args.size() > 0) { SourceLocation NewLocEnd = Args.back().Range.getEnd(); if (NewLocEnd.isValid()) - setSourceRange(SourceRange(getLocStart(), NewLocEnd)); + setSourceRange(SourceRange(getBeginLoc(), NewLocEnd)); } } @@ -706,7 +706,7 @@ Paragraph = PC; SourceLocation NewLocEnd = PC->getLocEnd(); if (NewLocEnd.isValid()) - setSourceRange(SourceRange(getLocStart(), NewLocEnd)); + setSourceRange(SourceRange(getBeginLoc(), NewLocEnd)); } CommandMarkerKind getCommandMarker() const LLVM_READONLY { @@ -1107,9 +1107,9 @@ if (Blocks.empty()) return; - setSourceRange(SourceRange(Blocks.front()->getLocStart(), + setSourceRange(SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getLocEnd())); - setLocation(Blocks.front()->getLocStart()); + setLocation(Blocks.front()->getBeginLoc()); } static bool classof(const Comment *C) { Index: include/clang/AST/Decl.h =================================================================== --- include/clang/AST/Decl.h +++ include/clang/AST/Decl.h @@ -3149,7 +3149,7 @@ /// Return SourceLocation representing start of source /// range ignoring outer template declarations. - SourceLocation getInnerLocStart() const { return getLocStart(); } + SourceLocation getInnerLocStart() const { return getBeginLoc(); } /// Return SourceLocation representing start of source /// range taking into account any outer template declarations. Index: include/clang/AST/DeclCXX.h =================================================================== --- include/clang/AST/DeclCXX.h +++ include/clang/AST/DeclCXX.h @@ -240,7 +240,7 @@ /// Get the location at which the base class type was written. SourceLocation getBaseTypeLoc() const LLVM_READONLY { - return BaseTypeInfo->getTypeLoc().getLocStart(); + return BaseTypeInfo->getTypeLoc().getBeginLoc(); } /// Determines whether the base class is a virtual base class (or not). @@ -3701,7 +3701,7 @@ public: /// Returns the source location of the 'using' keyword. - SourceLocation getUsingLoc() const { return getLocStart(); } + SourceLocation getUsingLoc() const { return getBeginLoc(); } /// Returns the source location of the 'typename' keyword. SourceLocation getTypenameLoc() const { return TypenameLocation; } Index: include/clang/AST/DeclObjC.h =================================================================== --- include/clang/AST/DeclObjC.h +++ include/clang/AST/DeclObjC.h @@ -328,7 +328,7 @@ SourceLocation getSelectorStartLoc() const { if (isImplicit()) - return getLocStart(); + return getBeginLoc(); return getSelectorLoc(0); } Index: include/clang/AST/DeclarationName.h =================================================================== --- include/clang/AST/DeclarationName.h +++ include/clang/AST/DeclarationName.h @@ -559,7 +559,7 @@ /// getSourceRange - The range of the declaration name. SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getLocStart(), getLocEnd()); + return SourceRange(getBeginLoc(), getLocEnd()); } SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } @@ -567,7 +567,7 @@ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { SourceLocation EndLoc = getEndLocPrivate(); - return EndLoc.isValid() ? EndLoc : getLocStart(); + return EndLoc.isValid() ? EndLoc : getBeginLoc(); } private: SourceLocation getEndLocPrivate() const; Index: include/clang/AST/Expr.h =================================================================== --- include/clang/AST/Expr.h +++ include/clang/AST/Expr.h @@ -906,7 +906,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return SourceExpr ? SourceExpr->getLocStart() : Loc; + return SourceExpr ? SourceExpr->getBeginLoc() : Loc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -1549,7 +1549,7 @@ void setSubExpr(Expr *E) { Val = E; } SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } - SourceLocation getBeginLoc() const LLVM_READONLY { return Val->getLocStart(); } + SourceLocation getBeginLoc() const LLVM_READONLY { return Val->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return Val->getLocEnd(); } @@ -1894,7 +1894,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return isPostfix() ? Val->getLocStart() : Loc; + return isPostfix() ? Val->getBeginLoc() : Loc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -2280,7 +2280,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getLHS()->getLocStart(); + return getLHS()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; } @@ -2796,7 +2796,7 @@ if (!Init) return SourceLocation(); if (LParenLoc.isInvalid()) - return Init->getLocStart(); + return Init->getBeginLoc(); return LParenLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -2977,7 +2977,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getSubExpr()->getLocStart(); + return getSubExpr()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -3165,7 +3165,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getLHS()->getLocStart(); + return getLHS()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -3450,7 +3450,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getCond()->getLocStart(); + return getCond()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -3540,7 +3540,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getCommon()->getLocStart(); + return getCommon()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -4445,7 +4445,7 @@ return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc(); } SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getLocStart(), getLocEnd()); + return SourceRange(getBeginLoc(), getLocEnd()); } }; @@ -4684,7 +4684,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getCommonExpr()->getLocStart(); + return getCommonExpr()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -5000,7 +5000,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return AccessorLoc; } @@ -5246,7 +5246,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getSyntacticForm()->getLocStart(); + return getSyntacticForm()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { Index: include/clang/AST/ExprCXX.h =================================================================== --- include/clang/AST/ExprCXX.h +++ include/clang/AST/ExprCXX.h @@ -128,7 +128,7 @@ SourceLocation getExprLoc() const LLVM_READONLY { return (Operator < OO_Plus || Operator >= OO_Arrow || Operator == OO_PlusPlus || Operator == OO_MinusMinus) - ? getLocStart() + ? getBeginLoc() : getOperatorLoc(); } @@ -193,7 +193,7 @@ if (CLoc.isValid()) return CLoc; - return getLocStart(); + return getBeginLoc(); } static bool classof(const Stmt *T) { @@ -512,7 +512,7 @@ SourceLocation getBeginLoc() const { if (getLiteralOperatorKind() == LOK_Template) return getRParenLoc(); - return getArg(0)->getLocStart(); + return getArg(0)->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -623,7 +623,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return SubExpr->getLocStart(); + return SubExpr->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -765,7 +765,7 @@ MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {} SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getLocStart(), getLocEnd()); + return SourceRange(getBeginLoc(), getLocEnd()); } bool isImplicitAccess() const { @@ -775,7 +775,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const { if (!isImplicitAccess()) - return BaseExpr->getLocStart(); + return BaseExpr->getBeginLoc(); else if (QualifierLoc) return QualifierLoc.getBeginLoc(); else @@ -845,7 +845,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -1251,7 +1251,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return SubExpr->getLocStart(); + return SubExpr->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -2367,7 +2367,7 @@ } SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } - SourceLocation getBeginLoc() const LLVM_READONLY {return Base->getLocStart();} + SourceLocation getBeginLoc() const LLVM_READONLY {return Base->getBeginLoc();} SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY; @@ -2877,7 +2877,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { if (NestedNameSpecifierLoc l = getQualifierLoc()) return l.getBeginLoc(); - return getNameInfo().getLocStart(); + return getNameInfo().getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -3025,7 +3025,7 @@ return {getTemplateArgs(), getNumTemplateArgs()}; } - /// Note: getLocStart() is the start of the whole DependentScopeDeclRefExpr, + /// Note: getBeginLoc() is the start of the whole DependentScopeDeclRefExpr, /// and differs from getLocation().getStart(). SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { @@ -3111,7 +3111,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return SubExpr->getLocStart(); + return SubExpr->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -3463,7 +3463,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { if (!isImplicitAccess()) - return Base->getLocStart(); + return Base->getBeginLoc(); if (getQualifier()) return getQualifierLoc().getBeginLoc(); return MemberNameInfo.getBeginLoc(); @@ -3615,10 +3615,10 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { if (!isImplicitAccess()) - return Base->getLocStart(); + return Base->getBeginLoc(); if (NestedNameSpecifierLoc l = getQualifierLoc()) return l.getBeginLoc(); - return getMemberNameInfo().getLocStart(); + return getMemberNameInfo().getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -3769,7 +3769,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return Pattern->getLocStart(); + return Pattern->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -4196,7 +4196,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getTemporary()->getLocStart(); + return getTemporary()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } Index: include/clang/AST/ExprObjC.h =================================================================== --- include/clang/AST/ExprObjC.h +++ include/clang/AST/ExprObjC.h @@ -574,7 +574,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return isFreeIvar() ? Loc : getBase()->getLocStart(); + return isFreeIvar() ? Loc : getBase()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return Loc; } @@ -762,7 +762,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return isObjectReceiver() ? getBase()->getLocStart() :getReceiverLocation(); + return isObjectReceiver() ? getBase()->getBeginLoc() :getReceiverLocation(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -860,7 +860,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return SubExprs[BASE]->getLocStart(); + return SubExprs[BASE]->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -1386,7 +1386,7 @@ SourceLocation getSelectorStartLoc() const { if (isImplicit()) - return getLocStart(); + return getBeginLoc(); return getSelectorLoc(0); } @@ -1498,7 +1498,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation getBaseLocEnd() const LLVM_READONLY { @@ -1577,7 +1577,7 @@ // Source locations are determined by the subexpression. SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return Operand->getLocStart(); + return Operand->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return Operand->getLocEnd();} Index: include/clang/AST/ExprOpenMP.h =================================================================== --- include/clang/AST/ExprOpenMP.h +++ include/clang/AST/ExprOpenMP.h @@ -103,7 +103,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; } Index: include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h =================================================================== --- include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h +++ include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h @@ -99,7 +99,7 @@ LexicallyNestedDeclarations.clear(); for (++I; I != E; ++I) { Decl *Sibling = *I; - if (!SM.isBeforeInTranslationUnit(Sibling->getLocStart(), + if (!SM.isBeforeInTranslationUnit(Sibling->getBeginLoc(), Child->getLocEnd())) break; if (!BaseType::canIgnoreChildDeclWhileTraversingDeclContext(Sibling)) Index: include/clang/AST/RawCommentList.h =================================================================== --- include/clang/AST/RawCommentList.h +++ include/clang/AST/RawCommentList.h @@ -182,7 +182,7 @@ explicit BeforeThanCompare(const SourceManager &SM) : SM(SM) { } bool operator()(const RawComment &LHS, const RawComment &RHS) { - return SM.isBeforeInTranslationUnit(LHS.getLocStart(), RHS.getLocStart()); + return SM.isBeforeInTranslationUnit(LHS.getBeginLoc(), RHS.getBeginLoc()); } bool operator()(const RawComment *LHS, const RawComment *RHS) { Index: include/clang/AST/Stmt.h =================================================================== --- include/clang/AST/Stmt.h +++ include/clang/AST/Stmt.h @@ -2310,7 +2310,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getCapturedStmt()->getLocStart(); + return getCapturedStmt()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } Index: include/clang/AST/StmtCXX.h =================================================================== --- include/clang/AST/StmtCXX.h +++ include/clang/AST/StmtCXX.h @@ -408,8 +408,8 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return getBody() ? getBody()->getLocStart() - : getPromiseDecl()->getLocStart(); + return getBody() ? getBody()->getBeginLoc() + : getPromiseDecl()->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { @@ -477,7 +477,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getOperand() ? getOperand()->getLocEnd() : getLocStart(); + return getOperand() ? getOperand()->getLocEnd() : getBeginLoc(); } child_range children() { Index: include/clang/AST/StmtDataCollectors.td =================================================================== --- include/clang/AST/StmtDataCollectors.td +++ include/clang/AST/StmtDataCollectors.td @@ -3,7 +3,7 @@ addData(S->getStmtClass()); // This ensures that non-macro-generated code isn't identical to // macro-generated code. - addData(data_collection::getMacroStack(S->getLocStart(), Context)); + addData(data_collection::getMacroStack(S->getBeginLoc(), Context)); addData(data_collection::getMacroStack(S->getLocEnd(), Context)); }]; } Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -245,7 +245,7 @@ AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) { auto &SourceManager = Finder->getASTContext().getSourceManager(); return SourceManager.isInMainFile( - SourceManager.getExpansionLoc(Node.getLocStart())); + SourceManager.getExpansionLoc(Node.getBeginLoc())); } /// Matches AST nodes that were expanded within system-header-files. @@ -265,7 +265,7 @@ AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader, AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc)) { auto &SourceManager = Finder->getASTContext().getSourceManager(); - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); + auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc()); if (ExpansionLoc.isInvalid()) { return false; } @@ -291,7 +291,7 @@ AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), std::string, RegExp) { auto &SourceManager = Finder->getASTContext().getSourceManager(); - auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getLocStart()); + auto ExpansionLoc = SourceManager.getExpansionLoc(Node.getBeginLoc()); if (ExpansionLoc.isInvalid()) { return false; } Index: include/clang/Sema/Initialization.h =================================================================== --- include/clang/Sema/Initialization.h +++ include/clang/Sema/Initialization.h @@ -671,10 +671,10 @@ static InitializationKind CreateForInit(SourceLocation Loc, bool DirectInit, Expr *Init) { if (!Init) return CreateDefault(Loc); - if (!DirectInit) return CreateCopy(Loc, Init->getLocStart()); + if (!DirectInit) return CreateCopy(Loc, Init->getBeginLoc()); if (isa(Init)) - return CreateDirectList(Loc, Init->getLocStart(), Init->getLocEnd()); - return CreateDirect(Loc, Init->getLocStart(), Init->getLocEnd()); + return CreateDirectList(Loc, Init->getBeginLoc(), Init->getLocEnd()); + return CreateDirect(Loc, Init->getBeginLoc(), Init->getLocEnd()); } /// Determine the initialization kind. Index: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -181,7 +181,7 @@ PathDiagnosticLocation(const Stmt *s, const SourceManager &sm, LocationOrAnalysisDeclContext lac) - : K(s->getLocStart().isValid() ? StmtK : SingleLocK), + : K(s->getBeginLoc().isValid() ? StmtK : SingleLocK), S(K == StmtK ? s : nullptr), SM(&sm), Loc(genLocation(SourceLocation(), lac)), Range(genRange(lac)) { assert(K == SingleLocK || S); Index: lib/ARCMigrate/ObjCMT.cpp =================================================================== --- lib/ARCMigrate/ObjCMT.cpp +++ lib/ARCMigrate/ObjCMT.cpp @@ -269,7 +269,7 @@ // rewrite getter method expression into: receiver.property or // (receiver).property if (NeedsParen) { - commit.insertBefore(receiver->getLocStart(), "("); + commit.insertBefore(receiver->getBeginLoc(), "("); PropertyDotString = ")."; } else @@ -293,7 +293,7 @@ SourceLocation BegLoc = ReceiverIsSuper ? Msg->getSuperLoc() : receiver->getLocEnd(); BegLoc = PP.getLocForEndOfToken(BegLoc); - SourceLocation EndLoc = RHS->getLocStart(); + SourceLocation EndLoc = RHS->getBeginLoc(); EndLoc = EndLoc.getLocWithOffset(-1); const char *colon = PP.getSourceManager().getCharacterData(EndLoc); // Add a space after '=' if there is no space between RHS and '=' @@ -545,14 +545,14 @@ SourceLocation EndGetterSelectorLoc = StartGetterSelectorLoc.getLocWithOffset(GetterSelector.getNameForSlot(0).size()); - commit.replace(CharSourceRange::getCharRange(Getter->getLocStart(), + commit.replace(CharSourceRange::getCharRange(Getter->getBeginLoc(), EndGetterSelectorLoc), PropertyString); if (Setter && AvailabilityArgsMatch) { SourceLocation EndLoc = Setter->getDeclaratorEndLoc(); // Get location past ';' EndLoc = EndLoc.getLocWithOffset(1); - SourceLocation BeginOfSetterDclLoc = Setter->getLocStart(); + SourceLocation BeginOfSetterDclLoc = Setter->getBeginLoc(); // FIXME. This assumes that setter decl; is immediately preceded by eoln. // It is trying to remove the setter method decl. line entirely. BeginOfSetterDclLoc = BeginOfSetterDclLoc.getLocWithOffset(-1); @@ -720,14 +720,14 @@ ClassString += TypedefDcl->getIdentifier()->getName(); ClassString += ')'; - SourceRange R(EnumDcl->getLocStart(), EnumDcl->getLocStart()); + SourceRange R(EnumDcl->getBeginLoc(), EnumDcl->getBeginLoc()); commit.replace(R, ClassString); SourceLocation EndOfEnumDclLoc = EnumDcl->getLocEnd(); EndOfEnumDclLoc = trans::findSemiAfterLocation(EndOfEnumDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndOfEnumDclLoc.isValid()) { - SourceRange EnumDclRange(EnumDcl->getLocStart(), EndOfEnumDclLoc); - commit.insertFromRange(TypedefDcl->getLocStart(), EnumDclRange); + SourceRange EnumDclRange(EnumDcl->getBeginLoc(), EndOfEnumDclLoc); + commit.insertFromRange(TypedefDcl->getBeginLoc(), EnumDclRange); } else return false; @@ -736,7 +736,7 @@ EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc, NS.getASTContext(), /*IsDecl*/true); if (EndTypedefDclLoc.isValid()) { - SourceRange TDRange(TypedefDcl->getLocStart(), EndTypedefDclLoc); + SourceRange TDRange(TypedefDcl->getBeginLoc(), EndTypedefDclLoc); commit.remove(TDRange); } else @@ -745,7 +745,7 @@ EndOfEnumDclLoc = trans::findLocationAfterSemi(EnumDcl->getLocEnd(), NS.getASTContext(), /*IsDecl*/true); if (EndOfEnumDclLoc.isValid()) { - SourceLocation BeginOfEnumDclLoc = EnumDcl->getLocStart(); + SourceLocation BeginOfEnumDclLoc = EnumDcl->getBeginLoc(); // FIXME. This assumes that enum decl; is immediately preceded by eoln. // It is trying to remove the enum decl. lines entirely. BeginOfEnumDclLoc = BeginOfEnumDclLoc.getLocWithOffset(-1); @@ -775,7 +775,7 @@ SourceLocation EndLoc = EnumDcl->getBraceRange().getBegin(); if (EndLoc.isInvalid()) return; - CharSourceRange R = CharSourceRange::getCharRange(EnumDcl->getLocStart(), EndLoc); + CharSourceRange R = CharSourceRange::getCharRange(EnumDcl->getBeginLoc(), EndLoc); commit.replace(R, ClassString); // This is to remove spaces between '}' and typedef name. SourceLocation StartTypedefLoc = EnumDcl->getLocEnd(); @@ -928,7 +928,7 @@ if (const EnumType *EnumTy = qt->getAs()) { if (EnumTy->getDecl() == EnumDcl) { bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl); - if (!InsertFoundation(Ctx, TypedefDcl->getLocStart())) + if (!InsertFoundation(Ctx, TypedefDcl->getBeginLoc())) return false; edit::Commit commit(*Editor); rewriteToNSMacroDecl(Ctx, EnumDcl, TypedefDcl, *NSAPIObj, commit, !NSOptions); @@ -941,7 +941,7 @@ // We may still use NS_OPTIONS based on what we find in the enumertor list. bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl); - if (!InsertFoundation(Ctx, TypedefDcl->getLocStart())) + if (!InsertFoundation(Ctx, TypedefDcl->getBeginLoc())) return false; edit::Commit commit(*Editor); bool Res = rewriteToNSEnumDecl(EnumDcl, TypedefDcl, *NSAPIObj, @@ -964,7 +964,7 @@ ClassString = "instancetype"; } else { - R = SourceRange(OM->getLocStart(), OM->getLocStart()); + R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc()); ClassString = OM->isInstanceMethod() ? '-' : '+'; ClassString += " (instancetype)"; } @@ -986,7 +986,7 @@ } } else { - R = SourceRange(OM->getLocStart(), OM->getLocStart()); + R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc()); ClassString = "+ ("; ClassString += IDecl->getName(); ClassString += "*)"; } @@ -1395,7 +1395,7 @@ CFFunctionIBCandidates[CFFunctionIBCandidates.size()-1]; const char *PragmaString = "\nCF_IMPLICIT_BRIDGING_ENABLED\n\n"; edit::Commit commit(*Editor); - commit.insertBefore(FirstFD->getLocStart(), PragmaString); + commit.insertBefore(FirstFD->getBeginLoc(), PragmaString); PragmaString = "\n\nCF_IMPLICIT_BRIDGING_DISABLED\n"; SourceLocation EndLoc = LastFD->getLocEnd(); // get location just past end of function location. Index: lib/ARCMigrate/TransAPIUses.cpp =================================================================== --- lib/ARCMigrate/TransAPIUses.cpp +++ lib/ARCMigrate/TransAPIUses.cpp @@ -75,7 +75,7 @@ return true; if (pointee.getObjCLifetime() > Qualifiers::OCL_ExplicitNone) - Pass.TA.report(parm->getLocStart(), + Pass.TA.report(parm->getBeginLoc(), diag::err_arcmt_nsinvocation_ownership, parm->getSourceRange()) << selName; Index: lib/ARCMigrate/TransAutoreleasePool.cpp =================================================================== --- lib/ARCMigrate/TransAutoreleasePool.cpp +++ lib/ARCMigrate/TransAutoreleasePool.cpp @@ -137,12 +137,12 @@ Pass.TA.increaseIndentation( SourceRange(scope.getIndentedRange().getBegin(), (*retI)->getLocEnd()), - scope.CompoundParent->getLocStart()); + scope.CompoundParent->getBeginLoc()); } else { Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {"); Pass.TA.replaceStmt(*scope.End, "}"); Pass.TA.increaseIndentation(scope.getIndentedRange(), - scope.CompoundParent->getLocStart()); + scope.CompoundParent->getBeginLoc()); } } @@ -241,7 +241,7 @@ Stmt::child_iterator rangeE = Begin; for (Stmt::child_iterator I = rangeS; I != End; ++I) ++rangeE; - return SourceRange((*rangeS)->getLocStart(), (*rangeE)->getLocEnd()); + return SourceRange((*rangeS)->getBeginLoc(), (*rangeE)->getLocEnd()); } }; @@ -256,8 +256,8 @@ SourceLocation &declarationLoc) : Ctx(ctx), referenceLoc(referenceLoc), declarationLoc(declarationLoc) { - ScopeRange = SourceRange((*scope.Begin)->getLocStart(), - (*scope.End)->getLocStart()); + ScopeRange = SourceRange((*scope.Begin)->getBeginLoc(), + (*scope.End)->getBeginLoc()); } bool VisitDeclRefExpr(DeclRefExpr *E) { @@ -328,9 +328,9 @@ "NSAutoreleasePool scope that it was declared in", referenceLoc); Pass.TA.reportNote("name declared here", declarationLoc); Pass.TA.reportNote("intended @autoreleasepool scope begins here", - (*scope.Begin)->getLocStart()); + (*scope.Begin)->getBeginLoc()); Pass.TA.reportNote("intended @autoreleasepool scope ends here", - (*scope.End)->getLocStart()); + (*scope.End)->getBeginLoc()); return; } } Index: lib/ARCMigrate/TransGCCalls.cpp =================================================================== --- lib/ARCMigrate/TransGCCalls.cpp +++ lib/ARCMigrate/TransGCCalls.cpp @@ -38,7 +38,7 @@ TransformActions &TA = MigrateCtx.Pass.TA; if (MigrateCtx.isGCOwnedNonObjC(E->getType())) { - TA.report(E->getLocStart(), diag::warn_arcmt_nsalloc_realloc, + TA.report(E->getBeginLoc(), diag::warn_arcmt_nsalloc_realloc, E->getSourceRange()); return true; } Index: lib/ARCMigrate/TransProtectedScope.cpp =================================================================== --- lib/ARCMigrate/TransProtectedScope.cpp +++ lib/ARCMigrate/TransProtectedScope.cpp @@ -77,8 +77,8 @@ Curr = S->getSwitchCaseList(); // We iterate over case statements in reverse source-order. while (Curr) { - Cases.push_back(CaseInfo(Curr,SourceRange(Curr->getLocStart(), NextLoc))); - NextLoc = Curr->getLocStart(); + Cases.push_back(CaseInfo(Curr,SourceRange(Curr->getBeginLoc(), NextLoc))); + NextLoc = Curr->getBeginLoc(); Curr = Curr->getNextSwitchCase(); } return true; Index: lib/ARCMigrate/TransRetainReleaseDealloc.cpp =================================================================== --- lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -73,7 +73,7 @@ // and emit an error to force the user to restructure their code. Pass.TA.reportError("it is not safe to remove an unused 'autorelease' " "message; its receiver may be destroyed immediately", - E->getLocStart(), E->getSourceRange()); + E->getBeginLoc(), E->getSourceRange()); return true; } } @@ -89,7 +89,7 @@ std::string err = "it is not safe to remove '"; err += E->getSelector().getAsString() + "' message on " "an __unsafe_unretained type"; - Pass.TA.reportError(err, rec->getLocStart()); + Pass.TA.reportError(err, rec->getBeginLoc()); return true; } @@ -98,7 +98,7 @@ std::string err = "it is not safe to remove '"; err += E->getSelector().getAsString() + "' message on " "a global variable"; - Pass.TA.reportError(err, rec->getLocStart()); + Pass.TA.reportError(err, rec->getBeginLoc()); return true; } @@ -106,7 +106,7 @@ Pass.TA.reportError("it is not safe to remove 'retain' " "message on the result of a 'delegate' message; " "the object that was passed to 'setDelegate:' may not be " - "properly retained", rec->getLocStart()); + "properly retained", rec->getBeginLoc()); return true; } } Index: lib/ARCMigrate/TransUnbridgedCasts.cpp =================================================================== --- lib/ARCMigrate/TransUnbridgedCasts.cpp +++ lib/ARCMigrate/TransUnbridgedCasts.cpp @@ -209,7 +209,7 @@ // We will remove the compiler diagnostic. if (!TA.hasDiagnostic(diag::err_arc_mismatched_cast, diag::err_arc_cast_requires_bridge, - E->getLocStart())) { + E->getBeginLoc())) { Trans.abort(); return; } @@ -226,12 +226,12 @@ TA.clearDiagnostic(diag::err_arc_mismatched_cast, diag::err_arc_cast_requires_bridge, - E->getLocStart()); + E->getBeginLoc()); if (Kind == OBC_Bridge || !Pass.CFBridgingFunctionsDefined()) { if (CStyleCastExpr *CCE = dyn_cast(E)) { TA.insertAfterToken(CCE->getLParenLoc(), bridge); } else { - SourceLocation insertLoc = E->getSubExpr()->getLocStart(); + SourceLocation insertLoc = E->getSubExpr()->getBeginLoc(); SmallString<128> newCast; newCast += '('; newCast += bridge; @@ -251,7 +251,7 @@ SmallString<32> BridgeCall; Expr *WrapE = E->getSubExpr(); - SourceLocation InsertLoc = WrapE->getLocStart(); + SourceLocation InsertLoc = WrapE->getBeginLoc(); SourceManager &SM = Pass.Ctx.getSourceManager(); char PrevChar = *SM.getCharacterData(InsertLoc.getLocWithOffset(-1)); @@ -368,7 +368,7 @@ err += family == OMF_autorelease ? "autorelease" : "release"; err += "' message; a __bridge cast may result in a pointer to a " "destroyed object and a __bridge_retained may leak the object"; - Pass.TA.reportError(err, E->getLocStart(), + Pass.TA.reportError(err, E->getBeginLoc(), E->getSubExpr()->getSourceRange()); Stmt *parent = E; do { @@ -380,7 +380,7 @@ "to '"; note += E->getSubExpr()->getType().getAsString(Pass.Ctx.getPrintingPolicy()); note += "' to have the object automatically autoreleased"; - Pass.TA.reportNote(note, retS->getLocStart()); + Pass.TA.reportNote(note, retS->getBeginLoc()); } } Index: lib/ARCMigrate/TransformActions.cpp =================================================================== --- lib/ARCMigrate/TransformActions.cpp +++ lib/ARCMigrate/TransformActions.cpp @@ -350,7 +350,7 @@ void TransformActionsImpl::replaceStmt(Stmt *S, StringRef text) { assert(IsInTransaction && "Actions only allowed during a transaction"); text = getUniqueText(text); - insert(S->getLocStart(), text); + insert(S->getBeginLoc(), text); removeStmt(S); } Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -192,7 +192,7 @@ isa(D) || isa(D) || isa(D)) - DeclLoc = D->getLocStart(); + DeclLoc = D->getBeginLoc(); else { DeclLoc = D->getLocation(); if (DeclLoc.isMacroID()) { @@ -200,7 +200,7 @@ // If location of the typedef name is in a macro, it is because being // declared via a macro. Try using declaration's starting location as // the "declaration location". - DeclLoc = D->getLocStart(); + DeclLoc = D->getBeginLoc(); } else if (const auto *TD = dyn_cast(D)) { // If location of the tag decl is inside a macro, but the spelling of // the tag name comes from a macro argument, it looks like a special Index: lib/AST/ASTDumper.cpp =================================================================== --- lib/AST/ASTDumper.cpp +++ lib/AST/ASTDumper.cpp @@ -2032,7 +2032,7 @@ << ClauseName.drop_front() << "Clause"; } dumpPointer(C); - dumpSourceRange(SourceRange(C->getLocStart(), C->getLocEnd())); + dumpSourceRange(SourceRange(C->getBeginLoc(), C->getLocEnd())); if (C->isImplicit()) OS << " "; for (auto *S : C->children()) Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -1823,7 +1823,7 @@ if (!ToNamespace) { if (GetImportedOrCreateDecl( ToNamespace, D, Importer.getToContext(), DC, D->isInline(), - Importer.Import(D->getLocStart()), Loc, Name.getAsIdentifierInfo(), + Importer.Import(D->getBeginLoc()), Loc, Name.getAsIdentifierInfo(), /*PrevDecl=*/nullptr)) return ToNamespace; ToNamespace->setLexicalDeclContext(LexicalDC); @@ -1932,7 +1932,7 @@ // Create the new typedef node. TypeSourceInfo *TInfo = Importer.Import(D->getTypeSourceInfo()); - SourceLocation StartL = Importer.Import(D->getLocStart()); + SourceLocation StartL = Importer.Import(D->getBeginLoc()); TypedefNameDecl *ToTypedef; if (IsAlias) { @@ -2041,7 +2041,7 @@ ? GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Importer.Import(D->getLocation()), Name.getAsIdentifierInfo(), - Importer.Import(D->getLocStart())) + Importer.Import(D->getBeginLoc())) : GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Importer.Import(D->getLocation()), Name.getAsIdentifierInfo())) @@ -2110,7 +2110,7 @@ // Create the enum declaration. EnumDecl *D2; if (GetImportedOrCreateDecl( - D2, D, Importer.getToContext(), DC, Importer.Import(D->getLocStart()), + D2, D, Importer.getToContext(), DC, Importer.Import(D->getBeginLoc()), Loc, Name.getAsIdentifierInfo(), nullptr, D->isScoped(), D->isScopedUsingClassTag(), D->isFixed())) return D2; @@ -2271,7 +2271,7 @@ // Create the record declaration. RecordDecl *D2 = AdoptDecl; - SourceLocation StartLoc = Importer.Import(D->getLocStart()); + SourceLocation StartLoc = Importer.Import(D->getBeginLoc()); if (!D2) { CXXRecordDecl *D2CXX = nullptr; if (auto *DCXX = dyn_cast(D)) { @@ -4223,7 +4223,7 @@ Property->getQueryKind()); if (!ToImpl) { if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC, - Importer.Import(D->getLocStart()), + Importer.Import(D->getBeginLoc()), Importer.Import(D->getLocation()), Property, D->getPropertyImplementation(), Ivar, Importer.Import(D->getPropertyIvarDeclLoc()))) @@ -4278,7 +4278,7 @@ (void)GetImportedOrCreateDecl( ToD, D, Importer.getToContext(), Importer.getToContext().getTranslationUnitDecl(), - Importer.Import(D->getLocStart()), Importer.Import(D->getLocation()), + Importer.Import(D->getBeginLoc()), Importer.Import(D->getLocation()), D->getDepth(), D->getIndex(), Importer.Import(D->getIdentifier()), D->wasDeclaredWithTypename(), D->isParameterPack()); return ToD; @@ -4490,7 +4490,7 @@ } // Import the location of this declaration. - SourceLocation StartLoc = Importer.Import(D->getLocStart()); + SourceLocation StartLoc = Importer.Import(D->getBeginLoc()); SourceLocation IdLoc = Importer.Import(D->getLocation()); // Import template arguments. @@ -4718,7 +4718,7 @@ } // Import the location of this declaration. - SourceLocation StartLoc = Importer.Import(D->getLocStart()); + SourceLocation StartLoc = Importer.Import(D->getBeginLoc()); SourceLocation IdLoc = Importer.Import(D->getLocation()); // Import template arguments. @@ -4911,7 +4911,7 @@ } Stmt *ASTNodeImporter::VisitStmt(Stmt *S) { - Importer.FromDiag(S->getLocStart(), diag::err_unsupported_ast_node) + Importer.FromDiag(S->getBeginLoc(), diag::err_unsupported_ast_node) << S->getStmtClassName(); return nullptr; } @@ -5428,7 +5428,7 @@ // Import Expressions //---------------------------------------------------------------------------- Expr *ASTNodeImporter::VisitExpr(Expr *E) { - Importer.FromDiag(E->getLocStart(), diag::err_unsupported_ast_node) + Importer.FromDiag(E->getBeginLoc(), diag::err_unsupported_ast_node) << E->getStmtClassName(); return nullptr; } @@ -5457,7 +5457,7 @@ return nullptr; return new (Importer.getToContext()) GNUNullExpr( - T, Importer.Import(E->getLocStart())); + T, Importer.Import(E->getBeginLoc())); } Expr *ASTNodeImporter::VisitPredefinedExpr(PredefinedExpr *E) { @@ -5470,7 +5470,7 @@ return nullptr; return new (Importer.getToContext()) PredefinedExpr( - Importer.Import(E->getLocStart()), T, E->getIdentType(), SL); + Importer.Import(E->getBeginLoc()), T, E->getIdentType(), SL); } Expr *ASTNodeImporter::VisitDeclRefExpr(DeclRefExpr *E) { @@ -5833,7 +5833,7 @@ return nullptr; return new (Importer.getToContext()) ArrayTypeTraitExpr( - Importer.Import(E->getLocStart()), E->getTrait(), ToQueried, + Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried, E->getValue(), Dim, Importer.Import(E->getLocEnd()), T); } @@ -5847,7 +5847,7 @@ return nullptr; return new (Importer.getToContext()) ExpressionTraitExpr( - Importer.Import(E->getLocStart()), E->getTrait(), ToQueried, + Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried, E->getValue(), Importer.Import(E->getLocEnd()), T); } @@ -6032,7 +6032,7 @@ switch (Node.getKind()) { case OffsetOfNode::Array: - Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()), + Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), Node.getArrayExprIndex(), Importer.Import(Node.getLocEnd()))); break; @@ -6048,7 +6048,7 @@ auto *FD = cast_or_null(Importer.Import(Node.getField())); if (!FD) return nullptr; - Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()), FD, + Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), FD, Importer.Import(Node.getLocEnd()))); break; } @@ -6056,7 +6056,7 @@ IdentifierInfo *ToII = Importer.Import(Node.getFieldName()); if (!ToII) return nullptr; - Nodes.push_back(OffsetOfNode(Importer.Import(Node.getLocStart()), ToII, + Nodes.push_back(OffsetOfNode(Importer.Import(Node.getBeginLoc()), ToII, Importer.Import(Node.getLocEnd()))); break; } @@ -6098,7 +6098,7 @@ return new (Importer.getToContext()) CXXNoexceptExpr( T, Operand, CanThrow, - Importer.Import(E->getLocStart()), Importer.Import(E->getLocEnd())); + Importer.Import(E->getBeginLoc()), Importer.Import(E->getLocEnd())); } Expr *ASTNodeImporter::VisitCXXThrowExpr(CXXThrowExpr *E) { @@ -6304,7 +6304,7 @@ E->doesUsualArrayDeleteWantSize(), OperatorDeleteDecl, ToArg, - Importer.Import(E->getLocStart())); + Importer.Import(E->getBeginLoc())); } Expr *ASTNodeImporter::VisitCXXConstructExpr(CXXConstructExpr *E) { @@ -6819,7 +6819,7 @@ return nullptr; return CXXDefaultInitExpr::Create( - Importer.getToContext(), Importer.Import(DIE->getLocStart()), ToField); + Importer.getToContext(), Importer.Import(DIE->getBeginLoc()), ToField); } Expr *ASTNodeImporter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) { @@ -6892,7 +6892,7 @@ ToValue = E->getValue(); return TypeTraitExpr::Create( - Importer.getToContext(), ToType, Importer.Import(E->getLocStart()), + Importer.getToContext(), ToType, Importer.Import(E->getBeginLoc()), E->getTrait(), ToArgs, Importer.Import(E->getLocEnd()), ToValue); } @@ -6973,7 +6973,7 @@ return nullptr; return ToContext.getTrivialTypeSourceInfo(T, - Import(FromTSI->getTypeLoc().getLocStart())); + Import(FromTSI->getTypeLoc().getBeginLoc())); } Attr *ASTImporter::Import(const Attr *FromAttr) { Index: lib/AST/ASTStructuralEquivalence.cpp =================================================================== --- lib/AST/ASTStructuralEquivalence.cpp +++ lib/AST/ASTStructuralEquivalence.cpp @@ -1061,9 +1061,9 @@ Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.ToCtx.getTypeDeclType(D2); - Context.Diag2(Base2->getLocStart(), diag::note_odr_base) + Context.Diag2(Base2->getBeginLoc(), diag::note_odr_base) << Base2->getType() << Base2->getSourceRange(); - Context.Diag1(Base1->getLocStart(), diag::note_odr_base) + Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); } return false; @@ -1075,9 +1075,9 @@ Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.ToCtx.getTypeDeclType(D2); - Context.Diag2(Base2->getLocStart(), diag::note_odr_virtual_base) + Context.Diag2(Base2->getBeginLoc(), diag::note_odr_virtual_base) << Base2->isVirtual() << Base2->getSourceRange(); - Context.Diag1(Base1->getLocStart(), diag::note_odr_base) + Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base) << Base1->isVirtual() << Base1->getSourceRange(); } return false; @@ -1126,7 +1126,7 @@ Context.Diag2(D2->getLocation(), diag::warn_odr_tag_type_inconsistent) << Context.ToCtx.getTypeDeclType(D2); const CXXBaseSpecifier *Base1 = D1CXX->bases_begin(); - Context.Diag1(Base1->getLocStart(), diag::note_odr_base) + Context.Diag1(Base1->getBeginLoc(), diag::note_odr_base) << Base1->getType() << Base1->getSourceRange(); Context.Diag2(D2->getLocation(), diag::note_odr_missing_base); } Index: lib/AST/Decl.cpp =================================================================== --- lib/AST/Decl.cpp +++ lib/AST/Decl.cpp @@ -2531,7 +2531,7 @@ // DeclaratorDecl considers the range of postfix types as overlapping with the // declaration name, but this is not the case with parameters in ObjC methods. if (isa(getDeclContext())) - return SourceRange(DeclaratorDecl::getLocStart(), getLocation()); + return SourceRange(DeclaratorDecl::getBeginLoc(), getLocation()); return DeclaratorDecl::getSourceRange(); } @@ -3127,7 +3127,7 @@ // Skip self-referential return types. const SourceManager &SM = getASTContext().getSourceManager(); SourceRange RTRange = FTL.getReturnLoc().getSourceRange(); - SourceLocation Boundary = getNameInfo().getLocStart(); + SourceLocation Boundary = getNameInfo().getBeginLoc(); if (RTRange.isInvalid() || Boundary.isInvalid() || !SM.isBeforeInTranslationUnit(RTRange.getEnd(), Boundary)) return SourceRange(); @@ -4472,14 +4472,14 @@ if (typeIsPostfix(TInfo->getType())) RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd(); } - return SourceRange(getLocStart(), RangeEnd); + return SourceRange(getBeginLoc(), RangeEnd); } SourceRange TypeAliasDecl::getSourceRange() const { - SourceLocation RangeEnd = getLocStart(); + SourceLocation RangeEnd = getBeginLoc(); if (TypeSourceInfo *TInfo = getTypeSourceInfo()) RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd(); - return SourceRange(getLocStart(), RangeEnd); + return SourceRange(getBeginLoc(), RangeEnd); } void FileScopeAsmDecl::anchor() {} Index: lib/AST/DeclObjC.cpp =================================================================== --- lib/AST/DeclObjC.cpp +++ lib/AST/DeclObjC.cpp @@ -350,7 +350,7 @@ SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const { if (TypeSourceInfo *superTInfo = getSuperClassTInfo()) - return superTInfo->getTypeLoc().getLocStart(); + return superTInfo->getTypeLoc().getBeginLoc(); return SourceLocation(); } Index: lib/AST/DeclOpenMP.cpp =================================================================== --- lib/AST/DeclOpenMP.cpp +++ lib/AST/DeclOpenMP.cpp @@ -104,5 +104,5 @@ SourceRange OMPCapturedExprDecl::getSourceRange() const { assert(hasInit()); - return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd()); + return SourceRange(getInit()->getBeginLoc(), getInit()->getLocEnd()); } Index: lib/AST/DeclTemplate.cpp =================================================================== --- lib/AST/DeclTemplate.cpp +++ lib/AST/DeclTemplate.cpp @@ -473,7 +473,7 @@ SourceRange TemplateTypeParmDecl::getSourceRange() const { if (hasDefaultArgument() && !defaultArgumentWasInherited()) - return SourceRange(getLocStart(), + return SourceRange(getBeginLoc(), getDefaultArgumentInfo()->getTypeLoc().getEndLoc()); else return TypeDecl::getSourceRange(); Index: lib/AST/Expr.cpp =================================================================== --- lib/AST/Expr.cpp +++ lib/AST/Expr.cpp @@ -192,7 +192,7 @@ // Amusing macro metaprogramming hack: check whether a class provides // a more specific implementation of getExprLoc(). // -// See also Stmt.cpp:{getLocStart(),getLocEnd()}. +// See also Stmt.cpp:{getBeginLoc(),getLocEnd()}. namespace { /// This implementation is used when a class provides a custom /// implementation of getExprLoc. @@ -209,7 +209,7 @@ template SourceLocation getExprLocImpl(const Expr *expr, SourceLocation (Expr::*v)() const) { - return static_cast(expr)->getLocStart(); + return static_cast(expr)->getBeginLoc(); } } @@ -450,7 +450,7 @@ SourceLocation DeclRefExpr::getBeginLoc() const { if (hasQualifier()) return getQualifierLoc().getBeginLoc(); - return getNameInfo().getLocStart(); + return getNameInfo().getBeginLoc(); } SourceLocation DeclRefExpr::getEndLoc() const { if (hasExplicitTemplateArgs()) @@ -1360,11 +1360,11 @@ SourceLocation CallExpr::getBeginLoc() const { if (isa(this)) - return cast(this)->getLocStart(); + return cast(this)->getBeginLoc(); - SourceLocation begin = getCallee()->getLocStart(); + SourceLocation begin = getCallee()->getBeginLoc(); if (begin.isInvalid() && getNumArgs() > 0 && getArg(0)) - begin = getArg(0)->getLocStart(); + begin = getArg(0)->getBeginLoc(); return begin; } SourceLocation CallExpr::getEndLoc() const { @@ -1538,7 +1538,7 @@ // FIXME: We don't want this to happen. Rather, we should be able to // detect all kinds of implicit accesses more cleanly. - SourceLocation BaseStartLoc = getBase()->getLocStart(); + SourceLocation BaseStartLoc = getBase()->getBeginLoc(); if (BaseStartLoc.isValid()) return BaseStartLoc; return MemberLoc; @@ -2018,7 +2018,7 @@ SourceLocation InitListExpr::getBeginLoc() const { if (InitListExpr *SyntacticForm = getSyntacticForm()) - return SyntacticForm->getLocStart(); + return SyntacticForm->getBeginLoc(); SourceLocation Beg = LBraceLoc; if (Beg.isInvalid()) { // Find the first non-null initializer. @@ -2026,7 +2026,7 @@ E = InitExprs.end(); I != E; ++I) { if (Stmt *S = *I) { - Beg = S->getLocStart(); + Beg = S->getBeginLoc(); break; } } @@ -2251,11 +2251,11 @@ if (HasWarnUnusedResultAttr || FD->hasAttr() || FD->hasAttr()) { WarnE = this; - Loc = CE->getCallee()->getLocStart(); + Loc = CE->getCallee()->getBeginLoc(); R1 = CE->getCallee()->getSourceRange(); if (unsigned NumArgs = CE->getNumArgs()) - R2 = SourceRange(CE->getArg(0)->getLocStart(), + R2 = SourceRange(CE->getArg(0)->getBeginLoc(), CE->getArg(NumArgs-1)->getLocEnd()); return true; } @@ -2273,7 +2273,7 @@ if (const CXXRecordDecl *Type = getType()->getAsCXXRecordDecl()) { if (Type->hasAttr()) { WarnE = this; - Loc = getLocStart(); + Loc = getBeginLoc(); R1 = getSourceRange(); return true; } @@ -2373,7 +2373,7 @@ WarnE = this; if (const CXXFunctionalCastExpr *CXXCE = dyn_cast(this)) { - Loc = CXXCE->getLocStart(); + Loc = CXXCE->getBeginLoc(); R1 = CXXCE->getSubExpr()->getSourceRange(); } else { const CStyleCastExpr *CStyleCE = cast(this); @@ -3843,7 +3843,7 @@ DesignatedInitExpr *DIE = const_cast(this); if (size() == 1) return DIE->getDesignator(0)->getSourceRange(); - return SourceRange(DIE->getDesignator(0)->getLocStart(), + return SourceRange(DIE->getDesignator(0)->getBeginLoc(), DIE->getDesignator(size()-1)->getLocEnd()); } @@ -3922,7 +3922,7 @@ } SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation DesignatedInitUpdateExpr::getEndLoc() const { Index: lib/AST/ExprCXX.cpp =================================================================== --- lib/AST/ExprCXX.cpp +++ lib/AST/ExprCXX.cpp @@ -452,7 +452,7 @@ SourceLocation CXXConstructExpr::getBeginLoc() const { if (isa(this)) - return cast(this)->getLocStart(); + return cast(this)->getBeginLoc(); return Loc; } @@ -486,17 +486,17 @@ return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd()); else // Postfix operator - return SourceRange(getArg(0)->getLocStart(), getOperatorLoc()); + return SourceRange(getArg(0)->getBeginLoc(), getOperatorLoc()); } else if (Kind == OO_Arrow) { return getArg(0)->getSourceRange(); } else if (Kind == OO_Call) { - return SourceRange(getArg(0)->getLocStart(), getRParenLoc()); + return SourceRange(getArg(0)->getBeginLoc(), getRParenLoc()); } else if (Kind == OO_Subscript) { - return SourceRange(getArg(0)->getLocStart(), getRParenLoc()); + return SourceRange(getArg(0)->getBeginLoc(), getRParenLoc()); } else if (getNumArgs() == 1) { return SourceRange(getOperatorLoc(), getArg(0)->getLocEnd()); } else if (getNumArgs() == 2) { - return SourceRange(getArg(0)->getLocStart(), getArg(1)->getLocEnd()); + return SourceRange(getArg(0)->getBeginLoc(), getArg(1)->getLocEnd()); } else { return getOperatorLoc(); } @@ -692,7 +692,7 @@ } SourceLocation CXXFunctionalCastExpr::getBeginLoc() const { - return getTypeInfoAsWritten()->getTypeLoc().getLocStart(); + return getTypeInfoAsWritten()->getTypeLoc().getBeginLoc(); } SourceLocation CXXFunctionalCastExpr::getEndLoc() const { Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -805,7 +805,7 @@ bool nextStep(const Stmt *S) { if (!StepsLeft) { - FFDiag(S->getLocStart(), diag::note_constexpr_step_limit_exceeded); + FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded); return false; } --StepsLeft; @@ -2506,7 +2506,7 @@ if (Info.checkingPotentialConstantExpression()) return false; // FIXME: implement capture evaluation during constant expr evaluation. - Info.FFDiag(E->getLocStart(), + Info.FFDiag(E->getBeginLoc(), diag::note_unimplemented_constexpr_lambda_feature_ast) << "captures not currently allowed"; return false; @@ -3797,7 +3797,7 @@ const Expr *InitE = VD->getInit(); if (!InitE) { - Info.FFDiag(VD->getLocStart(), diag::note_constexpr_uninitialized) + Info.FFDiag(VD->getBeginLoc(), diag::note_constexpr_uninitialized) << false << VD->getType(); Val = APValue(); return false; @@ -3943,7 +3943,7 @@ case ESR_CaseNotFound: // This can only happen if the switch case is nested within a statement // expression. We have no intention of supporting that. - Info.FFDiag(Found->getLocStart(), diag::note_constexpr_stmt_expr_unsupported); + Info.FFDiag(Found->getBeginLoc(), diag::note_constexpr_stmt_expr_unsupported); return ESR_Failed; } llvm_unreachable("Invalid EvalStmtResult!"); @@ -4034,7 +4034,7 @@ return ESR_Succeeded; } - Info.FFDiag(S->getLocStart()); + Info.FFDiag(S->getBeginLoc()); return ESR_Failed; case Stmt::NullStmtClass: @@ -5029,7 +5029,7 @@ if (BI + 1 == BE) { const Expr *FinalExpr = dyn_cast(*BI); if (!FinalExpr) { - Info.FFDiag((*BI)->getLocStart(), + Info.FFDiag((*BI)->getBeginLoc(), diag::note_constexpr_stmt_expr_unsupported); return false; } @@ -5044,7 +5044,7 @@ // 'break', or 'continue', it would be nice to propagate that to // the outer statement evaluation rather than bailing out. if (ESR != ESR_Failed) - Info.FFDiag((*BI)->getLocStart(), + Info.FFDiag((*BI)->getBeginLoc(), diag::note_constexpr_stmt_expr_unsupported); return false; } @@ -10745,7 +10745,7 @@ Expr::EvalResult EVResult; if (!E->EvaluateAsRValue(EVResult, Ctx) || EVResult.HasSideEffects || !EVResult.Val.isInt()) - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); return NoDiag(); } @@ -10753,7 +10753,7 @@ static ICEDiag CheckICE(const Expr* E, const ASTContext &Ctx) { assert(!E->isValueDependent() && "Should not see value dependent exprs!"); if (!E->getType()->isIntegralOrEnumerationType()) - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); switch (E->getStmtClass()) { #define ABSTRACT_STMT(Node) @@ -10837,7 +10837,7 @@ case Expr::CoawaitExprClass: case Expr::DependentCoawaitExprClass: case Expr::CoyieldExprClass: - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); case Expr::InitListExprClass: { // C++03 [dcl.init]p13: If T is a scalar type, then a declaration of the @@ -10847,7 +10847,7 @@ if (E->isRValue()) if (cast(E)->getNumInits() == 1) return CheckICE(cast(E)->getInit(0), Ctx); - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); } case Expr::SizeOfPackExprClass: @@ -10882,7 +10882,7 @@ const CallExpr *CE = cast(E); if (CE->getBuiltinCallee()) return CheckEvalInICE(E, Ctx); - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); } case Expr::DeclRefExprClass: { if (isa(cast(E)->getDecl())) @@ -10912,7 +10912,7 @@ return ICEDiag(IK_NotICE, cast(E)->getLocation()); } } - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); } case Expr::UnaryOperatorClass: { const UnaryOperator *Exp = cast(E); @@ -10927,7 +10927,7 @@ // C99 6.6/3 allows increment and decrement within unevaluated // subexpressions of constant expressions, but they can never be ICEs // because an ICE cannot contain an lvalue operand. - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); case UO_Extension: case UO_LNot: case UO_Plus: @@ -10954,7 +10954,7 @@ const UnaryExprOrTypeTraitExpr *Exp = cast(E); if ((Exp->getKind() == UETT_SizeOf) && Exp->getTypeOfArgument()->isVariableArrayType()) - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); return NoDiag(); } case Expr::BinaryOperatorClass: { @@ -10976,7 +10976,7 @@ // C99 6.6/3 allows assignments within unevaluated subexpressions of // constant expressions, but they can never be ICEs because an ICE cannot // contain an lvalue operand. - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); case BO_Mul: case BO_Div: @@ -11005,11 +11005,11 @@ if (LHSResult.Kind == IK_ICE && RHSResult.Kind == IK_ICE) { llvm::APSInt REval = Exp->getRHS()->EvaluateKnownConstInt(Ctx); if (REval == 0) - return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart()); + return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc()); if (REval.isSigned() && REval.isAllOnesValue()) { llvm::APSInt LEval = Exp->getLHS()->EvaluateKnownConstInt(Ctx); if (LEval.isMinSignedValue()) - return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart()); + return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc()); } } } @@ -11018,10 +11018,10 @@ // C99 6.6p3 introduces a strange edge case: comma can be in an ICE // if it isn't evaluated. if (LHSResult.Kind == IK_ICE && RHSResult.Kind == IK_ICE) - return ICEDiag(IK_ICEIfUnevaluated, E->getLocStart()); + return ICEDiag(IK_ICEIfUnevaluated, E->getBeginLoc()); } else { // In both C89 and C++, commas in ICEs are illegal. - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); } } return Worst(LHSResult, RHSResult); @@ -11066,7 +11066,7 @@ if (FL->getValue().convertToInteger(IgnoredVal, llvm::APFloat::rmTowardZero, &Ignored) & APFloat::opInvalidOp) - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); return NoDiag(); } } @@ -11079,7 +11079,7 @@ case CK_IntegralCast: return CheckICE(SubExpr, Ctx); default: - return ICEDiag(IK_NotICE, E->getLocStart()); + return ICEDiag(IK_NotICE, E->getBeginLoc()); } } case Expr::BinaryConditionalOperatorClass: { Index: lib/AST/RawCommentList.cpp =================================================================== --- lib/AST/RawCommentList.cpp +++ lib/AST/RawCommentList.cpp @@ -68,8 +68,8 @@ /// column. bool commentsStartOnSameColumn(const SourceManager &SM, const RawComment &R1, const RawComment &R2) { - SourceLocation L1 = R1.getLocStart(); - SourceLocation L2 = R2.getLocStart(); + SourceLocation L1 = R1.getBeginLoc(); + SourceLocation L2 = R2.getBeginLoc(); bool Invalid = false; unsigned C1 = SM.getPresumedColumnNumber(L1, &Invalid); if (!Invalid) { @@ -278,8 +278,8 @@ // Check if the comments are not in source order. while (!Comments.empty() && - !SourceMgr.isBeforeInTranslationUnit(Comments.back()->getLocStart(), - RC.getLocStart())) { + !SourceMgr.isBeforeInTranslationUnit(Comments.back()->getBeginLoc(), + RC.getBeginLoc())) { // If they are, just pop a few last comments that don't fit. // This happens if an \#include directive contains comments. Comments.pop_back(); @@ -316,9 +316,9 @@ (C1.isTrailingComment() && !C2.isTrailingComment() && isOrdinaryKind(C2.getKind()) && commentsStartOnSameColumn(SourceMgr, C1, C2))) && - onlyWhitespaceBetween(SourceMgr, C1.getLocEnd(), C2.getLocStart(), + onlyWhitespaceBetween(SourceMgr, C1.getLocEnd(), C2.getBeginLoc(), /*MaxNewlinesAllowed=*/1)) { - SourceRange MergedRange(C1.getLocStart(), C2.getLocEnd()); + SourceRange MergedRange(C1.getBeginLoc(), C2.getLocEnd()); *Comments.back() = RawComment(SourceMgr, MergedRange, CommentOpts, true); } else { Comments.push_back(new (Allocator) RawComment(RC)); Index: lib/AST/SelectorLocationsKind.cpp =================================================================== --- lib/AST/SelectorLocationsKind.cpp +++ lib/AST/SelectorLocationsKind.cpp @@ -49,12 +49,12 @@ template <> SourceLocation getArgLoc(Expr *Arg) { - return Arg->getLocStart(); + return Arg->getBeginLoc(); } template <> SourceLocation getArgLoc(ParmVarDecl *Arg) { - SourceLocation Loc = Arg->getLocStart(); + SourceLocation Loc = Arg->getBeginLoc(); if (Loc.isInvalid()) return Loc; // -1 to point to left paren of the method parameter's type. Index: lib/AST/Stmt.cpp =================================================================== --- lib/AST/Stmt.cpp +++ lib/AST/Stmt.cpp @@ -186,11 +186,11 @@ } typedef SourceLocation getLocStart_t() const; - template good implements_getLocStart(getLocStart_t T::*) { + template good implements_getBeginLoc(getLocStart_t T::*) { return good(); } LLVM_ATTRIBUTE_UNUSED - static bad implements_getLocStart(getLocStart_t Stmt::*) { + static bad implements_getBeginLoc(getLocStart_t Stmt::*) { return bad(); } @@ -205,8 +205,8 @@ #define ASSERT_IMPLEMENTS_children(type) \ (void) is_good(implements_children(&type::children)) -#define ASSERT_IMPLEMENTS_getLocStart(type) \ - (void) is_good(implements_getLocStart(&type::getLocStart)) +#define ASSERT_IMPLEMENTS_getBeginLoc(type) \ + (void) is_good(implements_getBeginLoc(&type::getBeginLoc)) #define ASSERT_IMPLEMENTS_getLocEnd(type) \ (void) is_good(implements_getLocEnd(&type::getLocEnd)) @@ -219,7 +219,7 @@ #define ABSTRACT_STMT(type) #define STMT(type, base) \ ASSERT_IMPLEMENTS_children(type); \ - ASSERT_IMPLEMENTS_getLocStart(type); \ + ASSERT_IMPLEMENTS_getBeginLoc(type); \ ASSERT_IMPLEMENTS_getLocEnd(type); #include "clang/AST/StmtNodes.inc" } @@ -257,7 +257,7 @@ template SourceRange getSourceRangeImpl(const Stmt *stmt, SourceRange (Stmt::*v)() const) { - return SourceRange(static_cast(stmt)->getLocStart(), + return SourceRange(static_cast(stmt)->getBeginLoc(), static_cast(stmt)->getLocEnd()); } @@ -282,7 +282,7 @@ #define ABSTRACT_STMT(type) #define STMT(type, base) \ case Stmt::type##Class: \ - return static_cast(this)->getLocStart(); + return static_cast(this)->getBeginLoc(); #include "clang/AST/StmtNodes.inc" } llvm_unreachable("unknown statement kind"); Index: lib/AST/StmtPrinter.cpp =================================================================== --- lib/AST/StmtPrinter.cpp +++ lib/AST/StmtPrinter.cpp @@ -1378,7 +1378,7 @@ if (const auto *DRE = dyn_cast(E)) { if (const auto *PD = dyn_cast(DRE->getDecl())) { if (PD->getParameterKind() == ImplicitParamDecl::ObjCSelf && - DRE->getLocStart().isInvalid()) + DRE->getBeginLoc().isInvalid()) return true; } } Index: lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- lib/Analysis/AnalysisDeclContext.cpp +++ lib/Analysis/AnalysisDeclContext.cpp @@ -137,7 +137,7 @@ bool AnalysisDeclContext::isBodyAutosynthesizedFromModelFile() const { bool Tmp; Stmt *Body = getBody(Tmp); - return Tmp && Body->getLocStart().isValid(); + return Tmp && Body->getBeginLoc().isValid(); } /// Returns true if \param VD is an Objective-C implicit 'self' parameter. @@ -500,7 +500,7 @@ OS << "Calling anonymous code"; if (const Stmt *S = cast(LCtx)->getCallSite()) { OS << " at "; - printLocation(OS, SM, S->getLocStart()); + printLocation(OS, SM, S->getBeginLoc()); } break; case Scope: @@ -510,7 +510,7 @@ OS << "Invoking block"; if (const Decl *D = cast(LCtx)->getDecl()) { OS << " defined at "; - printLocation(OS, SM, D->getLocStart()); + printLocation(OS, SM, D->getBeginLoc()); } break; } Index: lib/Analysis/CloneDetection.cpp =================================================================== --- lib/Analysis/CloneDetection.cpp +++ lib/Analysis/CloneDetection.cpp @@ -78,7 +78,7 @@ } SourceLocation StmtSequence::getBeginLoc() const { - return front()->getLocStart(); + return front()->getBeginLoc(); } SourceLocation StmtSequence::getEndLoc() const { return back()->getLocEnd(); } Index: lib/Analysis/Consumed.cpp =================================================================== --- lib/Analysis/Consumed.cpp +++ lib/Analysis/Consumed.cpp @@ -64,7 +64,7 @@ // is not empty. for (const auto &B : *Block) if (Optional CS = B.getAs()) - return CS->getStmt()->getLocStart(); + return CS->getStmt()->getBeginLoc(); // Block is empty. // If we have one successor, return the first statement in that block @@ -78,12 +78,12 @@ // Find the source location of the last statement in the block, if the block // is not empty. if (const Stmt *StmtNode = Block->getTerminator()) { - return StmtNode->getLocStart(); + return StmtNode->getBeginLoc(); } else { for (CFGBlock::const_reverse_iterator BI = Block->rbegin(), BE = Block->rend(); BI != BE; ++BI) { if (Optional CS = BI->getAs()) - return CS->getStmt()->getLocStart(); + return CS->getStmt()->getBeginLoc(); } } @@ -893,7 +893,7 @@ } } - StateMap->checkParamsForReturnTypestate(Ret->getLocStart(), + StateMap->checkParamsForReturnTypestate(Ret->getBeginLoc(), Analyzer.WarningsHandler); } Index: lib/Analysis/LiveVariables.cpp =================================================================== --- lib/Analysis/LiveVariables.cpp +++ lib/Analysis/LiveVariables.cpp @@ -619,7 +619,7 @@ llvm::sort(declVec.begin(), declVec.end(), [](const Decl *A, const Decl *B) { - return A->getLocStart() < B->getLocStart(); + return A->getBeginLoc() < B->getBeginLoc(); }); for (std::vector::iterator di = declVec.begin(), Index: lib/Analysis/ReachableCode.cpp =================================================================== --- lib/Analysis/ReachableCode.cpp +++ lib/Analysis/ReachableCode.cpp @@ -153,7 +153,7 @@ // value comes from a macro, but we can do much better. This is likely // to be over conservative. This logic is factored into a separate function // so that we can refine it later. - SourceLocation L = S->getLocStart(); + SourceLocation L = S->getBeginLoc(); if (L.isMacroID()) { SourceManager &SM = PP.getSourceManager(); if (IgnoreYES_NO) { @@ -200,7 +200,7 @@ // Special case looking for the sigil '()' around an integer literal. if (const ParenExpr *PE = dyn_cast(S)) - if (!PE->getLocStart().isMacroID()) + if (!PE->getBeginLoc().isMacroID()) return isConfigurationValue(PE->getSubExpr(), PP, SilenceableCondVal, IncludeIntegers, true); @@ -446,7 +446,7 @@ } static bool isValidDeadStmt(const Stmt *S) { - if (S->getLocStart().isInvalid()) + if (S->getBeginLoc().isInvalid()) return false; if (const BinaryOperator *BO = dyn_cast(S)) return BO->getOpcode() != BO_Comma; @@ -474,9 +474,9 @@ static int SrcCmp(const std::pair *p1, const std::pair *p2) { - if (p1->second->getLocStart() < p2->second->getLocStart()) + if (p1->second->getBeginLoc() < p2->second->getBeginLoc()) return -1; - if (p2->second->getLocStart() < p1->second->getLocStart()) + if (p2->second->getBeginLoc() < p1->second->getBeginLoc()) return 1; return 0; } @@ -509,7 +509,7 @@ } // Specially handle macro-expanded code. - if (S->getLocStart().isMacroID()) { + if (S->getBeginLoc().isMacroID()) { count += scanMaybeReachableFromBlock(Block, PP, Reachable); continue; } @@ -592,7 +592,7 @@ case Expr::CXXFunctionalCastExprClass: { const CXXFunctionalCastExpr *CE = cast (S); R1 = CE->getSubExpr()->getSourceRange(); - return CE->getLocStart(); + return CE->getBeginLoc(); } case Stmt::CXXTryStmtClass: { return cast(S)->getHandler(0)->getCatchLoc(); @@ -605,7 +605,7 @@ default: ; } R1 = S->getSourceRange(); - return S->getLocStart(); + return S->getBeginLoc(); } void DeadCodeScan::reportDeadCode(const CFGBlock *B, @@ -631,12 +631,12 @@ // a for/for-range loop. This is the block that contains // the increment code. if (const Stmt *LoopTarget = B->getLoopTarget()) { - SourceLocation Loc = LoopTarget->getLocStart(); + SourceLocation Loc = LoopTarget->getBeginLoc(); SourceRange R1(Loc, Loc), R2; if (const ForStmt *FS = dyn_cast(LoopTarget)) { const Expr *Inc = FS->getInc(); - Loc = Inc->getLocStart(); + Loc = Inc->getBeginLoc(); R2 = Inc->getSourceRange(); } Index: lib/Analysis/ThreadSafety.cpp =================================================================== --- lib/Analysis/ThreadSafety.cpp +++ lib/Analysis/ThreadSafety.cpp @@ -819,13 +819,13 @@ // Find the source location of the last statement in the block, if the // block is not empty. if (const Stmt *S = CurrBlock->getTerminator()) { - CurrBlockInfo->EntryLoc = CurrBlockInfo->ExitLoc = S->getLocStart(); + CurrBlockInfo->EntryLoc = CurrBlockInfo->ExitLoc = S->getBeginLoc(); } else { for (CFGBlock::const_reverse_iterator BI = CurrBlock->rbegin(), BE = CurrBlock->rend(); BI != BE; ++BI) { // FIXME: Handle other CFGElement kinds. if (Optional CS = BI->getAs()) { - CurrBlockInfo->ExitLoc = CS->getStmt()->getLocStart(); + CurrBlockInfo->ExitLoc = CS->getStmt()->getBeginLoc(); break; } } @@ -837,7 +837,7 @@ for (const auto &BI : *CurrBlock) { // FIXME: Handle other CFGElement kinds. if (Optional CS = BI.getAs()) { - CurrBlockInfo->EntryLoc = CS->getStmt()->getLocStart(); + CurrBlockInfo->EntryLoc = CS->getStmt()->getBeginLoc(); break; } } @@ -2080,7 +2080,7 @@ CXXConstructorDecl *CtorD = findConstructorForByValueReturn(RD); if (!CtorD || !CtorD->hasAttrs()) continue; - handleCall(buildFakeCtorCall(CtorD, {E}, E->getLocStart()), CtorD, VD); + handleCall(buildFakeCtorCall(CtorD, {E}, E->getBeginLoc()), CtorD, VD); } } } Index: lib/CodeGen/CGAtomic.cpp =================================================================== --- lib/CodeGen/CGAtomic.cpp +++ lib/CodeGen/CGAtomic.cpp @@ -769,7 +769,7 @@ getContext().toBits(sizeChars) > MaxInlineWidthInBits); if (UseLibcall) - CGM.getDiags().Report(E->getLocStart(), diag::warn_atomic_op_misaligned); + CGM.getDiags().Report(E->getBeginLoc(), diag::warn_atomic_op_misaligned); llvm::Value *Order = EmitScalarExpr(E->getOrder()); llvm::Value *Scope = Index: lib/CodeGen/CGBlocks.cpp =================================================================== --- lib/CodeGen/CGBlocks.cpp +++ lib/CodeGen/CGBlocks.cpp @@ -1284,7 +1284,7 @@ } } - SourceLocation StartLoc = BlockInfo->getBlockExpr()->getBody()->getLocStart(); + SourceLocation StartLoc = BlockInfo->getBlockExpr()->getBody()->getBeginLoc(); ApplyDebugLocation Scope(*this, StartLoc); // Instead of messing around with LocalDeclMap, just set the value @@ -1379,7 +1379,7 @@ // Begin generating the function. StartFunction(blockDecl, fnType->getReturnType(), fn, fnInfo, args, blockDecl->getLocation(), - blockInfo.getBlockExpr()->getBody()->getLocStart()); + blockInfo.getBlockExpr()->getBody()->getBeginLoc()); // Okay. Undo some of what StartFunction did. @@ -1688,7 +1688,7 @@ CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI); StartFunction(FD, C.VoidTy, Fn, FI, args); - ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getLocStart()}; + ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()}; llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo(); Address src = GetAddrOfLocalVar(&SrcDecl); @@ -1874,7 +1874,7 @@ CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI); StartFunction(FD, C.VoidTy, Fn, FI, args); - ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getLocStart()}; + ApplyDebugLocation NL{*this, blockInfo.getBlockExpr()->getBeginLoc()}; llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo(); Index: lib/CodeGen/CGBuiltin.cpp =================================================================== --- lib/CodeGen/CGBuiltin.cpp +++ lib/CodeGen/CGBuiltin.cpp @@ -461,7 +461,7 @@ assert(DIter != LocalDeclMap.end()); return EmitLoadOfScalar(DIter->second, /*volatile=*/false, - getContext().getSizeType(), E->getLocStart()); + getContext().getSizeType(), E->getBeginLoc()); } } @@ -11054,13 +11054,13 @@ .getQualifiers() .getAddressSpace() != LangAS::opencl_local || !PtrTy->getPointerElementType()->isFloatTy()) { - CGM.Error(E->getArg(0)->getLocStart(), + CGM.Error(E->getArg(0)->getBeginLoc(), "parameter should have type \"local float*\""); return nullptr; } // check float parameter if (!Args[1]->getType()->isFloatTy()) { - CGM.Error(E->getArg(1)->getLocStart(), + CGM.Error(E->getArg(1)->getBeginLoc(), "parameter should have type \"float\""); return nullptr; } Index: lib/CodeGen/CGCall.cpp =================================================================== --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -2327,7 +2327,7 @@ } else { // Load scalar value from indirect argument. llvm::Value *V = - EmitLoadOfScalar(ParamAddr, false, Ty, Arg->getLocStart()); + EmitLoadOfScalar(ParamAddr, false, Ty, Arg->getBeginLoc()); if (isPromoted) V = emitArgumentDemotion(*this, Arg, V); @@ -2490,7 +2490,7 @@ // Match to what EmitParmDecl is expecting for this type. if (CodeGenFunction::hasScalarEvaluationKind(Ty)) { llvm::Value *V = - EmitLoadOfScalar(Alloca, false, Ty, Arg->getLocStart()); + EmitLoadOfScalar(Alloca, false, Ty, Arg->getBeginLoc()); if (isPromoted) V = emitArgumentDemotion(*this, Arg, V); ArgVals.push_back(ParamValue::forDirect(V)); @@ -4503,7 +4503,7 @@ const CallExpr *CE = getVirtualCallExpr(); return CGF.CGM.getCXXABI().getVirtualFunctionPointer( CGF, getVirtualMethodDecl(), getThisAddress(), - getFunctionType(), CE ? CE->getLocStart() : SourceLocation()); + getFunctionType(), CE ? CE->getBeginLoc() : SourceLocation()); } return *this; Index: lib/CodeGen/CGClass.cpp =================================================================== --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -2844,7 +2844,7 @@ // Add the rest of the parameters. for (auto param : BD->parameters()) - EmitDelegateCallArg(CallArgs, param, param->getLocStart()); + EmitDelegateCallArg(CallArgs, param, param->getBeginLoc()); assert(!Lambda->isGenericLambda() && "generic lambda interconversion to block not implemented"); @@ -2863,7 +2863,7 @@ // Add the rest of the parameters. for (auto Param : MD->parameters()) - EmitDelegateCallArg(CallArgs, Param, Param->getLocStart()); + EmitDelegateCallArg(CallArgs, Param, Param->getBeginLoc()); const CXXMethodDecl *CallOp = Lambda->getLambdaCallOperator(); // For a generic lambda, find the corresponding call operator specialization Index: lib/CodeGen/CGCoroutine.cpp =================================================================== --- lib/CodeGen/CGCoroutine.cpp +++ lib/CodeGen/CGCoroutine.cpp @@ -93,10 +93,10 @@ CallExpr const *CoroIdExpr = nullptr) { if (CurCoro.Data) { if (CurCoro.Data->CoroIdExpr) - CGF.CGM.Error(CoroIdExpr->getLocStart(), + CGF.CGM.Error(CoroIdExpr->getBeginLoc(), "only one __builtin_coro_id can be used in a function"); else if (CoroIdExpr) - CGF.CGM.Error(CoroIdExpr->getLocStart(), + CGF.CGM.Error(CoroIdExpr->getBeginLoc(), "__builtin_coro_id shall not be used in a C++ coroutine"); else llvm_unreachable("EmitCoroutineBodyStatement called twice?"); @@ -444,7 +444,7 @@ // We should have captured coro.free from the emission of deallocate. auto *CoroFree = CGF.CurCoro.Data->LastCoroFree; if (!CoroFree) { - CGF.CGM.Error(Deallocate->getLocStart(), + CGF.CGM.Error(Deallocate->getBeginLoc(), "Deallocation expressoin does not refer to coro.free"); return; } @@ -654,7 +654,7 @@ EmitBlock(BodyBB); } - auto Loc = S.getLocStart(); + auto Loc = S.getBeginLoc(); CXXCatchStmt Catch(Loc, /*exDecl=*/nullptr, CurCoro.Data->ExceptionHandler); auto *TryStmt = @@ -707,7 +707,7 @@ if (CurCoro.Data && CurCoro.Data->CoroBegin) { return RValue::get(CurCoro.Data->CoroBegin); } - CGM.Error(E->getLocStart(), "this builtin expect that __builtin_coro_begin " + CGM.Error(E->getBeginLoc(), "this builtin expect that __builtin_coro_begin " "has been used earlier in this function"); auto NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy()); return RValue::get(NullPtr); @@ -722,7 +722,7 @@ Args.push_back(CurCoro.Data->CoroId); break; } - CGM.Error(E->getLocStart(), "this builtin expect that __builtin_coro_id has" + CGM.Error(E->getBeginLoc(), "this builtin expect that __builtin_coro_id has" " been used earlier in this function"); // Fallthrough to the next case to add TokenNone as the first argument. LLVM_FALLTHROUGH; Index: lib/CodeGen/CGDeclCXX.cpp =================================================================== --- lib/CodeGen/CGDeclCXX.cpp +++ lib/CodeGen/CGDeclCXX.cpp @@ -565,7 +565,7 @@ if (D->hasAttr()) DebugInfo = nullptr; // disable debug info indefinitely for this function - CurEHLocation = D->getLocStart(); + CurEHLocation = D->getBeginLoc(); StartFunction(GlobalDecl(D), getContext().VoidTy, Fn, getTypes().arrangeNullaryFunction(), @@ -679,7 +679,7 @@ llvm::Function *fn = CGM.CreateGlobalInitOrDestructFunction( FTy, "__cxx_global_array_dtor", FI, VD->getLocation()); - CurEHLocation = VD->getLocStart(); + CurEHLocation = VD->getBeginLoc(); StartFunction(VD, getContext().VoidTy, fn, FI, args); Index: lib/CodeGen/CGException.cpp =================================================================== --- lib/CodeGen/CGException.cpp +++ lib/CodeGen/CGException.cpp @@ -1823,7 +1823,7 @@ void CodeGenFunction::startOutlinedSEHHelper(CodeGenFunction &ParentCGF, bool IsFilter, const Stmt *OutlinedStmt) { - SourceLocation StartLoc = OutlinedStmt->getLocStart(); + SourceLocation StartLoc = OutlinedStmt->getBeginLoc(); // Get the mangled function name. SmallString<128> Name; @@ -1871,7 +1871,7 @@ IsOutlinedSEHHelper = true; StartFunction(GlobalDecl(), RetTy, Fn, FnInfo, Args, - OutlinedStmt->getLocStart(), OutlinedStmt->getLocStart()); + OutlinedStmt->getBeginLoc(), OutlinedStmt->getBeginLoc()); CurSEHParent = ParentCGF.CurSEHParent; CGM.SetLLVMFunctionAttributes(nullptr, FnInfo, CurFn); Index: lib/CodeGen/CGExpr.cpp =================================================================== --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -1043,7 +1043,7 @@ EmitVTablePtrCheckForCast(PT->getPointeeType(), Addr.getPointer(), /*MayBeNull=*/true, CodeGenFunction::CFITCK_UnrelatedCast, - CE->getLocStart()); + CE->getBeginLoc()); } return CE->getCastKind() != CK_AddressSpaceConversion ? Builder.CreateBitCast(Addr, ConvertType(E->getType())) @@ -4194,7 +4194,7 @@ if (SanOpts.has(SanitizerKind::CFIDerivedCast)) EmitVTablePtrCheckForCast(E->getType(), Derived.getPointer(), /*MayBeNull=*/false, - CFITCK_DerivedCast, E->getLocStart()); + CFITCK_DerivedCast, E->getBeginLoc()); return MakeAddrLValue(Derived, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); @@ -4211,7 +4211,7 @@ if (SanOpts.has(SanitizerKind::CFIUnrelatedCast)) EmitVTablePtrCheckForCast(E->getType(), V.getPointer(), /*MayBeNull=*/false, - CFITCK_UnrelatedCast, E->getLocStart()); + CFITCK_UnrelatedCast, E->getBeginLoc()); return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); @@ -4621,7 +4621,7 @@ llvm::Value *CalleeRTTIMatch = Builder.CreateICmpEQ(CalleeRTTI, FTRTTIConst); llvm::Constant *StaticData[] = { - EmitCheckSourceLocation(E->getLocStart()), + EmitCheckSourceLocation(E->getBeginLoc()), EmitCheckTypeDescriptor(CalleeType) }; EmitCheck(std::make_pair(CalleeRTTIMatch, SanitizerKind::Function), @@ -4657,7 +4657,7 @@ auto CrossDsoTypeId = CGM.CreateCrossDsoCfiTypeId(MD); llvm::Constant *StaticData[] = { llvm::ConstantInt::get(Int8Ty, CFITCK_ICall), - EmitCheckSourceLocation(E->getLocStart()), + EmitCheckSourceLocation(E->getBeginLoc()), EmitCheckTypeDescriptor(QualType(FnType, 0)), }; if (CGM.getCodeGenOpts().SanitizeCfiCrossDso && CrossDsoTypeId) { Index: lib/CodeGen/CGExprCXX.cpp =================================================================== --- lib/CodeGen/CGExprCXX.cpp +++ lib/CodeGen/CGExprCXX.cpp @@ -383,7 +383,7 @@ std::tie(VTable, RD) = CGM.getCXXABI().LoadVTablePtr(*this, This.getAddress(), MD->getParent()); - EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getLocStart()); + EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getBeginLoc()); } if (getLangOpts().AppleKext && MD->isVirtual() && HasQualifier) Index: lib/CodeGen/CGExprScalar.cpp =================================================================== --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -1681,7 +1681,7 @@ CGF.EmitVTablePtrCheckForCast(PT->getPointeeType(), Src, /*MayBeNull=*/true, CodeGenFunction::CFITCK_UnrelatedCast, - CE->getLocStart()); + CE->getBeginLoc()); } if (CGF.CGM.getCodeGenOpts().StrictVTablePointers) { @@ -1749,7 +1749,7 @@ Derived.getPointer(), /*MayBeNull=*/true, CodeGenFunction::CFITCK_DerivedCast, - CE->getLocStart()); + CE->getBeginLoc()); return Derived.getPointer(); } Index: lib/CodeGen/CGObjC.cpp =================================================================== --- lib/CodeGen/CGObjC.cpp +++ lib/CodeGen/CGObjC.cpp @@ -127,7 +127,7 @@ llvm::Constant *Constant = CGM.CreateRuntimeVariable(ConvertType(IdTy), ConstantName); LValue LV = MakeNaturalAlignAddrLValue(Constant, IdTy); - llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getLocStart()); + llvm::Value *Ptr = EmitLoadOfScalar(LV, E->getBeginLoc()); cast(Ptr)->setMetadata( CGM.getModule().getMDKindID("invariant.load"), llvm::MDNode::get(getLLVMContext(), None)); @@ -531,7 +531,7 @@ /// CodeGenFunction. void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD) { - SourceLocation StartLoc = OMD->getLocStart(); + SourceLocation StartLoc = OMD->getBeginLoc(); FunctionArgList args; // Check if we should generate debug info for this method. if (OMD->hasAttr()) Index: lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- lib/CodeGen/CGOpenMPRuntime.cpp +++ lib/CodeGen/CGOpenMPRuntime.cpp @@ -1406,8 +1406,8 @@ bool Tied, unsigned &NumberOfParts) { auto &&UntiedCodeGen = [this, &D, TaskTVar](CodeGenFunction &CGF, PrePostActionTy &) { - llvm::Value *ThreadID = getThreadID(CGF, D.getLocStart()); - llvm::Value *UpLoc = emitUpdateLocation(CGF, D.getLocStart()); + llvm::Value *ThreadID = getThreadID(CGF, D.getBeginLoc()); + llvm::Value *UpLoc = emitUpdateLocation(CGF, D.getBeginLoc()); llvm::Value *TaskArgs[] = { UpLoc, ThreadID, CGF.EmitLoadOfPointerLValue(CGF.GetAddrOfLocalVar(TaskTVar), @@ -2648,7 +2648,7 @@ QualType ASTTy = VD->getType(); - SourceLocation Loc = VD->getCanonicalDecl()->getLocStart(); + SourceLocation Loc = VD->getCanonicalDecl()->getBeginLoc(); // Produce the unique prefix to identify the new target regions. We use // the source location of the variable declaration which we know to not // conflict with any target region. @@ -5774,7 +5774,7 @@ std::string Name = CGM.getOpenMPRuntime().getName( {D->isLocalVarDeclOrParm() ? D->getName() : CGM.getMangledName(D)}); Out << Prefix << Name << "_" - << D->getCanonicalDecl()->getLocStart().getRawEncoding(); + << D->getCanonicalDecl()->getBeginLoc().getRawEncoding(); return Out.str(); } @@ -6272,7 +6272,7 @@ unsigned DeviceID; unsigned FileID; unsigned Line; - getTargetEntryUniqueInfo(CGM.getContext(), D.getLocStart(), DeviceID, FileID, + getTargetEntryUniqueInfo(CGM.getContext(), D.getBeginLoc(), DeviceID, FileID, Line); SmallString<64> EntryFnName; { @@ -7788,7 +7788,7 @@ CapturedVars.clear(); CGF.GenerateOpenMPCapturedVars(CS, CapturedVars); } - emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedFn, CapturedVars); + emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedFn, CapturedVars); CGF.EmitBranch(OffloadContBlock); CGF.EmitBlock(OffloadContBlock, /*IsFinished=*/true); @@ -7802,7 +7802,7 @@ CapturedVars.clear(); CGF.GenerateOpenMPCapturedVars(CS, CapturedVars); } - emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedFn, CapturedVars); + emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedFn, CapturedVars); }; auto &&TargetThenGen = [this, &ThenGen, &D, &InputInfo, &MapTypesArray, @@ -7933,7 +7933,7 @@ unsigned DeviceID; unsigned FileID; unsigned Line; - getTargetEntryUniqueInfo(CGM.getContext(), E.getLocStart(), DeviceID, + getTargetEntryUniqueInfo(CGM.getContext(), E.getBeginLoc(), DeviceID, FileID, Line); // Is this a target region that should not be emitted as an entry point? If @@ -8811,8 +8811,8 @@ // Build call void __kmpc_doacross_init(ident_t *loc, kmp_int32 gtid, // kmp_int32 num_dims, struct kmp_dim * dims); - llvm::Value *Args[] = {emitUpdateLocation(CGF, D.getLocStart()), - getThreadID(CGF, D.getLocStart()), + llvm::Value *Args[] = {emitUpdateLocation(CGF, D.getBeginLoc()), + getThreadID(CGF, D.getBeginLoc()), llvm::ConstantInt::getSigned(CGM.Int32Ty, 1), CGF.Builder.CreatePointerBitCastOrAddrSpaceCast( DimsAddr.getPointer(), CGM.VoidPtrTy)}; @@ -8837,8 +8837,8 @@ CounterVal->getExprLoc()); Address CntAddr = CGF.CreateMemTemp(Int64Ty, ".cnt.addr"); CGF.EmitStoreOfScalar(CntVal, CntAddr, /*Volatile=*/false, Int64Ty); - llvm::Value *Args[] = {emitUpdateLocation(CGF, C->getLocStart()), - getThreadID(CGF, C->getLocStart()), + llvm::Value *Args[] = {emitUpdateLocation(CGF, C->getBeginLoc()), + getThreadID(CGF, C->getBeginLoc()), CntAddr.getPointer()}; llvm::Value *RTLFn; if (C->getDependencyKind() == OMPC_DEPEND_source) { Index: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp =================================================================== --- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -872,7 +872,7 @@ const RegionCodeGenTy &CodeGen) { ExecutionModeRAII ModeRAII(CurrentExecutionMode, /*IsSPMD=*/false); EntryFunctionState EST; - WorkerFunctionState WST(CGM, D.getLocStart()); + WorkerFunctionState WST(CGM, D.getBeginLoc()); Work.clear(); WrapperFunctionsMap.clear(); @@ -1600,7 +1600,7 @@ llvm::Value *CGOpenMPRuntimeNVPTX::emitTeamsOutlinedFunction( const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) { - SourceLocation Loc = D.getLocStart(); + SourceLocation Loc = D.getBeginLoc(); // Emit target region as a standalone region. class NVPTXPrePostActionTy : public PrePostActionTy { @@ -3478,7 +3478,7 @@ return ParmVarDecl::Create( CGM.getContext(), const_cast(NativeParam->getDeclContext()), - NativeParam->getLocStart(), NativeParam->getLocation(), + NativeParam->getBeginLoc(), NativeParam->getLocation(), NativeParam->getIdentifier(), ArgType, /*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr); } @@ -3556,10 +3556,10 @@ Ctx.getIntTypeForBitwidth(/*DestWidth=*/16, /*Signed=*/false); QualType Int32QTy = Ctx.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/false); - ImplicitParamDecl ParallelLevelArg(Ctx, /*DC=*/nullptr, D.getLocStart(), + ImplicitParamDecl ParallelLevelArg(Ctx, /*DC=*/nullptr, D.getBeginLoc(), /*Id=*/nullptr, Int16QTy, ImplicitParamDecl::Other); - ImplicitParamDecl WrapperArg(Ctx, /*DC=*/nullptr, D.getLocStart(), + ImplicitParamDecl WrapperArg(Ctx, /*DC=*/nullptr, D.getBeginLoc(), /*Id=*/nullptr, Int32QTy, ImplicitParamDecl::Other); WrapperArgs.emplace_back(&ParallelLevelArg); @@ -3577,7 +3577,7 @@ CodeGenFunction CGF(CGM, /*suppressNewContext=*/true); CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, Fn, CGFI, WrapperArgs, - D.getLocStart(), D.getLocStart()); + D.getBeginLoc(), D.getBeginLoc()); const auto *RD = CS.getCapturedRecordDecl(); auto CurField = RD->field_begin(); @@ -3662,7 +3662,7 @@ } } - emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedParallelFn, Args); + emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedParallelFn, Args); CGF.FinishFunction(); return Fn; } @@ -3710,7 +3710,7 @@ Data.insert(std::make_pair(VD, std::make_pair(FD, Address::invalid()))); } if (!NeedToDelayGlobalization) { - emitGenericVarsProlog(CGF, D->getLocStart()); + emitGenericVarsProlog(CGF, D->getBeginLoc()); struct GlobalizationScope final : EHScopeStack::Cleanup { GlobalizationScope() = default; Index: lib/CodeGen/CGStmt.cpp =================================================================== --- lib/CodeGen/CGStmt.cpp +++ lib/CodeGen/CGStmt.cpp @@ -38,7 +38,7 @@ void CodeGenFunction::EmitStopPoint(const Stmt *S) { if (CGDebugInfo *DI = getDebugInfo()) { SourceLocation Loc; - Loc = S->getLocStart(); + Loc = S->getBeginLoc(); DI->EmitLocation(Builder, Loc); LastStopPoint = Loc; @@ -1020,7 +1020,7 @@ /// non-void. Fun stuff :). void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { if (requiresReturnValueCheck()) { - llvm::Constant *SLoc = EmitCheckSourceLocation(S.getLocStart()); + llvm::Constant *SLoc = EmitCheckSourceLocation(S.getBeginLoc()); auto *SLocPtr = new llvm::GlobalVariable(CGM.getModule(), SLoc->getType(), false, llvm::GlobalVariable::PrivateLinkage, SLoc); @@ -1848,7 +1848,7 @@ SmallVector Locs; // Add the location of the first line to the MDNode. Locs.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get( - CGF.Int32Ty, Str->getLocStart().getRawEncoding()))); + CGF.Int32Ty, Str->getBeginLoc().getRawEncoding()))); StringRef StrVal = Str->getString(); if (!StrVal.empty()) { const SourceManager &SM = CGF.CGM.getContext().getSourceManager(); @@ -2272,7 +2272,7 @@ "CapturedStmtInfo should be set when generating the captured function"); const CapturedDecl *CD = S.getCapturedDecl(); const RecordDecl *RD = S.getCapturedRecordDecl(); - SourceLocation Loc = S.getLocStart(); + SourceLocation Loc = S.getBeginLoc(); assert(CD->hasBody() && "missing CapturedDecl body"); // Build the argument list. @@ -2295,7 +2295,7 @@ // Generate the function. StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, CD->getLocation(), - CD->getBody()->getLocStart()); + CD->getBody()->getBeginLoc()); // Set the context parameter in CapturedStmtInfo. Address DeclPtr = GetAddrOfLocalVar(CD->getContextParam()); CapturedStmtInfo->setContextValue(Builder.CreateLoad(DeclPtr)); @@ -2306,7 +2306,7 @@ for (auto *FD : RD->fields()) { if (FD->hasCapturedVLAType()) { auto *ExprArg = EmitLoadOfLValue(EmitLValueForField(Base, FD), - S.getLocStart()).getScalarVal(); + S.getBeginLoc()).getScalarVal(); auto VAT = FD->getCapturedVLAType(); VLASizeMap[VAT->getSizeExpr()] = ExprArg; } Index: lib/CodeGen/CGStmtOpenMP.cpp =================================================================== --- lib/CodeGen/CGStmtOpenMP.cpp +++ lib/CodeGen/CGStmtOpenMP.cpp @@ -386,7 +386,7 @@ if (!FO.UIntPtrCastRequired) { FunctionProtoType::ExtProtoInfo EPI; DebugFunctionDecl = FunctionDecl::Create( - Ctx, Ctx.getTranslationUnitDecl(), FO.S->getLocStart(), + Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(), SourceLocation(), DeclarationName(), Ctx.VoidTy, Ctx.getTrivialTypeSourceInfo( Ctx.getFunctionType(Ctx.VoidTy, llvm::None, EPI)), @@ -422,7 +422,7 @@ if (DebugFunctionDecl && (CapVar || I->capturesThis())) { Arg = ParmVarDecl::Create( Ctx, DebugFunctionDecl, - CapVar ? CapVar->getLocStart() : FD->getLocStart(), + CapVar ? CapVar->getBeginLoc() : FD->getBeginLoc(), CapVar ? CapVar->getLocation() : FD->getLocation(), II, ArgType, /*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr); } else { @@ -459,7 +459,7 @@ // Generate the function. CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, TargetArgs, - FO.S->getLocStart(), CD->getBody()->getLocStart()); + FO.S->getBeginLoc(), CD->getBody()->getBeginLoc()); unsigned Cnt = CD->getContextParamPosition(); I = FO.S->captures().begin(); for (const FieldDecl *FD : RD->fields()) { @@ -602,7 +602,7 @@ I->second.second, I->second.first ? I->second.first->getType() : Arg->getType(), AlignmentSource::Decl); - CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getLocStart()); + CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc()); } else { auto EI = VLASizes.find(Arg); if (EI != VLASizes.end()) { @@ -611,12 +611,12 @@ LValue LV = WrapperCGF.MakeAddrLValue(WrapperCGF.GetAddrOfLocalVar(Arg), Arg->getType(), AlignmentSource::Decl); - CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getLocStart()); + CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc()); } } CallArgs.emplace_back(WrapperCGF.EmitFromMemory(CallArg, Arg->getType())); } - CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, S.getLocStart(), + CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, S.getBeginLoc(), F, CallArgs); WrapperCGF.FinishFunction(); return WrapperF; @@ -1237,12 +1237,12 @@ CGF.EmitScalarExpr(NumThreadsClause->getNumThreads(), /*IgnoreResultAssign=*/true); CGF.CGM.getOpenMPRuntime().emitNumThreadsClause( - CGF, NumThreads, NumThreadsClause->getLocStart()); + CGF, NumThreads, NumThreadsClause->getBeginLoc()); } if (const auto *ProcBindClause = S.getSingleClause()) { CodeGenFunction::RunCleanupsScope ProcBindScope(CGF); CGF.CGM.getOpenMPRuntime().emitProcBindClause( - CGF, ProcBindClause->getProcBindKind(), ProcBindClause->getLocStart()); + CGF, ProcBindClause->getProcBindKind(), ProcBindClause->getBeginLoc()); } const Expr *IfCond = nullptr; for (const auto *C : S.getClausesOfKind()) { @@ -1261,7 +1261,7 @@ // parameters when necessary CodeGenBoundParameters(CGF, S, CapturedVars); CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); - CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getLocStart(), OutlinedFn, + CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getBeginLoc(), OutlinedFn, CapturedVars, IfCond); } @@ -1281,7 +1281,7 @@ // propagation master's thread values of threadprivate variables to local // instances of that variables of all other implicit threads. CGF.CGM.getOpenMPRuntime().emitBarrierCall( - CGF, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false, + CGF, S.getBeginLoc(), OMPD_unknown, /*EmitChecks=*/false, /*ForceSimpleCall=*/true); } CGF.EmitOMPPrivateClause(S, PrivateScope); @@ -1785,7 +1785,7 @@ BoolCondVal = EvaluateExprAsBool(LoopArgs.Cond); } else { BoolCondVal = - RT.emitForNext(*this, S.getLocStart(), IVSize, IVSigned, LoopArgs.IL, + RT.emitForNext(*this, S.getBeginLoc(), IVSize, IVSigned, LoopArgs.IL, LoopArgs.LB, LoopArgs.UB, LoopArgs.ST); } @@ -1819,7 +1819,7 @@ else EmitOMPSimdInit(S, IsMonotonic); - SourceLocation Loc = S.getLocStart(); + SourceLocation Loc = S.getBeginLoc(); // when 'distribute' is not combined with a 'for': // while (idx <= UB) { BODY; ++idx; } @@ -1934,13 +1934,13 @@ llvm::Value *UBVal = DispatchBounds.second; CGOpenMPRuntime::DispatchRTInput DipatchRTInputValues = {LBVal, UBVal, LoopArgs.Chunk}; - RT.emitForDispatchInit(*this, S.getLocStart(), ScheduleKind, IVSize, + RT.emitForDispatchInit(*this, S.getBeginLoc(), ScheduleKind, IVSize, IVSigned, Ordered, DipatchRTInputValues); } else { CGOpenMPRuntime::StaticRTInput StaticInit( IVSize, IVSigned, Ordered, LoopArgs.IL, LoopArgs.LB, LoopArgs.UB, LoopArgs.ST, LoopArgs.Chunk); - RT.emitForStaticInit(*this, S.getLocStart(), S.getDirectiveKind(), + RT.emitForStaticInit(*this, S.getBeginLoc(), S.getDirectiveKind(), ScheduleKind, StaticInit); } @@ -1986,7 +1986,7 @@ CGOpenMPRuntime::StaticRTInput StaticInit( IVSize, IVSigned, /* Ordered = */ false, LoopArgs.IL, LoopArgs.LB, LoopArgs.UB, LoopArgs.ST, LoopArgs.Chunk); - RT.emitDistributeStaticInit(*this, S.getLocStart(), ScheduleKind, StaticInit); + RT.emitDistributeStaticInit(*this, S.getBeginLoc(), ScheduleKind, StaticInit); // for combined 'distribute' and 'for' the increment expression of distribute // is store in DistInc. For 'distribute' alone, it is in Inc. @@ -2082,9 +2082,9 @@ // distribute chunk QualType IteratorTy = IVExpr->getType(); llvm::Value *LBVal = - CGF.EmitLoadOfScalar(LB, /*Volatile=*/false, IteratorTy, S.getLocStart()); + CGF.EmitLoadOfScalar(LB, /*Volatile=*/false, IteratorTy, S.getBeginLoc()); llvm::Value *UBVal = - CGF.EmitLoadOfScalar(UB, /*Volatile=*/false, IteratorTy, S.getLocStart()); + CGF.EmitLoadOfScalar(UB, /*Volatile=*/false, IteratorTy, S.getBeginLoc()); return {LBVal, UBVal}; } @@ -2270,7 +2270,7 @@ // initialization of firstprivate variables and post-update of // lastprivate variables. CGM.getOpenMPRuntime().emitBarrierCall( - *this, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false, + *this, S.getBeginLoc(), OMPD_unknown, /*EmitChecks=*/false, /*ForceSimpleCall=*/true); } EmitOMPPrivateClause(S, LoopScope); @@ -2291,7 +2291,7 @@ Chunk = EmitScalarExpr(Ch); Chunk = EmitScalarConversion(Chunk, Ch->getType(), S.getIterationVariable()->getType(), - S.getLocStart()); + S.getBeginLoc()); } } const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); @@ -2313,7 +2313,7 @@ CGOpenMPRuntime::StaticRTInput StaticInit( IVSize, IVSigned, Ordered, IL.getAddress(), LB.getAddress(), UB.getAddress(), ST.getAddress()); - RT.emitForStaticInit(*this, S.getLocStart(), S.getDirectiveKind(), + RT.emitForStaticInit(*this, S.getBeginLoc(), S.getDirectiveKind(), ScheduleKind, StaticInit); JumpDest LoopExit = getJumpDestInCurrentScope(createBasicBlock("omp.loop.exit")); @@ -2354,7 +2354,7 @@ EmitOMPSimdFinal(S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); } EmitOMPReductionClauseFinal( @@ -2365,17 +2365,17 @@ emitPostUpdateForReductionClause( *this, S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); // Emit final copy of the lastprivate variables if IsLastIter != 0. if (HasLastprivateClause) EmitOMPLastprivateClauseFinal( S, isOpenMPSimdDirective(S.getDirectiveKind()), - Builder.CreateIsNotNull(EmitLoadOfScalar(IL, S.getLocStart()))); + Builder.CreateIsNotNull(EmitLoadOfScalar(IL, S.getBeginLoc()))); } EmitOMPLinearClauseFinal(S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); DoacrossCleanupScope.ForceCleanup(); // We're now done with the loop, so jump to the continuation block. @@ -2432,7 +2432,7 @@ // Emit an implicit barrier at the end. if (!S.getSingleClause() || HasLastprivates) - CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), OMPD_for); + CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getBeginLoc(), OMPD_for); } void CodeGenFunction::EmitOMPForSimdDirective(const OMPForSimdDirective &S) { @@ -2450,7 +2450,7 @@ // Emit an implicit barrier at the end. if (!S.getSingleClause() || HasLastprivates) - CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), OMPD_for); + CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getBeginLoc(), OMPD_for); } static LValue createSectionLVal(CodeGenFunction &CGF, QualType Ty, @@ -2485,16 +2485,16 @@ CGF.Builder.getInt32(0)); // Loop counter. LValue IV = createSectionLVal(CGF, KmpInt32Ty, ".omp.sections.iv."); - OpaqueValueExpr IVRefExpr(S.getLocStart(), KmpInt32Ty, VK_LValue); + OpaqueValueExpr IVRefExpr(S.getBeginLoc(), KmpInt32Ty, VK_LValue); CodeGenFunction::OpaqueValueMapping OpaqueIV(CGF, &IVRefExpr, IV); - OpaqueValueExpr UBRefExpr(S.getLocStart(), KmpInt32Ty, VK_LValue); + OpaqueValueExpr UBRefExpr(S.getBeginLoc(), KmpInt32Ty, VK_LValue); CodeGenFunction::OpaqueValueMapping OpaqueUB(CGF, &UBRefExpr, UB); // Generate condition for loop. BinaryOperator Cond(&IVRefExpr, &UBRefExpr, BO_LE, C.BoolTy, VK_RValue, - OK_Ordinary, S.getLocStart(), FPOptions()); + OK_Ordinary, S.getBeginLoc(), FPOptions()); // Increment for loop counter. UnaryOperator Inc(&IVRefExpr, UO_PreInc, KmpInt32Ty, VK_RValue, OK_Ordinary, - S.getLocStart(), true); + S.getBeginLoc(), true); auto &&BodyGen = [CapturedStmt, CS, &S, &IV](CodeGenFunction &CGF) { // Iterate through all sections and emit a switch construct: // switch (IV) { @@ -2509,7 +2509,7 @@ // .omp.sections.exit: llvm::BasicBlock *ExitBB = CGF.createBasicBlock(".omp.sections.exit"); llvm::SwitchInst *SwitchStmt = - CGF.Builder.CreateSwitch(CGF.EmitLoadOfScalar(IV, S.getLocStart()), + CGF.Builder.CreateSwitch(CGF.EmitLoadOfScalar(IV, S.getBeginLoc()), ExitBB, CS == nullptr ? 1 : CS->size()); if (CS) { unsigned CaseNumber = 0; @@ -2537,7 +2537,7 @@ // initialization of firstprivate variables and post-update of lastprivate // variables. CGF.CGM.getOpenMPRuntime().emitBarrierCall( - CGF, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false, + CGF, S.getBeginLoc(), OMPD_unknown, /*EmitChecks=*/false, /*ForceSimpleCall=*/true); } CGF.EmitOMPPrivateClause(S, LoopScope); @@ -2552,14 +2552,14 @@ /*IVSize=*/32, /*IVSigned=*/true, /*Ordered=*/false, IL.getAddress(), LB.getAddress(), UB.getAddress(), ST.getAddress()); CGF.CGM.getOpenMPRuntime().emitForStaticInit( - CGF, S.getLocStart(), S.getDirectiveKind(), ScheduleKind, StaticInit); + CGF, S.getBeginLoc(), S.getDirectiveKind(), ScheduleKind, StaticInit); // UB = min(UB, GlobalUB); - llvm::Value *UBVal = CGF.EmitLoadOfScalar(UB, S.getLocStart()); + llvm::Value *UBVal = CGF.EmitLoadOfScalar(UB, S.getBeginLoc()); llvm::Value *MinUBGlobalUB = CGF.Builder.CreateSelect( CGF.Builder.CreateICmpSLT(UBVal, GlobalUBVal), UBVal, GlobalUBVal); CGF.EmitStoreOfScalar(MinUBGlobalUB, UB); // IV = LB; - CGF.EmitStoreOfScalar(CGF.EmitLoadOfScalar(LB, S.getLocStart()), IV); + CGF.EmitStoreOfScalar(CGF.EmitLoadOfScalar(LB, S.getBeginLoc()), IV); // while (idx <= UB) { BODY; ++idx; } CGF.EmitOMPInnerLoop(S, /*RequiresCleanup=*/false, &Cond, &Inc, BodyGen, [](CodeGenFunction &) {}); @@ -2573,7 +2573,7 @@ // Emit post-update of the reduction variables if IsLastIter != 0. emitPostUpdateForReductionClause(CGF, S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); // Emit final copy of the lastprivate variables if IsLastIter != 0. @@ -2581,7 +2581,7 @@ CGF.EmitOMPLastprivateClauseFinal( S, /*NoFinals=*/false, CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart()))); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc()))); }; bool HasCancel = false; @@ -2598,7 +2598,7 @@ if (HasLastprivates && S.getSingleClause()) { // Emit implicit barrier to synchronize threads and avoid data races on // initialization of firstprivate variables. - CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), + CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getBeginLoc(), OMPD_unknown); } } @@ -2610,7 +2610,7 @@ } // Emit an implicit barrier at the end. if (!S.getSingleClause()) { - CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), + CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getBeginLoc(), OMPD_sections); } } @@ -2652,7 +2652,7 @@ }; { OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(), + CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getBeginLoc(), CopyprivateVars, DestExprs, SrcExprs, AssignmentOps); } @@ -2660,7 +2660,7 @@ // init or if no 'nowait' clause was specified and no 'copyprivate' clause). if (!S.getSingleClause() && CopyprivateVars.empty()) { CGM.getOpenMPRuntime().emitBarrierCall( - *this, S.getLocStart(), + *this, S.getBeginLoc(), S.getSingleClause() ? OMPD_unknown : OMPD_single); } } @@ -2671,7 +2671,7 @@ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); }; OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitMasterRegion(*this, CodeGen, S.getLocStart()); + CGM.getOpenMPRuntime().emitMasterRegion(*this, CodeGen, S.getBeginLoc()); } void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { @@ -2685,7 +2685,7 @@ OMPLexicalScope Scope(*this, S, OMPD_unknown); CGM.getOpenMPRuntime().emitCriticalRegion(*this, S.getDirectiveName().getAsString(), - CodeGen, S.getLocStart(), Hint); + CodeGen, S.getBeginLoc(), Hint); } void CodeGenFunction::EmitOMPParallelForDirective( @@ -2828,7 +2828,7 @@ } } Data.Reductions = CGM.getOpenMPRuntime().emitTaskReductionInit( - *this, S.getLocStart(), LHSs, RHSs, Data); + *this, S.getBeginLoc(), LHSs, RHSs, Data); // Build list of dependences. for (const auto *C : S.getClausesOfKind()) for (const Expr *IRef : C->varlists()) @@ -2872,7 +2872,7 @@ PrivatePtrs.emplace_back(VD, PrivatePtr); CallArgs.push_back(PrivatePtr.getPointer()); } - CGF.CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getLocStart(), + CGF.CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getBeginLoc(), CopyFn, CallArgs); for (const auto &Pair : LastprivateDstsOrigs) { const auto *OrigVD = cast(Pair.second->getDecl()); @@ -2903,10 +2903,10 @@ // FIXME: This must removed once the runtime library is fixed. // Emit required threadprivate variables for // initilizer/combiner/finalizer. - CGF.CGM.getOpenMPRuntime().emitTaskReductionFixups(CGF, S.getLocStart(), + CGF.CGM.getOpenMPRuntime().emitTaskReductionFixups(CGF, S.getBeginLoc(), RedCG, Cnt); Address Replacement = CGF.CGM.getOpenMPRuntime().getTaskReductionItem( - CGF, S.getLocStart(), ReductionsPtr, RedCG.getSharedLValue(Cnt)); + CGF, S.getBeginLoc(), ReductionsPtr, RedCG.getSharedLValue(Cnt)); Replacement = Address(CGF.EmitScalarConversion( Replacement.getPointer(), CGF.getContext().VoidPtrTy, @@ -2952,13 +2952,13 @@ // FIXME: This must removed once the runtime library is fixed. // Emit required threadprivate variables for // initilizer/combiner/finalizer. - CGF.CGM.getOpenMPRuntime().emitTaskReductionFixups(CGF, S.getLocStart(), + CGF.CGM.getOpenMPRuntime().emitTaskReductionFixups(CGF, S.getBeginLoc(), RedCG, Cnt); llvm::Value *ReductionsPtr = CGF.EmitLoadOfScalar(CGF.EmitLValue(TaskgroupDescriptors[Cnt]), TaskgroupDescriptors[Cnt]->getExprLoc()); Address Replacement = CGF.CGM.getOpenMPRuntime().getTaskReductionItem( - CGF, S.getLocStart(), ReductionsPtr, RedCG.getSharedLValue(Cnt)); + CGF, S.getBeginLoc(), ReductionsPtr, RedCG.getSharedLValue(Cnt)); Replacement = Address( CGF.EmitScalarConversion( Replacement.getPointer(), CGF.getContext().VoidPtrTy, @@ -3049,14 +3049,14 @@ getContext().VoidPtrTy, ArrSize, ArrayType::Normal, /*IndexTypeQuals=*/0); BPVD = createImplicitFirstprivateForType( - getContext(), Data, BaseAndPointersType, CD, S.getLocStart()); + getContext(), Data, BaseAndPointersType, CD, S.getBeginLoc()); PVD = createImplicitFirstprivateForType( - getContext(), Data, BaseAndPointersType, CD, S.getLocStart()); + getContext(), Data, BaseAndPointersType, CD, S.getBeginLoc()); QualType SizesType = getContext().getConstantArrayType( getContext().getSizeType(), ArrSize, ArrayType::Normal, /*IndexTypeQuals=*/0); SVD = createImplicitFirstprivateForType(getContext(), Data, SizesType, CD, - S.getLocStart()); + S.getBeginLoc()); TargetScope.addPrivate( BPVD, [&InputInfo]() { return InputInfo.BasePointersArray; }); TargetScope.addPrivate(PVD, @@ -3091,7 +3091,7 @@ PrivatePtrs.emplace_back(VD, PrivatePtr); CallArgs.push_back(PrivatePtr.getPointer()); } - CGF.CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getLocStart(), + CGF.CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getBeginLoc(), CopyFn, CallArgs); for (const auto &Pair : PrivatePtrs) { Address Replacement(CGF.Builder.CreateLoad(Pair.second), @@ -3122,7 +3122,7 @@ getContext().getIntTypeForBitwidth(32, /*Signed=*/0), SourceLocation()); - CGM.getOpenMPRuntime().emitTaskCall(*this, S.getLocStart(), S, OutlinedFn, + CGM.getOpenMPRuntime().emitTaskCall(*this, S.getBeginLoc(), S, OutlinedFn, SharedsTy, CapturedStruct, &IfCond, Data); } @@ -3149,7 +3149,7 @@ auto &&TaskGen = [&S, SharedsTy, CapturedStruct, IfCond](CodeGenFunction &CGF, llvm::Value *OutlinedFn, const OMPTaskDataTy &Data) { - CGF.CGM.getOpenMPRuntime().emitTaskCall(CGF, S.getLocStart(), S, OutlinedFn, + CGF.CGM.getOpenMPRuntime().emitTaskCall(CGF, S.getBeginLoc(), S, OutlinedFn, SharedsTy, CapturedStruct, IfCond, Data); }; @@ -3158,15 +3158,15 @@ void CodeGenFunction::EmitOMPTaskyieldDirective( const OMPTaskyieldDirective &S) { - CGM.getOpenMPRuntime().emitTaskyieldCall(*this, S.getLocStart()); + CGM.getOpenMPRuntime().emitTaskyieldCall(*this, S.getBeginLoc()); } void CodeGenFunction::EmitOMPBarrierDirective(const OMPBarrierDirective &S) { - CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), OMPD_barrier); + CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getBeginLoc(), OMPD_barrier); } void CodeGenFunction::EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &S) { - CGM.getOpenMPRuntime().emitTaskwaitCall(*this, S.getLocStart()); + CGM.getOpenMPRuntime().emitTaskwaitCall(*this, S.getBeginLoc()); } void CodeGenFunction::EmitOMPTaskgroupDirective( @@ -3195,7 +3195,7 @@ } } llvm::Value *ReductionDesc = - CGF.CGM.getOpenMPRuntime().emitTaskReductionInit(CGF, S.getLocStart(), + CGF.CGM.getOpenMPRuntime().emitTaskReductionInit(CGF, S.getBeginLoc(), LHSs, RHSs, Data); const auto *VD = cast(cast(E)->getDecl()); CGF.EmitVarDecl(*VD); @@ -3205,7 +3205,7 @@ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt()); }; OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitTaskgroupRegion(*this, CodeGen, S.getLocStart()); + CGM.getOpenMPRuntime().emitTaskgroupRegion(*this, CodeGen, S.getBeginLoc()); } void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) { @@ -3217,7 +3217,7 @@ FlushClause->varlist_end()); return llvm::None; }(), - S.getLocStart()); + S.getBeginLoc()); } void CodeGenFunction::EmitOMPDistributeLoop(const OMPLoopDirective &S, @@ -3286,7 +3286,7 @@ // on initialization of firstprivate variables and post-update of // lastprivate variables. CGM.getOpenMPRuntime().emitBarrierCall( - *this, S.getLocStart(), OMPD_unknown, /*EmitChecks=*/false, + *this, S.getBeginLoc(), OMPD_unknown, /*EmitChecks=*/false, /*ForceSimpleCall=*/true); } EmitOMPPrivateClause(S, LoopScope); @@ -3307,7 +3307,7 @@ Chunk = EmitScalarExpr(Ch); Chunk = EmitScalarConversion(Chunk, Ch->getType(), S.getIterationVariable()->getType(), - S.getLocStart()); + S.getBeginLoc()); } } const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); @@ -3328,7 +3328,7 @@ CGOpenMPRuntime::StaticRTInput StaticInit( IVSize, IVSigned, /* Ordered = */ false, IL.getAddress(), LB.getAddress(), UB.getAddress(), ST.getAddress()); - RT.emitDistributeStaticInit(*this, S.getLocStart(), ScheduleKind, + RT.emitDistributeStaticInit(*this, S.getBeginLoc(), ScheduleKind, StaticInit); JumpDest LoopExit = getJumpDestInCurrentScope(createBasicBlock("omp.loop.exit")); @@ -3357,7 +3357,7 @@ [](CodeGenFunction &) {}); EmitBlock(LoopExit.getBlock()); // Tell the runtime we are done. - RT.emitForStaticFinish(*this, S.getLocStart(), S.getDirectiveKind()); + RT.emitForStaticFinish(*this, S.getBeginLoc(), S.getDirectiveKind()); } else { // Emit the outer loop, which requests its work chunk [LB..UB] from // runtime and runs the inner loop to process it. @@ -3370,7 +3370,7 @@ if (isOpenMPSimdDirective(S.getDirectiveKind())) { EmitOMPSimdFinal(S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); } if (isOpenMPSimdDirective(S.getDirectiveKind()) && @@ -3394,14 +3394,14 @@ emitPostUpdateForReductionClause( *this, S, [IL, &S](CodeGenFunction &CGF) { return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); }); } // Emit final copy of the lastprivate variables if IsLastIter != 0. if (HasLastprivateClause) { EmitOMPLastprivateClauseFinal( S, /*NoFinals=*/false, - Builder.CreateIsNotNull(EmitLoadOfScalar(IL, S.getLocStart()))); + Builder.CreateIsNotNull(EmitLoadOfScalar(IL, S.getBeginLoc()))); } } @@ -3448,7 +3448,7 @@ llvm::SmallVector CapturedVars; CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); llvm::Function *OutlinedFn = emitOutlinedOrderedFunction(CGM, CS); - CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getLocStart(), + CGM.getOpenMPRuntime().emitOutlinedFunctionCall(CGF, S.getBeginLoc(), OutlinedFn, CapturedVars); } else { Action.Enter(CGF); @@ -3456,7 +3456,7 @@ } }; OMPLexicalScope Scope(*this, S, OMPD_unknown); - CGM.getOpenMPRuntime().emitOrderedRegion(*this, CodeGen, S.getLocStart(), !C); + CGM.getOpenMPRuntime().emitOrderedRegion(*this, CodeGen, S.getBeginLoc(), !C); } static llvm::Value *convertToScalarValue(CodeGenFunction &CGF, RValue Val, @@ -3918,7 +3918,7 @@ CGF.EmitStopPoint(CS); emitOMPAtomicExpr(CGF, Kind, IsSeqCst, S.isPostfixUpdate(), S.getX(), S.getV(), S.getExpr(), S.getUpdateExpr(), - S.isXLHSInRHSPart(), S.getLocStart()); + S.isXLHSInRHSPart(), S.getBeginLoc()); }; OMPLexicalScope Scope(*this, S, OMPD_unknown); CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_atomic, CodeGen); @@ -4037,13 +4037,13 @@ const Expr *ThreadLimit = TL ? TL->getThreadLimit() : nullptr; CGF.CGM.getOpenMPRuntime().emitNumTeamsClause(CGF, NumTeams, ThreadLimit, - S.getLocStart()); + S.getBeginLoc()); } OMPTeamsScope Scope(CGF, S); llvm::SmallVector CapturedVars; CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); - CGF.CGM.getOpenMPRuntime().emitTeamsCall(CGF, S, S.getLocStart(), OutlinedFn, + CGF.CGM.getOpenMPRuntime().emitTeamsCall(CGF, S, S.getBeginLoc(), OutlinedFn, CapturedVars); } @@ -4394,7 +4394,7 @@ void CodeGenFunction::EmitOMPCancellationPointDirective( const OMPCancellationPointDirective &S) { - CGM.getOpenMPRuntime().emitCancellationPointCall(*this, S.getLocStart(), + CGM.getOpenMPRuntime().emitCancellationPointCall(*this, S.getBeginLoc(), S.getCancelRegion()); } @@ -4407,7 +4407,7 @@ break; } } - CGM.getOpenMPRuntime().emitCancelCall(*this, S.getLocStart(), IfCond, + CGM.getOpenMPRuntime().emitCancelCall(*this, S.getBeginLoc(), IfCond, S.getCancelRegion()); } @@ -4864,7 +4864,7 @@ S, isOpenMPSimdDirective(S.getDirectiveKind()), CGF.Builder.CreateIsNotNull(CGF.EmitLoadOfScalar( CGF.GetAddrOfLocalVar(*LIP), /*Volatile=*/false, - (*LIP)->getType(), S.getLocStart()))); + (*LIP)->getType(), S.getBeginLoc()))); } }; auto &&TaskGen = [&S, SharedsTy, CapturedStruct, @@ -4873,7 +4873,7 @@ auto &&CodeGen = [&S, OutlinedFn, SharedsTy, CapturedStruct, IfCond, &Data](CodeGenFunction &CGF, PrePostActionTy &) { OMPLoopScope PreInitScope(CGF, S); - CGF.CGM.getOpenMPRuntime().emitTaskLoopCall(CGF, S.getLocStart(), S, + CGF.CGM.getOpenMPRuntime().emitTaskLoopCall(CGF, S.getBeginLoc(), S, OutlinedFn, SharedsTy, CapturedStruct, IfCond, Data); }; @@ -4891,7 +4891,7 @@ CGF.EmitOMPTaskBasedDirective(S, OMPD_taskloop, BodyGen, TaskGen, Data); }, - S.getLocStart()); + S.getBeginLoc()); } } Index: lib/CodeGen/CodeGenFunction.cpp =================================================================== --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -2089,7 +2089,7 @@ SanitizerScope SanScope(this); llvm::Value *Zero = llvm::Constant::getNullValue(Size->getType()); llvm::Constant *StaticArgs[] = { - EmitCheckSourceLocation(size->getLocStart()), + EmitCheckSourceLocation(size->getBeginLoc()), EmitCheckTypeDescriptor(size->getType()) }; EmitCheck(std::make_pair(Builder.CreateICmpSGT(Size, Zero), @@ -2319,7 +2319,7 @@ return; StringRef(FeatureList).split(ReqFeatures, ','); if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature)) - CGM.getDiags().Report(E->getLocStart(), diag::err_builtin_needs_feature) + CGM.getDiags().Report(E->getBeginLoc(), diag::err_builtin_needs_feature) << TargetDecl->getDeclName() << CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID); @@ -2345,7 +2345,7 @@ ReqFeatures.push_back(F.getKey()); } if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature)) - CGM.getDiags().Report(E->getLocStart(), diag::err_function_needs_feature) + CGM.getDiags().Report(E->getBeginLoc(), diag::err_function_needs_feature) << FD->getDeclName() << TargetDecl->getDeclName() << MissingFeature; } } Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -683,7 +683,7 @@ unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; - getDiags().Report(Context.getFullLoc(S->getLocStart()), DiagID) + getDiags().Report(Context.getFullLoc(S->getBeginLoc()), DiagID) << Msg << S->getSourceRange(); } @@ -4810,7 +4810,7 @@ if (!cast(D)->doesThisDeclarationHaveABody()) return; SourceManager &SM = getContext().getSourceManager(); - if (LimitedCoverage && SM.getMainFileID() != SM.getFileID(D->getLocStart())) + if (LimitedCoverage && SM.getMainFileID() != SM.getFileID(D->getBeginLoc())) return; auto I = DeferredEmptyCoverageMappingDecls.find(D); if (I == DeferredEmptyCoverageMappingDecls.end()) @@ -5073,7 +5073,7 @@ Address Addr(GetAddrOfGlobalVar(VD), getContext().getDeclAlign(VD)); if (auto InitFunction = getOpenMPRuntime().emitThreadPrivateVarDefinition( - VD, Addr, RefExpr->getLocStart(), PerformInit)) + VD, Addr, RefExpr->getBeginLoc(), PerformInit)) CXXGlobalInits.push_back(InitFunction); } } Index: lib/CodeGen/CodeGenPGO.cpp =================================================================== --- lib/CodeGen/CodeGenPGO.cpp +++ lib/CodeGen/CodeGenPGO.cpp @@ -815,7 +815,7 @@ // Don't map the functions in system headers. const auto &SM = CGM.getContext().getSourceManager(); - auto Loc = D->getBody()->getLocStart(); + auto Loc = D->getBody()->getBeginLoc(); return SM.isInSystemHeader(Loc); } Index: lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- lib/CodeGen/CoverageMappingGen.cpp +++ lib/CodeGen/CoverageMappingGen.cpp @@ -205,7 +205,7 @@ /// Get the start of \c S ignoring macro arguments and builtin macros. SourceLocation getStart(const Stmt *S) { - SourceLocation Loc = S->getLocStart(); + SourceLocation Loc = S->getBeginLoc(); while (SM.isMacroArgExpansion(Loc) || isInBuiltin(Loc)) Loc = SM.getImmediateExpansionRange(Loc).getBegin(); return Loc; @@ -637,7 +637,7 @@ // The statement may be spanned by an expansion. Make sure we handle a file // exit out of this expansion before moving to the next statement. - if (SM.isBeforeInTranslationUnit(StartLoc, S->getLocStart())) + if (SM.isBeforeInTranslationUnit(StartLoc, S->getBeginLoc())) MostRecentLocation = EndLoc; return ExitCount; @@ -827,7 +827,7 @@ } void VisitStmt(const Stmt *S) { - if (S->getLocStart().isValid()) + if (S->getBeginLoc().isValid()) extendRegion(S); for (const Stmt *Child : S->children()) if (Child) Index: lib/CodeGen/ItaniumCXXABI.cpp =================================================================== --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -634,7 +634,7 @@ if (ShouldEmitCFICheck) { CodeGenFunction::SanitizerScope SanScope(&CGF); - CheckSourceLocation = CGF.EmitCheckSourceLocation(E->getLocStart()); + CheckSourceLocation = CGF.EmitCheckSourceLocation(E->getBeginLoc()); CheckTypeDesc = CGF.EmitCheckTypeDescriptor(QualType(MPT, 0)); llvm::Constant *StaticData[] = { llvm::ConstantInt::get(CGF.Int8Ty, CodeGenFunction::CFITCK_VMFCall), @@ -4146,7 +4146,7 @@ // Emit the local. CodeGenFunction::AutoVarEmission var = CGF.EmitAutoVarAlloca(*CatchParam); - InitCatchParam(CGF, *CatchParam, var.getObjectAddress(CGF), S->getLocStart()); + InitCatchParam(CGF, *CatchParam, var.getObjectAddress(CGF), S->getBeginLoc()); CGF.EmitAutoVarCleanups(var); } Index: lib/Edit/RewriteObjCFoundationAPI.cpp =================================================================== --- lib/Edit/RewriteObjCFoundationAPI.cpp +++ lib/Edit/RewriteObjCFoundationAPI.cpp @@ -420,7 +420,7 @@ commit.replace(MsgRange, "@[]"); return true; } - SourceRange ArgRange(Msg->getArg(0)->getLocStart(), + SourceRange ArgRange(Msg->getArg(0)->getBeginLoc(), Msg->getArg(Msg->getNumArgs()-2)->getLocEnd()); commit.replaceWithInner(MsgRange, ArgRange); commit.insertWrap("@[", ArgRange, "]"); @@ -550,7 +550,7 @@ // Range of arguments up until and including the last key. // The sentinel and first value are cut off, the value will move after the // key. - SourceRange ArgRange(Msg->getArg(1)->getLocStart(), + SourceRange ArgRange(Msg->getArg(1)->getBeginLoc(), Msg->getArg(SentinelIdx-1)->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); @@ -591,7 +591,7 @@ } // Range of arguments up until and including the last key. // The first value is cut off, the value will move after the key. - SourceRange ArgRange(Keys.front()->getLocStart(), + SourceRange ArgRange(Keys.front()->getBeginLoc(), Keys.back()->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); @@ -1131,7 +1131,7 @@ if (const StringLiteral * StrE = dyn_cast(OrigArg->IgnoreParens())) { commit.replaceWithInner(Msg->getSourceRange(), StrE->getSourceRange()); - commit.insert(StrE->getLocStart(), "@"); + commit.insert(StrE->getBeginLoc(), "@"); return true; } Index: lib/Frontend/Rewrite/RewriteModernObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -265,7 +265,7 @@ // Measure the old text. int Size = Rewrite.getRangeSize(SrcRange); if (Size == -1) { - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) << Old->getSourceRange(); return; } @@ -282,7 +282,7 @@ } if (SilenceRewriteMacroWarning) return; - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) << Old->getSourceRange(); } @@ -748,11 +748,11 @@ if (ObjCInterfaceDecl *IFace = dyn_cast((*DI))) { if (!IFace->isThisDeclarationADefinition()) { SmallVector DG; - SourceLocation StartLoc = IFace->getLocStart(); + SourceLocation StartLoc = IFace->getBeginLoc(); do { if (isa(*DI) && !cast(*DI)->isThisDeclarationADefinition() && - StartLoc == (*DI)->getLocStart()) + StartLoc == (*DI)->getBeginLoc()) DG.push_back(*DI); else break; @@ -773,11 +773,11 @@ if (ObjCProtocolDecl *Proto = dyn_cast((*DI))) { if (!Proto->isThisDeclarationADefinition()) { SmallVector DG; - SourceLocation StartLoc = Proto->getLocStart(); + SourceLocation StartLoc = Proto->getBeginLoc(); do { if (isa(*DI) && !cast(*DI)->isThisDeclarationADefinition() && - StartLoc == (*DI)->getLocStart()) + StartLoc == (*DI)->getBeginLoc()) DG.push_back(*DI); else break; @@ -923,8 +923,8 @@ static bool objcSetPropertyDefined = false; SourceLocation startGetterSetterLoc; - if (PID->getLocStart().isValid()) { - SourceLocation startLoc = PID->getLocStart(); + if (PID->getBeginLoc().isValid()) { + SourceLocation startLoc = PID->getBeginLoc(); InsertText(startLoc, "// "); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @synthesize location"); @@ -1061,7 +1061,7 @@ void RewriteModernObjC::RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl, const std::string &typedefString) { - SourceLocation startLoc = ClassDecl->getLocStart(); + SourceLocation startLoc = ClassDecl->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *semiPtr = strchr(startBuf, ';'); // Replace the @class with typedefs corresponding to the classes. @@ -1109,7 +1109,7 @@ // nothing to rewrite. if (Method->isImplicit()) return; - SourceLocation LocStart = Method->getLocStart(); + SourceLocation LocStart = Method->getBeginLoc(); SourceLocation LocEnd = Method->getLocEnd(); if (SM->getExpansionLineNumber(LocEnd) > @@ -1129,7 +1129,7 @@ } void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { - SourceLocation LocStart = CatDecl->getLocStart(); + SourceLocation LocStart = CatDecl->getBeginLoc(); // FIXME: handle category headers that are declared across multiple lines. if (CatDecl->getIvarRBraceLoc().isValid()) { @@ -1154,7 +1154,7 @@ } void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { - SourceLocation LocStart = PDecl->getLocStart(); + SourceLocation LocStart = PDecl->getBeginLoc(); assert(PDecl->isThisDeclarationADefinition()); // FIXME: handle protocol headers that are declared across multiple lines. @@ -1189,7 +1189,7 @@ } void RewriteModernObjC::RewriteForwardProtocolDecl(DeclGroupRef D) { - SourceLocation LocStart = (*D.begin())->getLocStart(); + SourceLocation LocStart = (*D.begin())->getBeginLoc(); if (LocStart.isInvalid()) llvm_unreachable("Invalid SourceLocation"); // FIXME: handle forward protocol that are declared across multiple lines. @@ -1198,7 +1198,7 @@ void RewriteModernObjC::RewriteForwardProtocolDecl(const SmallVectorImpl &DG) { - SourceLocation LocStart = DG[0]->getLocStart(); + SourceLocation LocStart = DG[0]->getBeginLoc(); if (LocStart.isInvalid()) llvm_unreachable("Invalid SourceLocation"); // FIXME: handle forward protocol that are declared across multiple lines. @@ -1338,21 +1338,21 @@ if (IMD) { if (IMD->getIvarRBraceLoc().isValid()) { - ReplaceText(IMD->getLocStart(), 1, "/** "); + ReplaceText(IMD->getBeginLoc(), 1, "/** "); ReplaceText(IMD->getIvarRBraceLoc(), 1, "**/ "); } else { - InsertText(IMD->getLocStart(), "// "); + InsertText(IMD->getBeginLoc(), "// "); } } else - InsertText(CID->getLocStart(), "// "); + InsertText(CID->getBeginLoc(), "// "); for (auto *OMD : IMD ? IMD->instance_methods() : CID->instance_methods()) { std::string ResultStr; RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr); - SourceLocation LocStart = OMD->getLocStart(); - SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart(); + SourceLocation LocStart = OMD->getBeginLoc(); + SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc(); const char *startBuf = SM->getCharacterData(LocStart); const char *endBuf = SM->getCharacterData(LocEnd); @@ -1362,8 +1362,8 @@ for (auto *OMD : IMD ? IMD->class_methods() : CID->class_methods()) { std::string ResultStr; RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr); - SourceLocation LocStart = OMD->getLocStart(); - SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart(); + SourceLocation LocStart = OMD->getBeginLoc(); + SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc(); const char *startBuf = SM->getCharacterData(LocStart); const char *endBuf = SM->getCharacterData(LocEnd); @@ -1608,7 +1608,7 @@ // replace break with goto __break_label std::string buf; - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); buf = "goto __break_label_"; buf += utostr(ObjCBcLabelNo.back()); ReplaceText(startLoc, strlen("break"), buf); @@ -1638,7 +1638,7 @@ // replace continue with goto __continue_label std::string buf; - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); buf = "goto __continue_label_"; buf += utostr(ObjCBcLabelNo.back()); ReplaceText(startLoc, strlen("continue"), buf); @@ -1686,7 +1686,7 @@ assert(!ObjCBcLabelNo.empty() && "ObjCForCollectionStmt - Label No stack empty"); - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); StringRef elementName; std::string elementTypeAsString; @@ -1860,7 +1860,7 @@ /// Stmt *RewriteModernObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) { // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @synchronized location"); @@ -1883,12 +1883,12 @@ // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since // the sync expression is typically a message expression that's already // been rewritten! (which implies the SourceLocation's are invalid). - SourceLocation RParenExprLoc = S->getSynchBody()->getLocStart(); + SourceLocation RParenExprLoc = S->getSynchBody()->getBeginLoc(); const char *RParenExprLocBuf = SM->getCharacterData(RParenExprLoc); while (*RParenExprLocBuf != ')') RParenExprLocBuf--; RParenExprLoc = startLoc.getLocWithOffset(RParenExprLocBuf-startBuf); - SourceLocation LBranceLoc = S->getSynchBody()->getLocStart(); + SourceLocation LBranceLoc = S->getSynchBody()->getBeginLoc(); const char *LBraceLocBuf = SM->getCharacterData(LBranceLoc); assert (*LBraceLocBuf == '{'); ReplaceText(RParenExprLoc, (LBraceLocBuf - SM->getCharacterData(RParenExprLoc) + 1), buf); @@ -1915,7 +1915,7 @@ WarnAboutReturnGotoStmts(SubStmt); if (isa(S) || isa(S)) { - Diags.Report(Context->getFullLoc(S->getLocStart()), + Diags.Report(Context->getFullLoc(S->getBeginLoc()), TryFinallyContainsReturnDiag); } } @@ -1923,7 +1923,7 @@ Stmt *RewriteModernObjC::RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) { SourceLocation startLoc = S->getAtLoc(); ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */"); - ReplaceText(S->getSubStmt()->getLocStart(), 1, + ReplaceText(S->getSubStmt()->getBeginLoc(), 1, "{ __AtAutoreleasePool __autoreleasepool; "); return nullptr; @@ -1944,7 +1944,7 @@ } } // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @try location"); @@ -1958,7 +1958,7 @@ ObjCAtCatchStmt *Catch = S->getCatchStmt(I); VarDecl *catchDecl = Catch->getCatchParamDecl(); - startLoc = Catch->getLocStart(); + startLoc = Catch->getBeginLoc(); bool AtRemoved = false; if (catchDecl) { QualType t = catchDecl->getType(); @@ -1967,7 +1967,7 @@ ObjCInterfaceDecl *IDecl = Ptr->getObjectType()->getInterface(); if (IDecl) { std::string Result; - ConvertSourceLocationToLineDirective(Catch->getLocStart(), Result); + ConvertSourceLocationToLineDirective(Catch->getBeginLoc(), Result); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @catch location"); @@ -1988,7 +1988,7 @@ Result += "_"; Result += catchDecl->getNameAsString(); Result += "; "; - SourceLocation lBraceLoc = Catch->getCatchBody()->getLocStart(); + SourceLocation lBraceLoc = Catch->getCatchBody()->getBeginLoc(); ReplaceText(lBraceLoc, 1, Result); AtRemoved = true; } @@ -2001,7 +2001,7 @@ } if (finalStmt) { buf.clear(); - SourceLocation FinallyLoc = finalStmt->getLocStart(); + SourceLocation FinallyLoc = finalStmt->getBeginLoc(); if (noCatch) { ConvertSourceLocationToLineDirective(FinallyLoc, buf); @@ -2013,10 +2013,10 @@ buf += "catch (id e) {_rethrow = e;}\n"; } - SourceLocation startFinalLoc = finalStmt->getLocStart(); + SourceLocation startFinalLoc = finalStmt->getBeginLoc(); ReplaceText(startFinalLoc, 8, buf); Stmt *body = finalStmt->getFinallyBody(); - SourceLocation startFinalBodyLoc = body->getLocStart(); + SourceLocation startFinalBodyLoc = body->getBeginLoc(); buf.clear(); Write_RethrowObject(buf); ReplaceText(startFinalBodyLoc, 1, buf); @@ -2035,7 +2035,7 @@ // been rewritten! (which implies the SourceLocation's are invalid). Stmt *RewriteModernObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) { // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @throw location"); @@ -2170,7 +2170,7 @@ Loc = ECE->getLParenLoc(); EndLoc = ECE->getRParenLoc(); } else { - Loc = E->getLocStart(); + Loc = E->getBeginLoc(); EndLoc = E->getLocEnd(); } // This will defend against trying to rewrite synthesized expressions. @@ -2296,7 +2296,7 @@ if (const CStyleCastExpr *ECE = dyn_cast(E)) startLoc = ECE->getLParenLoc(); else - startLoc = E->getLocStart(); + startLoc = E->getBeginLoc(); startLoc = SM->getExpansionLoc(startLoc); const char *endBuf = SM->getCharacterData(startLoc); ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); @@ -2625,7 +2625,7 @@ SynthGetClassFunctionDecl(); FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; - SourceLocation StartLoc = Exp->getLocStart(); + SourceLocation StartLoc = Exp->getBeginLoc(); SourceLocation EndLoc = Exp->getLocEnd(); // Synthesize a call to objc_msgSend(). @@ -2709,7 +2709,7 @@ SynthGetClassFunctionDecl(); FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; - SourceLocation StartLoc = Exp->getLocStart(); + SourceLocation StartLoc = Exp->getBeginLoc(); SourceLocation EndLoc = Exp->getLocEnd(); // Build the expression: __NSContainer_literal(int, ...).arr @@ -2832,7 +2832,7 @@ SynthGetClassFunctionDecl(); FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl; - SourceLocation StartLoc = Exp->getLocStart(); + SourceLocation StartLoc = Exp->getBeginLoc(); SourceLocation EndLoc = Exp->getLocEnd(); // Build the expression: __NSContainer_literal(int, ...).arr @@ -3070,7 +3070,7 @@ LineString += "\""; else LineString += "\"\n"; - Location = D->getLocStart(); + Location = D->getBeginLoc(); if (const FunctionDecl *FD = dyn_cast(D)) { if (FD->isExternC() && !FD->isMain()) { const DeclContext *DC = FD->getDeclContext(); @@ -3169,7 +3169,7 @@ FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef); else { assert(CurMethodDef && "SynthMsgSendStretCallExpr - CurMethodDef is null"); - FunLocStart = CurMethodDef->getLocStart(); + FunLocStart = CurMethodDef->getBeginLoc(); } InsertText(FunLocStart, str); @@ -3563,7 +3563,7 @@ } Stmt *RewriteModernObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { - Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(), + Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); // Now do the actual rewrite. @@ -3896,7 +3896,7 @@ IVD; IVD = IVD->getNextIvar()) IVars.push_back(IVD); - SourceLocation LocStart = CDecl->getLocStart(); + SourceLocation LocStart = CDecl->getBeginLoc(); SourceLocation LocEnd = CDecl->getEndOfDefinitionLoc(); const char *startBuf = SM->getCharacterData(LocStart); @@ -4462,8 +4462,8 @@ void RewriteModernObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); - //SourceLocation FunLocStart = MD->getLocStart(); - SourceLocation FunLocStart = MD->getLocStart(); + //SourceLocation FunLocStart = MD->getBeginLoc(); + SourceLocation FunLocStart = MD->getBeginLoc(); std::string FuncName; BuildUniqueMethodName(FuncName, MD); SynthesizeBlockLiterals(FunLocStart, FuncName); @@ -4778,7 +4778,7 @@ std::string Str = "("; Str += TypeString; Str += ")"; - InsertText(IC->getSubExpr()->getLocStart(), Str); + InsertText(IC->getSubExpr()->getBeginLoc(), Str); } void RewriteModernObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) { @@ -5069,7 +5069,7 @@ FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef); else { assert(CurMethodDef && "RewriteByRefVar - CurMethodDef is null"); - FunLocStart = CurMethodDef->getLocStart(); + FunLocStart = CurMethodDef->getBeginLoc(); } InsertText(FunLocStart, ByrefType); @@ -5156,7 +5156,7 @@ if (const CStyleCastExpr *ECE = dyn_cast(E)) startLoc = ECE->getLParenLoc(); else - startLoc = E->getLocStart(); + startLoc = E->getBeginLoc(); startLoc = SM->getExpansionLoc(startLoc); endBuf = SM->getCharacterData(startLoc); ReplaceText(DeclLoc, endBuf-startBuf, ByrefType); @@ -5537,7 +5537,7 @@ if (ObjCMessageExpr *MessExpr = dyn_cast(S)) { #if 0 // Before we rewrite it, put the original message expression in a comment. - SourceLocation startLoc = MessExpr->getLocStart(); + SourceLocation startLoc = MessExpr->getBeginLoc(); SourceLocation endLoc = MessExpr->getLocEnd(); const char *startBuf = SM->getCharacterData(startLoc); @@ -5676,7 +5676,7 @@ const std::string &Str = Buf.str(); printf("CAST = %s\n", &Str[0]); - InsertText(ICE->getSubExpr()->getLocStart(), Str); + InsertText(ICE->getSubExpr()->getBeginLoc(), Str); delete S; return Replacement; } Index: lib/Frontend/Rewrite/RewriteObjC.cpp =================================================================== --- lib/Frontend/Rewrite/RewriteObjC.cpp +++ lib/Frontend/Rewrite/RewriteObjC.cpp @@ -216,7 +216,7 @@ // Measure the old text. int Size = Rewrite.getRangeSize(SrcRange); if (Size == -1) { - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) << Old->getSourceRange(); return; } @@ -233,7 +233,7 @@ } if (SilenceRewriteMacroWarning) return; - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) << Old->getSourceRange(); } @@ -680,11 +680,11 @@ if (ObjCInterfaceDecl *IFace = dyn_cast((*DI))) { if (!IFace->isThisDeclarationADefinition()) { SmallVector DG; - SourceLocation StartLoc = IFace->getLocStart(); + SourceLocation StartLoc = IFace->getBeginLoc(); do { if (isa(*DI) && !cast(*DI)->isThisDeclarationADefinition() && - StartLoc == (*DI)->getLocStart()) + StartLoc == (*DI)->getBeginLoc()) DG.push_back(*DI); else break; @@ -699,11 +699,11 @@ if (ObjCProtocolDecl *Proto = dyn_cast((*DI))) { if (!Proto->isThisDeclarationADefinition()) { SmallVector DG; - SourceLocation StartLoc = Proto->getLocStart(); + SourceLocation StartLoc = Proto->getBeginLoc(); do { if (isa(*DI) && !cast(*DI)->isThisDeclarationADefinition() && - StartLoc == (*DI)->getLocStart()) + StartLoc == (*DI)->getBeginLoc()) DG.push_back(*DI); else break; @@ -769,7 +769,7 @@ ObjCCategoryImplDecl *CID) { static bool objcGetPropertyDefined = false; static bool objcSetPropertyDefined = false; - SourceLocation startLoc = PID->getLocStart(); + SourceLocation startLoc = PID->getBeginLoc(); InsertText(startLoc, "// "); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @synthesize location"); @@ -901,7 +901,7 @@ void RewriteObjC::RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl, const std::string &typedefString) { - SourceLocation startLoc = ClassDecl->getLocStart(); + SourceLocation startLoc = ClassDecl->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *semiPtr = strchr(startBuf, ';'); // Replace the @class with typedefs corresponding to the classes. @@ -945,7 +945,7 @@ // nothing to rewrite. if (Method->isImplicit()) return; - SourceLocation LocStart = Method->getLocStart(); + SourceLocation LocStart = Method->getBeginLoc(); SourceLocation LocEnd = Method->getLocEnd(); if (SM->getExpansionLineNumber(LocEnd) > @@ -965,7 +965,7 @@ } void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { - SourceLocation LocStart = CatDecl->getLocStart(); + SourceLocation LocStart = CatDecl->getBeginLoc(); // FIXME: handle category headers that are declared across multiple lines. ReplaceText(LocStart, 0, "// "); @@ -983,7 +983,7 @@ } void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { - SourceLocation LocStart = PDecl->getLocStart(); + SourceLocation LocStart = PDecl->getBeginLoc(); assert(PDecl->isThisDeclarationADefinition()); // FIXME: handle protocol headers that are declared across multiple lines. @@ -1018,7 +1018,7 @@ } void RewriteObjC::RewriteForwardProtocolDecl(DeclGroupRef D) { - SourceLocation LocStart = (*D.begin())->getLocStart(); + SourceLocation LocStart = (*D.begin())->getBeginLoc(); if (LocStart.isInvalid()) llvm_unreachable("Invalid SourceLocation"); // FIXME: handle forward protocol that are declared across multiple lines. @@ -1027,7 +1027,7 @@ void RewriteObjC::RewriteForwardProtocolDecl(const SmallVectorImpl &DG) { - SourceLocation LocStart = DG[0]->getLocStart(); + SourceLocation LocStart = DG[0]->getBeginLoc(); if (LocStart.isInvalid()) llvm_unreachable("Invalid SourceLocation"); // FIXME: handle forward protocol that are declared across multiple lines. @@ -1165,13 +1165,13 @@ ObjCImplementationDecl *IMD = dyn_cast(OID); ObjCCategoryImplDecl *CID = dyn_cast(OID); - InsertText(IMD ? IMD->getLocStart() : CID->getLocStart(), "// "); + InsertText(IMD ? IMD->getBeginLoc() : CID->getBeginLoc(), "// "); for (auto *OMD : IMD ? IMD->instance_methods() : CID->instance_methods()) { std::string ResultStr; RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr); - SourceLocation LocStart = OMD->getLocStart(); - SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart(); + SourceLocation LocStart = OMD->getBeginLoc(); + SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc(); const char *startBuf = SM->getCharacterData(LocStart); const char *endBuf = SM->getCharacterData(LocEnd); @@ -1181,8 +1181,8 @@ for (auto *OMD : IMD ? IMD->class_methods() : CID->class_methods()) { std::string ResultStr; RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr); - SourceLocation LocStart = OMD->getLocStart(); - SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart(); + SourceLocation LocStart = OMD->getBeginLoc(); + SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc(); const char *startBuf = SM->getCharacterData(LocStart); const char *endBuf = SM->getCharacterData(LocEnd); @@ -1412,7 +1412,7 @@ // replace break with goto __break_label std::string buf; - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); buf = "goto __break_label_"; buf += utostr(ObjCBcLabelNo.back()); ReplaceText(startLoc, strlen("break"), buf); @@ -1429,7 +1429,7 @@ // replace continue with goto __continue_label std::string buf; - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); buf = "goto __continue_label_"; buf += utostr(ObjCBcLabelNo.back()); ReplaceText(startLoc, strlen("continue"), buf); @@ -1477,7 +1477,7 @@ assert(!ObjCBcLabelNo.empty() && "ObjCForCollectionStmt - Label No stack empty"); - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); StringRef elementName; std::string elementTypeAsString; @@ -1641,7 +1641,7 @@ /// Stmt *RewriteObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) { // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @synchronized location"); @@ -1654,7 +1654,7 @@ // We can't use S->getSynchExpr()->getLocEnd() to find the end location, since // the sync expression is typically a message expression that's already // been rewritten! (which implies the SourceLocation's are invalid). - SourceLocation endLoc = S->getSynchBody()->getLocStart(); + SourceLocation endLoc = S->getSynchBody()->getBeginLoc(); const char *endBuf = SM->getCharacterData(endLoc); while (*endBuf != ')') endBuf--; SourceLocation rparenLoc = startLoc.getLocWithOffset(endBuf-startBuf); @@ -1719,7 +1719,7 @@ WarnAboutReturnGotoStmts(SubStmt); if (isa(S) || isa(S)) { - Diags.Report(Context->getFullLoc(S->getLocStart()), + Diags.Report(Context->getFullLoc(S->getBeginLoc()), TryFinallyContainsReturnDiag); } } @@ -1742,7 +1742,7 @@ RewriteTryReturnStmts(SubStmt); } if (isa(S)) { - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *semiBuf = strchr(startBuf, ';'); assert((*semiBuf == ';') && "RewriteTryReturnStmts: can't find ';'"); @@ -1763,7 +1763,7 @@ RewriteSyncReturnStmts(SubStmt, syncExitBuf); } if (isa(S)) { - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); const char *semiBuf = strchr(startBuf, ';'); @@ -1782,7 +1782,7 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) { // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @try location"); @@ -1829,7 +1829,7 @@ buf = "if ("; // we are generating code for the first catch clause else buf = "else if ("; - startLoc = Catch->getLocStart(); + startLoc = Catch->getBeginLoc(); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @catch location"); @@ -1839,7 +1839,7 @@ if (Catch->hasEllipsis()) { // Now rewrite the body... lastCatchBody = Catch->getCatchBody(); - SourceLocation bodyLoc = lastCatchBody->getLocStart(); + SourceLocation bodyLoc = lastCatchBody->getBeginLoc(); const char *bodyBuf = SM->getCharacterData(bodyLoc); assert(*SM->getCharacterData(Catch->getRParenLoc()) == ')' && "bogus @catch paren location"); @@ -1866,7 +1866,7 @@ // Now rewrite the body... lastCatchBody = Catch->getCatchBody(); SourceLocation rParenLoc = Catch->getRParenLoc(); - SourceLocation bodyLoc = lastCatchBody->getLocStart(); + SourceLocation bodyLoc = lastCatchBody->getBeginLoc(); const char *bodyBuf = SM->getCharacterData(bodyLoc); const char *rParenBuf = SM->getCharacterData(rParenLoc); assert((*rParenBuf == ')') && "bogus @catch paren location"); @@ -1900,14 +1900,14 @@ lastCurlyLoc = lastCatchBody->getLocEnd(); } if (ObjCAtFinallyStmt *finalStmt = S->getFinallyStmt()) { - startLoc = finalStmt->getLocStart(); + startLoc = finalStmt->getBeginLoc(); startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @finally start"); ReplaceText(startLoc, 8, "/* @finally */"); Stmt *body = finalStmt->getFinallyBody(); - SourceLocation startLoc = body->getLocStart(); + SourceLocation startLoc = body->getBeginLoc(); SourceLocation endLoc = body->getLocEnd(); assert(*SM->getCharacterData(startLoc) == '{' && "bogus @finally body location"); @@ -1950,7 +1950,7 @@ // been rewritten! (which implies the SourceLocation's are invalid). Stmt *RewriteObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) { // Get the start location and compute the semi location. - SourceLocation startLoc = S->getLocStart(); + SourceLocation startLoc = S->getBeginLoc(); const char *startBuf = SM->getCharacterData(startLoc); assert((*startBuf == '@') && "bogus @throw location"); @@ -2082,7 +2082,7 @@ Loc = ECE->getLParenLoc(); EndLoc = ECE->getRParenLoc(); } else { - Loc = E->getLocStart(); + Loc = E->getBeginLoc(); EndLoc = E->getLocEnd(); } // This will defend against trying to rewrite synthesized expressions. @@ -2204,7 +2204,7 @@ if (const CStyleCastExpr *ECE = dyn_cast(E)) startLoc = ECE->getLParenLoc(); else - startLoc = E->getLocStart(); + startLoc = E->getBeginLoc(); startLoc = SM->getExpansionLoc(startLoc); const char *endBuf = SM->getCharacterData(startLoc); ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString); @@ -3008,7 +3008,7 @@ } Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { - Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(), + Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); // Now do the actual rewrite. @@ -3093,7 +3093,7 @@ return; ObjCInterfaceDecl *RCDecl = CDecl->getSuperClass(); int NumIvars = CDecl->ivar_size(); - SourceLocation LocStart = CDecl->getLocStart(); + SourceLocation LocStart = CDecl->getBeginLoc(); SourceLocation LocEnd = CDecl->getEndOfDefinitionLoc(); const char *startBuf = SM->getCharacterData(LocStart); @@ -3636,8 +3636,8 @@ void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); - //SourceLocation FunLocStart = MD->getLocStart(); - SourceLocation FunLocStart = MD->getLocStart(); + //SourceLocation FunLocStart = MD->getBeginLoc(); + SourceLocation FunLocStart = MD->getBeginLoc(); std::string FuncName; BuildUniqueMethodName(FuncName, MD); SynthesizeBlockLiterals(FunLocStart, FuncName); @@ -4212,7 +4212,7 @@ FunLocStart = CurFunctionDef->getTypeSpecStartLoc(); else { assert(CurMethodDef && "RewriteByRefVar - CurMethodDef is null"); - FunLocStart = CurMethodDef->getLocStart(); + FunLocStart = CurMethodDef->getBeginLoc(); } InsertText(FunLocStart, ByrefType); if (Ty.isObjCGCWeak()) { @@ -4274,7 +4274,7 @@ if (const CStyleCastExpr *ECE = dyn_cast(E)) startLoc = ECE->getLParenLoc(); else - startLoc = E->getLocStart(); + startLoc = E->getBeginLoc(); startLoc = SM->getExpansionLoc(startLoc); endBuf = SM->getCharacterData(startLoc); ByrefType += " " + Name; @@ -4632,7 +4632,7 @@ if (ObjCMessageExpr *MessExpr = dyn_cast(S)) { #if 0 // Before we rewrite it, put the original message expression in a comment. - SourceLocation startLoc = MessExpr->getLocStart(); + SourceLocation startLoc = MessExpr->getBeginLoc(); SourceLocation endLoc = MessExpr->getLocEnd(); const char *startBuf = SM->getCharacterData(startLoc); @@ -4760,7 +4760,7 @@ const std::string &Str = Buf.str(); printf("CAST = %s\n", &Str[0]); - InsertText(ICE->getSubExpr()->getLocStart(), Str); + InsertText(ICE->getSubExpr()->getBeginLoc(), Str); delete S; return Replacement; } @@ -5873,7 +5873,7 @@ CK_BitCast, IV->getBase()); // Don't forget the parens to enforce the proper binding. - ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(), + ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getBeginLoc(), IV->getBase()->getLocEnd(), castExpr); // Cannot delete IV->getBase(), since PE points to it. // Replace the old base with the cast. This is important when doing Index: lib/Index/IndexBody.cpp =================================================================== --- lib/Index/IndexBody.cpp +++ lib/Index/IndexBody.cpp @@ -143,7 +143,7 @@ bool VisitMemberExpr(MemberExpr *E) { SourceLocation Loc = E->getMemberLoc(); if (Loc.isInvalid()) - Loc = E->getLocStart(); + Loc = E->getBeginLoc(); SmallVector Relations; SymbolRoleSet Roles = getRolesForRef(E, Relations); return IndexCtx.handleReference(E->getMemberDecl(), Loc, @@ -175,7 +175,7 @@ return true; SourceLocation Loc = NameInfo.getLoc(); if (Loc.isInvalid()) - Loc = E->getLocStart(); + Loc = E->getBeginLoc(); SmallVector Relations; SymbolRoleSet Roles = getRolesForRef(E, Relations); return IndexCtx.handleReference(Symbols[0], Loc, Parent, ParentDC, Roles, @@ -312,7 +312,7 @@ SmallVector Relations; addCallRole(Roles, Relations); Roles |= (unsigned)SymbolRole::Implicit; - return IndexCtx.handleReference(MD, E->getLocStart(), + return IndexCtx.handleReference(MD, E->getBeginLoc(), Parent, ParentDC, Roles, Relations, E); } Index: lib/Index/IndexDecl.cpp =================================================================== --- lib/Index/IndexDecl.cpp +++ lib/Index/IndexDecl.cpp @@ -263,7 +263,7 @@ } else if (const CXXDestructorDecl *Dtor = dyn_cast(D)) { if (auto TypeNameInfo = Dtor->getNameInfo().getNamedTypeInfo()) { IndexCtx.handleReference(Dtor->getParent(), - TypeNameInfo->getTypeLoc().getLocStart(), + TypeNameInfo->getTypeLoc().getBeginLoc(), Dtor->getParent(), Dtor->getDeclContext()); } } else if (const auto *Guide = dyn_cast(D)) { Index: lib/Index/USRGeneration.cpp =================================================================== --- lib/Index/USRGeneration.cpp +++ lib/Index/USRGeneration.cpp @@ -599,7 +599,7 @@ D = D->getCanonicalDecl(); IgnoreResults = - IgnoreResults || printLoc(Out, D->getLocStart(), + IgnoreResults || printLoc(Out, D->getBeginLoc(), Context->getSourceManager(), IncludeOffset); return IgnoreResults; Index: lib/Parse/ParseDecl.cpp =================================================================== --- lib/Parse/ParseDecl.cpp +++ lib/Parse/ParseDecl.cpp @@ -1940,7 +1940,7 @@ Diag(Loc, diag::err_c11_noreturn_misplaced) << (Fixit ? FixItHint::CreateRemoval(Loc) : FixItHint()) - << (Fixit ? FixItHint::CreateInsertion(D.getLocStart(), "_Noreturn ") + << (Fixit ? FixItHint::CreateInsertion(D.getBeginLoc(), "_Noreturn ") : FixItHint()); } } Index: lib/Parse/ParseExpr.cpp =================================================================== --- lib/Parse/ParseExpr.cpp +++ lib/Parse/ParseExpr.cpp @@ -1742,7 +1742,7 @@ // Code completion for a member access expression. Actions.CodeCompleteMemberReferenceExpr( getCurScope(), Base, CorrectedBase, OpLoc, OpKind == tok::arrow, - Base && ExprStatementTokLoc == Base->getLocStart()); + Base && ExprStatementTokLoc == Base->getBeginLoc()); cutOffParsing(); return ExprError(); Index: lib/Parse/ParseExprCXX.cpp =================================================================== --- lib/Parse/ParseExprCXX.cpp +++ lib/Parse/ParseExprCXX.cpp @@ -1674,7 +1674,7 @@ return Init; Expr *InitList = Init.get(); return Actions.ActOnCXXTypeConstructExpr( - TypeRep, InitList->getLocStart(), MultiExprArg(&InitList, 1), + TypeRep, InitList->getBeginLoc(), MultiExprArg(&InitList, 1), InitList->getLocEnd(), /*ListInitialization=*/true); } else { BalancedDelimiterTracker T(*this, tok::l_paren); Index: lib/Parse/ParseObjc.cpp =================================================================== --- lib/Parse/ParseObjc.cpp +++ lib/Parse/ParseObjc.cpp @@ -178,7 +178,7 @@ Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); if (Decl) - Diag(Decl->getLocStart(), diag::note_objc_container_start) + Diag(Decl->getBeginLoc(), diag::note_objc_container_start) << (int) ock; } @@ -690,7 +690,7 @@ case tok::objc_interface: Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) << (int) Actions.getObjCContainerKind(); ConsumeToken(); break; @@ -776,7 +776,7 @@ } else { Diag(Tok, diag::err_objc_missing_end) << FixItHint::CreateInsertion(Tok.getLocation(), "\n@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) << (int) Actions.getObjCContainerKind(); AtEnd.setBegin(Tok.getLocation()); AtEnd.setEnd(Tok.getLocation()); @@ -2223,7 +2223,7 @@ if (P.isEofOrEom()) { P.Diag(P.Tok, diag::err_objc_missing_end) << FixItHint::CreateInsertion(P.Tok.getLocation(), "\n@end\n"); - P.Diag(Dcl->getLocStart(), diag::note_objc_container_start) + P.Diag(Dcl->getBeginLoc(), diag::note_objc_container_start) << Sema::OCK_Implementation; } } Index: lib/Parse/ParseStmt.cpp =================================================================== --- lib/Parse/ParseStmt.cpp +++ lib/Parse/ParseStmt.cpp @@ -1897,7 +1897,7 @@ if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) { R = ParseInitializer(); if (R.isUsable()) - Diag(R.get()->getLocStart(), getLangOpts().CPlusPlus11 ? + Diag(R.get()->getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_generalized_initializer_lists : diag::ext_generalized_initializer_lists) << R.get()->getSourceRange(); Index: lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- lib/Sema/AnalysisBasedWarnings.cpp +++ lib/Sema/AnalysisBasedWarnings.cpp @@ -114,7 +114,7 @@ // // Note that this is also a performance optimization. Analyzing // headers many times can be expensive. - if (!S.getSourceManager().isInMainFile(AC.getDecl()->getLocStart())) + if (!S.getSourceManager().isInMainFile(AC.getDecl()->getBeginLoc())) return; UnreachableCodeHandler UC(S); @@ -252,7 +252,7 @@ // Emit diagnostic if a recursive function call is detected for all paths. if (checkForRecursiveFunctionCall(FD, cfg)) - S.Diag(Body->getLocStart(), diag::warn_infinite_recursive_function); + S.Diag(Body->getBeginLoc(), diag::warn_infinite_recursive_function); } //===----------------------------------------------------------------------===// @@ -651,7 +651,7 @@ // Short circuit for compilation speed. if (CD.checkDiagnostics(Diags, ReturnsVoid, HasNoReturn)) return; - SourceLocation LBrace = Body->getLocStart(), RBrace = Body->getLocEnd(); + SourceLocation LBrace = Body->getBeginLoc(), RBrace = Body->getLocEnd(); auto EmitDiag = [&](SourceLocation Loc, unsigned DiagID) { if (IsCoroutine) S.Diag(Loc, DiagID) << FSI->CoroutinePromise->getType(); @@ -771,8 +771,8 @@ if (CondVal) { // If condition is always true, remove all but the 'then'. Fixit1 = FixItHint::CreateRemoval( - CharSourceRange::getCharRange(If->getLocStart(), - Then->getLocStart())); + CharSourceRange::getCharRange(If->getBeginLoc(), + Then->getBeginLoc())); if (Else) { SourceLocation ElseKwLoc = S.getLocForEndOfToken(Then->getLocEnd()); Fixit2 = FixItHint::CreateRemoval( @@ -782,8 +782,8 @@ // If condition is always false, remove all but the 'else'. if (Else) Fixit1 = FixItHint::CreateRemoval( - CharSourceRange::getCharRange(If->getLocStart(), - Else->getLocStart())); + CharSourceRange::getCharRange(If->getBeginLoc(), + Else->getBeginLoc())); else Fixit1 = FixItHint::CreateRemoval(If->getSourceRange()); } @@ -797,7 +797,7 @@ switch (Use.getKind()) { case UninitUse::Always: - S.Diag(Use.getUser()->getLocStart(), diag::warn_uninit_var) + S.Diag(Use.getUser()->getBeginLoc(), diag::warn_uninit_var) << VD->getDeclName() << IsCapturedByBlock << Use.getUser()->getSourceRange(); return; @@ -809,7 +809,7 @@ << (Use.getKind() == UninitUse::AfterDecl ? 4 : 5) << const_cast(VD->getLexicalDeclContext()) << VD->getSourceRange(); - S.Diag(Use.getUser()->getLocStart(), diag::note_uninit_var_use) + S.Diag(Use.getUser()->getBeginLoc(), diag::note_uninit_var_use) << IsCapturedByBlock << Use.getUser()->getSourceRange(); return; @@ -880,7 +880,7 @@ if ((BO->getOpcode() == BO_LAnd && I->Output) || (BO->getOpcode() == BO_LOr && !I->Output)) // true && y -> y, false || y -> y. - Fixit1 = FixItHint::CreateRemoval(SourceRange(BO->getLocStart(), + Fixit1 = FixItHint::CreateRemoval(SourceRange(BO->getBeginLoc(), BO->getOperatorLoc())); else // false && y -> false, true || y -> true. @@ -943,7 +943,7 @@ S.Diag(Range.getBegin(), diag::warn_sometimes_uninit_var) << VD->getDeclName() << IsCapturedByBlock << DiagKind << Str << I->Output << Range; - S.Diag(User->getLocStart(), diag::note_uninit_var_use) + S.Diag(User->getBeginLoc(), diag::note_uninit_var_use) << IsCapturedByBlock << User->getSourceRange(); if (RemoveDiagKind != -1) S.Diag(Fixit1.RemoveRange.getBegin(), diag::note_uninit_fixit_remove_cond) @@ -953,7 +953,7 @@ } if (!Diagnosed) - S.Diag(Use.getUser()->getLocStart(), diag::warn_maybe_uninit_var) + S.Diag(Use.getUser()->getBeginLoc(), diag::warn_maybe_uninit_var) << VD->getDeclName() << IsCapturedByBlock << Use.getUser()->getSourceRange(); } @@ -985,7 +985,7 @@ ContainsReference CR(S.Context, DRE); CR.Visit(Initializer); if (CR.doesContainReference()) { - S.Diag(DRE->getLocStart(), + S.Diag(DRE->getBeginLoc(), diag::warn_uninit_self_reference_in_init) << VD->getDeclName() << VD->getLocation() << DRE->getSourceRange(); return true; @@ -996,7 +996,7 @@ } else { const BlockExpr *BE = cast(Use.getUser()); if (VD->getType()->isBlockPointerType() && !VD->hasAttr()) - S.Diag(BE->getLocStart(), + S.Diag(BE->getBeginLoc(), diag::warn_uninit_byref_blockvar_captured_by_block) << VD->getDeclName(); else @@ -1007,7 +1007,7 @@ // the initializer of that declaration & we didn't already suggest // an initialization fixit. if (!SuggestInitializationFixit(S, VD)) - S.Diag(VD->getLocStart(), diag::note_var_declared_here) + S.Diag(VD->getBeginLoc(), diag::note_var_declared_here) << VD->getDeclName(); return true; @@ -1098,7 +1098,7 @@ // attribute in template instantiations as it may not be // unreachable in all instantiations of the template. if (!IsTemplateInstantiation) - S.Diag(AS->getLocStart(), + S.Diag(AS->getBeginLoc(), diag::warn_fallthrough_attr_unreachable); markFallthroughVisited(AS); ++AnnotatedCnt; @@ -1266,12 +1266,12 @@ IsTemplateInstantiation)) continue; - S.Diag(Label->getLocStart(), + S.Diag(Label->getBeginLoc(), PerFunction ? diag::warn_unannotated_fallthrough_per_function : diag::warn_unannotated_fallthrough); if (!AnnotatedCnt) { - SourceLocation L = Label->getLocStart(); + SourceLocation L = Label->getBeginLoc(); if (L.isMacroID()) continue; if (S.getLangOpts().CPlusPlus11) { @@ -1297,7 +1297,7 @@ } for (const auto *F : FM.getFallthroughStmts()) - S.Diag(F->getLocStart(), diag::err_fallthrough_attr_invalid_placement); + S.Diag(F->getBeginLoc(), diag::err_fallthrough_attr_invalid_placement); } static bool isInLoop(const ASTContext &Ctx, const ParentMap &PM, @@ -1396,8 +1396,8 @@ SourceManager &SM = S.getSourceManager(); llvm::sort(UsesByStmt.begin(), UsesByStmt.end(), [&SM](const StmtUsesPair &LHS, const StmtUsesPair &RHS) { - return SM.isBeforeInTranslationUnit(LHS.first->getLocStart(), - RHS.first->getLocStart()); + return SM.isBeforeInTranslationUnit(LHS.first->getBeginLoc(), + RHS.first->getBeginLoc()); }); // Classify the current code body for better warning text. @@ -1467,7 +1467,7 @@ continue; // Show the first time the object was read. - S.Diag(FirstRead->getLocStart(), DiagKind) + S.Diag(FirstRead->getBeginLoc(), DiagKind) << int(ObjectKind) << KeyProp << int(FunctionKind) << FirstRead->getSourceRange(); @@ -1475,7 +1475,7 @@ for (const auto &Use : Uses) { if (Use.getUseExpr() == FirstRead) continue; - S.Diag(Use.getUseExpr()->getLocStart(), + S.Diag(Use.getUseExpr()->getBeginLoc(), diag::note_arc_weak_also_accessed_here) << Use.getUseExpr()->getSourceRange(); } @@ -1538,7 +1538,7 @@ // Prefer a more confident report over a less confident one. if (a.getKind() != b.getKind()) return a.getKind() > b.getKind(); - return a.getUser()->getLocStart() < b.getUser()->getLocStart(); + return a.getUser()->getBeginLoc() < b.getUser()->getBeginLoc(); }); for (const auto &U : *vec) { @@ -1605,7 +1605,7 @@ OptionalNotes getNotes() const { if (Verbose && CurrentFunction) { - PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(), + PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(), S.PDiag(diag::note_thread_warning_in_fun) << CurrentFunction); return OptionalNotes(1, FNote); @@ -1616,7 +1616,7 @@ OptionalNotes getNotes(const PartialDiagnosticAt &Note) const { OptionalNotes ONS(1, Note); if (Verbose && CurrentFunction) { - PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(), + PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(), S.PDiag(diag::note_thread_warning_in_fun) << CurrentFunction); ONS.push_back(std::move(FNote)); @@ -1630,7 +1630,7 @@ ONS.push_back(Note1); ONS.push_back(Note2); if (Verbose && CurrentFunction) { - PartialDiagnosticAt FNote(CurrentFunction->getBody()->getLocStart(), + PartialDiagnosticAt FNote(CurrentFunction->getBody()->getBeginLoc(), S.PDiag(diag::note_thread_warning_in_fun) << CurrentFunction); ONS.push_back(std::move(FNote)); @@ -2070,7 +2070,7 @@ // Install the logical handler for -Wtautological-overlap-compare std::unique_ptr LEH; if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison, - D->getLocStart())) { + D->getBeginLoc())) { LEH.reset(new LogicalErrorHandler(S)); AC.getCFGBuildOptions().Observer = LEH.get(); } @@ -2147,9 +2147,9 @@ SourceLocation FL = AC.getDecl()->getLocation(); SourceLocation FEL = AC.getDecl()->getLocEnd(); threadSafety::ThreadSafetyReporter Reporter(S, FL, FEL); - if (!Diags.isIgnored(diag::warn_thread_safety_beta, D->getLocStart())) + if (!Diags.isIgnored(diag::warn_thread_safety_beta, D->getBeginLoc())) Reporter.setIssueBetaWarnings(true); - if (!Diags.isIgnored(diag::warn_thread_safety_verbose, D->getLocStart())) + if (!Diags.isIgnored(diag::warn_thread_safety_verbose, D->getBeginLoc())) Reporter.setVerbose(true); threadSafety::runThreadSafetyAnalysis(AC, Reporter, @@ -2164,9 +2164,9 @@ Analyzer.run(AC); } - if (!Diags.isIgnored(diag::warn_uninit_var, D->getLocStart()) || - !Diags.isIgnored(diag::warn_sometimes_uninit_var, D->getLocStart()) || - !Diags.isIgnored(diag::warn_maybe_uninit_var, D->getLocStart())) { + if (!Diags.isIgnored(diag::warn_uninit_var, D->getBeginLoc()) || + !Diags.isIgnored(diag::warn_sometimes_uninit_var, D->getBeginLoc()) || + !Diags.isIgnored(diag::warn_maybe_uninit_var, D->getBeginLoc())) { if (CFG *cfg = AC.getCFG()) { UninitValsDiagReporter reporter(S); UninitVariablesAnalysisStats stats; @@ -2189,29 +2189,29 @@ } bool FallThroughDiagFull = - !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getLocStart()); + !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getBeginLoc()); bool FallThroughDiagPerFunction = !Diags.isIgnored( - diag::warn_unannotated_fallthrough_per_function, D->getLocStart()); + diag::warn_unannotated_fallthrough_per_function, D->getBeginLoc()); if (FallThroughDiagFull || FallThroughDiagPerFunction || fscope->HasFallthroughStmt) { DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull); } if (S.getLangOpts().ObjCWeak && - !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, D->getLocStart())) + !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, D->getBeginLoc())) diagnoseRepeatedUseOfWeak(S, fscope, D, AC.getParentMap()); // Check for infinite self-recursion in functions if (!Diags.isIgnored(diag::warn_infinite_recursive_function, - D->getLocStart())) { + D->getBeginLoc())) { if (const FunctionDecl *FD = dyn_cast(D)) { checkRecursiveFunction(S, FD, Body, AC); } } // Check for throw out of non-throwing function. - if (!Diags.isIgnored(diag::warn_throw_in_noexcept_func, D->getLocStart())) + if (!Diags.isIgnored(diag::warn_throw_in_noexcept_func, D->getBeginLoc())) if (const FunctionDecl *FD = dyn_cast(D)) if (S.getLangOpts().CPlusPlus && isNoexcept(FD)) checkThrowInNonThrowingFunc(S, FD, AC); @@ -2219,7 +2219,7 @@ // If none of the previous checks caused a CFG build, trigger one here // for -Wtautological-overlap-compare if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison, - D->getLocStart())) { + D->getBeginLoc())) { AC.getCFG(); } Index: lib/Sema/JumpDiagnostics.cpp =================================================================== --- lib/Sema/JumpDiagnostics.cpp +++ lib/Sema/JumpDiagnostics.cpp @@ -299,7 +299,7 @@ auto *CS = cast(S); unsigned Diag = diag::note_protected_by_objc_fast_enumeration; unsigned NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getBeginLoc())); BuildScopeInformation(CS->getBody(), NewParentScope); return; } @@ -353,16 +353,16 @@ // Cannot jump into the middle of the condition. unsigned NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); BuildScopeInformation(IS->getCond(), NewParentScope); // Jumps into either arm of an 'if constexpr' are not allowed. NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); BuildScopeInformation(IS->getThen(), NewParentScope); if (Stmt *Else = IS->getElse()) { NewParentScope = Scopes.size(); - Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getLocStart())); + Scopes.push_back(GotoScope(ParentScope, Diag, 0, IS->getBeginLoc())); BuildScopeInformation(Else, NewParentScope); } return; @@ -619,11 +619,11 @@ continue; SourceLocation Loc; if (CaseStmt *CS = dyn_cast(SC)) - Loc = CS->getLocStart(); + Loc = CS->getBeginLoc(); else if (DefaultStmt *DS = dyn_cast(SC)) - Loc = DS->getLocStart(); + Loc = DS->getBeginLoc(); else - Loc = SC->getLocStart(); + Loc = SC->getBeginLoc(); CheckJump(SS, SC, Loc, diag::err_switch_into_protected_scope, 0, diag::warn_cxx98_compat_switch_into_protected_scope); } @@ -863,7 +863,7 @@ // less nested scope. Check if it crosses a __finally along the way. for (unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) { if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) { - S.Diag(From->getLocStart(), diag::warn_jump_out_of_seh_finally); + S.Diag(From->getBeginLoc(), diag::warn_jump_out_of_seh_finally); break; } } Index: lib/Sema/Sema.cpp =================================================================== --- lib/Sema/Sema.cpp +++ lib/Sema/Sema.cpp @@ -441,7 +441,7 @@ void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) { if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant, - E->getLocStart())) + E->getBeginLoc())) return; // nullptr only exists from C++11 on, so don't warn on its absence earlier. if (!getLangOpts().CPlusPlus11) @@ -454,13 +454,13 @@ // If it is a macro from system header, and if the macro name is not "NULL", // do not warn. - SourceLocation MaybeMacroLoc = E->getLocStart(); + SourceLocation MaybeMacroLoc = E->getBeginLoc(); if (Diags.getSuppressSystemWarnings() && SourceMgr.isInSystemMacro(MaybeMacroLoc) && !findMacroSpelling(MaybeMacroLoc, "NULL")) return; - Diag(E->getLocStart(), diag::warn_zero_as_null_pointer_constant) + Diag(E->getBeginLoc(), diag::warn_zero_as_null_pointer_constant) << FixItHint::CreateReplacement(E->getSourceRange(), "nullptr"); } @@ -488,7 +488,7 @@ assert((VK == VK_RValue || !E->isRValue()) && "can't cast rvalue to lvalue"); #endif - diagnoseNullableToNonnullConversion(Ty, E->getType(), E->getLocStart()); + diagnoseNullableToNonnullConversion(Ty, E->getType(), E->getBeginLoc()); diagnoseZeroToNullptrConversion(Kind, E); QualType ExprTy = Context.getCanonicalType(E->getType()); @@ -1899,6 +1899,6 @@ bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) { IdentifierInfo *FnName = D.getIdentifier(); - return checkOpenCLDisabledTypeOrDecl(&D, E.getLocStart(), FnName, + return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName, OpenCLDeclExtMap, 1, D.getSourceRange()); } Index: lib/Sema/SemaAttr.cpp =================================================================== --- lib/Sema/SemaAttr.cpp +++ lib/Sema/SemaAttr.cpp @@ -405,7 +405,7 @@ Diag(PragmaLocation, diag::warn_pragma_pop_failed) << PragmaName << "stack empty"; if (SegmentName && - !checkSectionName(SegmentName->getLocStart(), SegmentName->getString())) + !checkSectionName(SegmentName->getBeginLoc(), SegmentName->getString())) return; Stack->Act(PragmaLocation, Action, StackSlotLabel, SegmentName); } @@ -669,7 +669,7 @@ void Sema::PrintPragmaAttributeInstantiationPoint() { assert(PragmaAttributeCurrentTargetDecl && "Expected an active declaration"); - Diags.Report(PragmaAttributeCurrentTargetDecl->getLocStart(), + Diags.Report(PragmaAttributeCurrentTargetDecl->getBeginLoc(), diag::note_pragma_attribute_applied_decl_here); } Index: lib/Sema/SemaCast.cpp =================================================================== --- lib/Sema/SemaCast.cpp +++ lib/Sema/SemaCast.cpp @@ -1264,7 +1264,7 @@ } Sema::ReferenceCompareResult RefResult = Self.CompareReferenceRelationship( - SrcExpr->getLocStart(), ToType, FromType, DerivedToBase, ObjCConversion, + SrcExpr->getBeginLoc(), ToType, FromType, DerivedToBase, ObjCConversion, ObjCLifetimeConversion); if (RefResult != Sema::Ref_Compatible) { if (CStyle || RefResult == Sema::Ref_Incompatible) @@ -1281,7 +1281,7 @@ Kind = CK_DerivedToBase; CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/true); - if (!Self.IsDerivedFrom(SrcExpr->getLocStart(), SrcExpr->getType(), + if (!Self.IsDerivedFrom(SrcExpr->getBeginLoc(), SrcExpr->getType(), R->getPointeeType(), Paths)) return TC_NotApplicable; @@ -2612,7 +2612,7 @@ } else if (!SrcType->isArithmeticType()) { if (!DestType->isIntegralType(Self.Context) && DestType->isArithmeticType()) { - Self.Diag(SrcExpr.get()->getLocStart(), + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_cast_pointer_to_non_pointer_int) << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); @@ -2623,7 +2623,7 @@ if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().isEnabled("cl_khr_fp16")) { if (DestType->isHalfType()) { - Self.Diag(SrcExpr.get()->getLocStart(), diag::err_opencl_cast_to_half) + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); return; @@ -2644,7 +2644,7 @@ if (CastPtr->getPointeeType()->isObjCLifetimeType() && ExprPtr->getPointeeType()->isObjCLifetimeType() && !CastQuals.compatiblyIncludesObjCLifetime(ExprQuals)) { - Self.Diag(SrcExpr.get()->getLocStart(), + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_typecheck_incompatible_ownership) << SrcType << DestType << Sema::AA_Casting << SrcExpr.get()->getSourceRange(); @@ -2653,7 +2653,7 @@ } } else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) { - Self.Diag(SrcExpr.get()->getLocStart(), + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable) << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); @@ -2703,10 +2703,10 @@ } // This is a variant of int **x; const int **y = (const int **)x; if (qualifiers == -1) - Self.Diag(SrcExpr.get()->getLocStart(), diag::warn_cast_qual2) + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual2) << SrcType << DestType; else - Self.Diag(SrcExpr.get()->getLocStart(), diag::warn_cast_qual) + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::warn_cast_qual) << TheOffendingSrcType << TheOffendingDestType << qualifiers; } Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -117,7 +117,7 @@ << call->getSourceRange(); // Highlight all the excess arguments. - SourceRange range(call->getArg(desiredArgCount)->getLocStart(), + SourceRange range(call->getArg(desiredArgCount)->getBeginLoc(), call->getArg(argCount - 1)->getLocEnd()); return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args) @@ -135,7 +135,7 @@ Expr *ValArg = TheCall->getArg(0); QualType Ty = ValArg->getType(); if (!Ty->isIntegerType()) { - S.Diag(ValArg->getLocStart(), diag::err_builtin_annotation_first_arg) + S.Diag(ValArg->getBeginLoc(), diag::err_builtin_annotation_first_arg) << ValArg->getSourceRange(); return true; } @@ -144,7 +144,7 @@ Expr *StrArg = TheCall->getArg(1)->IgnoreParenCasts(); StringLiteral *Literal = dyn_cast(StrArg); if (!Literal || !Literal->isAscii()) { - S.Diag(StrArg->getLocStart(), diag::err_builtin_annotation_second_arg) + S.Diag(StrArg->getBeginLoc(), diag::err_builtin_annotation_second_arg) << StrArg->getSourceRange(); return true; } @@ -166,7 +166,7 @@ for (Expr *Arg : TheCall->arguments()) { auto *Literal = dyn_cast(Arg->IgnoreParenCasts()); if (!Literal || !Literal->isWide()) { - S.Diag(Arg->getLocStart(), diag::err_msvc_annotation_wide_str) + S.Diag(Arg->getBeginLoc(), diag::err_msvc_annotation_wide_str) << Arg->getSourceRange(); return true; } @@ -182,7 +182,7 @@ return true; ExprResult Arg(TheCall->getArg(0)); - QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getLocStart()); + QualType ResultType = S.CheckAddressOfOperand(Arg, TheCall->getBeginLoc()); if (ResultType.isNull()) return true; @@ -200,7 +200,7 @@ ExprResult Arg = TheCall->getArg(I); QualType Ty = Arg.get()->getType(); if (!Ty->isIntegerType()) { - S.Diag(Arg.get()->getLocStart(), diag::err_overflow_builtin_must_be_int) + S.Diag(Arg.get()->getBeginLoc(), diag::err_overflow_builtin_must_be_int) << Ty << Arg.get()->getSourceRange(); return true; } @@ -221,7 +221,7 @@ const auto *PtrTy = Ty->getAs(); if (!(PtrTy && PtrTy->getPointeeType()->isIntegerType() && !PtrTy->getPointeeType().isConstQualified())) { - S.Diag(Arg.get()->getLocStart(), + S.Diag(Arg.get()->getBeginLoc(), diag::err_overflow_builtin_must_be_ptr_int) << Ty << Arg.get()->getSourceRange(); return true; @@ -258,7 +258,7 @@ // confirmed overflow so generate the diagnostic. IdentifierInfo *FnName = FDecl->getIdentifier(); - SourceLocation SL = TheCall->getLocStart(); + SourceLocation SL = TheCall->getBeginLoc(); SourceRange SR = TheCall->getSourceRange(); S.Diag(SL, diag::warn_memcpy_chk_overflow) << SR << FnName; @@ -268,7 +268,7 @@ if (checkArgCount(S, BuiltinCall, 2)) return true; - SourceLocation BuiltinLoc = BuiltinCall->getLocStart(); + SourceLocation BuiltinLoc = BuiltinCall->getBeginLoc(); Expr *Builtin = BuiltinCall->getCallee()->IgnoreImpCasts(); Expr *Call = BuiltinCall->getArg(0); Expr *Chain = BuiltinCall->getArg(1); @@ -375,9 +375,9 @@ SourceLocation ErrorLoc; if (isa(BlockArg)) { BlockDecl *BD = cast(BlockArg)->getBlockDecl(); - ErrorLoc = BD->getParamDecl(ArgCounter)->getLocStart(); + ErrorLoc = BD->getParamDecl(ArgCounter)->getBeginLoc(); } else if (isa(BlockArg)) { - ErrorLoc = cast(BlockArg)->getLocStart(); + ErrorLoc = cast(BlockArg)->getBeginLoc(); } S.Diag(ErrorLoc, diag::err_opencl_enqueue_kernel_blocks_non_local_void_args); @@ -390,7 +390,7 @@ static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) { if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) { - S.Diag(Call->getLocStart(), diag::err_opencl_requires_extension) + S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension) << 1 << Call->getDirectCallee() << "cl_khr_subgroups"; return true; } @@ -407,7 +407,7 @@ // First argument is an ndrange_t type. Expr *NDRangeArg = TheCall->getArg(0); if (NDRangeArg->getType().getUnqualifiedType().getAsString() != "ndrange_t") { - S.Diag(NDRangeArg->getLocStart(), + S.Diag(NDRangeArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "'ndrange_t'"; return true; @@ -415,7 +415,7 @@ Expr *BlockArg = TheCall->getArg(1); if (!isBlockPointer(BlockArg)) { - S.Diag(BlockArg->getLocStart(), + S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; @@ -432,7 +432,7 @@ Expr *BlockArg = TheCall->getArg(0); if (!isBlockPointer(BlockArg)) { - S.Diag(BlockArg->getLocStart(), + S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; @@ -467,7 +467,7 @@ // For each argument passed to the block, a corresponding uint needs to // be passed to describe the size of the local memory. if (TotalNumArgs != NumBlockParams + NumNonVarArgs) { - S.Diag(TheCall->getLocStart(), + S.Diag(TheCall->getBeginLoc(), diag::err_opencl_enqueue_kernel_local_size_args); return true; } @@ -507,7 +507,7 @@ unsigned NumArgs = TheCall->getNumArgs(); if (NumArgs < 4) { - S.Diag(TheCall->getLocStart(), diag::err_typecheck_call_too_few_args); + S.Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_few_args); return true; } @@ -518,7 +518,7 @@ // First argument always needs to be a queue_t type. if (!Arg0->getType()->isQueueT()) { - S.Diag(TheCall->getArg(0)->getLocStart(), + S.Diag(TheCall->getArg(0)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << S.Context.OCLQueueTy; return true; @@ -526,7 +526,7 @@ // Second argument always needs to be a kernel_enqueue_flags_t enum value. if (!Arg1->getType()->isIntegerType()) { - S.Diag(TheCall->getArg(1)->getLocStart(), + S.Diag(TheCall->getArg(1)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "'kernel_enqueue_flags_t' (i.e. uint)"; return true; @@ -534,7 +534,7 @@ // Third argument is always an ndrange_t type. if (Arg2->getType().getUnqualifiedType().getAsString() != "ndrange_t") { - S.Diag(TheCall->getArg(2)->getLocStart(), + S.Diag(TheCall->getArg(2)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "'ndrange_t'"; return true; @@ -545,7 +545,7 @@ if (NumArgs == 4) { // check that the last argument is the right block type. if (!isBlockPointer(Arg3)) { - S.Diag(Arg3->getLocStart(), diag::err_opencl_builtin_expected_type) + S.Diag(Arg3->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; } @@ -553,7 +553,7 @@ const BlockPointerType *BPT = cast(Arg3->getType().getCanonicalType()); if (BPT->getPointeeType()->getAs()->getNumParams() > 0) { - S.Diag(Arg3->getLocStart(), + S.Diag(Arg3->getBeginLoc(), diag::err_opencl_enqueue_kernel_blocks_no_args); return true; } @@ -568,7 +568,7 @@ // check common block argument. Expr *Arg6 = TheCall->getArg(6); if (!isBlockPointer(Arg6)) { - S.Diag(Arg6->getLocStart(), diag::err_opencl_builtin_expected_type) + S.Diag(Arg6->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; } @@ -577,7 +577,7 @@ // Forth argument has to be any integer type. if (!Arg3->getType()->isIntegerType()) { - S.Diag(TheCall->getArg(3)->getLocStart(), + S.Diag(TheCall->getArg(3)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "integer"; return true; @@ -590,7 +590,7 @@ if (!Arg4->isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull) && !Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) { - S.Diag(TheCall->getArg(4)->getLocStart(), + S.Diag(TheCall->getArg(4)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << S.Context.getPointerType(S.Context.OCLClkEventTy); @@ -602,7 +602,7 @@ Expr::NPC_ValueDependentIsNotNull) && !(Arg5->getType()->isPointerType() && Arg5->getType()->getPointeeType()->isClkEventT())) { - S.Diag(TheCall->getArg(5)->getLocStart(), + S.Diag(TheCall->getArg(5)->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << S.Context.getPointerType(S.Context.OCLClkEventTy); @@ -616,7 +616,7 @@ } // None of the specific case has been detected, give generic error - S.Diag(TheCall->getLocStart(), + S.Diag(TheCall->getBeginLoc(), diag::err_opencl_enqueue_kernel_incorrect_args); return true; } @@ -631,7 +631,7 @@ const Expr *Arg0 = Call->getArg(0); // First argument type should always be pipe. if (!Arg0->getType()->isPipeType()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_first_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg) << Call->getDirectCallee() << Arg0->getSourceRange(); return true; } @@ -650,7 +650,7 @@ case Builtin::BIwork_group_commit_read_pipe: case Builtin::BIsub_group_commit_read_pipe: if (!(!AccessQual || AccessQual->isReadOnly())) { - S.Diag(Arg0->getLocStart(), + S.Diag(Arg0->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_access_modifier) << "read_only" << Arg0->getSourceRange(); return true; @@ -664,7 +664,7 @@ case Builtin::BIwork_group_commit_write_pipe: case Builtin::BIsub_group_commit_write_pipe: if (!(AccessQual && AccessQual->isWriteOnly())) { - S.Diag(Arg0->getLocStart(), + S.Diag(Arg0->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_access_modifier) << "write_only" << Arg0->getSourceRange(); return true; @@ -688,7 +688,7 @@ if (!ArgTy || !S.Context.hasSameType( EltTy, ArgTy->getPointeeType()->getCanonicalTypeInternal())) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg) << Call->getDirectCallee() << S.Context.getPointerType(EltTy) << ArgIdx->getType() << ArgIdx->getSourceRange(); return true; @@ -721,7 +721,7 @@ // read/write_pipe(pipe T, reserve_id_t, uint, T*). // Check reserve_id_t. if (!Call->getArg(1)->getType()->isReserveIDT()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg) << Call->getDirectCallee() << S.Context.OCLReserveIDTy << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange(); return true; @@ -731,7 +731,7 @@ const Expr *Arg2 = Call->getArg(2); if (!Arg2->getType()->isIntegerType() && !Arg2->getType()->isUnsignedIntegerType()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg) << Call->getDirectCallee() << S.Context.UnsignedIntTy << Arg2->getType() << Arg2->getSourceRange(); return true; @@ -742,7 +742,7 @@ return true; } break; default: - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_arg_num) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_arg_num) << Call->getDirectCallee() << Call->getSourceRange(); return true; } @@ -765,7 +765,7 @@ // Check the reserve size. if (!Call->getArg(1)->getType()->isIntegerType() && !Call->getArg(1)->getType()->isUnsignedIntegerType()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg) << Call->getDirectCallee() << S.Context.UnsignedIntTy << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange(); return true; @@ -793,7 +793,7 @@ // Check reserve_id_t. if (!Call->getArg(1)->getType()->isReserveIDT()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_invalid_arg) << Call->getDirectCallee() << S.Context.OCLReserveIDTy << Call->getArg(1)->getType() << Call->getArg(1)->getSourceRange(); return true; @@ -812,7 +812,7 @@ return true; if (!Call->getArg(0)->getType()->isPipeType()) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_first_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_pipe_first_arg) << Call->getDirectCallee() << Call->getArg(0)->getSourceRange(); return true; } @@ -829,7 +829,7 @@ static bool SemaOpenCLBuiltinToAddr(Sema &S, unsigned BuiltinID, CallExpr *Call) { if (Call->getNumArgs() != 1) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_to_addr_arg_num) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_arg_num) << Call->getDirectCallee() << Call->getSourceRange(); return true; } @@ -837,7 +837,7 @@ auto RT = Call->getArg(0)->getType(); if (!RT->isPointerType() || RT->getPointeeType() .getAddressSpace() == LangAS::opencl_constant) { - S.Diag(Call->getLocStart(), diag::err_opencl_builtin_to_addr_invalid_arg) + S.Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_invalid_arg) << Call->getArg(0) << Call->getDirectCallee() << Call->getSourceRange(); return true; } @@ -872,7 +872,7 @@ S.getASTContext().getTargetInfo().getTriple().getArch(); if (llvm::is_contained(SupportedArchs, CurArch)) return false; - S.Diag(TheCall->getLocStart(), diag::err_builtin_target_unsupported) + S.Diag(TheCall->getBeginLoc(), diag::err_builtin_target_unsupported) << TheCall->getSourceRange(); return true; } @@ -1171,7 +1171,7 @@ const QualType PtrArgType = PtrArg->getType(); if (!PtrArgType->isPointerType() || !PtrArgType->getPointeeType()->isRecordType()) { - Diag(PtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(PtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) << PtrArgType << "structure pointer" << 1 << 0 << 3 << 1 << PtrArgType << "structure pointer"; return ExprError(); @@ -1181,7 +1181,7 @@ const Expr *FnPtrArg = TheCall->getArg(1)->IgnoreImpCasts(); const QualType FnPtrArgType = FnPtrArg->getType(); if (!FnPtrArgType->isPointerType()) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); @@ -1191,7 +1191,7 @@ FnPtrArgType->getPointeeType()->getAs(); if (!FuncType) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); @@ -1199,7 +1199,7 @@ if (const auto *FT = dyn_cast(FuncType)) { if (!FT->getNumParams()) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); @@ -1208,7 +1208,7 @@ if (!FT->isVariadic() || FT->getReturnType() != Context.IntTy || !PT->isPointerType() || !PT->getPointeeType()->isCharType() || !PT->getPointeeType().isConstQualified()) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); @@ -1259,7 +1259,7 @@ return ExprError(); if (CheckCXXThrowOperand( - TheCall->getLocStart(), + TheCall->getBeginLoc(), Context.getExceptionObjectType(FDecl->getParamDecl(0)->getType()), TheCall)) return ExprError(); @@ -1477,7 +1477,7 @@ TV = Result.getLimitedValue(64); if ((TV > 63) || (mask & (1ULL << TV)) == 0) - return Diag(TheCall->getLocStart(), diag::err_invalid_neon_type_code) + return Diag(TheCall->getBeginLoc(), diag::err_invalid_neon_type_code) << TheCall->getArg(ImmArg)->getSourceRange(); } @@ -1503,7 +1503,7 @@ ConvTy = CheckSingleAssignmentConstraints(LHSTy, RHS); if (RHS.isInvalid()) return true; - if (DiagnoseAssignmentResult(ConvTy, Arg->getLocStart(), LHSTy, RHSTy, + if (DiagnoseAssignmentResult(ConvTy, Arg->getBeginLoc(), LHSTy, RHSTy, RHS.get(), AA_Assigning)) return true; } @@ -1557,7 +1557,7 @@ const PointerType *pointerType = PointerArg->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) << PointerArg->getType() << PointerArg->getSourceRange(); return true; } @@ -1574,7 +1574,7 @@ CastKind CastNeeded = CK_NoOp; if (!AddrType.isAtLeastAsQualifiedAs(ValType)) { CastNeeded = CK_BitCast; - Diag(DRE->getLocStart(), diag::ext_typecheck_convert_discards_qualifiers) + Diag(DRE->getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers) << PointerArg->getType() << Context.getPointerType(AddrType) << AA_Passing << PointerArg->getSourceRange(); @@ -1592,7 +1592,7 @@ // In general, we allow ints, floats and pointers to be loaded and stored. if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType() && !ValType->isFloatingType()) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer_intfltptr) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr) << PointerArg->getType() << PointerArg->getSourceRange(); return true; } @@ -1600,7 +1600,7 @@ // But ARM doesn't have instructions to deal with 128-bit versions. if (Context.getTypeSize(ValType) > MaxWidth) { assert(MaxWidth == 64 && "Diagnostic unexpectedly inaccurate"); - Diag(DRE->getLocStart(), diag::err_atomic_exclusive_builtin_pointer_size) + Diag(DRE->getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size) << PointerArg->getType() << PointerArg->getSourceRange(); return true; } @@ -1614,7 +1614,7 @@ case Qualifiers::OCL_Weak: case Qualifiers::OCL_Strong: case Qualifiers::OCL_Autoreleasing: - Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership) + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) << ValType << PointerArg->getSourceRange(); return true; } @@ -2491,7 +2491,7 @@ assert(CPU.startswith("hexagon") && "Unexpected CPU name"); CPU.consume_front("hexagon"); if (llvm::none_of(FC->second, [CPU](StringRef S) { return S == CPU; })) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_hexagon_builtin_unsupported_cpu); } } @@ -2499,7 +2499,7 @@ auto FH = ValidHVX.find(BuiltinID); if (FH != ValidHVX.end()) { if (!TI.hasFeature("hvx")) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_hexagon_builtin_requires_hvx); bool IsValid = llvm::any_of(FH->second, @@ -2508,7 +2508,7 @@ return TI.hasFeature(F); }); if (!IsValid) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_hexagon_builtin_unsupported_hvx); } @@ -2935,13 +2935,13 @@ BuiltinID == PPC::BI__builtin_divdeu; if (Is64BitBltin && !IsTarget64Bit) - return Diag(TheCall->getLocStart(), diag::err_64_bit_builtin_32_bit_tgt) + return Diag(TheCall->getBeginLoc(), diag::err_64_bit_builtin_32_bit_tgt) << TheCall->getSourceRange(); if ((IsBltinExtDiv && !Context.getTargetInfo().hasFeature("extdiv")) || (BuiltinID == PPC::BI__builtin_bpermd && !Context.getTargetInfo().hasFeature("bpermd"))) - return Diag(TheCall->getLocStart(), diag::err_ppc_builtin_only_on_pwr7) + return Diag(TheCall->getBeginLoc(), diag::err_ppc_builtin_only_on_pwr7) << TheCall->getSourceRange(); switch (BuiltinID) { @@ -2973,7 +2973,7 @@ llvm::APSInt AbortCode(32); if (Arg->isIntegerConstantExpr(AbortCode, Context) && AbortCode.getSExtValue() >= 0 && AbortCode.getSExtValue() < 256) - return Diag(Arg->getLocStart(), diag::err_systemz_invalid_tabort_code) + return Diag(Arg->getBeginLoc(), diag::err_systemz_invalid_tabort_code) << Arg->getSourceRange(); } @@ -3037,14 +3037,14 @@ // Check if the argument is a string literal. if (!isa(Arg->IgnoreParenImpCasts())) - return S.Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal) + return S.Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal) << Arg->getSourceRange(); // Check the contents of the string. StringRef Feature = cast(Arg->IgnoreParenImpCasts())->getString(); if (!S.Context.getTargetInfo().validateCpuSupports(Feature)) - return S.Diag(TheCall->getLocStart(), diag::err_invalid_cpu_supports) + return S.Diag(TheCall->getBeginLoc(), diag::err_invalid_cpu_supports) << Arg->getSourceRange(); return false; } @@ -3057,14 +3057,14 @@ // Check if the argument is a string literal. if (!isa(Arg->IgnoreParenImpCasts())) - return S.Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal) + return S.Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal) << Arg->getSourceRange(); // Check the contents of the string. StringRef Feature = cast(Arg->IgnoreParenImpCasts())->getString(); if (!S.Context.getTargetInfo().validateCpuIs(Feature)) - return S.Diag(TheCall->getLocStart(), diag::err_invalid_cpu_is) + return S.Diag(TheCall->getBeginLoc(), diag::err_invalid_cpu_is) << Arg->getSourceRange(); return false; } @@ -3267,7 +3267,7 @@ (HasRC && Result.getZExtValue() >= 8 && Result.getZExtValue() <= 11)) return false; - return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_rounding) + return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_rounding) << Arg->getSourceRange(); } @@ -3370,7 +3370,7 @@ if (Result == 1 || Result == 2 || Result == 4 || Result == 8) return false; - return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_scale) + return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_scale) << Arg->getSourceRange(); } @@ -3395,7 +3395,7 @@ // Check for 32-bit only builtins on a 64-bit target. const llvm::Triple &TT = Context.getTargetInfo().getTriple(); if (TT.getArch() != llvm::Triple::x86 && isX86_32Builtin(BuiltinID)) - return Diag(TheCall->getCallee()->getLocStart(), + return Diag(TheCall->getCallee()->getBeginLoc(), diag::err_32_bit_builtin_64_bit_tgt); // If the intrinsic has rounding or SAE make sure its valid. @@ -4317,7 +4317,7 @@ << TheCall->getCallee()->getSourceRange(); return ExprError(); } else if (TheCall->getNumArgs() > AdjustedNumArgs) { - Diag(TheCall->getArg(AdjustedNumArgs)->getLocStart(), + Diag(TheCall->getArg(AdjustedNumArgs)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 << AdjustedNumArgs << TheCall->getNumArgs() << TheCall->getCallee()->getSourceRange(); @@ -4333,7 +4333,7 @@ Ptr = ConvertedPtr.get(); const PointerType *pointerType = Ptr->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4343,13 +4343,13 @@ QualType ValType = AtomTy; // 'C' if (IsC11) { if (!AtomTy->isAtomicType()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic) << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } if (AtomTy.isConstQualified() || AtomTy.getAddressSpace() == LangAS::opencl_constant) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_atomic) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_non_const_atomic) << (AtomTy.isConstQualified() ? 0 : 1) << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); @@ -4357,7 +4357,7 @@ ValType = AtomTy->getAs()->getValueType(); } else if (Form != Load && Form != LoadCopy) { if (ValType.isConstQualified()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_pointer) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_non_const_pointer) << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4368,7 +4368,7 @@ // gcc does not enforce these rules for GNU atomics, but we do so for sanity. if (IsAddSub && !ValType->isIntegerType() && !ValType->isPointerType()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic_int_or_ptr) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr) << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4376,24 +4376,24 @@ const BuiltinType *BT = ValType->getAs(); if (!BT || (BT->getKind() != BuiltinType::Int && BT->getKind() != BuiltinType::UInt)) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_int32_or_ptr); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_int32_or_ptr); return ExprError(); } } if (!IsAddSub && !IsMinMax && !ValType->isIntegerType()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_bitwise_needs_atomic_int) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_bitwise_needs_atomic_int) << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } if (IsC11 && ValType->isPointerType() && - RequireCompleteType(Ptr->getLocStart(), ValType->getPointeeType(), + RequireCompleteType(Ptr->getBeginLoc(), ValType->getPointeeType(), diag::err_incomplete_type)) { return ExprError(); } } else if (IsN && !ValType->isIntegerType() && !ValType->isPointerType()) { // For __atomic_*_n operations, the value type must be a scalar integral or // pointer type which is 1, 2, 4, 8 or 16 bytes in length. - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic_int_or_ptr) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr) << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4402,7 +4402,7 @@ !AtomTy->isScalarType()) { // For GNU atomics, require a trivially-copyable type. This is not part of // the GNU atomics specification, but we enforce it for sanity. - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_trivial_copy) + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_trivial_copy) << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4418,7 +4418,7 @@ case Qualifiers::OCL_Autoreleasing: // FIXME: Can this happen? By this point, ValType should be known // to be trivially copyable. - Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership) + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) << ValType << Ptr->getSourceRange(); return ExprError(); } @@ -4457,7 +4457,7 @@ case 0: // The first argument is always a pointer. It has a fixed type. // It is always dereferenced, a nullptr is undefined. - CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart()); + CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc()); // Nothing else to do: we already know all we want about this pointer. continue; case 1: @@ -4471,14 +4471,14 @@ else if (Form == Copy || Form == Xchg) { if (IsPassedByAddress) // The value pointer is always dereferenced, a nullptr is undefined. - CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart()); + CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc()); Ty = ByValType; } else if (Form == Arithmetic) Ty = Context.getPointerDiffType(); else { Expr *ValArg = TheCall->getArg(i); // The value pointer is always dereferenced, a nullptr is undefined. - CheckNonNullArgument(*this, ValArg, DRE->getLocStart()); + CheckNonNullArgument(*this, ValArg, DRE->getBeginLoc()); LangAS AS = LangAS::Default; // Keep address space of non-atomic pointer type. if (const PointerType *PtrTy = @@ -4493,7 +4493,7 @@ // The third argument to compare_exchange / GNU exchange is the desired // value, either by-value (for the C11 and *_n variant) or as a pointer. if (IsPassedByAddress) - CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getLocStart()); + CheckNonNullArgument(*this, TheCall->getArg(i), DRE->getBeginLoc()); Ty = ByValType; break; case 3: @@ -4558,7 +4558,7 @@ llvm::APSInt Result(32); if (SubExprs[1]->isIntegerConstantExpr(Result, Context) && !isValidOrderingForOp(Result.getSExtValue(), Op)) - Diag(SubExprs[1]->getLocStart(), + Diag(SubExprs[1]->getBeginLoc(), diag::warn_atomic_op_has_invalid_memory_order) << SubExprs[1]->getSourceRange(); } @@ -4568,13 +4568,13 @@ llvm::APSInt Result(32); if (Scope->isIntegerConstantExpr(Result, Context) && !ScopeModel->isValid(Result.getZExtValue())) { - Diag(Scope->getLocStart(), diag::err_atomic_op_has_invalid_synch_scope) + Diag(Scope->getBeginLoc(), diag::err_atomic_op_has_invalid_synch_scope) << Scope->getSourceRange(); } SubExprs.push_back(Scope); } - AtomicExpr *AE = new (Context) AtomicExpr(TheCall->getCallee()->getLocStart(), + AtomicExpr *AE = new (Context) AtomicExpr(TheCall->getCallee()->getBeginLoc(), SubExprs, ResultType, Op, TheCall->getRParenLoc()); @@ -4583,7 +4583,7 @@ Op == AtomicExpr::AO__opencl_atomic_load || Op == AtomicExpr::AO__opencl_atomic_store ) && Context.AtomicUsesUnsupportedLibcall(AE)) - Diag(AE->getLocStart(), diag::err_atomic_load_store_uses_lib) + Diag(AE->getBeginLoc(), diag::err_atomic_load_store_uses_lib) << ((Op == AtomicExpr::AO__c11_atomic_load || Op == AtomicExpr::AO__opencl_atomic_load) ? 0 : 1); @@ -4651,7 +4651,7 @@ const PointerType *pointerType = FirstArg->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } @@ -4659,13 +4659,13 @@ QualType ValType = pointerType->getPointeeType(); if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType()) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer_intptr) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intptr) << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } if (ValType.isConstQualified()) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_cannot_be_const) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_cannot_be_const) << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } @@ -4679,7 +4679,7 @@ case Qualifiers::OCL_Weak: case Qualifiers::OCL_Strong: case Qualifiers::OCL_Autoreleasing: - Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership) + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) << ValType << FirstArg->getSourceRange(); return ExprError(); } @@ -4730,7 +4730,7 @@ case 8: SizeIndex = 3; break; case 16: SizeIndex = 4; break; default: - Diag(DRE->getLocStart(), diag::err_atomic_builtin_pointer_size) + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_pointer_size) << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } @@ -4929,7 +4929,7 @@ else { // Perform builtin lookup to avoid redeclaring it. DeclarationName DN(&Context.Idents.get(NewBuiltinName)); - LookupResult Res(*this, DN, DRE->getLocStart(), LookupOrdinaryName); + LookupResult Res(*this, DN, DRE->getBeginLoc(), LookupOrdinaryName); LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true); assert(Res.getFoundDecl()); NewBuiltinDecl = dyn_cast(Res.getFoundDecl()); @@ -5026,7 +5026,7 @@ const PointerType *pointerType = PointerArg->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_nontemporal_builtin_must_be_pointer) + Diag(DRE->getBeginLoc(), diag::err_nontemporal_builtin_must_be_pointer) << PointerArg->getType() << PointerArg->getSourceRange(); return ExprError(); } @@ -5038,7 +5038,7 @@ if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType() && !ValType->isFloatingType() && !ValType->isVectorType()) { - Diag(DRE->getLocStart(), + Diag(DRE->getBeginLoc(), diag::err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector) << PointerArg->getType() << PointerArg->getSourceRange(); return ExprError(); @@ -5070,7 +5070,7 @@ StringLiteral *Literal = dyn_cast(Arg); if (!Literal || !Literal->isAscii()) { - Diag(Arg->getLocStart(), diag::err_cfstring_literal_not_string_constant) + Diag(Arg->getBeginLoc(), diag::err_cfstring_literal_not_string_constant) << Arg->getSourceRange(); return true; } @@ -5087,7 +5087,7 @@ ToPtr + NumBytes, llvm::strictConversion); // Check for conversion failure. if (Result != llvm::conversionOK) - Diag(Arg->getLocStart(), + Diag(Arg->getBeginLoc(), diag::warn_cfstring_truncated) << Arg->getSourceRange(); } return false; @@ -5106,7 +5106,7 @@ if (!Literal || (!Literal->isAscii() && !Literal->isUTF8())) { return ExprError( - Diag(Arg->getLocStart(), diag::err_os_log_format_not_string_constant) + Diag(Arg->getBeginLoc(), diag::err_os_log_format_not_string_constant) << Arg->getSourceRange()); } @@ -5133,7 +5133,7 @@ if (IsMSVAStart) { // Don't allow this in System V ABI functions. if (CC == CC_X86_64SysV || (!IsWindows && CC != CC_Win64)) - return S.Diag(Fn->getLocStart(), + return S.Diag(Fn->getBeginLoc(), diag::err_ms_va_start_used_in_sysv_function); } else { // On x86-64/AArch64 Unix, don't allow this in Win64 ABI functions. @@ -5142,7 +5142,7 @@ // System V ABI functions on Windows.) if ((IsWindows && CC == CC_X86_64SysV) || (!IsWindows && CC == CC_Win64)) - return S.Diag(Fn->getLocStart(), + return S.Diag(Fn->getBeginLoc(), diag::err_va_start_used_in_wrong_abi_function) << !IsWindows; } @@ -5150,7 +5150,7 @@ } if (IsMSVAStart) - return S.Diag(Fn->getLocStart(), diag::err_builtin_x64_aarch64_only); + return S.Diag(Fn->getBeginLoc(), diag::err_builtin_x64_aarch64_only); return false; } @@ -5173,16 +5173,16 @@ Params = MD->parameters(); } else if (isa(Caller)) { // We don't support va_start in a CapturedDecl. - S.Diag(Fn->getLocStart(), diag::err_va_start_captured_stmt); + S.Diag(Fn->getBeginLoc(), diag::err_va_start_captured_stmt); return true; } else { // This must be some other declcontext that parses exprs. - S.Diag(Fn->getLocStart(), diag::err_va_start_outside_function); + S.Diag(Fn->getBeginLoc(), diag::err_va_start_outside_function); return true; } if (!IsVariadic) { - S.Diag(Fn->getLocStart(), diag::err_va_start_fixed_function); + S.Diag(Fn->getBeginLoc(), diag::err_va_start_fixed_function); return true; } @@ -5202,11 +5202,11 @@ return true; if (TheCall->getNumArgs() > 2) { - Diag(TheCall->getArg(2)->getLocStart(), + Diag(TheCall->getArg(2)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << 2 << TheCall->getNumArgs() << Fn->getSourceRange() - << SourceRange(TheCall->getArg(2)->getLocStart(), + << SourceRange(TheCall->getArg(2)->getBeginLoc(), (*(TheCall->arg_end()-1))->getLocEnd()); return true; } @@ -5249,7 +5249,7 @@ } if (!SecondArgIsLastNamedArgument) - Diag(TheCall->getArg(1)->getLocStart(), + Diag(TheCall->getArg(1)->getBeginLoc(), diag::warn_second_arg_of_va_start_not_last_named_param); else if (IsCRegister || Type->isReferenceType() || Type->isSpecificBuiltinType(BuiltinType::Float) || [=] { @@ -5266,7 +5266,7 @@ unsigned Reason = 0; if (Type->isReferenceType()) Reason = 1; else if (IsCRegister) Reason = 2; - Diag(Arg->getLocStart(), diag::warn_va_start_type_is_undefined) << Reason; + Diag(Arg->getBeginLoc(), diag::warn_va_start_type_is_undefined) << Reason; Diag(ParamLoc, diag::note_parameter_type) << Type; } @@ -5305,7 +5305,7 @@ Context.getPointerType(Context.CharTy.withConst()); if (!Arg1Ty->isPointerType() || Arg1Ty->getPointeeType().withoutLocalFastQualifiers() != Context.CharTy) - Diag(Arg1->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(Arg1->getBeginLoc(), diag::err_typecheck_convert_incompatible) << Arg1->getType() << ConstCharPtrTy << 1 /* different class */ << 0 /* qualifier difference */ @@ -5314,7 +5314,7 @@ const QualType SizeTy = Context.getSizeType(); if (Arg2Ty->getCanonicalTypeInternal().withoutLocalFastQualifiers() != SizeTy) - Diag(Arg2->getLocStart(), diag::err_typecheck_convert_incompatible) + Diag(Arg2->getBeginLoc(), diag::err_typecheck_convert_incompatible) << Arg2->getType() << SizeTy << 1 /* different class */ << 0 /* qualifier difference */ @@ -5331,10 +5331,10 @@ return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) << 0 << 2 << TheCall->getNumArgs()/*function call*/; if (TheCall->getNumArgs() > 2) - return Diag(TheCall->getArg(2)->getLocStart(), + return Diag(TheCall->getArg(2)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << 2 << TheCall->getNumArgs() - << SourceRange(TheCall->getArg(2)->getLocStart(), + << SourceRange(TheCall->getArg(2)->getBeginLoc(), (*(TheCall->arg_end()-1))->getLocEnd()); ExprResult OrigArg0 = TheCall->getArg(0); @@ -5358,10 +5358,10 @@ // If the common type isn't a real floating type, then the arguments were // invalid for this operation. if (Res.isNull() || !Res->isRealFloatingType()) - return Diag(OrigArg0.get()->getLocStart(), + return Diag(OrigArg0.get()->getBeginLoc(), diag::err_typecheck_call_invalid_ordered_compare) << OrigArg0.get()->getType() << OrigArg1.get()->getType() - << SourceRange(OrigArg0.get()->getLocStart(), OrigArg1.get()->getLocEnd()); + << SourceRange(OrigArg0.get()->getBeginLoc(), OrigArg1.get()->getLocEnd()); return false; } @@ -5375,10 +5375,10 @@ return Diag(TheCall->getLocEnd(), diag::err_typecheck_call_too_few_args) << 0 << NumArgs << TheCall->getNumArgs()/*function call*/; if (TheCall->getNumArgs() > NumArgs) - return Diag(TheCall->getArg(NumArgs)->getLocStart(), + return Diag(TheCall->getArg(NumArgs)->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << NumArgs << TheCall->getNumArgs() - << SourceRange(TheCall->getArg(NumArgs)->getLocStart(), + << SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(), (*(TheCall->arg_end()-1))->getLocEnd()); Expr *OrigArg = TheCall->getArg(NumArgs-1); @@ -5388,7 +5388,7 @@ // This operation requires a non-_Complex floating-point number. if (!OrigArg->getType()->isRealFloatingType()) - return Diag(OrigArg->getLocStart(), + return Diag(OrigArg->getBeginLoc(), diag::err_typecheck_call_invalid_unary_fp) << OrigArg->getType() << OrigArg->getSourceRange(); @@ -5438,22 +5438,22 @@ // Check the third argument is a compile time constant llvm::APSInt Value; if(!TheCall->getArg(2)->isIntegerConstantExpr(Value, Context)) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_vsx_builtin_nonconstant_argument) << 3 /* argument index */ << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(2)->getLocStart(), + << SourceRange(TheCall->getArg(2)->getBeginLoc(), TheCall->getArg(2)->getLocEnd()); QualType Arg1Ty = TheCall->getArg(0)->getType(); QualType Arg2Ty = TheCall->getArg(1)->getType(); // Check the type of argument 1 and argument 2 are vectors. - SourceLocation BuiltinLoc = TheCall->getLocStart(); + SourceLocation BuiltinLoc = TheCall->getBeginLoc(); if ((!Arg1Ty->isVectorType() && !Arg1Ty->isDependentType()) || (!Arg2Ty->isVectorType() && !Arg2Ty->isDependentType())) { return Diag(BuiltinLoc, diag::err_vec_builtin_non_vector) << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(0)->getLocStart(), + << SourceRange(TheCall->getArg(0)->getBeginLoc(), TheCall->getArg(1)->getLocEnd()); } @@ -5461,7 +5461,7 @@ if (!Context.hasSameUnqualifiedType(Arg1Ty, Arg2Ty)) { return Diag(BuiltinLoc, diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(0)->getLocStart(), + << SourceRange(TheCall->getArg(0)->getBeginLoc(), TheCall->getArg(1)->getLocEnd()); } @@ -5494,10 +5494,10 @@ QualType RHSType = TheCall->getArg(1)->getType(); if (!LHSType->isVectorType() || !RHSType->isVectorType()) - return ExprError(Diag(TheCall->getLocStart(), + return ExprError(Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_non_vector) << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(0)->getLocStart(), + << SourceRange(TheCall->getArg(0)->getBeginLoc(), TheCall->getArg(1)->getLocEnd())); numElements = LHSType->getAs()->getNumElements(); @@ -5509,16 +5509,16 @@ if (TheCall->getNumArgs() == 2) { if (!RHSType->hasIntegerRepresentation() || RHSType->getAs()->getNumElements() != numElements) - return ExprError(Diag(TheCall->getLocStart(), + return ExprError(Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(1)->getLocStart(), + << SourceRange(TheCall->getArg(1)->getBeginLoc(), TheCall->getArg(1)->getLocEnd())); } else if (!Context.hasSameUnqualifiedType(LHSType, RHSType)) { - return ExprError(Diag(TheCall->getLocStart(), + return ExprError(Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_incompatible_vector) << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(0)->getLocStart(), + << SourceRange(TheCall->getArg(0)->getBeginLoc(), TheCall->getArg(1)->getLocEnd())); } else if (numElements != numResElements) { QualType eltType = LHSType->getAs()->getElementType(); @@ -5534,7 +5534,7 @@ llvm::APSInt Result(32); if (!TheCall->getArg(i)->isIntegerConstantExpr(Result, Context)) - return ExprError(Diag(TheCall->getLocStart(), + return ExprError(Diag(TheCall->getBeginLoc(), diag::err_shufflevector_nonconstant_argument) << TheCall->getArg(i)->getSourceRange()); @@ -5543,7 +5543,7 @@ continue; if (Result.getActiveBits() > 64 || Result.getZExtValue() >= numElements*2) - return ExprError(Diag(TheCall->getLocStart(), + return ExprError(Diag(TheCall->getBeginLoc(), diag::err_shufflevector_argument_too_large) << TheCall->getArg(i)->getSourceRange()); } @@ -5556,7 +5556,7 @@ } return new (Context) ShuffleVectorExpr(Context, exprs, resType, - TheCall->getCallee()->getLocStart(), + TheCall->getCallee()->getBeginLoc(), TheCall->getRParenLoc()); } @@ -5619,7 +5619,7 @@ if (Arg->isInstantiationDependent()) return false; if (Arg->HasSideEffects(Context)) - Diag(Arg->getLocStart(), diag::warn_assume_side_effects) + Diag(Arg->getBeginLoc(), diag::warn_assume_side_effects) << Arg->getSourceRange() << cast(TheCall->getCalleeDecl())->getIdentifier(); @@ -5638,23 +5638,23 @@ if (const auto *UE = dyn_cast(Arg->IgnoreParenImpCasts())) if (UE->getKind() == UETT_AlignOf) - Diag(TheCall->getLocStart(), diag::warn_alloca_align_alignof) + Diag(TheCall->getBeginLoc(), diag::warn_alloca_align_alignof) << Arg->getSourceRange(); llvm::APSInt Result = Arg->EvaluateKnownConstInt(Context); if (!Result.isPowerOf2()) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two) << Arg->getSourceRange(); if (Result < Context.getCharWidth()) - return Diag(TheCall->getLocStart(), diag::err_alignment_too_small) + return Diag(TheCall->getBeginLoc(), diag::err_alignment_too_small) << (unsigned)Context.getCharWidth() << Arg->getSourceRange(); if (Result > std::numeric_limits::max()) - return Diag(TheCall->getLocStart(), diag::err_alignment_too_big) + return Diag(TheCall->getBeginLoc(), diag::err_alignment_too_big) << std::numeric_limits::max() << Arg->getSourceRange(); } @@ -5683,7 +5683,7 @@ return true; if (!Result.isPowerOf2()) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two) << Arg->getSourceRange(); } @@ -5766,7 +5766,7 @@ ArrayRef Args(TheCall->getArgs(), TheCall->getNumArgs()); bool Success = CheckFormatArguments( Args, /*HasVAListArg*/ false, FormatIdx, FirstDataArg, FST_OSLog, - VariadicFunction, TheCall->getLocStart(), SourceRange(), + VariadicFunction, TheCall->getBeginLoc(), SourceRange(), CheckedVarArgs); if (!Success) return true; @@ -5791,7 +5791,7 @@ if (Arg->isTypeDependent() || Arg->isValueDependent()) return false; if (!Arg->isIntegerConstantExpr(Result, Context)) - return Diag(TheCall->getLocStart(), diag::err_constant_integer_arg_type) + return Diag(TheCall->getBeginLoc(), diag::err_constant_integer_arg_type) << FDecl->getDeclName() << Arg->getSourceRange(); return false; @@ -5814,12 +5814,12 @@ if (Result.getSExtValue() < Low || Result.getSExtValue() > High) { if (RangeIsError) - return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range) + return Diag(TheCall->getBeginLoc(), diag::err_argument_invalid_range) << Result.toString(10) << Low << High << Arg->getSourceRange(); else // Defer the warning until we know if the code will be emitted so that // dead code can ignore this. - DiagRuntimeBehavior(TheCall->getLocStart(), TheCall, + DiagRuntimeBehavior(TheCall->getBeginLoc(), TheCall, PDiag(diag::warn_argument_invalid_range) << Result.toString(10) << Low << High << Arg->getSourceRange()); @@ -5844,7 +5844,7 @@ return true; if (Result.getSExtValue() % Num != 0) - return Diag(TheCall->getLocStart(), diag::err_argument_not_multiple) + return Diag(TheCall->getBeginLoc(), diag::err_argument_not_multiple) << Num << Arg->getSourceRange(); return false; @@ -5876,7 +5876,7 @@ // Check if the argument is a string literal. if (!isa(Arg->IgnoreParenImpCasts())) - return Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal) + return Diag(TheCall->getBeginLoc(), diag::err_expr_not_string_literal) << Arg->getSourceRange(); // Check the type of special register given. @@ -5885,7 +5885,7 @@ Reg.split(Fields, ":"); if (Fields.size() != ExpectedFieldNum && !(AllowName && Fields.size() == 1)) - return Diag(TheCall->getLocStart(), diag::err_arm_invalid_specialreg) + return Diag(TheCall->getBeginLoc(), diag::err_arm_invalid_specialreg) << Arg->getSourceRange(); // If the string is the name of a register then we cannot check that it is @@ -5927,7 +5927,7 @@ } if (!ValidString) - return Diag(TheCall->getLocStart(), diag::err_arm_invalid_specialreg) + return Diag(TheCall->getBeginLoc(), diag::err_arm_invalid_specialreg) << Arg->getSourceRange(); } else if (IsAArch64Builtin && Fields.size() == 1) { // If the register name is one of those that appear in the condition below @@ -5955,8 +5955,8 @@ /// that val is a constant 1. bool Sema::SemaBuiltinLongjmp(CallExpr *TheCall) { if (!Context.getTargetInfo().hasSjLjLowering()) - return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_unsupported) - << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd()); + return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_unsupported) + << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd()); Expr *Arg = TheCall->getArg(1); llvm::APSInt Result; @@ -5966,8 +5966,8 @@ return true; if (Result != 1) - return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_invalid_val) - << SourceRange(Arg->getLocStart(), Arg->getLocEnd()); + return Diag(TheCall->getBeginLoc(), diag::err_builtin_longjmp_invalid_val) + << SourceRange(Arg->getBeginLoc(), Arg->getLocEnd()); return false; } @@ -5976,8 +5976,8 @@ /// This checks that the target supports __builtin_setjmp. bool Sema::SemaBuiltinSetjmp(CallExpr *TheCall) { if (!Context.getTargetInfo().hasSjLjLowering()) - return Diag(TheCall->getLocStart(), diag::err_builtin_setjmp_unsupported) - << SourceRange(TheCall->getLocStart(), TheCall->getLocEnd()); + return Diag(TheCall->getBeginLoc(), diag::err_builtin_setjmp_unsupported) + << SourceRange(TheCall->getBeginLoc(), TheCall->getLocEnd()); return false; } @@ -6123,7 +6123,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return FExpr->getLocStart().getLocWithOffset(Offset); + return FExpr->getBeginLoc().getLocWithOffset(Offset); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -6513,7 +6513,7 @@ // format is either NSString or CFString. This is a hack to prevent // diag when using the NSLocalizedString and CFCopyLocalizedString macros // which are usually used in place of NS and CF string literals. - SourceLocation FormatLoc = Args[format_idx]->getLocStart(); + SourceLocation FormatLoc = Args[format_idx]->getBeginLoc(); if (Type == FST_NSString && SourceMgr.isInSystemMacro(FormatLoc)) return false; @@ -6833,7 +6833,7 @@ if (!ArgExpr) return; - SourceLocation Loc = ArgExpr->getLocStart(); + SourceLocation Loc = ArgExpr->getBeginLoc(); if (S.getSourceManager().isInSystemMacro(Loc)) return; @@ -7279,7 +7279,7 @@ AT.matchesType(S.Context, Method->getReturnType())) { // FIXME: Suggest parens if the expression needs them. SourceLocation EndLoc = S.getLocForEndOfToken(E->getLocEnd()); - S.Diag(E->getLocStart(), diag::note_printf_c_str) + S.Diag(E->getBeginLoc(), diag::note_printf_c_str) << "c_str()" << FixItHint::CreateInsertion(EndLoc, ".c_str()"); return true; @@ -7358,7 +7358,7 @@ S.PDiag(diag::warn_format_conversion_argument_type_mismatch) << AT.getRepresentativeTypeName(S.Context) << Ex->getType() << false << Ex->getSourceRange(), - Ex->getLocStart(), /*IsStringLocation*/false, + Ex->getBeginLoc(), /*IsStringLocation*/false, getSpecifierRange(startSpecifier, specifierLen)); // Type check the second argument (char * for both %b and %D) @@ -7369,7 +7369,7 @@ S.PDiag(diag::warn_format_conversion_argument_type_mismatch) << AT2.getRepresentativeTypeName(S.Context) << Ex->getType() << false << Ex->getSourceRange(), - Ex->getLocStart(), /*IsStringLocation*/false, + Ex->getBeginLoc(), /*IsStringLocation*/false, getSpecifierRange(startSpecifier, specifierLen)); return true; @@ -7668,7 +7668,7 @@ return true; } - LookupResult Result(S, &S.Context.Idents.get("unichar"), E->getLocStart(), + LookupResult Result(S, &S.Context.Idents.get("unichar"), E->getBeginLoc(), Sema::LookupOrdinaryName); if (S.LookupName(Result, S.getCurScope())) { NamedDecl *ND = Result.getFoundDecl(); @@ -7720,7 +7720,7 @@ EmitFormatDiagnostic(S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << IntendedTy << IsEnum << E->getSourceRange(), - E->getLocStart(), + E->getBeginLoc(), /*IsStringLocation*/ false, SpecRange, FixItHint::CreateReplacement(SpecRange, os.str())); } else { @@ -7749,12 +7749,12 @@ } else if (!requiresParensToAddCast(E)) { // If the expression has high enough precedence, // just write the C-style cast. - Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(), + Hints.push_back(FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str())); } else { // Otherwise, add parens around the expression as well as the cast. CastFix << "("; - Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(), + Hints.push_back(FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str())); SourceLocation After = S.getLocForEndOfToken(E->getLocEnd()); @@ -7775,7 +7775,7 @@ : diag::warn_format_argument_needs_cast; EmitFormatDiagnostic(S.PDiag(Diag) << Name << IntendedTy << IsEnum << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation=*/false, + E->getBeginLoc(), /*IsStringLocation=*/false, SpecRange, Hints); } else { // In this case, the expression could be printed using a different @@ -7785,7 +7785,7 @@ S.PDiag(diag::warn_format_conversion_argument_type_mismatch) << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, + E->getBeginLoc(), /*IsStringLocation*/false, SpecRange, Hints); } } @@ -7806,7 +7806,7 @@ EmitFormatDiagnostic( S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum << CSR << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/ false, CSR); + E->getBeginLoc(), /*IsStringLocation*/ false, CSR); break; } case Sema::VAK_Undefined: @@ -7819,7 +7819,7 @@ << AT.getRepresentativeTypeName(S.Context) << CSR << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, CSR); + E->getBeginLoc(), /*IsStringLocation*/false, CSR); checkForCStrMembers(AT, E); break; @@ -7833,11 +7833,11 @@ << AT.getRepresentativeTypeName(S.Context) << CSR << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, CSR); + E->getBeginLoc(), /*IsStringLocation*/false, CSR); else // FIXME: If this is an initializer list, suggest removing the braces // or inserting a cast to the target type. - S.Diag(E->getLocStart(), diag::err_cannot_pass_to_vararg_format) + S.Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg_format) << isa(E) << ExprTy << CallType << AT.getRepresentativeTypeName(S.Context) << E->getSourceRange(); @@ -8010,7 +8010,7 @@ EmitFormatDiagnostic( S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << Ex->getType() << false << Ex->getSourceRange(), - Ex->getLocStart(), + Ex->getBeginLoc(), /*IsStringLocation*/ false, getSpecifierRange(startSpecifier, specifierLen), FixItHint::CreateReplacement( @@ -8019,7 +8019,7 @@ EmitFormatDiagnostic(S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << Ex->getType() << false << Ex->getSourceRange(), - Ex->getLocStart(), + Ex->getBeginLoc(), /*IsStringLocation*/ false, getSpecifierRange(startSpecifier, specifierLen)); } @@ -8041,7 +8041,7 @@ if (!FExpr->isAscii() && !FExpr->isUTF8()) { CheckFormatHandler::EmitFormatDiagnostic( S, inFunctionCall, Args[format_idx], - S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getLocStart(), + S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getBeginLoc(), /*IsStringLocation*/true, OrigFormatExpr->getSourceRange()); return; } @@ -8064,7 +8064,7 @@ CheckFormatHandler::EmitFormatDiagnostic( S, inFunctionCall, Args[format_idx], S.PDiag(diag::warn_printf_format_string_not_null_terminated), - FExpr->getLocStart(), + FExpr->getBeginLoc(), /*IsStringLocation=*/true, OrigFormatExpr->getSourceRange()); return; } @@ -8073,7 +8073,7 @@ if (StrLen == 0 && numDataArgs > 0) { CheckFormatHandler::EmitFormatDiagnostic( S, inFunctionCall, Args[format_idx], - S.PDiag(diag::warn_empty_format_string), FExpr->getLocStart(), + S.PDiag(diag::warn_empty_format_string), FExpr->getBeginLoc(), /*IsStringLocation*/true, OrigFormatExpr->getSourceRange()); return; } @@ -8855,7 +8855,7 @@ const Expr *LenExpr = Call->getArg(LenArg)->IgnoreParenImpCasts(); if (CheckMemorySizeofForComparison(*this, LenExpr, FnName, - Call->getLocStart(), Call->getRParenLoc())) + Call->getBeginLoc(), Call->getRParenLoc())) return; // Catch cases like 'memset(buf, sizeof(buf), 0)'. @@ -9077,7 +9077,7 @@ const Expr *CompareWithSrc = nullptr; if (CheckMemorySizeofForComparison(*this, SizeArg, FnName, - Call->getLocStart(), Call->getRParenLoc())) + Call->getBeginLoc(), Call->getRParenLoc())) return; // Look for 'strlcpy(dst, x, sizeof(x))' @@ -9109,7 +9109,7 @@ return; const Expr *OriginalSizeArg = Call->getArg(2); - Diag(CompareWithSrcDRE->getLocStart(), diag::warn_strlcpycat_wrong_size) + Diag(CompareWithSrcDRE->getBeginLoc(), diag::warn_strlcpycat_wrong_size) << OriginalSizeArg->getSourceRange() << FnName; // Output a FIXIT hint if the destination is an array (rather than a @@ -9126,7 +9126,7 @@ DstArg->printPretty(OS, nullptr, getPrintingPolicy()); OS << ")"; - Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size) + Diag(OriginalSizeArg->getBeginLoc(), diag::note_strlcpycat_wrong_size) << FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(), OS.str()); } @@ -9161,7 +9161,7 @@ const Expr *SrcArg = CE->getArg(1)->IgnoreParenCasts(); const Expr *LenArg = CE->getArg(2)->IgnoreParenCasts(); - if (CheckMemorySizeofForComparison(*this, LenArg, FnName, CE->getLocStart(), + if (CheckMemorySizeofForComparison(*this, LenArg, FnName, CE->getBeginLoc(), CE->getRParenLoc())) return; @@ -9193,7 +9193,7 @@ return; // Generate the diagnostic. - SourceLocation SL = LenArg->getLocStart(); + SourceLocation SL = LenArg->getBeginLoc(); SourceRange SR = LenArg->getSourceRange(); SourceManager &SM = getSourceManager(); @@ -9740,7 +9740,7 @@ return true; // Suppress cases where the '0' value is expanded from a macro. - if (E->getLocStart().isMacroID()) + if (E->getBeginLoc().isMacroID()) return true; return false; @@ -10547,7 +10547,7 @@ ElementResult, false, false) != Sema::Compatible) { - S.Diag(Element->getLocStart(), + S.Diag(Element->getBeginLoc(), diag::warn_objc_collection_literal_element) << ElementType << ElementKind << TargetElementType << Element->getSourceRange(); @@ -10626,7 +10626,7 @@ // to fill all the bits, even if there is a sign change. if (auto *IntLit = dyn_cast(E->IgnoreParenImpCasts())) { const char FirstLiteralCharacter = - S.getSourceManager().getCharacterData(IntLit->getLocStart())[0]; + S.getSourceManager().getCharacterData(IntLit->getBeginLoc())[0]; if (FirstLiteralCharacter == '0') return false; } @@ -11069,13 +11069,13 @@ // Taking into account implicit conversions, // allow any integer. if (!E->getType()->isIntegerType()) { - S.Diag(E->getLocStart(), + S.Diag(E->getBeginLoc(), diag::err_opencl_enqueue_kernel_invalid_local_size_type); return true; } // Potentially emit standard warnings for implicit conversions if enabled // using -Wconversion. - CheckImplicitConversion(S, E, IntT, E->getLocStart()); + CheckImplicitConversion(S, E, IntT, E->getBeginLoc()); return false; } @@ -11283,7 +11283,7 @@ // Suggest '&' to silence the function warning. Diag(E->getExprLoc(), diag::note_function_warning_silence) - << FixItHint::CreateInsertion(E->getLocStart(), "&"); + << FixItHint::CreateInsertion(E->getBeginLoc(), "&"); // Check to see if '()' fixit should be emitted. QualType ReturnType; @@ -12186,7 +12186,7 @@ ASE->getRBracketLoc()); if (SourceMgr.isInSystemHeader(RBracketLoc)) { SourceLocation IndexLoc = SourceMgr.getSpellingLoc( - IndexExpr->getLocStart()); + IndexExpr->getBeginLoc()); if (SourceMgr.isWrittenInSameFile(RBracketLoc, IndexLoc)) return; } @@ -12196,7 +12196,7 @@ if (ASE) DiagID = diag::warn_array_index_exceeds_bounds; - DiagRuntimeBehavior(BaseExpr->getLocStart(), BaseExpr, + DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr, PDiag(DiagID) << index.toString(10, true) << size.toString(10, true) << (unsigned)size.getLimitedValue(~0U) @@ -12208,7 +12208,7 @@ if (index.isNegative()) index = -index; } - DiagRuntimeBehavior(BaseExpr->getLocStart(), BaseExpr, + DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr, PDiag(DiagID) << index.toString(10, true) << IndexExpr->getSourceRange()); } @@ -12225,7 +12225,7 @@ } if (ND) - DiagRuntimeBehavior(ND->getLocStart(), BaseExpr, + DiagRuntimeBehavior(ND->getBeginLoc(), BaseExpr, PDiag(diag::note_array_index_out_of_bounds) << ND->getDeclName()); } @@ -12967,14 +12967,14 @@ if (!ProbableTypo) { bool BodyColInvalid; unsigned BodyCol = SourceMgr.getPresumedColumnNumber( - PossibleBody->getLocStart(), + PossibleBody->getBeginLoc(), &BodyColInvalid); if (BodyColInvalid) return; bool StmtColInvalid; unsigned StmtCol = SourceMgr.getPresumedColumnNumber( - S->getLocStart(), + S->getBeginLoc(), &StmtColInvalid); if (StmtColInvalid) return; @@ -13495,7 +13495,7 @@ if (const TypedefNameDecl *TD = m.RD->getTypedefNameForAnonDecl()) ND = TD; } - Diag(m.E->getLocStart(), diag::warn_taking_address_of_packed_member) + Diag(m.E->getBeginLoc(), diag::warn_taking_address_of_packed_member) << m.MD << ND << m.E->getSourceRange(); } MisalignedMembers.clear(); Index: lib/Sema/SemaCoroutine.cpp =================================================================== --- lib/Sema/SemaCoroutine.cpp +++ lib/Sema/SemaCoroutine.cpp @@ -453,7 +453,7 @@ // to bool. ExprResult Conv = S.PerformContextuallyConvertToBool(AwaitReady); if (Conv.isInvalid()) { - S.Diag(AwaitReady->getDirectCallee()->getLocStart(), + S.Diag(AwaitReady->getDirectCallee()->getBeginLoc(), diag::note_await_ready_no_bool_conversion); S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required) << AwaitReady->getDirectCallee() << E->getSourceRange(); @@ -1460,7 +1460,7 @@ T = E->getType(); QualType TargetType = S.BuildReferenceType( T, /*SpelledAsLValue*/ false, SourceLocation(), DeclarationName()); - SourceLocation ExprLoc = E->getLocStart(); + SourceLocation ExprLoc = E->getBeginLoc(); TypeSourceInfo *TargetLoc = S.Context.getTrivialTypeSourceInfo(TargetType, ExprLoc); Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -1740,7 +1740,7 @@ if (AfterColon.isInvalid()) return; Hint = FixItHint::CreateRemoval(CharSourceRange:: - getCharRange(D->getLocStart(), AfterColon)); + getCharRange(D->getBeginLoc(), AfterColon)); } } @@ -4356,7 +4356,7 @@ Record = UT->getDecl(); if (Record && getLangOpts().MicrosoftExt) { - Diag(DS.getLocStart(), diag::ext_ms_anonymous_record) + Diag(DS.getBeginLoc(), diag::ext_ms_anonymous_record) << Record->isUnion() << DS.getSourceRange(); return BuildMicrosoftCAnonymousStruct(S, DS, Record); } @@ -4380,7 +4380,7 @@ if (!DS.isMissingDeclaratorOk()) { // Customize diagnostic for a typedef missing a name. if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) - Diag(DS.getLocStart(), diag::ext_typedef_without_a_name) + Diag(DS.getBeginLoc(), diag::ext_typedef_without_a_name) << DS.getSourceRange(); else DeclaresAnything = false; @@ -4405,7 +4405,7 @@ if (!DeclaresAnything) { // In C, we allow this as a (popular) extension / bug. Don't bother // producing further diagnostics for redundant qualifiers after this. - Diag(DS.getLocStart(), diag::ext_no_declarators) << DS.getSourceRange(); + Diag(DS.getBeginLoc(), diag::ext_no_declarators) << DS.getSourceRange(); return TagD; } @@ -4816,7 +4816,7 @@ NamedDecl *Anon = nullptr; if (RecordDecl *OwningClass = dyn_cast(Owner)) { Anon = FieldDecl::Create(Context, OwningClass, - DS.getLocStart(), + DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), @@ -4838,7 +4838,7 @@ } Anon = VarDecl::Create(Context, Owner, - DS.getLocStart(), + DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo, SC); @@ -4915,8 +4915,8 @@ // Create a declaration for this anonymous struct. NamedDecl *Anon = FieldDecl::Create(Context, ParentDecl, - DS.getLocStart(), - DS.getLocStart(), + DS.getBeginLoc(), + DS.getBeginLoc(), /*IdentifierInfo=*/nullptr, RecTy, TInfo, @@ -5349,7 +5349,7 @@ return ActOnDecompositionDeclarator(S, D, TemplateParamLists); } else if (!Name) { if (!D.isInvalidType()) // Reject this if we think it is valid. - Diag(D.getDeclSpec().getLocStart(), + Diag(D.getDeclSpec().getBeginLoc(), diag::err_declarator_need_ident) << D.getDeclSpec().getSourceRange() << D.getSourceRange(); return nullptr; @@ -6358,7 +6358,7 @@ // address space qualifiers. if (R->isEventT()) { if (R.getAddressSpace() != LangAS::opencl_private) { - Diag(D.getLocStart(), diag::err_event_t_addr_space_qual); + Diag(D.getBeginLoc(), diag::err_event_t_addr_space_qual); D.setInvalidType(); } } @@ -6432,7 +6432,7 @@ VarTemplateDecl *NewTemplate = nullptr; TemplateParameterList *TemplateParams = nullptr; if (!getLangOpts().CPlusPlus) { - NewVD = VarDecl::Create(Context, DC, D.getLocStart(), + NewVD = VarDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(), II, R, TInfo, SC); @@ -6496,7 +6496,7 @@ // Match up the template parameter lists with the scope specifier, then // determine whether we have a template or a template specialization. TemplateParams = MatchTemplateParametersToScopeSpecifier( - D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), + D.getDeclSpec().getBeginLoc(), D.getIdentifierLoc(), D.getCXXScopeSpec(), D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId ? D.getName().TemplateId @@ -6555,11 +6555,11 @@ NewVD = cast(Res.get()); AddToScope = false; } else if (D.isDecompositionDeclarator()) { - NewVD = DecompositionDecl::Create(Context, DC, D.getLocStart(), + NewVD = DecompositionDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(), R, TInfo, SC, Bindings); } else - NewVD = VarDecl::Create(Context, DC, D.getLocStart(), + NewVD = VarDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(), II, R, TInfo, SC); // If this is supposed to be a variable template, create it as such. @@ -6776,7 +6776,7 @@ } if (!R->isIntegralType(Context) && !R->isPointerType()) { - Diag(D.getLocStart(), diag::err_asm_bad_register_type); + Diag(D.getBeginLoc(), diag::err_asm_bad_register_type); NewVD->setInvalidDecl(true); } } @@ -6906,12 +6906,12 @@ // C++ [basic.start.main]p3 // A program that declares a variable main at global scope is ill-formed. if (getLangOpts().CPlusPlus) - Diag(D.getLocStart(), diag::err_main_global_variable); + Diag(D.getBeginLoc(), diag::err_main_global_variable); // In C, and external-linkage variable named main results in undefined // behavior. else if (NewVD->hasExternalFormalLinkage()) - Diag(D.getLocStart(), diag::warn_main_redefined); + Diag(D.getBeginLoc(), diag::warn_main_redefined); } if (D.isRedeclaration() && !Previous.empty()) { @@ -7914,7 +7914,7 @@ (!R->getAsAdjusted() && R->isFunctionProtoType()); NewFD = FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), NameInfo, R, + D.getBeginLoc(), NameInfo, R, TInfo, SC, isInline, HasPrototype, false); if (D.isInvalidType()) @@ -7942,7 +7942,7 @@ R = SemaRef.CheckConstructorDeclarator(D, R, SC); return CXXConstructorDecl::Create(SemaRef.Context, cast(DC), - D.getLocStart(), NameInfo, + D.getBeginLoc(), NameInfo, R, TInfo, isExplicit, isInline, /*isImplicitlyDeclared=*/false, isConstexpr); @@ -7954,7 +7954,7 @@ CXXRecordDecl *Record = cast(DC); CXXDestructorDecl *NewDD = CXXDestructorDecl::Create( SemaRef.Context, Record, - D.getLocStart(), + D.getBeginLoc(), NameInfo, R, TInfo, isInline, /*isImplicitlyDeclared=*/false); @@ -7977,7 +7977,7 @@ // Create a FunctionDecl to satisfy the function definition parsing // code path. return FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), + D.getBeginLoc(), D.getIdentifierLoc(), Name, R, TInfo, SC, isInline, /*hasPrototype=*/true, isConstexpr); @@ -7993,14 +7993,14 @@ SemaRef.CheckConversionDeclarator(D, R, SC); IsVirtualOkay = true; return CXXConversionDecl::Create(SemaRef.Context, cast(DC), - D.getLocStart(), NameInfo, + D.getBeginLoc(), NameInfo, R, TInfo, isInline, isExplicit, isConstexpr, SourceLocation()); } else if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) { SemaRef.CheckDeductionGuideDeclarator(D, R, SC); - return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getLocStart(), + return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), isExplicit, NameInfo, R, TInfo, D.getLocEnd()); } else if (DC->isRecord()) { @@ -8019,7 +8019,7 @@ // This is a C++ method declaration. CXXMethodDecl *Ret = CXXMethodDecl::Create(SemaRef.Context, cast(DC), - D.getLocStart(), NameInfo, R, + D.getBeginLoc(), NameInfo, R, TInfo, SC, isInline, isConstexpr, SourceLocation()); IsVirtualOkay = !Ret->isStatic(); @@ -8034,7 +8034,7 @@ // prototype. This true when: // - we're in C++ (where every function has a prototype), return FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), + D.getBeginLoc(), NameInfo, R, TInfo, SC, isInline, true/*HasPrototype*/, isConstexpr); } @@ -8339,7 +8339,7 @@ bool Invalid = false; if (TemplateParameterList *TemplateParams = MatchTemplateParametersToScopeSpecifier( - D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), + D.getDeclSpec().getBeginLoc(), D.getIdentifierLoc(), D.getCXXScopeSpec(), D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId ? D.getName().TemplateId @@ -10029,7 +10029,7 @@ // A deduction guide is not on the list of entities that can be // explicitly specialized. if (Guide->getTemplateSpecializationKind() == TSK_ExplicitSpecialization) - Diag(Guide->getLocStart(), diag::err_deduction_guide_specialized) + Diag(Guide->getBeginLoc(), diag::err_deduction_guide_specialized) << /*explicit specialization*/ 1; } @@ -10632,7 +10632,7 @@ return; } - S.DiagRuntimeBehavior(DRE->getLocStart(), DRE, + S.DiagRuntimeBehavior(DRE->getBeginLoc(), DRE, S.PDiag(diag) << DRE->getDecl() << OrigDecl->getLocation() @@ -10735,7 +10735,7 @@ if (DeduceInits.empty()) { // It isn't possible to write this directly, but it is possible to // end up in this situation with "auto x(some_pack...);" - Diag(Init->getLocStart(), IsInitCapture + Diag(Init->getBeginLoc(), IsInitCapture ? diag::err_init_capture_no_expression : diag::err_auto_var_init_no_expression) << VN << Type << Range; @@ -10743,7 +10743,7 @@ } if (DeduceInits.size() > 1) { - Diag(DeduceInits[1]->getLocStart(), + Diag(DeduceInits[1]->getBeginLoc(), IsInitCapture ? diag::err_init_capture_multiple_expressions : diag::err_auto_var_init_multiple_expressions) << VN << Type << Range; @@ -10752,7 +10752,7 @@ Expr *DeduceInit = DeduceInits[0]; if (DirectInit && isa(DeduceInit)) { - Diag(Init->getLocStart(), IsInitCapture + Diag(Init->getBeginLoc(), IsInitCapture ? diag::err_init_capture_paren_braces : diag::err_auto_var_init_paren_braces) << isa(Init) << VN << Type << Range; @@ -11057,7 +11057,7 @@ if ((VDecl->getType().getObjCLifetime() == Qualifiers::OCL_Strong || VDecl->getType().isNonWeakInMRRWithObjCWeak(Context)) && !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, - Init->getLocStart())) + Init->getBeginLoc())) FSI->markSafeWeakUse(Init); } @@ -11189,9 +11189,9 @@ Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type_cxx11) << DclT << Init->getSourceRange(); - Diag(VDecl->getLocStart(), + Diag(VDecl->getBeginLoc(), diag::note_in_class_initializer_float_type_cxx11) - << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); + << FixItHint::CreateInsertion(VDecl->getBeginLoc(), "constexpr "); } else { Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type) << DclT << Init->getSourceRange(); @@ -11207,7 +11207,7 @@ } else if (getLangOpts().CPlusPlus11 && DclT->isLiteralType(Context)) { Diag(VDecl->getLocation(), diag::err_in_class_initializer_literal_type) << DclT << Init->getSourceRange() - << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); + << FixItHint::CreateInsertion(VDecl->getBeginLoc(), "constexpr "); VDecl->setConstexpr(true); } else { @@ -12289,7 +12289,7 @@ // the enclosing context. This prevents them from accidentally // looking like class members in C++. ParmVarDecl *New = CheckParameter(Context.getTranslationUnitDecl(), - D.getLocStart(), + D.getBeginLoc(), D.getIdentifierLoc(), II, parmDeclType, TInfo, SC); @@ -13029,7 +13029,7 @@ if (FD->isMultiVersion() && FD->hasAttr() && Body) if (const auto *CmpndBody = dyn_cast(Body)) if (!CmpndBody->body_empty()) - Diag(CmpndBody->body_front()->getLocStart(), + Diag(CmpndBody->body_front()->getBeginLoc(), diag::warn_dispatch_body_ignored); if (auto *MD = dyn_cast(FD)) { @@ -13180,7 +13180,7 @@ if (RegisterVariables) continue; if (!isa(S) && !isa(S)) { - Diag(S->getLocStart(), diag::err_non_asm_stmt_in_naked_function); + Diag(S->getBeginLoc(), diag::err_non_asm_stmt_in_naked_function); Diag(FD->getAttr()->getLocation(), diag::note_attribute); FD->setInvalidDecl(); break; @@ -13487,7 +13487,7 @@ // Scope manipulation handled by caller. TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext, - D.getLocStart(), + D.getBeginLoc(), D.getIdentifierLoc(), D.getIdentifier(), TInfo); @@ -14783,7 +14783,7 @@ // as if it were a public member name. CXXRecordDecl *InjectedClassName = CXXRecordDecl::Create(Context, Record->getTagKind(), CurContext, - Record->getLocStart(), Record->getLocation(), + Record->getBeginLoc(), Record->getLocation(), Record->getIdentifier(), /*PrevDecl=*/nullptr, /*DelayTypeCreation=*/true); @@ -15053,7 +15053,7 @@ bool Mutable = (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_mutable); - SourceLocation TSSL = D.getLocStart(); + SourceLocation TSSL = D.getBeginLoc(); FieldDecl *NewFD = CheckFieldDecl(II, T, TInfo, Record, Loc, Mutable, BitWidth, InitStyle, TSSL, AS, PrevDecl, &D); @@ -16689,7 +16689,7 @@ switch (LSD->getLanguage()) { case LinkageSpecDecl::lang_c: if (ExternCLoc.isInvalid()) - ExternCLoc = LSD->getLocStart(); + ExternCLoc = LSD->getBeginLoc(); break; case LinkageSpecDecl::lang_cxx: break; @@ -16705,7 +16705,7 @@ ? diag::ext_module_import_not_at_top_level_noop : diag::err_module_import_not_at_top_level_fatal) << M->getFullModuleName() << DC; - S.Diag(cast(DC)->getLocStart(), + S.Diag(cast(DC)->getBeginLoc(), diag::note_module_import_not_at_top_level) << DC; } else if (!M->IsExternC && ExternCLoc.isValid()) { S.Diag(ImportLoc, diag::ext_module_import_in_extern_c) Index: lib/Sema/SemaDeclAttr.cpp =================================================================== --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -372,10 +372,10 @@ Expr *ArgExpr = AL.getArgAsExpr(ArgNum); const auto *Literal = dyn_cast(ArgExpr->IgnoreParenCasts()); if (ArgLocation) - *ArgLocation = ArgExpr->getLocStart(); + *ArgLocation = ArgExpr->getBeginLoc(); if (!Literal || !Literal->isAscii()) { - Diag(ArgExpr->getLocStart(), diag::err_attribute_argument_type) + Diag(ArgExpr->getBeginLoc(), diag::err_attribute_argument_type) << AL.getName() << AANT_ArgumentString; return false; } @@ -772,7 +772,7 @@ const ParmVarDecl *Param = FD->getParamDecl(Idx.getASTIndex()); if (!Param->getType()->isIntegerType() && !Param->getType()->isCharType()) { - SourceLocation SrcLoc = AttrArg->getLocStart(); + SourceLocation SrcLoc = AttrArg->getBeginLoc(); S.Diag(SrcLoc, diag::err_attribute_integers_only) << getAttrName(AI) << Param->getSourceRange(); return false; @@ -987,7 +987,7 @@ DiagnoseIfAttr::DiagnosticType DiagType; if (!DiagnoseIfAttr::ConvertStrToDiagnosticType(DiagTypeStr, DiagType)) { - S.Diag(AL.getArgAsExpr(2)->getLocStart(), + S.Diag(AL.getArgAsExpr(2)->getBeginLoc(), diag::err_diagnose_if_invalid_diagnostic_type); return; } @@ -1002,7 +1002,7 @@ static void handlePassObjectSizeAttr(Sema &S, Decl *D, const ParsedAttr &AL) { if (D->hasAttr()) { - S.Diag(D->getLocStart(), diag::err_attribute_only_once_per_parameter) + S.Diag(D->getBeginLoc(), diag::err_attribute_only_once_per_parameter) << AL.getName(); return; } @@ -1016,7 +1016,7 @@ // __builtin_object_size. So, it has the same constraints as that second // argument; namely, it must be in the range [0, 3]. if (Type > 3) { - S.Diag(E->getLocStart(), diag::err_attribute_argument_outof_range) + S.Diag(E->getBeginLoc(), diag::err_attribute_argument_outof_range) << AL.getName() << 0 << 3 << E->getSourceRange(); return; } @@ -1026,7 +1026,7 @@ // At this point, we have no clue if `D` belongs to a function declaration or // definition, so we defer the constness check until later. if (!cast(D)->getType()->isPointerType()) { - S.Diag(D->getLocStart(), diag::err_attribute_pointers_only) + S.Diag(D->getBeginLoc(), diag::err_attribute_pointers_only) << AL.getName() << 1; return; } @@ -1579,7 +1579,7 @@ QualType Ty = getFunctionOrMethodParamType(D, Idx.getASTIndex()); if (!Ty->isDependentType() && !Ty->isIntegralType(Context)) { - Diag(ParamExpr->getLocStart(), diag::err_attribute_integers_only) + Diag(ParamExpr->getBeginLoc(), diag::err_attribute_integers_only) << &TmpAttr << FuncDecl->getParamDecl(Idx.getASTIndex())->getSourceRange(); return; @@ -4112,15 +4112,15 @@ } if (const auto *Method = dyn_cast(FD)) { if (Method->isInstance()) { - S.Diag(Method->getLocStart(), diag::err_kern_is_nonstatic_method) + S.Diag(Method->getBeginLoc(), diag::err_kern_is_nonstatic_method) << Method; return; } - S.Diag(Method->getLocStart(), diag::warn_kern_is_method) << Method; + S.Diag(Method->getBeginLoc(), diag::warn_kern_is_method) << Method; } // Only warn for "inline" when compiling for host, to cut down on noise. if (FD->isInlineSpecified() && !S.getLangOpts().CUDAIsDevice) - S.Diag(FD->getLocStart(), diag::warn_kern_is_inline) << FD; + S.Diag(FD->getBeginLoc(), diag::warn_kern_is_inline) << FD; D->addAttr(::new (S.Context) CUDAGlobalAttr(AL.getRange(), S.Context, @@ -4672,7 +4672,7 @@ // is significant. Allow non-dependent code to contain inappropriate // attributes even in ARC, but require template instantiations to be // set up correctly. - Diag(D->getLocStart(), (IsTemplateInstantiation && IsNSConsumed && + Diag(D->getBeginLoc(), (IsTemplateInstantiation && IsNSConsumed && getLangOpts().ObjCAutoRefCount ? diag::err_ns_attribute_wrong_parameter_type : diag::warn_ns_attribute_wrong_parameter_type)) @@ -4714,7 +4714,7 @@ else if (const auto *Param = dyn_cast(D)) { ReturnType = Param->getType()->getPointeeType(); if (ReturnType.isNull()) { - S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type) + S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type) << AL.getName() << /*pointer-to-CF*/2 << AL.getRange(); return; @@ -4736,7 +4736,7 @@ ExpectedDeclKind = ExpectedFunctionMethodOrParameter; break; } - S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) + S.Diag(D->getBeginLoc(), diag::warn_attribute_wrong_decl_type) << AL.getRange() << AL.getName() << ExpectedDeclKind; return; } @@ -4768,7 +4768,7 @@ return; if (isa(D)) { - S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_parameter_type) + S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_parameter_type) << AL.getName() << /*pointer-to-CF*/2 << AL.getRange(); } else { @@ -4782,7 +4782,7 @@ SubjectKind = Method; else if (isa(D)) SubjectKind = Property; - S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type) + S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type) << AL.getName() << SubjectKind << Cf << AL.getRange(); } @@ -4829,7 +4829,7 @@ if (!resultType->isReferenceType() && (!resultType->isPointerType() || resultType->isObjCRetainableType())) { - S.Diag(D->getLocStart(), diag::warn_ns_attribute_wrong_return_type) + S.Diag(D->getBeginLoc(), diag::warn_ns_attribute_wrong_return_type) << SourceRange(loc) << Attrs.getName() << (isa(D) ? EP_ObjCMethod : EP_ObjCProperty) @@ -4849,13 +4849,13 @@ const DeclContext *DC = Method->getDeclContext(); if (const auto *PDecl = dyn_cast_or_null(DC)) { - S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) + S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs.getName() << 0; S.Diag(PDecl->getLocation(), diag::note_protocol_decl); return; } if (Method->getMethodFamily() == OMF_dealloc) { - S.Diag(D->getLocStart(), diag::warn_objc_requires_super_protocol) + S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs.getName() << 1; return; } @@ -4868,7 +4868,7 @@ IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr; if (!Parm) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL.getName() << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL.getName() << 0; return; } @@ -4898,7 +4898,7 @@ IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr; if (!Parm) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL.getName() << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL.getName() << 0; return; } @@ -4912,7 +4912,7 @@ IdentifierInfo *RelatedClass = AL.isArgIdent(0) ? AL.getArgAsIdent(0)->Ident : nullptr; if (!RelatedClass) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL.getName() << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL.getName() << 0; return; } IdentifierInfo *ClassMethod = @@ -4982,7 +4982,7 @@ static void handleObjCOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) { if (hasDeclarator(D)) return; - S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) + S.Diag(D->getBeginLoc(), diag::err_attribute_wrong_decl_type) << AL.getRange() << AL.getName() << ExpectedVariable; } @@ -5308,7 +5308,7 @@ // Interrupt handler must have 1 or 2 parameters. unsigned NumParams = getFunctionOrMethodNumParams(D); if (NumParams < 1 || NumParams > 2) { - S.Diag(D->getLocStart(), diag::err_anyx86_interrupt_attribute) + S.Diag(D->getBeginLoc(), diag::err_anyx86_interrupt_attribute) << (S.Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86 ? 0 : 1) @@ -7081,7 +7081,7 @@ return {" ", Loc, ""}; } static AttributeInsertion createInsertionBefore(const NamedDecl *D) { - return {"", D->getLocStart(), "\n"}; + return {"", D->getBeginLoc(), "\n"}; } }; @@ -7611,18 +7611,18 @@ bool VisitDeclRefExpr(DeclRefExpr *DRE) { DiagnoseDeclAvailability(DRE->getDecl(), - SourceRange(DRE->getLocStart(), DRE->getLocEnd())); + SourceRange(DRE->getBeginLoc(), DRE->getLocEnd())); return true; } bool VisitMemberExpr(MemberExpr *ME) { DiagnoseDeclAvailability(ME->getMemberDecl(), - SourceRange(ME->getLocStart(), ME->getLocEnd())); + SourceRange(ME->getBeginLoc(), ME->getLocEnd())); return true; } bool VisitObjCAvailabilityCheckExpr(ObjCAvailabilityCheckExpr *E) { - SemaRef.Diag(E->getLocStart(), diag::warn_at_available_unchecked_use) + SemaRef.Diag(E->getBeginLoc(), diag::warn_at_available_unchecked_use) << (!SemaRef.getLangOpts().ObjC1); return true; } @@ -7711,7 +7711,7 @@ const SourceManager &SM = SemaRef.getSourceManager(); SourceLocation IfInsertionLoc = - SM.getExpansionLoc(StmtOfUse->getLocStart()); + SM.getExpansionLoc(StmtOfUse->getBeginLoc()); SourceLocation StmtEndLoc = SM.getExpansionRange( (LastStmtOfUse ? LastStmtOfUse : StmtOfUse)->getLocEnd()) Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -94,7 +94,7 @@ // evaluated. Parameters of a function declared before a default // argument expression are in scope and can hide namespace and // class member names. - return S->Diag(DRE->getLocStart(), + return S->Diag(DRE->getBeginLoc(), diag::err_param_default_argument_references_param) << Param->getDeclName() << DefaultArg->getSourceRange(); } else if (VarDecl *VDecl = dyn_cast(Decl)) { @@ -102,7 +102,7 @@ // Local variables shall not be used in default argument // expressions. if (VDecl->isLocalVarDecl()) - return S->Diag(DRE->getLocStart(), + return S->Diag(DRE->getBeginLoc(), diag::err_param_default_argument_references_local) << VDecl->getDeclName() << DefaultArg->getSourceRange(); } @@ -115,7 +115,7 @@ // C++ [dcl.fct.default]p8: // The keyword this shall not be used in a default argument of a // member function. - return S->Diag(ThisE->getLocStart(), + return S->Diag(ThisE->getBeginLoc(), diag::err_param_default_argument_references_this) << ThisE->getSourceRange(); } @@ -144,7 +144,7 @@ if (Lambda->capture_begin() == Lambda->capture_end()) return false; - return S->Diag(Lambda->getLocStart(), + return S->Diag(Lambda->getBeginLoc(), diag::err_lambda_capture_default_arg); } } @@ -1270,7 +1270,7 @@ << RD << BaseType; for (auto &BS : *BestPath) { if (BS.Base->getAccessSpecifier() != AS_public) { - S.Diag(BS.Base->getLocStart(), diag::note_access_constrained_by_path) + S.Diag(BS.Base->getBeginLoc(), diag::note_access_constrained_by_path) << (BS.Base->getAccessSpecifier() == AS_protected) << (BS.Base->getAccessSpecifierAsWritten() == AS_none); break; @@ -1606,7 +1606,7 @@ << isa(NewFD) << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases(); for (const auto &I : RD->vbases()) - Diag(I.getLocStart(), + Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here) << I.getSourceRange(); return false; } @@ -1691,7 +1691,7 @@ case Decl::CXXRecord: // C++1y allows types to be defined, not just declared. if (cast(DclIt)->isThisDeclarationADefinition()) - SemaRef.Diag(DS->getLocStart(), + SemaRef.Diag(DS->getBeginLoc(), SemaRef.getLangOpts().CPlusPlus14 ? diag::warn_cxx11_compat_constexpr_type_definition : diag::ext_constexpr_type_definition) @@ -1746,11 +1746,11 @@ // These are disallowed in C++11 and permitted in C++1y. Allow them // everywhere as an extension. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = DS->getLocStart(); + Cxx1yLoc = DS->getBeginLoc(); continue; default: - SemaRef.Diag(DS->getLocStart(), diag::err_constexpr_body_invalid_stmt) + SemaRef.Diag(DS->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) << isa(Dcl); return false; } @@ -1830,17 +1830,17 @@ if (isa(Dcl)) { // C++1y allows return statements in constexpr constructors. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); return true; } - ReturnStmts.push_back(S->getLocStart()); + ReturnStmts.push_back(S->getBeginLoc()); return true; case Stmt::CompoundStmtClass: { // C++1y allows compound-statements. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); CompoundStmt *CompStmt = cast(S); for (auto *BodyIt : CompStmt->body()) { @@ -1853,13 +1853,13 @@ case Stmt::AttributedStmtClass: if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); return true; case Stmt::IfStmtClass: { // C++1y allows if-statements. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); IfStmt *If = cast(S); if (!CheckConstexprFunctionStmt(SemaRef, Dcl, If->getThen(), ReturnStmts, @@ -1882,7 +1882,7 @@ if (!SemaRef.getLangOpts().CPlusPlus14) break; if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); for (Stmt *SubStmt : S->children()) if (SubStmt && !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, @@ -1897,7 +1897,7 @@ // C++1y allows switch-statements, and since they don't need variable // mutation, we can reasonably allow them in C++11 as an extension. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); for (Stmt *SubStmt : S->children()) if (SubStmt && !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, @@ -1911,11 +1911,11 @@ // C++1y allows expression-statements. if (!Cxx1yLoc.isValid()) - Cxx1yLoc = S->getLocStart(); + Cxx1yLoc = S->getBeginLoc(); return true; } - SemaRef.Diag(S->getLocStart(), diag::err_constexpr_body_invalid_stmt) + SemaRef.Diag(S->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) << isa(Dcl); return false; } @@ -1935,7 +1935,7 @@ // C++11 [dcl.constexpr]p4: // In the definition of a constexpr constructor, [...] // - its function-body shall not be a function-try-block; - Diag(Body->getLocStart(), diag::err_constexpr_function_try_block) + Diag(Body->getBeginLoc(), diag::err_constexpr_function_try_block) << isa(Dcl); return false; } @@ -2395,7 +2395,7 @@ // C++ [class.mi]p3: // A class shall not be specified as a direct base class of a // derived class more than once. - Diag(Bases[idx]->getLocStart(), + Diag(Bases[idx]->getBeginLoc(), diag::err_duplicate_base_class) << KnownBase->getType() << Bases[idx]->getSourceRange(); @@ -2421,7 +2421,7 @@ KnownBase->getAccessSpecifier() != AS_public)) { // The Microsoft extension __interface does not permit bases that // are not themselves public interfaces. - Diag(KnownBase->getLocStart(), diag::err_invalid_base_in_interface) + Diag(KnownBase->getBeginLoc(), diag::err_invalid_base_in_interface) << getRecordDiagFromTagKind(RD->getTagKind()) << RD << RD->getSourceRange(); Invalid = true; @@ -2457,7 +2457,7 @@ (void)found; if (Paths.isAmbiguous(CanonicalBase)) - Diag(Bases[idx]->getLocStart (), diag::warn_inaccessible_base_class) + Diag(Bases[idx]->getBeginLoc (), diag::warn_inaccessible_base_class) << BaseType << getAmbiguousPathsDisplayString(Paths) << Bases[idx]->getSourceRange(); else @@ -2906,7 +2906,7 @@ // For anonymous bitfields, the location should point to the type. if (Loc.isInvalid()) - Loc = D.getLocStart(); + Loc = D.getBeginLoc(); Expr *BitWidth = static_cast(BW); @@ -3144,8 +3144,8 @@ if (auto *DG = dyn_cast(NonTemplateMember)) { auto *TD = DG->getDeducedTemplate(); if (AS != TD->getAccess()) { - Diag(DG->getLocStart(), diag::err_deduction_guide_wrong_access); - Diag(TD->getLocStart(), diag::note_deduction_guide_template_access) + Diag(DG->getBeginLoc(), diag::err_deduction_guide_wrong_access); + Diag(TD->getBeginLoc(), diag::note_deduction_guide_template_access) << TD->getAccess(); const AccessSpecDecl *LastAccessSpec = nullptr; for (const auto *D : cast(CurContext)->decls()) { @@ -3153,7 +3153,7 @@ LastAccessSpec = AccessSpec; } assert(LastAccessSpec && "differing access with no access specifier"); - Diag(LastAccessSpec->getLocStart(), diag::note_deduction_guide_access) + Diag(LastAccessSpec->getBeginLoc(), diag::note_deduction_guide_access) << AS; } } @@ -3638,10 +3638,10 @@ InitializedEntity::InitializeMemberFromDefaultMemberInitializer(FD); InitializationKind Kind = FD->getInClassInitStyle() == ICIS_ListInit - ? InitializationKind::CreateDirectList(InitExpr->getLocStart(), - InitExpr->getLocStart(), + ? InitializationKind::CreateDirectList(InitExpr->getBeginLoc(), + InitExpr->getBeginLoc(), InitExpr->getLocEnd()) - : InitializationKind::CreateCopy(InitExpr->getLocStart(), InitLoc); + : InitializationKind::CreateCopy(InitExpr->getBeginLoc(), InitLoc); InitializationSequence Seq(*this, Entity, Kind, InitExpr); Init = Seq.Perform(*this, Entity, Kind, InitExpr); if (Init.isInvalid()) { @@ -3908,7 +3908,7 @@ const CXXBaseSpecifier *BaseSpec = DirectBaseSpec ? DirectBaseSpec : VirtualBaseSpec; - Diag(BaseSpec->getLocStart(), + Diag(BaseSpec->getBeginLoc(), diag::note_base_class_specified_here) << BaseSpec->getType() << BaseSpec->getSourceRange(); @@ -3990,7 +3990,7 @@ nullptr); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( - IdLoc, Init->getLocStart(), Init->getLocEnd()) + IdLoc, Init->getBeginLoc(), Init->getLocEnd()) : InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(), InitRange.getEnd()); @@ -4043,7 +4043,7 @@ QualType(ClassDecl->getTypeForDecl(), 0)); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( - NameLoc, Init->getLocStart(), Init->getLocEnd()) + NameLoc, Init->getBeginLoc(), Init->getLocEnd()) : InitializationKind::CreateDirect(NameLoc, InitRange.getBegin(), InitRange.getEnd()); InitializationSequence InitSeq(*this, DelegationEntity, Kind, Args); @@ -4214,7 +4214,7 @@ if (T.isNull()) T = E->getType(); QualType TargetType = SemaRef.BuildReferenceType( T, /*SpelledAsLValue*/false, SourceLocation(), DeclarationName()); - SourceLocation ExprLoc = E->getLocStart(); + SourceLocation ExprLoc = E->getBeginLoc(); TypeSourceInfo *TargetLoc = SemaRef.Context.getTrivialTypeSourceInfo( TargetType, ExprLoc); @@ -5171,7 +5171,7 @@ assert(Dtor && "No dtor found for BaseClassDecl!"); // FIXME: caret should be on the start of the class name - CheckDestructorAccess(Base.getLocStart(), Dtor, + CheckDestructorAccess(Base.getBeginLoc(), Dtor, PDiag(diag::err_access_dtor_base) << Base.getType() << Base.getSourceRange(), @@ -6542,7 +6542,7 @@ : isa(MD)) && MD->isConstexpr() && !Constexpr && MD->getTemplatedKind() == FunctionDecl::TK_NonTemplate) { - Diag(MD->getLocStart(), diag::err_incorrect_defaulted_constexpr) << CSM; + Diag(MD->getBeginLoc(), diag::err_incorrect_defaulted_constexpr) << CSM; // FIXME: Explain why the special member can't be constexpr. HadError = true; } @@ -6556,7 +6556,7 @@ // If the exception specification needs to be instantiated, do so now, // before we clobber it with an EST_Unevaluated specification below. if (Type->getExceptionSpecType() == EST_Uninstantiated) { - InstantiateExceptionSpec(MD->getLocStart(), MD); + InstantiateExceptionSpec(MD->getBeginLoc(), MD); Type = MD->getType()->getAs(); } DelayedDefaultedMemberExceptionSpecs.push_back(std::make_pair(MD, Type)); @@ -6858,7 +6858,7 @@ << Field << DiagKind << IsDtorCallInCtor; } else { CXXBaseSpecifier *Base = Subobj.get(); - S.Diag(Base->getLocStart(), + S.Diag(Base->getBeginLoc(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << MD->getParent() << /*IsField*/false << Base->getType() << DiagKind << IsDtorCallInCtor; @@ -6930,7 +6930,7 @@ // FIXME: Check that the base has a usable destructor! Sink this into // shouldDeleteForClassSubobject. if (BaseCtor->isDeleted() && Diagnose) { - S.Diag(Base->getLocStart(), + S.Diag(Base->getBeginLoc(), diag::note_deleted_special_member_class_subobject) << getEffectiveCSM() << MD->getParent() << /*IsField*/false << Base->getType() << /*Deleted*/1 << /*IsDtorCallInCtor*/false; @@ -7544,7 +7544,7 @@ // -- all the direct base classes have trivial [default constructors or // destructors] for (const auto &BI : RD->bases()) - if (!checkTrivialSubobjectCall(*this, BI.getLocStart(), BI.getType(), + if (!checkTrivialSubobjectCall(*this, BI.getBeginLoc(), BI.getType(), ConstArg, CSM, TSK_BaseClass, TAH, Diagnose)) return false; @@ -7584,14 +7584,14 @@ // member in all bases is trivial, so vbases must all be direct. CXXBaseSpecifier &BS = *RD->vbases_begin(); assert(BS.isVirtual()); - Diag(BS.getLocStart(), diag::note_nontrivial_has_virtual) << RD << 1; + Diag(BS.getBeginLoc(), diag::note_nontrivial_has_virtual) << RD << 1; return false; } // Must have a virtual method. for (const auto *MI : RD->methods()) { if (MI->isVirtual()) { - SourceLocation MLoc = MI->getLocStart(); + SourceLocation MLoc = MI->getBeginLoc(); Diag(MLoc, diag::note_nontrivial_has_virtual) << RD << 0; return false; } @@ -8627,13 +8627,13 @@ if (Chunk.Kind == DeclaratorChunk::Paren) continue; if (Chunk.Kind != DeclaratorChunk::Function || FoundFunction) { - Diag(D.getDeclSpec().getLocStart(), + Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_with_complex_decl) << D.getSourceRange(); break; } if (!Chunk.Fun.hasTrailingReturnType()) { - Diag(D.getName().getLocStart(), + Diag(D.getName().getBeginLoc(), diag::err_deduction_guide_no_trailing_return_type); break; } @@ -8665,7 +8665,7 @@ } if (!AcceptableReturnType) { - Diag(TSI->getTypeLoc().getLocStart(), + Diag(TSI->getTypeLoc().getBeginLoc(), diag::err_deduction_guide_bad_trailing_return_type) << GuidedTemplate << TSI->getType() << MightInstantiateToSpecialization << TSI->getTypeLoc().getSourceRange(); @@ -9349,7 +9349,7 @@ assert(S->getFlags() & Scope::DeclScope && "Invalid Scope."); if (SS.isEmpty()) { - Diag(Name.getLocStart(), diag::err_using_requires_qualname); + Diag(Name.getBeginLoc(), diag::err_using_requires_qualname); return nullptr; } @@ -9364,7 +9364,7 @@ case UnqualifiedIdKind::IK_ConstructorName: case UnqualifiedIdKind::IK_ConstructorTemplateId: // C++11 inheriting constructors. - Diag(Name.getLocStart(), + Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_using_decl_constructor : diag::err_using_decl_constructor) @@ -9375,12 +9375,12 @@ return nullptr; case UnqualifiedIdKind::IK_DestructorName: - Diag(Name.getLocStart(), diag::err_using_decl_destructor) + Diag(Name.getBeginLoc(), diag::err_using_decl_destructor) << SS.getRange(); return nullptr; case UnqualifiedIdKind::IK_TemplateId: - Diag(Name.getLocStart(), diag::err_using_decl_template_id) + Diag(Name.getBeginLoc(), diag::err_using_decl_template_id) << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); return nullptr; @@ -9395,7 +9395,7 @@ // Warn about access declarations. if (UsingLoc.isInvalid()) { - Diag(Name.getLocStart(), + Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::err_access_decl : diag::warn_access_decl_deprecated) << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using "); @@ -12100,11 +12100,11 @@ if (Existing && Existing != &BI) { S.Diag(CurrentLocation, diag::warn_vbase_moved_multiple_times) << Class << Base; - S.Diag(Existing->getLocStart(), diag::note_vbase_moved_here) + S.Diag(Existing->getBeginLoc(), diag::note_vbase_moved_here) << (Base->getCanonicalDecl() == Existing->getType()->getAsCXXRecordDecl()->getCanonicalDecl()) << Base << Existing->getType() << Existing->getSourceRange(); - S.Diag(BI.getLocStart(), diag::note_vbase_moved_here) + S.Diag(BI.getBeginLoc(), diag::note_vbase_moved_here) << (Base->getCanonicalDecl() == BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl()) << Base << BI.getType() << BaseSpec->getSourceRange(); @@ -13712,7 +13712,7 @@ } VarDecl *ExDecl = BuildExceptionDeclaration(S, TInfo, - D.getLocStart(), + D.getBeginLoc(), D.getIdentifierLoc(), D.getIdentifier()); if (Invalid) @@ -13870,7 +13870,7 @@ // cv-qualified) class type, that class is declared as a friend; otherwise, // the friend declaration is ignored. return FriendDecl::Create(Context, CurContext, - TSInfo->getTypeLoc().getLocStart(), TSInfo, + TSInfo->getTypeLoc().getBeginLoc(), TSInfo, FriendLoc); } @@ -14012,7 +14012,7 @@ /// template <> template \ friend class A::B; Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TempParams) { - SourceLocation Loc = DS.getLocStart(); + SourceLocation Loc = DS.getBeginLoc(); assert(DS.isFriendSpecified()); assert(DS.getStorageClassSpec() == DeclSpec::SCS_unspecified); @@ -14532,7 +14532,7 @@ if (!SubStmt) continue; if (isa(SubStmt)) - Self.Diag(SubStmt->getLocStart(), + Self.Diag(SubStmt->getBeginLoc(), diag::err_return_in_constructor_handler); if (!isa(SubStmt)) SearchForReturnInStmt(Self, SubStmt); @@ -15439,7 +15439,7 @@ if (PrevDecl && !isDeclInScope(PrevDecl, Record, S)) PrevDecl = nullptr; - SourceLocation TSSL = D.getLocStart(); + SourceLocation TSSL = D.getBeginLoc(); const ParsedAttr::PropertyData &Data = MSPropertyAttr.getPropertyData(); MSPropertyDecl *NewPD = MSPropertyDecl::Create( Context, Record, Loc, II, T, TInfo, TSSL, Data.GetterId, Data.SetterId); Index: lib/Sema/SemaDeclObjC.cpp =================================================================== --- lib/Sema/SemaDeclObjC.cpp +++ lib/Sema/SemaDeclObjC.cpp @@ -717,7 +717,7 @@ if (auto attr = qual.getAs()) { rangeToRemove = attr.getLocalSourceRange(); if (attr.getTypePtr()->getImmediateNullability()) { - Diag(attr.getLocStart(), + Diag(attr.getBeginLoc(), diag::err_objc_type_param_bound_explicit_nullability) << paramName << typeBound << FixItHint::CreateRemoval(rangeToRemove); @@ -727,8 +727,8 @@ } if (!diagnosed) { - Diag(qual ? qual.getLocStart() - : typeBoundInfo->getTypeLoc().getLocStart(), + Diag(qual ? qual.getBeginLoc() + : typeBoundInfo->getTypeLoc().getBeginLoc(), diag::err_objc_type_param_bound_qualified) << paramName << typeBound << typeBound.getQualifiers().getAsString() << FixItHint::CreateRemoval(rangeToRemove); @@ -865,7 +865,7 @@ // Diagnose the conflict and update the second declaration. SourceLocation diagLoc = newTypeParam->getVarianceLoc(); if (diagLoc.isInvalid()) - diagLoc = newTypeParam->getLocStart(); + diagLoc = newTypeParam->getBeginLoc(); auto diag = S.Diag(diagLoc, diag::err_objc_type_param_variance_conflict) @@ -886,7 +886,7 @@ : "__contravariant"; if (newTypeParam->getVariance() == ObjCTypeParamVariance::Invariant) { - diag << FixItHint::CreateInsertion(newTypeParam->getLocStart(), + diag << FixItHint::CreateInsertion(newTypeParam->getBeginLoc(), (newVarianceStr + " ").str()); } else { diag << FixItHint::CreateReplacement(newTypeParam->getVarianceLoc(), @@ -2164,9 +2164,9 @@ } else if (ImplIvar->isBitField() && ClsIvar->isBitField() && ImplIvar->getBitWidthValue(Context) != ClsIvar->getBitWidthValue(Context)) { - Diag(ImplIvar->getBitWidth()->getLocStart(), + Diag(ImplIvar->getBitWidth()->getBeginLoc(), diag::err_conflicting_ivar_bitwidth) << ImplIvar->getIdentifier(); - Diag(ClsIvar->getBitWidth()->getLocStart(), + Diag(ClsIvar->getBitWidth()->getBeginLoc(), diag::note_previous_definition); } // Make sure the names are identical. @@ -2206,7 +2206,7 @@ } // Issue a note to the original declaration. - SourceLocation MethodLoc = method->getLocStart(); + SourceLocation MethodLoc = method->getBeginLoc(); if (MethodLoc.isValid()) S.Diag(MethodLoc, diag::note_method_declared_at) << method; } @@ -3580,11 +3580,11 @@ else Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R; - Diag(Methods[0]->getLocStart(), + Diag(Methods[0]->getBeginLoc(), issueError ? diag::note_possibility : diag::note_using) << Methods[0]->getSourceRange(); for (unsigned I = 1, N = Methods.size(); I != N; ++I) { - Diag(Methods[I]->getLocStart(), diag::note_also_found) + Diag(Methods[I]->getBeginLoc(), diag::note_also_found) << Methods[I]->getSourceRange(); } } @@ -4485,7 +4485,7 @@ QualType T; for (const ParmVarDecl *P : Method->parameters()) { if (P->getType()->isVectorType()) { - Loc = P->getLocStart(); + Loc = P->getBeginLoc(); T = P->getType(); break; } Index: lib/Sema/SemaExceptionSpec.cpp =================================================================== --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -64,7 +64,7 @@ } // Only apply this hack within a system header. - if (!Context.getSourceManager().isInSystemHeader(D.getLocStart())) + if (!Context.getSourceManager().isInSystemHeader(D.getBeginLoc())) return false; return llvm::StringSwitch(RD->getIdentifier()->getName()) @@ -992,7 +992,7 @@ if (!FT) return CT_Can; - FT = S.ResolveExceptionSpec(E->getLocStart(), FT); + FT = S.ResolveExceptionSpec(E->getBeginLoc(), FT); if (!FT) return CT_Can; Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -503,7 +503,7 @@ if (ObjectSetClass) { SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getLocEnd()); S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign) << - FixItHint::CreateInsertion(OIRE->getLocStart(), "object_setClass(") << + FixItHint::CreateInsertion(OIRE->getBeginLoc(), "object_setClass(") << FixItHint::CreateReplacement(SourceRange(OIRE->getOpLoc(), AssignLoc), ",") << FixItHint::CreateInsertion(RHSLocEnd, ")"); @@ -517,7 +517,7 @@ SourceLocation(), S.LookupOrdinaryName); if (ObjectGetClass) S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use) << - FixItHint::CreateInsertion(OIRE->getLocStart(), "object_getClass(") << + FixItHint::CreateInsertion(OIRE->getBeginLoc(), "object_getClass(") << FixItHint::CreateReplacement( SourceRange(OIRE->getOpLoc(), OIRE->getLocEnd()), ")"); @@ -576,7 +576,7 @@ SourceLocation(), LookupOrdinaryName); if (ObjectGetClass) Diag(E->getExprLoc(), diag::warn_objc_isa_use) << - FixItHint::CreateInsertion(OISA->getLocStart(), "object_getClass(") << + FixItHint::CreateInsertion(OISA->getBeginLoc(), "object_getClass(") << FixItHint::CreateReplacement( SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")"); else @@ -819,7 +819,7 @@ switch (VAK) { case VAK_ValidInCXX11: DiagRuntimeBehavior( - E->getLocStart(), nullptr, + E->getBeginLoc(), nullptr, PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT); LLVM_FALLTHROUGH; @@ -827,7 +827,7 @@ if (Ty->isRecordType()) { // This is unlikely to be what the user intended. If the class has a // 'c_str' member function, the user probably meant to call that. - DiagRuntimeBehavior(E->getLocStart(), nullptr, + DiagRuntimeBehavior(E->getBeginLoc(), nullptr, PDiag(diag::warn_pass_class_arg_to_vararg) << Ty << CT << hasCStrMethod(E) << ".c_str()"); } @@ -836,22 +836,22 @@ case VAK_Undefined: case VAK_MSVCUndefined: DiagRuntimeBehavior( - E->getLocStart(), nullptr, + E->getBeginLoc(), nullptr, PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg) << getLangOpts().CPlusPlus11 << Ty << CT); break; case VAK_Invalid: if (Ty.isDestructedType() == QualType::DK_nontrivial_c_struct) - Diag(E->getLocStart(), + Diag(E->getBeginLoc(), diag::err_cannot_pass_non_trivial_c_struct_to_vararg) << Ty << CT; else if (Ty->isObjCObjectType()) DiagRuntimeBehavior( - E->getLocStart(), nullptr, + E->getBeginLoc(), nullptr, PDiag(diag::err_cannot_pass_objc_interface_to_vararg) << Ty << CT); else - Diag(E->getLocStart(), diag::err_cannot_pass_to_vararg) + Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg) << isa(E) << Ty << CT; break; } @@ -890,19 +890,19 @@ SourceLocation TemplateKWLoc; UnqualifiedId Name; Name.setIdentifier(PP.getIdentifierInfo("__builtin_trap"), - E->getLocStart()); + E->getBeginLoc()); ExprResult TrapFn = ActOnIdExpression(TUScope, SS, TemplateKWLoc, Name, true, false); if (TrapFn.isInvalid()) return ExprError(); ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(), - E->getLocStart(), None, + E->getBeginLoc(), None, E->getLocEnd()); if (Call.isInvalid()) return ExprError(); - ExprResult Comma = ActOnBinOp(TUScope, E->getLocStart(), tok::comma, + ExprResult Comma = ActOnBinOp(TUScope, E->getBeginLoc(), tok::comma, Call.get(), E); if (Comma.isInvalid()) return ExprError(); @@ -1436,7 +1436,7 @@ // We strip parens here because the controlling expression is typically // parenthesized in macro definitions. ControllingExpr = ControllingExpr->IgnoreParens(); - Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_multi_match) + Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_multi_match) << ControllingExpr->getSourceRange() << ControllingExpr->getType() << (unsigned) CompatIndices.size(); for (unsigned I : CompatIndices) { @@ -1455,7 +1455,7 @@ // We strip parens here because the controlling expression is typically // parenthesized in macro definitions. ControllingExpr = ControllingExpr->IgnoreParens(); - Diag(ControllingExpr->getLocStart(), diag::err_generic_sel_no_match) + Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_no_match) << ControllingExpr->getSourceRange() << ControllingExpr->getType(); return ExprError(); } @@ -1681,7 +1681,7 @@ if (getLangOpts().ObjCWeak && isa(D) && Ty.getObjCLifetime() == Qualifiers::OCL_Weak && !isUnevaluatedContext() && - !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getLocStart())) + !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, E->getBeginLoc())) getCurFunction()->recordUseOfWeak(E); FieldDecl *FD = dyn_cast(D); @@ -4488,7 +4488,7 @@ // wasn't promoted because of the C90 rule that doesn't // allow promoting non-lvalue arrays. Warn, then // force the promotion here. - Diag(LHSExp->getLocStart(), diag::ext_subscript_non_lvalue) << + Diag(LHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue) << LHSExp->getSourceRange(); LHSExp = ImpCastExprToType(LHSExp, Context.getArrayDecayedType(LHSTy), CK_ArrayToPointerDecay).get(); @@ -4499,7 +4499,7 @@ ResultType = LHSTy->getAs()->getPointeeType(); } else if (RHSTy->isArrayType()) { // Same as previous, except for 123[f().a] case - Diag(RHSExp->getLocStart(), diag::ext_subscript_non_lvalue) << + Diag(RHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue) << RHSExp->getSourceRange(); RHSExp = ImpCastExprToType(RHSExp, Context.getArrayDecayedType(RHSTy), CK_ArrayToPointerDecay).get(); @@ -4527,7 +4527,7 @@ // type. Note that Functions are not objects, and that (in C99 parlance) // incomplete types are not object types. if (ResultType->isFunctionType()) { - Diag(BaseExpr->getLocStart(), diag::err_subscript_function_type) + Diag(BaseExpr->getBeginLoc(), diag::err_subscript_function_type) << ResultType << BaseExpr->getSourceRange(); return ExprError(); } @@ -4594,7 +4594,7 @@ if (Inst.isInvalid()) return true; if (Inst.isAlreadyInstantiating()) { - Diag(Param->getLocStart(), diag::err_recursive_default_argument) << FD; + Diag(Param->getBeginLoc(), diag::err_recursive_default_argument) << FD; Param->setInvalidDecl(); return true; } @@ -4618,7 +4618,7 @@ = InitializedEntity::InitializeParameter(Context, Param); InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(), - /*FIXME:EqualLoc*/UninstExpr->getLocStart()); + /*FIXME:EqualLoc*/UninstExpr->getBeginLoc()); Expr *ResultE = Result.getAs(); InitializationSequence InitSeq(*this, Entity, Kind, ResultE); @@ -4640,7 +4640,7 @@ // If the default argument expression is not set yet, we are building it now. if (!Param->hasInit()) { - Diag(Param->getLocStart(), diag::err_recursive_default_argument) << FD; + Diag(Param->getBeginLoc(), diag::err_recursive_default_argument) << FD; Param->setInvalidDecl(); return true; } @@ -4725,7 +4725,7 @@ ArrayRef Args) { MemberExpr *ME = dyn_cast(Fn); DeclarationName FuncName = FDecl->getDeclName(); - SourceLocation NameLoc = ME ? ME->getMemberLoc() : Fn->getLocStart(); + SourceLocation NameLoc = ME ? ME->getMemberLoc() : Fn->getBeginLoc(); if (TypoCorrection Corrected = S.CorrectTypo( DeclarationNameInfo(FuncName, NameLoc), Sema::LookupOrdinaryName, @@ -4816,7 +4816,7 @@ // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) - Diag(FDecl->getLocStart(), diag::note_callee_decl) + Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl; return true; @@ -4839,27 +4839,27 @@ << TC.getCorrectionRange()); } else if (NumParams == 1 && FDecl && FDecl->getParamDecl(0)->getDeclName()) - Diag(Args[NumParams]->getLocStart(), + Diag(Args[NumParams]->getBeginLoc(), MinArgs == NumParams ? diag::err_typecheck_call_too_many_args_one : diag::err_typecheck_call_too_many_args_at_most_one) << FnKind << FDecl->getParamDecl(0) << static_cast(Args.size()) << Fn->getSourceRange() - << SourceRange(Args[NumParams]->getLocStart(), + << SourceRange(Args[NumParams]->getBeginLoc(), Args.back()->getLocEnd()); else - Diag(Args[NumParams]->getLocStart(), + Diag(Args[NumParams]->getBeginLoc(), MinArgs == NumParams ? diag::err_typecheck_call_too_many_args : diag::err_typecheck_call_too_many_args_at_most) << FnKind << NumParams << static_cast(Args.size()) << Fn->getSourceRange() - << SourceRange(Args[NumParams]->getLocStart(), + << SourceRange(Args[NumParams]->getBeginLoc(), Args.back()->getLocEnd()); // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) - Diag(FDecl->getLocStart(), diag::note_callee_decl) + Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl; // This deletes the extra arguments. @@ -4870,7 +4870,7 @@ SmallVector AllArgs; VariadicCallType CallType = getVariadicCallType(FDecl, Proto, Fn); - Invalid = GatherArgumentsForCall(Call->getLocStart(), FDecl, + Invalid = GatherArgumentsForCall(Call->getBeginLoc(), FDecl, Proto, 0, Args, AllArgs, CallType); if (Invalid) return true; @@ -4899,7 +4899,7 @@ if (ArgIx < Args.size()) { Arg = Args[ArgIx++]; - if (RequireCompleteType(Arg->getLocStart(), + if (RequireCompleteType(Arg->getBeginLoc(), ProtoArgType, diag::err_call_incomplete_argument, Arg)) return true; @@ -5205,7 +5205,7 @@ return; if (const EnableIfAttr *Attr = S.CheckEnableIf(Callee, ArgExprs, true)) { - S.Diag(Fn->getLocStart(), + S.Diag(Fn->getBeginLoc(), isa(Callee) ? diag::err_ovl_no_viable_member_function_in_call : diag::err_ovl_no_viable_function_in_call) @@ -5317,9 +5317,9 @@ if (isa(Fn)) { if (!ArgExprs.empty()) { // Pseudo-destructor calls should not have any arguments. - Diag(Fn->getLocStart(), diag::err_pseudo_dtor_call_with_args) + Diag(Fn->getBeginLoc(), diag::err_pseudo_dtor_call_with_args) << FixItHint::CreateRemoval( - SourceRange(ArgExprs.front()->getLocStart(), + SourceRange(ArgExprs.front()->getBeginLoc(), ArgExprs.back()->getLocEnd())); } @@ -5349,7 +5349,7 @@ tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs( *this, dyn_cast(Fn->IgnoreParens()), - Fn->getLocStart()); + Fn->getBeginLoc()); return new (Context) CallExpr( Context, Fn, ArgExprs, Context.DependentTy, VK_RValue, RParenLoc); @@ -5432,7 +5432,7 @@ if (FunctionDecl *FD = dyn_cast_or_null(NDecl)) { if (CallingNDeclIndirectly && !checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - Fn->getLocStart())) + Fn->getBeginLoc())) return ExprError(); if (getLangOpts().OpenCL && checkOpenCLDisabledDecl(*FD, *Fn)) @@ -5599,7 +5599,7 @@ } // Check for a valid return type - if (CheckCallReturnType(FuncT->getReturnType(), Fn->getLocStart(), TheCall, + if (CheckCallReturnType(FuncT->getReturnType(), Fn->getBeginLoc(), TheCall, FDecl)) return ExprError(); @@ -5655,7 +5655,7 @@ Arg = ArgE.getAs(); } - if (RequireCompleteType(Arg->getLocStart(), + if (RequireCompleteType(Arg->getBeginLoc(), Arg->getType(), diag::err_call_incomplete_argument, Arg)) return ExprError(); @@ -6394,10 +6394,10 @@ Expr *RHSExpr = RHS.get(); if (!LHSExpr->getType()->isVoidType()) - S.Diag(RHSExpr->getLocStart(), diag::ext_typecheck_cond_one_void) + S.Diag(RHSExpr->getBeginLoc(), diag::ext_typecheck_cond_one_void) << RHSExpr->getSourceRange(); if (!RHSExpr->getType()->isVoidType()) - S.Diag(LHSExpr->getLocStart(), diag::ext_typecheck_cond_one_void) + S.Diag(LHSExpr->getBeginLoc(), diag::ext_typecheck_cond_one_void) << LHSExpr->getSourceRange(); LHS = S.ImpCastExprToType(LHS.get(), S.Context.VoidTy, CK_ToVoid); RHS = S.ImpCastExprToType(RHS.get(), S.Context.VoidTy, CK_ToVoid); @@ -7222,11 +7222,11 @@ SuggestParentheses(Self, OpLoc, Self.PDiag(diag::note_precedence_silence) << BinaryOperator::getOpcodeStr(CondOpcode), - SourceRange(Condition->getLocStart(), Condition->getLocEnd())); + SourceRange(Condition->getBeginLoc(), Condition->getLocEnd())); SuggestParentheses(Self, OpLoc, Self.PDiag(diag::note_precedence_conditional_first), - SourceRange(CondRHS->getLocStart(), RHSExpr->getLocEnd())); + SourceRange(CondRHS->getBeginLoc(), RHSExpr->getLocEnd())); } /// Compute the nullability of a conditional expression. @@ -8138,7 +8138,7 @@ return Incompatible; } if (getLangOpts().ObjC1 && - (CheckObjCBridgeRelatedConversions(E->getLocStart(), LHSType, + (CheckObjCBridgeRelatedConversions(E->getBeginLoc(), LHSType, E->getType(), E, Diagnose) || ConversionToObjCStringLiteralCheck(LHSType, E, Diagnose))) { if (!Diagnose) @@ -8923,7 +8923,7 @@ return; } - SourceRange DiagRange(LHSExpr->getLocStart(), RHSExpr->getLocEnd()); + SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); Self.Diag(OpLoc, diag::warn_string_plus_int) << DiagRange << IndexExpr->IgnoreImpCasts()->getType(); @@ -8931,7 +8931,7 @@ if (IndexExpr == RHSExpr) { SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd()); Self.Diag(OpLoc, diag::note_string_plus_scalar_silence) - << FixItHint::CreateInsertion(LHSExpr->getLocStart(), "&") + << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&") << FixItHint::CreateReplacement(SourceRange(OpLoc), "[") << FixItHint::CreateInsertion(EndLoc, "]"); } else @@ -8964,7 +8964,7 @@ return; ASTContext &Ctx = Self.getASTContext(); - SourceRange DiagRange(LHSExpr->getLocStart(), RHSExpr->getLocEnd()); + SourceRange DiagRange(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); const QualType CharType = CharExpr->getType(); if (!CharType->isAnyCharacterType() && @@ -8981,7 +8981,7 @@ if (isa(RHSExpr->IgnoreImpCasts())) { SourceLocation EndLoc = Self.getLocForEndOfToken(RHSExpr->getLocEnd()); Self.Diag(OpLoc, diag::note_string_plus_scalar_silence) - << FixItHint::CreateInsertion(LHSExpr->getLocStart(), "&") + << FixItHint::CreateInsertion(LHSExpr->getBeginLoc(), "&") << FixItHint::CreateReplacement(SourceRange(OpLoc), "[") << FixItHint::CreateInsertion(EndLoc, "]"); } else { @@ -9653,7 +9653,7 @@ if (BinaryOperator::isEqualityOp(Opc) && hasIsEqualMethod(S, LHS.get(), RHS.get())) { - SourceLocation Start = LHS.get()->getLocStart(); + SourceLocation Start = LHS.get()->getBeginLoc(); SourceLocation End = S.getLocForEndOfToken(RHS.get()->getLocEnd()); CharSourceRange OpRange = CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc)); @@ -9686,7 +9686,7 @@ << Loc << IsBitwiseOp; // First note suggest !(x < y) - SourceLocation FirstOpen = SubExpr->getLocStart(); + SourceLocation FirstOpen = SubExpr->getBeginLoc(); SourceLocation FirstClose = RHS.get()->getLocEnd(); FirstClose = S.getLocForEndOfToken(FirstClose); if (FirstClose.isInvalid()) @@ -9697,7 +9697,7 @@ << FixItHint::CreateInsertion(FirstClose, ")"); // Second note suggests (!x) < y - SourceLocation SecondOpen = LHS.get()->getLocStart(); + SourceLocation SecondOpen = LHS.get()->getBeginLoc(); SourceLocation SecondClose = LHS.get()->getLocEnd(); SecondClose = S.getLocForEndOfToken(SecondClose); if (SecondClose.isInvalid()) @@ -9734,7 +9734,7 @@ QualType RHSType = RHS->getType(); if (LHSType->hasFloatingRepresentation() || (LHSType->isBlockPointerType() && !BinaryOperator::isEqualityOp(Opc)) || - LHS->getLocStart().isMacroID() || RHS->getLocStart().isMacroID() || + LHS->getBeginLoc().isMacroID() || RHS->getBeginLoc().isMacroID() || S.inTemplateInstantiation()) return; @@ -9888,7 +9888,7 @@ case NK_Constant_Narrowing: // Implicit conversion to a narrower type, and the value is not a constant // expression. - S.Diag(E->getLocStart(), diag::err_spaceship_argument_narrowing) + S.Diag(E->getBeginLoc(), diag::err_spaceship_argument_narrowing) << /*Constant*/ 1 << PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << ToType; return true; @@ -9897,7 +9897,7 @@ // Implicit conversion to a narrower type, and the value is not a constant // expression. case NK_Type_Narrowing: - S.Diag(E->getLocStart(), diag::err_spaceship_argument_narrowing) + S.Diag(E->getBeginLoc(), diag::err_spaceship_argument_narrowing) << /*Constant*/ 0 << FromType << ToType; // TODO: It's not a constant expression, but what if the user intended it // to be? Can we produce notes to help them figure out why it isn't? @@ -9972,9 +9972,9 @@ assert(Type->isArithmeticType() || Type->isEnumeralType()); bool HasNarrowing = checkThreeWayNarrowingConversion( - S, Type, LHS.get(), LHSType, LHS.get()->getLocStart()); + S, Type, LHS.get(), LHSType, LHS.get()->getBeginLoc()); HasNarrowing |= checkThreeWayNarrowingConversion( - S, Type, RHS.get(), RHSType, RHS.get()->getLocStart()); + S, Type, RHS.get(), RHSType, RHS.get()->getBeginLoc()); if (HasNarrowing) return QualType(); @@ -11157,8 +11157,8 @@ Loc.getLocWithOffset(1) == UO->getOperatorLoc() && // And there is a space or other character before the subexpr of the // unary +/-. We don't want to warn on "x=-1". - Loc.getLocWithOffset(2) != UO->getSubExpr()->getLocStart() && - UO->getSubExpr()->getLocStart().isFileID()) { + Loc.getLocWithOffset(2) != UO->getSubExpr()->getBeginLoc() && + UO->getSubExpr()->getBeginLoc().isFileID()) { Diag(Loc, diag::warn_not_compound_assign) << (UO->getOpcode() == UO_Plus ? "+" : "-") << SourceRange(UO->getOperatorLoc(), UO->getOperatorLoc()); @@ -11188,7 +11188,7 @@ // For ObjCWeak only, we do not warn if the assign is to a non-weak // variable, which will be valid for the current autorelease scope. if (!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, - RHS.get()->getLocStart())) + RHS.get()->getBeginLoc())) getCurFunction()->markSafeWeakUse(RHS.get()); } else if (getLangOpts().ObjCAutoRefCount || getLangOpts().ObjCWeak) { @@ -11269,9 +11269,9 @@ return; Diag(Loc, diag::warn_comma_operator); - Diag(LHS->getLocStart(), diag::note_cast_to_void) + Diag(LHS->getBeginLoc(), diag::note_cast_to_void) << LHS->getSourceRange() - << FixItHint::CreateInsertion(LHS->getLocStart(), + << FixItHint::CreateInsertion(LHS->getBeginLoc(), LangOpts.CPlusPlus ? "static_cast(" : "(void)(") << FixItHint::CreateInsertion(PP.getLocForEndOfToken(LHS->getLocEnd()), @@ -11551,7 +11551,7 @@ if (auto *FD = dyn_cast_or_null(dcl)) if (!checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - op->getLocStart())) + op->getBeginLoc())) return QualType(); Expr::LValueClassification lval = op->ClassifyLValue(Context); @@ -12006,7 +12006,7 @@ // The meaning of x = {v} [...] is that of x = T(v) [...]. The meaning // of x = {} is x = T(). InitializationKind Kind = InitializationKind::CreateDirectList( - RHSExpr->getLocStart(), RHSExpr->getLocStart(), RHSExpr->getLocEnd()); + RHSExpr->getBeginLoc(), RHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); InitializedEntity Entity = InitializedEntity::InitializeTemporary(LHSExpr->getType()); InitializationSequence InitSeq(*this, Entity, Kind, RHSExpr); @@ -12035,7 +12035,7 @@ // OpenCLC v2.0 s6.13.11.1 allows atomic variables to be initialized by // the ATOMIC_VAR_INIT macro. if (LHSTy->isAtomicType() || RHSTy->isAtomicType()) { - SourceRange SR(LHSExpr->getLocStart(), RHSExpr->getLocEnd()); + SourceRange SR(LHSExpr->getBeginLoc(), RHSExpr->getLocEnd()); if (BO_Assign == Opc) Diag(OpLoc, diag::err_opencl_atomic_init) << 0 << SR; else @@ -12199,7 +12199,7 @@ if (ObjectSetClass && isa(LHS.get())) { SourceLocation RHSLocEnd = getLocForEndOfToken(RHS.get()->getLocEnd()); Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign) << - FixItHint::CreateInsertion(LHS.get()->getLocStart(), "object_setClass(") << + FixItHint::CreateInsertion(LHS.get()->getBeginLoc(), "object_setClass(") << FixItHint::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc), ",") << FixItHint::CreateInsertion(RHSLocEnd, ")"); } @@ -12258,13 +12258,13 @@ if (isLeftBitwise || isRightBitwise) return; - SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getLocStart(), + SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getBeginLoc(), OpLoc) : SourceRange(OpLoc, RHSExpr->getLocEnd()); StringRef OpStr = isLeftComp ? LHSBO->getOpcodeStr() : RHSBO->getOpcodeStr(); SourceRange ParensRange = isLeftComp ? - SourceRange(LHSBO->getRHS()->getLocStart(), RHSExpr->getLocEnd()) - : SourceRange(LHSExpr->getLocStart(), RHSBO->getLHS()->getLocEnd()); + SourceRange(LHSBO->getRHS()->getBeginLoc(), RHSExpr->getLocEnd()) + : SourceRange(LHSExpr->getBeginLoc(), RHSBO->getLHS()->getLocEnd()); Self.Diag(OpLoc, diag::warn_precedence_bitwise_rel) << DiagRange << BinaryOperator::getOpcodeStr(Opc) << OpStr; @@ -12400,7 +12400,7 @@ OCE->getSourceRange()); SuggestParentheses(S, OpLoc, S.PDiag(diag::note_evaluate_comparison_first), - SourceRange(OCE->getArg(1)->getLocStart(), + SourceRange(OCE->getArg(1)->getBeginLoc(), RHSExpr->getLocEnd())); } @@ -13071,7 +13071,7 @@ // FIXME: An integral constant expression? if (!Idx->isTypeDependent() && !Idx->isValueDependent() && !Idx->getType()->isIntegerType()) - return ExprError(Diag(Idx->getLocStart(), + return ExprError(Diag(Idx->getBeginLoc(), diag::err_typecheck_subscript_not_integer) << Idx->getSourceRange()); @@ -13365,7 +13365,7 @@ } else if (const FunctionProtoType *Fn = T->getAs()) { for (const auto &I : Fn->param_types()) { ParmVarDecl *Param = BuildParmVarDeclForTypedef( - CurBlock->TheDecl, ParamInfo.getLocStart(), I); + CurBlock->TheDecl, ParamInfo.getBeginLoc(), I); Params.push_back(Param); } } @@ -13544,7 +13544,7 @@ if (const FunctionDecl *F = dyn_cast(CurContext)) { CUDAFunctionTarget T = IdentifyCUDATarget(F); if (T == CFT_Global || T == CFT_Device || T == CFT_HostDevice) - return ExprError(Diag(E->getLocStart(), diag::err_va_arg_in_device)); + return ExprError(Diag(E->getBeginLoc(), diag::err_va_arg_in_device)); } } @@ -13594,7 +13594,7 @@ if (!IsMS && !E->isTypeDependent() && !Context.hasSameType(VaListType, E->getType())) - return ExprError(Diag(E->getLocStart(), + return ExprError(Diag(E->getBeginLoc(), diag::err_first_argument_to_va_arg_not_of_type_va_list) << OrigExpr->getType() << E->getSourceRange()); @@ -13687,9 +13687,9 @@ if (!SL || !SL->isAscii()) return false; if (Diagnose) { - Diag(SL->getLocStart(), diag::err_missing_atsign_prefix) - << FixItHint::CreateInsertion(SL->getLocStart(), "@"); - Exp = BuildObjCStringLiteral(SL->getLocStart(), SL).get(); + Diag(SL->getBeginLoc(), diag::err_missing_atsign_prefix) + << FixItHint::CreateInsertion(SL->getBeginLoc(), "@"); + Exp = BuildObjCStringLiteral(SL->getBeginLoc(), SL).get(); } return true; } @@ -13710,7 +13710,7 @@ return !S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - SrcExpr->getLocStart()); + SrcExpr->getBeginLoc()); } bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, @@ -13963,7 +13963,7 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, bool AllowFold) { - SourceLocation DiagLoc = E->getLocStart(); + SourceLocation DiagLoc = E->getBeginLoc(); if (getLangOpts().CPlusPlus11) { // C++11 [expr.const]p5: @@ -14193,7 +14193,7 @@ llvm_unreachable("Couldn't infer lambda error message."); for (const auto *L : Rec.Lambdas) - Diag(L->getLocStart(), D); + Diag(L->getBeginLoc(), D); } else { // Mark the capture expressions odr-used. This was deferred // during lambda expression creation. @@ -15023,7 +15023,7 @@ Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName(); Diag(Var->getLocation(), diag::note_previous_decl) << Var->getDeclName(); - Diag(LSI->Lambda->getLocStart(), diag::note_lambda_decl); + Diag(LSI->Lambda->getBeginLoc(), diag::note_lambda_decl); } else diagnoseUncapturableValueReference(*this, ExprLoc, Var, DC); } @@ -15077,7 +15077,7 @@ Diag(Var->getLocation(), diag::note_previous_decl) << Var->getDeclName(); if (cast(CSI)->Lambda) - Diag(cast(CSI)->Lambda->getLocStart(), + Diag(cast(CSI)->Lambda->getBeginLoc(), diag::note_lambda_decl); // FIXME: If we error out because an outer lambda can not implicitly // capture a variable that an inner lambda explicitly captures, we @@ -15436,7 +15436,7 @@ MightBeOdrUse = false; } SourceLocation Loc = E->getMemberLoc().isValid() ? - E->getMemberLoc() : E->getLocStart(); + E->getMemberLoc() : E->getBeginLoc(); MarkExprReferenced(*this, Loc, E->getMemberDecl(), E, MightBeOdrUse); } @@ -15532,26 +15532,26 @@ } void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { - S.MarkFunctionReferenced(E->getLocStart(), + S.MarkFunctionReferenced(E->getBeginLoc(), const_cast(E->getTemporary()->getDestructor())); Visit(E->getSubExpr()); } void VisitCXXNewExpr(CXXNewExpr *E) { if (E->getOperatorNew()) - S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorNew()); + S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorNew()); if (E->getOperatorDelete()) - S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorDelete()); + S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorDelete()); Inherited::VisitCXXNewExpr(E); } void VisitCXXDeleteExpr(CXXDeleteExpr *E) { if (E->getOperatorDelete()) - S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorDelete()); + S.MarkFunctionReferenced(E->getBeginLoc(), E->getOperatorDelete()); QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType()); if (const RecordType *DestroyedRec = Destroyed->getAs()) { CXXRecordDecl *Record = cast(DestroyedRec->getDecl()); - S.MarkFunctionReferenced(E->getLocStart(), + S.MarkFunctionReferenced(E->getBeginLoc(), S.LookupDestructor(Record)); } @@ -15559,7 +15559,7 @@ } void VisitCXXConstructExpr(CXXConstructExpr *E) { - S.MarkFunctionReferenced(E->getLocStart(), E->getConstructor()); + S.MarkFunctionReferenced(E->getBeginLoc(), E->getConstructor()); Inherited::VisitCXXConstructExpr(E); } @@ -15730,7 +15730,7 @@ Diag(Loc, diagnostic) << E->getSourceRange(); - SourceLocation Open = E->getLocStart(); + SourceLocation Open = E->getBeginLoc(); SourceLocation Close = getLocForEndOfToken(E->getSourceRange().getEnd()); Diag(Loc, diag::note_condition_assign_silence) << FixItHint::CreateInsertion(Open, "(") @@ -15748,7 +15748,7 @@ /// that the user intended an assignment used as condition. void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *ParenE) { // Don't warn if the parens came from a macro. - SourceLocation parenLoc = ParenE->getLocStart(); + SourceLocation parenLoc = ParenE->getBeginLoc(); if (parenLoc.isInvalid() || parenLoc.isMacroID()) return; // Don't warn for dependent expressions. @@ -16445,13 +16445,13 @@ } } - Diag(E->getLocStart(), diag::err_builtin_fn_use); + Diag(E->getBeginLoc(), diag::err_builtin_fn_use); return ExprError(); } // Expressions of unknown type. case BuiltinType::OMPArraySection: - Diag(E->getLocStart(), diag::err_omp_array_section_use); + Diag(E->getBeginLoc(), diag::err_omp_array_section_use); return ExprError(); // Everything else should be impossible. Index: lib/Sema/SemaExprCXX.cpp =================================================================== --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -413,7 +413,7 @@ // namespace scope. Therefore, this unqualified-id cannot name anything. // Reject it early, because we have no AST representation for this in the // case where the scope is dependent. - Diag(Name.getLocStart(), diag::err_literal_operator_id_outside_namespace) + Diag(Name.getBeginLoc(), diag::err_literal_operator_id_outside_namespace) << SS.getScopeRep(); return true; @@ -1796,7 +1796,7 @@ // initialization rules of 8.5 for direct-initialization. : initStyle == CXXNewExpr::ListInit ? InitializationKind::CreateDirectList(TypeRange.getBegin(), - Initializer->getLocStart(), + Initializer->getBeginLoc(), Initializer->getLocEnd()) : InitializationKind::CreateDirect(TypeRange.getBegin(), DirectInitRange.getBegin(), @@ -1831,12 +1831,12 @@ << AllocType << TypeRange); if (NumInits > 1) { Expr *FirstBad = Inits[1]; - return ExprError(Diag(FirstBad->getLocStart(), + return ExprError(Diag(FirstBad->getBeginLoc(), diag::err_auto_new_ctor_multiple_expressions) << AllocType << TypeRange); } if (Braced && !getLangOpts().CPlusPlus17) - Diag(Initializer->getLocStart(), diag::ext_auto_new_list_init) + Diag(Initializer->getBeginLoc(), diag::ext_auto_new_list_init) << AllocType << TypeRange; Expr *Deduce = Inits[0]; QualType DeducedType; @@ -1983,7 +1983,7 @@ // C++14 onwards, because Value is always unsigned here! if (ArraySize->isIntegerConstantExpr(Value, Context)) { if (Value.isSigned() && Value.isNegative()) { - return ExprError(Diag(ArraySize->getLocStart(), + return ExprError(Diag(ArraySize->getBeginLoc(), diag::err_typecheck_negative_array_size) << ArraySize->getSourceRange()); } @@ -1992,7 +1992,7 @@ unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, AllocType, Value); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) - return ExprError(Diag(ArraySize->getLocStart(), + return ExprError(Diag(ArraySize->getBeginLoc(), diag::err_array_too_large) << Value.toString(10) << ArraySize->getSourceRange()); @@ -2001,7 +2001,7 @@ KnownArraySize = Value.getZExtValue(); } else if (TypeIdParens.isValid()) { // Can't have dynamic array size when the type-id is in parentheses. - Diag(ArraySize->getLocStart(), diag::ext_new_paren_array_nonconst) + Diag(ArraySize->getBeginLoc(), diag::ext_new_paren_array_nonconst) << ArraySize->getSourceRange() << FixItHint::CreateRemoval(TypeIdParens.getBegin()) << FixItHint::CreateRemoval(TypeIdParens.getEnd()); @@ -2066,8 +2066,8 @@ // global operator new. if (PlacementArgs.empty() && !PassAlignment && (OperatorNew->isImplicit() || - (OperatorNew->getLocStart().isValid() && - getSourceManager().isInSystemHeader(OperatorNew->getLocStart())))) { + (OperatorNew->getBeginLoc().isValid() && + getSourceManager().isInSystemHeader(OperatorNew->getBeginLoc())))) { if (Alignment > NewAlignment) Diag(StartLoc, diag::warn_overaligned_type) << AllocType @@ -2080,7 +2080,7 @@ // Initializer lists are also allowed, in C++11. Rely on the parser for the // dialect distinction. if (ArraySize && !isLegalArrayNewInitializer(initStyle, Initializer)) { - SourceRange InitRange(Inits[0]->getLocStart(), + SourceRange InitRange(Inits[0]->getBeginLoc(), Inits[NumInits - 1]->getLocEnd()); Diag(StartLoc, diag::err_new_array_init_args) << InitRange; return ExprError(); @@ -2587,7 +2587,7 @@ if (IsSizedDelete) { SourceRange R = PlaceArgs.empty() ? SourceRange() - : SourceRange(PlaceArgs.front()->getLocStart(), + : SourceRange(PlaceArgs.front()->getBeginLoc(), PlaceArgs.back()->getLocEnd()); Diag(StartLoc, diag::err_placement_new_non_placement_delete) << R; if (!OperatorDelete->isImplicit()) @@ -3156,12 +3156,12 @@ switch (Detector.analyzeDeleteExpr(DE)) { case MismatchingNewDeleteDetector::VarInitMismatches: case MismatchingNewDeleteDetector::MemberInitMismatches: { - DiagnoseMismatchedNewDelete(*this, DE->getLocStart(), Detector); + DiagnoseMismatchedNewDelete(*this, DE->getBeginLoc(), Detector); break; } case MismatchingNewDeleteDetector::AnalyzeLater: { DeleteExprs[Detector.Field].push_back( - std::make_pair(DE->getLocStart(), DE->isArrayForm())); + std::make_pair(DE->getBeginLoc(), DE->isArrayForm())); break; } case MismatchingNewDeleteDetector::NoMismatch: @@ -3280,7 +3280,7 @@ if (Pointee.getAddressSpace() != LangAS::Default && !getLangOpts().OpenCLCPlusPlus) - return Diag(Ex.get()->getLocStart(), + return Diag(Ex.get()->getBeginLoc(), diag::err_address_space_qualified_delete) << Pointee.getUnqualifiedType() << Pointee.getQualifiers().getAddressSpaceAttributePrintValue(); @@ -3421,7 +3421,7 @@ DeclarationName NewName = S.Context.DeclarationNames.getCXXOperatorName( IsDelete ? OO_Delete : OO_New); - LookupResult R(S, NewName, TheCall->getLocStart(), Sema::LookupOrdinaryName); + LookupResult R(S, NewName, TheCall->getBeginLoc(), Sema::LookupOrdinaryName); S.LookupQualifiedName(R, S.Context.getTranslationUnitDecl()); assert(!R.empty() && "implicitly declared allocation functions not found"); assert(!R.isAmbiguous() && "global allocation functions are ambiguous"); @@ -3523,7 +3523,7 @@ InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, ParamTy, false); ExprResult Arg = PerformCopyInitialization( - Entity, TheCall->getArg(i)->getLocStart(), TheCall->getArg(i)); + Entity, TheCall->getArg(i)->getBeginLoc(), TheCall->getArg(i)); if (Arg.isInvalid()) return ExprError(); TheCall->setArg(i, Arg.get()); @@ -3813,7 +3813,7 @@ ExprResult CastArg = BuildCXXCastArgument(*this, - From->getLocStart(), + From->getBeginLoc(), ToType.getNonReferenceType(), CastKind, cast(FD), ICS.UserDefined.FoundConversionFunction, @@ -3906,7 +3906,7 @@ if (!Fn) return ExprError(); - if (DiagnoseUseOfDecl(Fn, From->getLocStart())) + if (DiagnoseUseOfDecl(Fn, From->getBeginLoc())) return ExprError(); From = FixOverloadedFunctionReference(From, Found, Fn); @@ -4045,12 +4045,12 @@ if (SCS.IncompatibleObjC && Action != AA_Casting) { // Diagnose incompatible Objective-C conversions if (Action == AA_Initializing || Action == AA_Assigning) - Diag(From->getLocStart(), + Diag(From->getBeginLoc(), diag::ext_typecheck_convert_incompatible_pointer) << ToType << From->getType() << Action << From->getSourceRange() << 0; else - Diag(From->getLocStart(), + Diag(From->getBeginLoc(), diag::ext_typecheck_convert_incompatible_pointer) << From->getType() << ToType << Action << From->getSourceRange() << 0; @@ -4062,10 +4062,10 @@ !CheckObjCARCUnavailableWeakConversion(ToType, From->getType())) { if (Action == AA_Initializing) - Diag(From->getLocStart(), + Diag(From->getBeginLoc(), diag::err_arc_weak_unavailable_assign); else - Diag(From->getLocStart(), + Diag(From->getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable) << (Action == AA_Casting) << From->getType() << ToType << From->getSourceRange(); @@ -4126,7 +4126,7 @@ CXXCastPath BasePath; if (CheckDerivedToBaseConversion(From->getType(), ToType.getNonReferenceType(), - From->getLocStart(), + From->getBeginLoc(), From->getSourceRange(), &BasePath, CStyle)) @@ -4270,7 +4270,7 @@ if (SCS.DeprecatedStringLiteralToCharPtr && !getLangOpts().WritableStrings) { - Diag(From->getLocStart(), getLangOpts().CPlusPlus11 + Diag(From->getBeginLoc(), getLangOpts().CPlusPlus11 ? diag::ext_deprecated_string_literal_conversion : diag::warn_deprecated_string_literal_conversion) << ToType.getNonReferenceType(); @@ -4296,7 +4296,7 @@ // _Nullable type to a _Nonnull one, complain. if (!isCast(CCK)) diagnoseNullableToNonnullConversion(ToType, InitialFromType, - From->getLocStart()); + From->getBeginLoc()); return From; } @@ -4926,7 +4926,7 @@ if (ArgTy->isObjectType() || ArgTy->isFunctionType()) ArgTy = S.Context.getRValueReferenceType(ArgTy); OpaqueArgExprs.push_back( - OpaqueValueExpr(Args[I]->getTypeLoc().getLocStart(), + OpaqueValueExpr(Args[I]->getTypeLoc().getBeginLoc(), ArgTy.getNonLValueExprType(S.Context), Expr::getValueKindForType(ArgTy))); } @@ -5422,7 +5422,7 @@ CXXCastPath BasePath; if (CheckDerivedToBaseConversion(LHSType, Class, Loc, - SourceRange(LHS.get()->getLocStart(), + SourceRange(LHS.get()->getBeginLoc(), RHS.get()->getLocEnd()), &BasePath)) return QualType(); @@ -5518,7 +5518,7 @@ HaveConversion = false; ToType = To->getType(); - InitializationKind Kind = InitializationKind::CreateCopy(To->getLocStart(), + InitializationKind Kind = InitializationKind::CreateCopy(To->getBeginLoc(), SourceLocation()); // C++11 5.16p3 // The process for determining whether an operand expression E1 of type T1 @@ -5664,7 +5664,7 @@ /// TryClassUnification. static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T) { InitializedEntity Entity = InitializedEntity::InitializeTemporary(T); - InitializationKind Kind = InitializationKind::CreateCopy(E.get()->getLocStart(), + InitializationKind Kind = InitializationKind::CreateCopy(E.get()->getBeginLoc(), SourceLocation()); Expr *Arg = E.get(); InitializationSequence InitSeq(Self, Entity, Kind, Arg); @@ -6571,7 +6571,7 @@ continue; if (CheckCallReturnType(Call->getCallReturnType(Context), - Call->getLocStart(), + Call->getBeginLoc(), Call, Call->getDirectCallee())) return ExprError(); } @@ -6707,7 +6707,7 @@ << BaseType << Base->getSourceRange(); CallExpr *CE = dyn_cast(Base); if (Decl *CD = (CE ? CE->getCalleeDecl() : nullptr)) { - Diag(CD->getLocStart(), + Diag(CD->getBeginLoc(), diag::note_member_reference_arrow_from_operator_arrow); } } Index: lib/Sema/SemaExprObjC.cpp =================================================================== --- lib/Sema/SemaExprObjC.cpp +++ lib/Sema/SemaExprObjC.cpp @@ -50,7 +50,7 @@ // ObjC strings can't be wide or UTF. if (!S->isAscii()) { - Diag(S->getLocStart(), diag::err_cfstring_literal_not_string_constant) + Diag(S->getBeginLoc(), diag::err_cfstring_literal_not_string_constant) << S->getSourceRange(); return true; } @@ -107,7 +107,7 @@ } else { // If there is no NSConstantString interface defined then treat this // as error and recover from it. - Diag(S->getLocStart(), diag::err_no_nsconstant_string_class) << NSIdent + Diag(S->getBeginLoc(), diag::err_no_nsconstant_string_class) << NSIdent << S->getSourceRange(); Ty = Context.getObjCIdType(); } @@ -400,7 +400,7 @@ = InitializedEntity::InitializeParameter(S.Context, T, /*Consumed=*/false); InitializationKind Kind - = InitializationKind::CreateCopy(Element->getLocStart(), + = InitializationKind::CreateCopy(Element->getBeginLoc(), SourceLocation()); InitializationSequence Seq(S, Entity, Kind, Element); if (!Seq.Failed()) @@ -432,11 +432,11 @@ isa(OrigElement)) ? 2 : 3; - S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection) + S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection) << Which << OrigElement->getSourceRange() - << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@"); + << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@"); - Result = S.BuildObjCNumericLiteral(OrigElement->getLocStart(), + Result = S.BuildObjCNumericLiteral(OrigElement->getBeginLoc(), OrigElement); if (Result.isInvalid()) return ExprError(); @@ -448,11 +448,11 @@ // If this is potentially an Objective-C string literal, add the '@'. else if (StringLiteral *String = dyn_cast(OrigElement)) { if (String->isAscii()) { - S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection) + S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection) << 0 << OrigElement->getSourceRange() - << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@"); + << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@"); - Result = S.BuildObjCStringLiteral(OrigElement->getLocStart(), String); + Result = S.BuildObjCStringLiteral(OrigElement->getBeginLoc(), String); if (Result.isInvalid()) return ExprError(); @@ -462,7 +462,7 @@ } if (!Recovered) { - S.Diag(Element->getLocStart(), diag::err_invalid_collection_element) + S.Diag(Element->getBeginLoc(), diag::err_invalid_collection_element) << Element->getType(); return ExprError(); } @@ -481,7 +481,7 @@ break; } if (!hasMacro) - S.Diag(Element->getLocStart(), + S.Diag(Element->getBeginLoc(), diag::warn_concatenated_nsarray_literal) << Element->getType(); } @@ -493,7 +493,7 @@ return S.PerformCopyInitialization( InitializedEntity::InitializeParameter(S.Context, T, /*Consumed=*/false), - Element->getLocStart(), Element); + Element->getBeginLoc(), Element); } ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { @@ -1034,7 +1034,7 @@ !Element.Value->containsUnexpandedParameterPack()) { Diag(Element.EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) - << SourceRange(Element.Key->getLocStart(), + << SourceRange(Element.Key->getBeginLoc(), Element.Value->getLocEnd()); return ExprError(); } @@ -1693,11 +1693,11 @@ } else { // Check for extra arguments to non-variadic methods. if (Args.size() != NumNamedArgs) { - Diag(Args[NumNamedArgs]->getLocStart(), + Diag(Args[NumNamedArgs]->getBeginLoc(), diag::err_typecheck_call_too_many_args) << 2 /*method*/ << NumNamedArgs << static_cast(Args.size()) << Method->getSourceRange() - << SourceRange(Args[NumNamedArgs]->getLocStart(), + << SourceRange(Args[NumNamedArgs]->getBeginLoc(), Args.back()->getLocEnd()); } } @@ -2323,7 +2323,7 @@ << (!Ret->isRecordType() ? /*Vector*/ 2 : Ret->isUnionType() ? /*Union*/ 1 : /*Struct*/ 0); - S.Diag(ImpliedMethod->getLocStart(), + S.Diag(ImpliedMethod->getBeginLoc(), diag::note_objc_unsafe_perform_selector_method_declared_here) << ImpliedMethod->getSelector() << Ret; } @@ -2582,7 +2582,7 @@ return false; const IdentifierInfo *II = S.NSAPIObj->getNSClassId(NSAPI::ClassId_NSObject); if (const auto *RootClass = dyn_cast_or_null( - S.LookupSingleName(S.TUScope, II, Protocol->getLocStart(), + S.LookupSingleName(S.TUScope, II, Protocol->getBeginLoc(), Sema::LookupOrdinaryName))) { for (const ObjCProtocolDecl *P : RootClass->all_referenced_protocols()) { if (P->getCanonicalDecl() == Protocol->getCanonicalDecl()) @@ -2635,7 +2635,7 @@ "use it instead."); // The location of the receiver. - SourceLocation Loc = SuperLoc.isValid()? SuperLoc : Receiver->getLocStart(); + SourceLocation Loc = SuperLoc.isValid()? SuperLoc : Receiver->getBeginLoc(); SourceRange RecRange = SuperLoc.isValid()? SuperLoc : Receiver->getSourceRange(); ArrayRef SelectorSlotLocs; @@ -2856,7 +2856,7 @@ return ExprError(); forwardClass = OCIType->getInterfaceDecl(); - Diag(Receiver ? Receiver->getLocStart() + Diag(Receiver ? Receiver->getBeginLoc() : SuperLoc, diag::note_receiver_is_id); Method = nullptr; } else { @@ -3776,7 +3776,7 @@ (CastClass && CastClass->isSuperClassOf(ExprClass))) return true; if (warn) - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge) + S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge) << T << Target->getName() << castType->getPointeeType(); return false; } else if (castType->isObjCIdType() || @@ -3788,20 +3788,20 @@ return true; else { if (warn) { - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge) + S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge) << T << Target->getName() << castType; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); - S.Diag(Target->getLocStart(), diag::note_declared_at); + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); + S.Diag(Target->getBeginLoc(), diag::note_declared_at); } return false; } } } else if (!castType->isObjCIdType()) { - S.Diag(castExpr->getLocStart(), diag::err_objc_cf_bridged_not_interface) + S.Diag(castExpr->getBeginLoc(), diag::err_objc_cf_bridged_not_interface) << castExpr->getType() << Parm; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); if (Target) - S.Diag(Target->getLocStart(), diag::note_declared_at); + S.Diag(Target->getBeginLoc(), diag::note_declared_at); } return true; } @@ -3841,9 +3841,9 @@ (ExprClass && CastClass->isSuperClassOf(ExprClass))) return true; if (warn) { - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge_to_cf) + S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge_to_cf) << castExpr->getType()->getPointeeType() << T; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); } return false; } else if (castExpr->getType()->isObjCIdType() || @@ -3855,20 +3855,20 @@ return true; else { if (warn) { - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge_to_cf) + S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge_to_cf) << castExpr->getType() << castType; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); - S.Diag(Target->getLocStart(), diag::note_declared_at); + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); + S.Diag(Target->getBeginLoc(), diag::note_declared_at); } return false; } } } - S.Diag(castExpr->getLocStart(), diag::err_objc_ns_bridged_invalid_cfobject) + S.Diag(castExpr->getBeginLoc(), diag::err_objc_ns_bridged_invalid_cfobject) << castExpr->getType() << castType; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); if (Target) - S.Diag(Target->getLocStart(), diag::note_declared_at); + S.Diag(Target->getBeginLoc(), diag::note_declared_at); return true; } return false; @@ -3945,7 +3945,7 @@ ARCConversionTypeClass castExprACTC = classifyTypeForARCConversion(castType); if (srcExprACTC != ACTC_retainable || castExprACTC != ACTC_coreFoundation) return; - CheckObjCBridgeRelatedConversions(castExpr->getLocStart(), + CheckObjCBridgeRelatedConversions(castExpr->getBeginLoc(), castType, SrcType, castExpr); } @@ -3991,7 +3991,7 @@ if (Diagnose) { Diag(Loc, diag::err_objc_bridged_related_invalid_class) << RCId << SrcType << DestType; - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); } return false; } @@ -4002,9 +4002,9 @@ if (Diagnose) { Diag(Loc, diag::err_objc_bridged_related_invalid_class_name) << RCId << SrcType << DestType; - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); if (Target) - Diag(Target->getLocStart(), diag::note_declared_at); + Diag(Target->getBeginLoc(), diag::note_declared_at); } return false; } @@ -4017,7 +4017,7 @@ if (Diagnose) { Diag(Loc, diag::err_objc_bridged_related_known_method) << SrcType << DestType << Sel << false; - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); } return false; } @@ -4031,7 +4031,7 @@ if (Diagnose) { Diag(Loc, diag::err_objc_bridged_related_known_method) << SrcType << DestType << Sel << true; - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); } return false; } @@ -4071,10 +4071,10 @@ // Provide a fixit: [RelatedClass ClassMethod SrcExpr] Diag(Loc, diag::err_objc_bridged_related_known_method) << SrcType << DestType << ClassMethod->getSelector() << false - << FixItHint::CreateInsertion(SrcExpr->getLocStart(), ExpressionString) + << FixItHint::CreateInsertion(SrcExpr->getBeginLoc(), ExpressionString) << FixItHint::CreateInsertion(SrcExprEndLoc, "]"); - Diag(RelatedClass->getLocStart(), diag::note_declared_at); - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(RelatedClass->getBeginLoc(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); QualType receiverType = Context.getObjCInterfaceType(RelatedClass); // Argument. @@ -4113,11 +4113,11 @@ Diag(Loc, diag::err_objc_bridged_related_known_method) << SrcType << DestType << InstanceMethod->getSelector() << true - << FixItHint::CreateInsertion(SrcExpr->getLocStart(), "[") + << FixItHint::CreateInsertion(SrcExpr->getBeginLoc(), "[") << FixItHint::CreateInsertion(SrcExprEndLoc, ExpressionString); } - Diag(RelatedClass->getLocStart(), diag::note_declared_at); - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + Diag(RelatedClass->getBeginLoc(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); ExprResult msg = BuildInstanceMessageImplicit(SrcExpr, SrcType, Index: lib/Sema/SemaInit.cpp =================================================================== --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -194,13 +194,13 @@ // [dcl.init.string]p2 if (StrLength > CAT->getSize().getZExtValue()) - S.Diag(Str->getLocStart(), + S.Diag(Str->getBeginLoc(), diag::err_initializer_string_for_char_array_too_long) << Str->getSourceRange(); } else { // C99 6.7.8p14. if (StrLength-1 > CAT->getSize().getZExtValue()) - S.Diag(Str->getLocStart(), + S.Diag(Str->getBeginLoc(), diag::ext_initializer_string_for_char_array_too_long) << Str->getSourceRange(); } @@ -917,7 +917,7 @@ if (maxElements == 0) { if (!VerifyOnly) - SemaRef.Diag(ParentIList->getInit(Index)->getLocStart(), + SemaRef.Diag(ParentIList->getInit(Index)->getBeginLoc(), diag::err_implicit_empty_initializer); ++Index; hadError = true; @@ -928,7 +928,7 @@ InitListExpr *StructuredSubobjectInitList = getStructuredSubobjectInit(ParentIList, Index, T, StructuredList, StructuredIndex, - SourceRange(ParentIList->getInit(Index)->getLocStart(), + SourceRange(ParentIList->getInit(Index)->getBeginLoc(), ParentIList->getSourceRange().getEnd())); unsigned StructuredSubobjectInitIndex = 0; @@ -956,11 +956,11 @@ if ((T->isArrayType() || T->isRecordType()) && !ParentIList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) && !isIdiomaticBraceElisionEntity(Entity)) { - SemaRef.Diag(StructuredSubobjectInitList->getLocStart(), + SemaRef.Diag(StructuredSubobjectInitList->getBeginLoc(), diag::warn_missing_braces) << StructuredSubobjectInitList->getSourceRange() << FixItHint::CreateInsertion( - StructuredSubobjectInitList->getLocStart(), "{") + StructuredSubobjectInitList->getBeginLoc(), "{") << FixItHint::CreateInsertion( SemaRef.getLocForEndOfToken( StructuredSubobjectInitList->getLocEnd()), @@ -1080,7 +1080,7 @@ hadError = true; } // Special-case - SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK) + SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK) << IList->getInit(Index)->getSourceRange(); } else if (!T->isIncompleteType()) { // Don't complain for incomplete types, since we'll get an error @@ -1103,7 +1103,7 @@ hadError = true; } - SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK) + SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK) << initKind << IList->getInit(Index)->getSourceRange(); } } @@ -1155,7 +1155,7 @@ // This type is invalid, issue a diagnostic. ++Index; if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type) + SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type) << DeclType; hadError = true; } else if (DeclType->isReferenceType()) { @@ -1163,12 +1163,12 @@ StructuredList, StructuredIndex); } else if (DeclType->isObjCObjectType()) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_init_objc_class) + SemaRef.Diag(IList->getBeginLoc(), diag::err_init_objc_class) << DeclType; hadError = true; } else { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type) + SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type) << DeclType; hadError = true; } @@ -1232,7 +1232,7 @@ // FIXME: Better EqualLoc? InitializationKind Kind = - InitializationKind::CreateCopy(expr->getLocStart(), SourceLocation()); + InitializationKind::CreateCopy(expr->getBeginLoc(), SourceLocation()); InitializationSequence Seq(SemaRef, Entity, Kind, expr, /*TopLevelOfInitList*/ true); @@ -1356,7 +1356,7 @@ // This is an extension in C. (The builtin _Complex type does not exist // in the C++ standard.) if (!SemaRef.getLangOpts().CPlusPlus && !VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::ext_complex_component_init) + SemaRef.Diag(IList->getBeginLoc(), diag::ext_complex_component_init) << IList->getSourceRange(); // Initialize the complex number. @@ -1378,7 +1378,7 @@ unsigned &StructuredIndex) { if (Index >= IList->getNumInits()) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), SemaRef.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_empty_scalar_initializer : diag::err_empty_scalar_initializer) @@ -1394,7 +1394,7 @@ // FIXME: This is invalid, and accepting it causes overload resolution // to pick the wrong overload in some corner cases. if (!VerifyOnly) - SemaRef.Diag(SubIList->getLocStart(), + SemaRef.Diag(SubIList->getBeginLoc(), diag::ext_many_braces_around_scalar_init) << SubIList->getSourceRange(); @@ -1403,7 +1403,7 @@ return; } else if (isa(expr)) { if (!VerifyOnly) - SemaRef.Diag(expr->getLocStart(), + SemaRef.Diag(expr->getBeginLoc(), diag::err_designator_for_scalar_init) << DeclType << expr->getSourceRange(); hadError = true; @@ -1420,7 +1420,7 @@ } ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr, + SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr, /*TopLevelOfInitList=*/true); Expr *ResultExpr = nullptr; @@ -1453,7 +1453,7 @@ // so that we know the location (or decl) of the "current object" being // initialized. if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), diag::err_init_reference_member_uninitialized) << DeclType << IList->getSourceRange(); @@ -1466,7 +1466,7 @@ Expr *expr = IList->getInit(Index); if (isa(expr) && !SemaRef.getLangOpts().CPlusPlus11) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_init_non_aggr_init_list) + SemaRef.Diag(IList->getBeginLoc(), diag::err_init_non_aggr_init_list) << DeclType << IList->getSourceRange(); hadError = true; ++Index; @@ -1482,7 +1482,7 @@ } ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr, + SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr, /*TopLevelOfInitList=*/true); if (Result.isInvalid()) @@ -1530,7 +1530,7 @@ } ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(), Init, + SemaRef.PerformCopyInitialization(Entity, Init->getBeginLoc(), Init, /*TopLevelOfInitList=*/true); Expr *ResultExpr = nullptr; @@ -1586,7 +1586,7 @@ // // Because of this, explicitly call out that it is non-portable. // - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), diag::warn_neon_vector_initializer_non_portable); const char *typeCode; @@ -1601,7 +1601,7 @@ else llvm_unreachable("Invalid element type!"); - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), SemaRef.Context.getTypeSize(VT) > 64 ? diag::note_neon_vector_initializer_non_portable_q : diag::note_neon_vector_initializer_non_portable) @@ -1646,7 +1646,7 @@ // OpenCL requires all elements to be initialized. if (numEltsInit != maxElements) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), diag::err_vector_incorrect_num_initializers) << (numEltsInit < maxElements) << maxElements << numEltsInit; hadError = true; @@ -1686,7 +1686,7 @@ // earlier, but I don't know where clang accepts VLAs (gcc accepts // them in all sorts of strange places). if (!VerifyOnly) - SemaRef.Diag(VAT->getSizeExpr()->getLocStart(), + SemaRef.Diag(VAT->getSizeExpr()->getBeginLoc(), diag::err_variable_object_no_init) << VAT->getSizeExpr()->getSourceRange(); hadError = true; @@ -1765,7 +1765,7 @@ if (maxElements == Zero && !Entity.isVariableLengthArrayNew()) { // Sizing an array implicitly to zero is not allowed by ISO C, // but is supported by GNU. - SemaRef.Diag(IList->getLocStart(), + SemaRef.Diag(IList->getBeginLoc(), diag::ext_typecheck_zero_array_size); } @@ -1815,9 +1815,9 @@ } if (!VerifyOnly) { - SemaRef.Diag(InitExpr->getLocStart(), + SemaRef.Diag(InitExpr->getBeginLoc(), FlexArrayDiag) - << InitExpr->getLocStart(); + << InitExpr->getBeginLoc(); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << Field; } @@ -1881,7 +1881,7 @@ // If we have any base classes, they are initialized prior to the fields. for (auto &Base : Bases) { Expr *Init = Index < IList->getNumInits() ? IList->getInit(Index) : nullptr; - SourceLocation InitLoc = Init ? Init->getLocStart() : IList->getLocEnd(); + SourceLocation InitLoc = Init ? Init->getBeginLoc() : IList->getLocEnd(); // Designated inits always initialize fields, so if we see one, all // remaining base classes have no explicit initializer. @@ -1959,7 +1959,7 @@ InvalidUse = !SemaRef.CanUseDecl(*Field, TreatUnavailableAsInvalid); else InvalidUse = SemaRef.DiagnoseUseOfDecl(*Field, - IList->getInit(Index)->getLocStart()); + IList->getInit(Index)->getBeginLoc()); if (InvalidUse) { ++Index; ++Field; @@ -2185,7 +2185,7 @@ StructuredList = getStructuredSubobjectInit(IList, Index, CurrentObjectType, StructuredList, StructuredIndex, - SourceRange(D->getLocStart(), + SourceRange(D->getBeginLoc(), DIE->getLocEnd())); else if (InitListExpr *Result = dyn_cast(ExistingInit)) StructuredList = Result; @@ -2196,7 +2196,7 @@ else { DesignatedInitUpdateExpr *DIUE = new (SemaRef.Context) DesignatedInitUpdateExpr(SemaRef.Context, - D->getLocStart(), ExistingInit, + D->getBeginLoc(), ExistingInit, DIE->getLocEnd()); StructuredList->updateInit(SemaRef.Context, StructuredIndex, DIUE); StructuredList = DIUE->getUpdater(); @@ -2222,11 +2222,11 @@ // Here, xs[0].a == 0 and xs[0].b == 3, since the second, // designated initializer re-initializes the whole // subobject [0], overwriting previous initializers. - SemaRef.Diag(D->getLocStart(), + SemaRef.Diag(D->getBeginLoc(), diag::warn_subobject_initializer_overrides) - << SourceRange(D->getLocStart(), DIE->getLocEnd()); + << SourceRange(D->getBeginLoc(), DIE->getLocEnd()); - SemaRef.Diag(ExistingInit->getLocStart(), + SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer) << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange(); @@ -2350,7 +2350,7 @@ SemaRef.Diag(D->getFieldLoc(), diag::warn_initializer_overrides) << D->getSourceRange(); - SemaRef.Diag(ExistingInit->getLocStart(), + SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer) << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange(); @@ -2395,9 +2395,9 @@ if (!VerifyOnly) { DesignatedInitExpr::Designator *NextD = DIE->getDesignator(DesigIdx + 1); - SemaRef.Diag(NextD->getLocStart(), + SemaRef.Diag(NextD->getBeginLoc(), diag::err_designator_into_flexible_array_member) - << SourceRange(NextD->getLocStart(), + << SourceRange(NextD->getBeginLoc(), DIE->getLocEnd()); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << *Field; @@ -2409,7 +2409,7 @@ !isa(DIE->getInit())) { // The initializer is not an initializer list. if (!VerifyOnly) { - SemaRef.Diag(DIE->getInit()->getLocStart(), + SemaRef.Diag(DIE->getInit()->getBeginLoc(), diag::err_flexible_array_init_needs_braces) << DIE->getInit()->getSourceRange(); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) @@ -2553,7 +2553,7 @@ DesignatedEndIndex.setIsUnsigned(MaxElements.isUnsigned()); if (DesignatedEndIndex >= MaxElements) { if (!VerifyOnly) - SemaRef.Diag(IndexExpr->getLocStart(), + SemaRef.Diag(IndexExpr->getBeginLoc(), diag::err_array_designator_too_large) << DesignatedEndIndex.toString(10) << MaxElements.toString(10) << IndexExpr->getSourceRange(); @@ -2728,7 +2728,7 @@ SemaRef.Diag(InitRange.getBegin(), diag::warn_subobject_initializer_overrides) << InitRange; - SemaRef.Diag(ExistingInit->getLocStart(), + SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer) << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange(); @@ -2810,11 +2810,11 @@ // There is an overwrite taking place because the first braced initializer // list "{ .a = 2 }' already provides value for .p.b (which is zero). if (PrevInit->getSourceRange().isValid()) { - SemaRef.Diag(expr->getLocStart(), + SemaRef.Diag(expr->getBeginLoc(), diag::warn_initializer_overrides) << expr->getSourceRange(); - SemaRef.Diag(PrevInit->getLocStart(), + SemaRef.Diag(PrevInit->getBeginLoc(), diag::note_previous_initializer) << /*FIXME:has side effects=*/0 << PrevInit->getSourceRange(); @@ -2833,7 +2833,7 @@ /// value of the constant expression. static ExprResult CheckArrayDesignatorExpr(Sema &S, Expr *Index, llvm::APSInt &Value) { - SourceLocation Loc = Index->getLocStart(); + SourceLocation Loc = Index->getBeginLoc(); // Make sure this is an integer constant expression. ExprResult Result = S.VerifyIntegerConstantExpression(Index, &Value); @@ -2941,7 +2941,7 @@ Init.getAs()); if (!getLangOpts().C99) - Diag(DIE->getLocStart(), diag::ext_designated_init) + Diag(DIE->getBeginLoc(), diag::ext_designated_init) << DIE->getSourceRange(); return DIE; @@ -3583,7 +3583,7 @@ InitializedEntity HiddenArray = InitializedEntity::InitializeTemporary(ArrayType); InitializationKind Kind = InitializationKind::CreateDirectList( - List->getExprLoc(), List->getLocStart(), List->getLocEnd()); + List->getExprLoc(), List->getBeginLoc(), List->getLocEnd()); TryListInitialization(S, HiddenArray, Kind, List, Sequence, TreatUnavailableAsInvalid); if (Sequence) @@ -3974,7 +3974,7 @@ T1, Sequence)) return; - SourceLocation DeclLoc = Initializer->getLocStart(); + SourceLocation DeclLoc = Initializer->getBeginLoc(); bool dummy1, dummy2, dummy3; Sema::ReferenceCompareResult RefRelationship = S.CompareReferenceRelationship(DeclLoc, cv1T1, cv2T2, dummy1, @@ -4031,7 +4031,7 @@ } if (DestType->isRecordType() && - !S.isCompleteType(InitList->getLocStart(), DestType)) { + !S.isCompleteType(InitList->getBeginLoc(), DestType)) { Sequence.setIncompleteTypeFailure(DestType); return; } @@ -4051,7 +4051,7 @@ if (DestType->isRecordType()) { QualType InitType = InitList->getInit(0)->getType(); if (S.Context.hasSameUnqualifiedType(InitType, DestType) || - S.IsDerivedFrom(InitList->getLocStart(), InitType, DestType)) { + S.IsDerivedFrom(InitList->getBeginLoc(), InitType, DestType)) { Expr *InitListAsExpr = InitList; TryConstructorInitialization(S, Entity, Kind, InitListAsExpr, DestType, DestType, Sequence, @@ -4218,7 +4218,7 @@ bool DerivedToBase; bool ObjCConversion; bool ObjCLifetimeConversion; - assert(!S.CompareReferenceRelationship(Initializer->getLocStart(), + assert(!S.CompareReferenceRelationship(Initializer->getBeginLoc(), T1, T2, DerivedToBase, ObjCConversion, ObjCLifetimeConversion) && @@ -4313,7 +4313,7 @@ if (T2RecordType && T2RecordType->getDecl()->isInvalidDecl()) return OR_No_Viable_Function; - SourceLocation DeclLoc = Initializer->getLocStart(); + SourceLocation DeclLoc = Initializer->getBeginLoc(); // Perform overload resolution. If it fails, return the failed result. OverloadCandidateSet::iterator Best; @@ -4439,7 +4439,7 @@ Qualifiers T2Quals, InitializationSequence &Sequence) { QualType DestType = Entity.getType(); - SourceLocation DeclLoc = Initializer->getLocStart(); + SourceLocation DeclLoc = Initializer->getBeginLoc(); // Compute some basic properties of the types and the initializer. bool isLValueRef = DestType->isLValueReferenceType(); bool isRValueRef = !isLValueRef; @@ -4867,7 +4867,7 @@ } } - SourceLocation DeclLoc = Initializer->getLocStart(); + SourceLocation DeclLoc = Initializer->getBeginLoc(); if (const RecordType *SourceRecordType = SourceType->getAs()) { // The type we're converting from is a class type, enumerate its conversion @@ -5310,7 +5310,7 @@ if (Args.size() == 1) { Initializer = Args[0]; if (S.getLangOpts().ObjC1) { - if (S.CheckObjCBridgeRelatedConversions(Initializer->getLocStart(), + if (S.CheckObjCBridgeRelatedConversions(Initializer->getBeginLoc(), DestType, Initializer->getType(), Initializer) || S.ConversionToObjCStringLiteralCheck(DestType, Initializer)) @@ -5501,7 +5501,7 @@ if (Kind.getKind() == InitializationKind::IK_Direct || (Kind.getKind() == InitializationKind::IK_Copy && (Context.hasSameUnqualifiedType(SourceType, DestType) || - S.IsDerivedFrom(Initializer->getLocStart(), SourceType, DestType)))) + S.IsDerivedFrom(Initializer->getBeginLoc(), SourceType, DestType)))) TryConstructorInitialization(S, Entity, Kind, Args, DestType, DestType, *this); // - Otherwise (i.e., for the remaining copy-initialization cases), @@ -5535,7 +5535,7 @@ bool NeedAtomicConversion = false; if (const AtomicType *Atomic = DestType->getAs()) { if (Context.hasSameUnqualifiedType(SourceType, Atomic->getValueType()) || - S.IsDerivedFrom(Initializer->getLocStart(), SourceType, + S.IsDerivedFrom(Initializer->getBeginLoc(), SourceType, Atomic->getValueType())) { DestType = Atomic->getValueType(); NeedAtomicConversion = true; @@ -5758,7 +5758,7 @@ case InitializedEntity::EK_LambdaToBlockConversionBlockElement: case InitializedEntity::EK_CompoundLiteralInit: case InitializedEntity::EK_RelatedResult: - return Initializer->getLocStart(); + return Initializer->getBeginLoc(); } llvm_unreachable("missed an InitializedEntity kind?"); } @@ -6978,18 +6978,18 @@ return; } - S.Diag(CE->getLocStart(), DiagID); + S.Diag(CE->getBeginLoc(), DiagID); // Get all the locations for a fix-it. Don't emit the fix-it if any location // is within a macro. - SourceLocation CallBegin = CE->getCallee()->getLocStart(); + SourceLocation CallBegin = CE->getCallee()->getBeginLoc(); if (CallBegin.isMacroID()) return; SourceLocation RParen = CE->getRParenLoc(); if (RParen.isMacroID()) return; SourceLocation LParen; - SourceLocation ArgLoc = Arg->getLocStart(); + SourceLocation ArgLoc = Arg->getBeginLoc(); // Special testing for the argument location. Since the fix-it needs the // location right before the argument, the argument location can be in a @@ -7004,7 +7004,7 @@ LParen = ArgLoc.getLocWithOffset(-1); - S.Diag(CE->getLocStart(), diag::note_remove_move) + S.Diag(CE->getBeginLoc(), diag::note_remove_move) << FixItHint::CreateRemoval(SourceRange(CallBegin, LParen)) << FixItHint::CreateRemoval(SourceRange(RParen, RParen)); } @@ -7146,7 +7146,7 @@ // from an initializer list. For parameters, we produce a better warning // elsewhere. Expr *Init = Args[0]; - S.Diag(Init->getLocStart(), diag::warn_cxx98_compat_reference_list_init) + S.Diag(Init->getBeginLoc(), diag::warn_cxx98_compat_reference_list_init) << Init->getSourceRange(); } @@ -7159,8 +7159,8 @@ if (S.getLangOpts().OpenCLVersion >= 200 && ETy->isAtomicType() && !HasGlobalAS && Entity.getKind() == InitializedEntity::EK_Variable && Args.size() > 0) { - S.Diag(Args[0]->getLocStart(), diag::err_opencl_atomic_init) << 1 << - SourceRange(Entity.getDecl()->getLocStart(), Args[0]->getLocEnd()); + S.Diag(Args[0]->getBeginLoc(), diag::err_opencl_atomic_init) << 1 << + SourceRange(Entity.getDecl()->getBeginLoc(), Args[0]->getLocEnd()); return ExprError(); } @@ -7277,7 +7277,7 @@ // Casts to inaccessible base classes are allowed with C-style casts. bool IgnoreBaseAccess = Kind.isCStyleOrFunctionalCast(); if (S.CheckDerivedToBaseConversion(SourceType, Step->Type, - CurInit.get()->getLocStart(), + CurInit.get()->getBeginLoc(), CurInit.get()->getSourceRange(), &BasePath, IgnoreBaseAccess)) return ExprError(); @@ -7308,7 +7308,7 @@ if (auto *DRE = dyn_cast(CurInit.get()->IgnoreParens())) { if (auto *FD = dyn_cast(DRE->getDecl())) { if (!S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - DRE->getLocStart())) + DRE->getBeginLoc())) return ExprError(); } } @@ -7369,7 +7369,7 @@ if (CXXConstructorDecl *Constructor = dyn_cast(Fn)) { // Build a call to the selected constructor. SmallVector ConstructorArgs; - SourceLocation Loc = CurInit.get()->getLocStart(); + SourceLocation Loc = CurInit.get()->getBeginLoc(); // Determine the arguments required to actually perform the constructor // call. @@ -7436,10 +7436,10 @@ if (const RecordType *Record = T->getAs()) { CXXDestructorDecl *Destructor = S.LookupDestructor(cast(Record->getDecl())); - S.CheckDestructorAccess(CurInit.get()->getLocStart(), Destructor, + S.CheckDestructorAccess(CurInit.get()->getBeginLoc(), Destructor, S.PDiag(diag::err_access_dtor_temp) << T); - S.MarkFunctionReferenced(CurInit.get()->getLocStart(), Destructor); - if (S.DiagnoseUseOfDecl(Destructor, CurInit.get()->getLocStart())) + S.MarkFunctionReferenced(CurInit.get()->getBeginLoc(), Destructor); + if (S.DiagnoseUseOfDecl(Destructor, CurInit.get()->getBeginLoc())) return ExprError(); } } @@ -7934,7 +7934,7 @@ } for (const auto &BI : RD->bases()) { - if (DiagnoseUninitializedReference(S, BI.getLocStart(), BI.getType())) { + if (DiagnoseUninitializedReference(S, BI.getBeginLoc(), BI.getType())) { S.Diag(Loc, diag::note_value_initialization_here) << RD; return true; } @@ -7989,7 +7989,7 @@ // inner initialization failed. QualType T = DestType->getAs()->getPointeeType(); diagnoseListInit(S, InitializedEntity::InitializeTemporary(T), InitList); - SourceLocation Loc = InitList->getLocStart(); + SourceLocation Loc = InitList->getBeginLoc(); if (auto *D = Entity.getDecl()) Loc = D->getLocation(); S.Diag(Loc, diag::note_in_reference_temporary_list_initializer) << T; @@ -8039,7 +8039,7 @@ (void)Diagnosed; } else // FIXME: diagnostic below could be better! S.Diag(Kind.getLocation(), diag::err_reference_has_multiple_inits) - << SourceRange(Args.front()->getLocStart(), Args.back()->getLocEnd()); + << SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd()); break; case FK_ParenthesizedListInitForReference: S.Diag(Kind.getLocation(), diag::err_list_init_in_parens) @@ -8068,9 +8068,9 @@ case FK_PlainStringIntoUTF8Char: S.Diag(Kind.getLocation(), diag::err_array_init_plain_string_into_char8_t); - S.Diag(Args.front()->getLocStart(), + S.Diag(Args.front()->getBeginLoc(), diag::note_array_init_plain_string_into_char8_t) - << FixItHint::CreateInsertion(Args.front()->getLocStart(), "u8"); + << FixItHint::CreateInsertion(Args.front()->getBeginLoc(), "u8"); break; case FK_UTF8StringIntoPlainChar: S.Diag(Kind.getLocation(), @@ -8104,7 +8104,7 @@ case FK_AddressOfUnaddressableFunction: { auto *FD = cast(cast(OnlyArg)->getDecl()); S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - OnlyArg->getLocStart()); + OnlyArg->getBeginLoc()); break; } @@ -8285,7 +8285,7 @@ case FK_ConstructorOverloadFailed: { SourceRange ArgsRange; if (Args.size()) - ArgsRange = SourceRange(Args.front()->getLocStart(), + ArgsRange = SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd()); if (Failure == FK_ListConstructorOverloadFailed) { @@ -8821,7 +8821,7 @@ // This was a floating-to-integer conversion, which is always considered a // narrowing conversion even if the value is a constant and can be // represented exactly as an integer. - S.Diag(PostInit->getLocStart(), NarrowingErrs(S.getLangOpts()) + S.Diag(PostInit->getBeginLoc(), NarrowingErrs(S.getLangOpts()) ? diag::ext_init_list_type_narrowing : diag::warn_init_list_type_narrowing) << PostInit->getSourceRange() @@ -8831,7 +8831,7 @@ case NK_Constant_Narrowing: // A constant value was narrowed. - S.Diag(PostInit->getLocStart(), + S.Diag(PostInit->getBeginLoc(), NarrowingErrs(S.getLangOpts()) ? diag::ext_init_list_constant_narrowing : diag::warn_init_list_constant_narrowing) @@ -8842,7 +8842,7 @@ case NK_Variable_Narrowing: // A variable's value may have been narrowed. - S.Diag(PostInit->getLocStart(), + S.Diag(PostInit->getBeginLoc(), NarrowingErrs(S.getLangOpts()) ? diag::ext_init_list_variable_narrowing : diag::warn_init_list_variable_narrowing) @@ -8870,9 +8870,9 @@ return; } OS << ">("; - S.Diag(PostInit->getLocStart(), diag::note_init_list_narrowing_silence) + S.Diag(PostInit->getBeginLoc(), diag::note_init_list_narrowing_silence) << PostInit->getSourceRange() - << FixItHint::CreateInsertion(PostInit->getLocStart(), OS.str()) + << FixItHint::CreateInsertion(PostInit->getBeginLoc(), OS.str()) << FixItHint::CreateInsertion( S.getLocForEndOfToken(PostInit->getLocEnd()), ")"); } @@ -8890,7 +8890,7 @@ assert(InitE && "No initialization expression"); InitializationKind Kind - = InitializationKind::CreateCopy(InitE->getLocStart(), SourceLocation()); + = InitializationKind::CreateCopy(InitE->getBeginLoc(), SourceLocation()); InitializationSequence Seq(*this, Entity, Kind, InitE); return !Seq.Failed(); } @@ -8908,9 +8908,9 @@ assert(InitE && "No initialization expression?"); if (EqualLoc.isInvalid()) - EqualLoc = InitE->getLocStart(); + EqualLoc = InitE->getBeginLoc(); - InitializationKind Kind = InitializationKind::CreateCopy(InitE->getLocStart(), + InitializationKind Kind = InitializationKind::CreateCopy(InitE->getBeginLoc(), EqualLoc, AllowExplicit); InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList); Index: lib/Sema/SemaLambda.cpp =================================================================== --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -479,7 +479,7 @@ if (!LSI->ReturnType->isDependentType() && !LSI->ReturnType->isVoidType()) { - if (RequireCompleteType(CallOperator->getLocStart(), LSI->ReturnType, + if (RequireCompleteType(CallOperator->getBeginLoc(), LSI->ReturnType, diag::err_lambda_incomplete_result)) { // Do nothing. } @@ -720,7 +720,7 @@ // FIXME: This is a poor diagnostic for ReturnStmts without expressions. // TODO: It's possible that the *first* return is the divergent one. - Diag(RS->getLocStart(), + Diag(RS->getBeginLoc(), diag::err_typecheck_missing_return_type_incompatible) << ReturnType << CSI.ReturnType << isa(CSI); @@ -762,9 +762,9 @@ InitializationKind Kind = IsDirectInit ? (CXXDirectInit ? InitializationKind::CreateDirect( - Loc, Init->getLocStart(), Init->getLocEnd()) + Loc, Init->getBeginLoc(), Init->getLocEnd()) : InitializationKind::CreateDirectList(Loc)) - : InitializationKind::CreateCopy(Loc, Init->getLocStart()); + : InitializationKind::CreateCopy(Loc, Init->getBeginLoc()); MultiExprArg Args = Init; if (CXXDirectInit) @@ -1289,7 +1289,7 @@ InvokerParams.push_back(ParmVarDecl::Create(S.Context, // Temporarily add to the TU. This is set to the invoker below. S.Context.getTranslationUnitDecl(), - From->getLocStart(), + From->getBeginLoc(), From->getLocation(), From->getIdentifier(), From->getType(), @@ -1748,7 +1748,7 @@ for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) { ParmVarDecl *From = CallOperator->getParamDecl(I); BlockParams.push_back(ParmVarDecl::Create(Context, Block, - From->getLocStart(), + From->getBeginLoc(), From->getLocation(), From->getIdentifier(), From->getType(), Index: lib/Sema/SemaLookup.cpp =================================================================== --- lib/Sema/SemaLookup.cpp +++ lib/Sema/SemaLookup.cpp @@ -4628,7 +4628,7 @@ getLangOpts().ModulesSearchAll) { // The following has the side effect of loading the missing module. getModuleLoader().lookupMissingImports(Typo->getName(), - TypoName.getLocStart()); + TypoName.getBeginLoc()); } CorrectionCandidateCallback &CCCRef = *CCC; Index: lib/Sema/SemaObjCProperty.cpp =================================================================== --- lib/Sema/SemaObjCProperty.cpp +++ lib/Sema/SemaObjCProperty.cpp @@ -614,7 +614,7 @@ Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object) << FixItHint::CreateInsertion(StarLoc, "*"); T = Context.getObjCObjectPointerType(T); - SourceLocation TLoc = TInfo->getTypeLoc().getLocStart(); + SourceLocation TLoc = TInfo->getTypeLoc().getBeginLoc(); TInfo = Context.getTrivialTypeSourceInfo(T, TLoc); } @@ -1061,7 +1061,7 @@ PropertyIvarLoc = PropertyLoc; SourceLocation PropertyDiagLoc = PropertyLoc; if (PropertyDiagLoc.isInvalid()) - PropertyDiagLoc = ClassImpDecl->getLocStart(); + PropertyDiagLoc = ClassImpDecl->getBeginLoc(); ObjCPropertyDecl *property = nullptr; ObjCInterfaceDecl *IDecl = nullptr; // Find the class or category class where this property must have @@ -1497,7 +1497,7 @@ Diag(PropertyDiagLoc, diag::err_atomic_property_nontrivial_assign_op) << property->getType(); - Diag(FuncDecl->getLocStart(), + Diag(FuncDecl->getBeginLoc(), diag::note_callee_decl) << FuncDecl; } } @@ -2100,7 +2100,7 @@ !impDecl->getInstanceMethod(getterMethod->getSelector())) { SourceLocation loc = propertyImpl->getLocation(); if (loc.isInvalid()) - loc = impDecl->getLocStart(); + loc = impDecl->getBeginLoc(); Diag(loc, diag::warn_null_resettable_setter) << setterMethod->getSelector() << property->getDeclName(); Index: lib/Sema/SemaOpenMP.cpp =================================================================== --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -1780,7 +1780,7 @@ bool VisitDeclRefExpr(const DeclRefExpr *E) { if (const auto *VD = dyn_cast(E->getDecl())) { if (VD->hasLocalStorage()) { - SemaRef.Diag(E->getLocStart(), + SemaRef.Diag(E->getBeginLoc(), diag::err_omp_local_var_in_threadprivate_init) << E->getSourceRange(); SemaRef.Diag(VD->getLocation(), diag::note_defined_here) @@ -2560,7 +2560,7 @@ WithInit = true; } auto *CED = OMPCapturedExprDecl::Create(C, S.CurContext, Id, Ty, - CaptureExpr->getLocStart()); + CaptureExpr->getBeginLoc()); if (!WithInit) CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C)); S.CurContext->addHiddenDecl(CED); @@ -2697,20 +2697,20 @@ ? SC->getFirstScheduleModifierLoc() : SC->getSecondScheduleModifierLoc(), diag::err_omp_schedule_nonmonotonic_ordered) - << SourceRange(OC->getLocStart(), OC->getLocEnd()); + << SourceRange(OC->getBeginLoc(), OC->getLocEnd()); ErrorFound = true; } if (!LCs.empty() && OC && OC->getNumForLoops()) { for (const OMPLinearClause *C : LCs) { - Diag(C->getLocStart(), diag::err_omp_linear_ordered) - << SourceRange(OC->getLocStart(), OC->getLocEnd()); + Diag(C->getBeginLoc(), diag::err_omp_linear_ordered) + << SourceRange(OC->getBeginLoc(), OC->getLocEnd()); } ErrorFound = true; } if (isOpenMPWorksharingDirective(DSAStack->getCurrentDirective()) && isOpenMPSimdDirective(DSAStack->getCurrentDirective()) && OC && OC->getNumForLoops()) { - Diag(OC->getLocStart(), diag::err_omp_ordered_simd) + Diag(OC->getBeginLoc(), diag::err_omp_ordered_simd) << getOpenMPDirectiveName(DSAStack->getCurrentDirective()); ErrorFound = true; } @@ -2989,7 +2989,7 @@ // the directive. OpenMPDirectiveKind CurNM = IC->getNameModifier(); if (FoundNameModifiers[CurNM]) { - S.Diag(C->getLocStart(), diag::err_omp_more_one_clause) + S.Diag(C->getBeginLoc(), diag::err_omp_more_one_clause) << getOpenMPDirectiveName(Kind) << getOpenMPClauseName(OMPC_if) << (CurNM != OMPD_unknown) << getOpenMPDirectiveName(CurNM); ErrorFound = true; @@ -3023,7 +3023,7 @@ // all if clauses on the directive must include a directive-name-modifier. if (FoundNameModifiers[OMPD_unknown] && NamedModifiersNumber > 0) { if (NamedModifiersNumber == AllowedNameModifiers.size()) { - S.Diag(FoundNameModifiers[OMPD_unknown]->getLocStart(), + S.Diag(FoundNameModifiers[OMPD_unknown]->getBeginLoc(), diag::err_omp_no_more_if_clause); } else { std::string Values; @@ -3045,7 +3045,7 @@ ++AllowedCnt; } } - S.Diag(FoundNameModifiers[OMPD_unknown]->getCondition()->getLocStart(), + S.Diag(FoundNameModifiers[OMPD_unknown]->getCondition()->getBeginLoc(), diag::err_omp_unnamed_if_clause) << (TotalAllowedNum > 1) << Values; } @@ -3804,7 +3804,7 @@ return true; if (!NewStep->isValueDependent()) { // Check that the step is integer expression. - SourceLocation StepLoc = NewStep->getLocStart(); + SourceLocation StepLoc = NewStep->getBeginLoc(); ExprResult Val = SemaRef.PerformOpenMPImplicitIntegerConversion( StepLoc, getExprAsWritten(NewStep)); if (Val.isInvalid()) @@ -3897,7 +3897,7 @@ if (Var->hasInit() && !Var->getType()->isReferenceType()) { // Accept non-canonical init form here but emit ext. warning. if (Var->getInitStyle() != VarDecl::CInit && EmitDiags) - SemaRef.Diag(S->getLocStart(), + SemaRef.Diag(S->getBeginLoc(), diag::ext_omp_loop_not_canonical_init) << S->getSourceRange(); return setLCDeclAndLB(Var, nullptr, Var->getInit()); @@ -3924,7 +3924,7 @@ if (dependent() || SemaRef.CurContext->isDependentContext()) return false; if (EmitDiags) { - SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_init) + SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_init) << S->getSourceRange(); } return true; @@ -3964,7 +3964,7 @@ return true; } S = getExprAsWritten(S); - SourceLocation CondLoc = S->getLocStart(); + SourceLocation CondLoc = S->getBeginLoc(); if (auto *BO = dyn_cast(S)) { if (BO->isRelationalOp()) { if (getInitLCDecl(BO->getLHS()) == LCDecl) @@ -4033,7 +4033,7 @@ } if (dependent() || SemaRef.CurContext->isDependentContext()) return false; - SemaRef.Diag(RHS->getLocStart(), diag::err_omp_loop_not_canonical_incr) + SemaRef.Diag(RHS->getBeginLoc(), diag::err_omp_loop_not_canonical_incr) << RHS->getSourceRange() << LCDecl; return true; } @@ -4066,7 +4066,7 @@ if (UO->isIncrementDecrementOp() && getInitLCDecl(UO->getSubExpr()) == LCDecl) return setStep(SemaRef - .ActOnIntegerConstant(UO->getLocStart(), + .ActOnIntegerConstant(UO->getBeginLoc(), (UO->isDecrementOp() ? -1 : 1)) .get(), /*Subtract=*/false); @@ -4091,7 +4091,7 @@ if (getInitLCDecl(CE->getArg(0)) == LCDecl) return setStep(SemaRef .ActOnIntegerConstant( - CE->getLocStart(), + CE->getBeginLoc(), ((CE->getOperator() == OO_MinusMinus) ? -1 : 1)) .get(), /*Subtract=*/false); @@ -4111,7 +4111,7 @@ } if (dependent() || SemaRef.CurContext->isDependentContext()) return false; - SemaRef.Diag(S->getLocStart(), diag::err_omp_loop_not_canonical_incr) + SemaRef.Diag(S->getBeginLoc(), diag::err_omp_loop_not_canonical_incr) << S->getSourceRange() << LCDecl; return true; } @@ -4155,7 +4155,7 @@ if (!Diff.isUsable() && VarType->getAsCXXRecordDecl()) { // BuildBinOp already emitted error, this one is to point user to upper // and lower bound, and to tell what is passed to 'operator-'. - SemaRef.Diag(Upper->getLocStart(), diag::err_omp_loop_diff_cxx) + SemaRef.Diag(Upper->getBeginLoc(), diag::err_omp_loop_diff_cxx) << Upper->getSourceRange() << Lower->getSourceRange(); return nullptr; } @@ -4369,7 +4369,7 @@ // for (init-expr; test-expr; incr-expr) structured-block auto *For = dyn_cast_or_null(S); if (!For) { - SemaRef.Diag(S->getLocStart(), diag::err_omp_not_for) + SemaRef.Diag(S->getBeginLoc(), diag::err_omp_not_for) << (CollapseLoopCountExpr != nullptr || OrderedLoopCountExpr != nullptr) << getOpenMPDirectiveName(DKind) << NestedLoopCount << (CurrentNestedLoopCount > 0) << CurrentNestedLoopCount; @@ -4414,7 +4414,7 @@ if (!VarType->isDependentType() && !VarType->isIntegerType() && !VarType->isPointerType() && !(SemaRef.getLangOpts().CPlusPlus && VarType->isOverloadableType())) { - SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_variable_type) + SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_variable_type) << SemaRef.getLangOpts().CPlusPlus; HasErrors = true; } @@ -4452,7 +4452,7 @@ !isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) && (DVar.CKind != OMPC_private || DVar.RefExpr != nullptr)) { - SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa) + SemaRef.Diag(Init->getBeginLoc(), diag::err_omp_loop_var_dsa) << getOpenMPClauseName(DVar.CKind) << getOpenMPDirectiveName(DKind) << getOpenMPClauseName(PredeterminedCKind); if (DVar.RefExpr == nullptr) @@ -4992,7 +4992,7 @@ } // Loop condition (IV < NumIterations) or (IV <= UB) for worksharing loops. - SourceLocation CondLoc = AStmt->getLocStart(); + SourceLocation CondLoc = AStmt->getBeginLoc(); ExprResult Cond = (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) || isOpenMPDistributeDirective(DKind)) @@ -5005,7 +5005,7 @@ SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), CombUB.get()); } // Loop increment (IV = IV + 1) - SourceLocation IncLoc = AStmt->getLocStart(); + SourceLocation IncLoc = AStmt->getBeginLoc(); ExprResult Inc = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(), SemaRef.ActOnIntegerConstant(IncLoc, 1).get()); @@ -5072,7 +5072,7 @@ // directive with for as IV = IV + ST; ensure upper bound expression based // on PrevUB instead of NumIterations - used to implement 'for' when found // in combination with 'distribute', like in 'distribute parallel for' - SourceLocation DistIncLoc = AStmt->getLocStart(); + SourceLocation DistIncLoc = AStmt->getBeginLoc(); ExprResult DistCond, DistInc, PrevEUB; if (isOpenMPLoopBoundSharingDirective(DKind)) { DistCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get()); @@ -5088,7 +5088,7 @@ // Build expression: UB = min(UB, prevUB) for #for in composite or combined // construct - SourceLocation DistEUBLoc = AStmt->getLocStart(); + SourceLocation DistEUBLoc = AStmt->getBeginLoc(); ExprResult IsUBGreater = SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT, UB.get(), PrevUB.get()); ExprResult CondOp = SemaRef.ActOnConditionalOp( @@ -5466,7 +5466,7 @@ for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) { if (!SectionStmt || !isa(SectionStmt)) { if (SectionStmt) - Diag(SectionStmt->getLocStart(), + Diag(SectionStmt->getBeginLoc(), diag::err_omp_sections_substmt_not_section); return StmtError(); } @@ -5474,7 +5474,7 @@ ->setHasCancel(DSAStack->isCancelRegion()); } } else { - Diag(AStmt->getLocStart(), diag::err_omp_sections_not_compound_stmt); + Diag(AStmt->getBeginLoc(), diag::err_omp_sections_not_compound_stmt); return StmtError(); } @@ -5520,9 +5520,9 @@ else if (Clause->getClauseKind() == OMPC_copyprivate) Copyprivate = Clause; if (Copyprivate && Nowait) { - Diag(Copyprivate->getLocStart(), + Diag(Copyprivate->getBeginLoc(), diag::err_omp_single_copyprivate_with_nowait); - Diag(Nowait->getLocStart(), diag::note_omp_nowait_clause_here); + Diag(Nowait->getBeginLoc(), diag::note_omp_nowait_clause_here); return StmtError(); } } @@ -5558,7 +5558,7 @@ for (const OMPClause *C : Clauses) { if (C->getClauseKind() == OMPC_hint) { if (!DirName.getName()) { - Diag(C->getLocStart(), diag::err_omp_hint_clause_no_name); + Diag(C->getBeginLoc(), diag::err_omp_hint_clause_no_name); ErrorFound = true; } Expr *E = cast(C)->getHint(); @@ -5567,7 +5567,7 @@ DependentHint = true; } else { Hint = E->EvaluateKnownConstInt(Context); - HintLoc = C->getLocStart(); + HintLoc = C->getBeginLoc(); } } } @@ -5583,12 +5583,12 @@ else Diag(StartLoc, diag::note_omp_critical_no_hint) << 0; if (const auto *C = Pair.first->getSingleClause()) { - Diag(C->getLocStart(), diag::note_omp_critical_hint_here) + Diag(C->getBeginLoc(), diag::note_omp_critical_hint_here) << 1 << C->getHint()->EvaluateKnownConstInt(Context).toString( /*Radix=*/10, /*Signed=*/false); } else { - Diag(Pair.first->getLocStart(), diag::note_omp_critical_no_hint) << 1; + Diag(Pair.first->getBeginLoc(), diag::note_omp_critical_no_hint) << 1; } } } @@ -5709,7 +5709,7 @@ for (Stmt *SectionStmt : llvm::make_range(std::next(S.begin()), S.end())) { if (!SectionStmt || !isa(SectionStmt)) { if (SectionStmt) - Diag(SectionStmt->getLocStart(), + Diag(SectionStmt->getBeginLoc(), diag::err_omp_parallel_sections_substmt_not_section); return StmtError(); } @@ -5717,7 +5717,7 @@ ->setHasCancel(DSAStack->isCancelRegion()); } } else { - Diag(AStmt->getLocStart(), + Diag(AStmt->getBeginLoc(), diag::err_omp_parallel_sections_not_compound_stmt); return StmtError(); } @@ -5801,7 +5801,7 @@ DependFound = C; if (DC->getDependencyKind() == OMPC_DEPEND_source) { if (DependSourceClause) { - Diag(C->getLocStart(), diag::err_omp_more_one_clause) + Diag(C->getBeginLoc(), diag::err_omp_more_one_clause) << getOpenMPDirectiveName(OMPD_ordered) << getOpenMPClauseName(OMPC_depend) << 2; ErrorFound = true; @@ -5809,13 +5809,13 @@ DependSourceClause = C; } if (DependSinkClause) { - Diag(C->getLocStart(), diag::err_omp_depend_sink_source_not_allowed) + Diag(C->getBeginLoc(), diag::err_omp_depend_sink_source_not_allowed) << 0; ErrorFound = true; } } else if (DC->getDependencyKind() == OMPC_DEPEND_sink) { if (DependSourceClause) { - Diag(C->getLocStart(), diag::err_omp_depend_sink_source_not_allowed) + Diag(C->getBeginLoc(), diag::err_omp_depend_sink_source_not_allowed) << 1; ErrorFound = true; } @@ -5835,19 +5835,19 @@ Diag(StartLoc, diag::err_omp_prohibited_region_simd); ErrorFound = true; } else if (DependFound && (TC || SC)) { - Diag(DependFound->getLocStart(), diag::err_omp_depend_clause_thread_simd) + Diag(DependFound->getBeginLoc(), diag::err_omp_depend_clause_thread_simd) << getOpenMPClauseName(TC ? TC->getClauseKind() : SC->getClauseKind()); ErrorFound = true; } else if (DependFound && !DSAStack->getParentOrderedRegionParam()) { - Diag(DependFound->getLocStart(), + Diag(DependFound->getBeginLoc(), diag::err_omp_ordered_directive_without_param); ErrorFound = true; } else if (TC || Clauses.empty()) { if (const Expr *Param = DSAStack->getParentOrderedRegionParam()) { - SourceLocation ErrLoc = TC ? TC->getLocStart() : StartLoc; + SourceLocation ErrLoc = TC ? TC->getBeginLoc() : StartLoc; Diag(ErrLoc, diag::err_omp_ordered_directive_with_param) << (TC != nullptr); - Diag(Param->getLocStart(), diag::note_omp_ordered_param); + Diag(Param->getBeginLoc(), diag::note_omp_ordered_param); ErrorFound = true; } } @@ -6068,12 +6068,12 @@ } } else { ErrorFound = NotAScalarType; - NoteLoc = ErrorLoc = AtomicBody->getLocStart(); + NoteLoc = ErrorLoc = AtomicBody->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } } else { ErrorFound = NotAnExpression; - NoteLoc = ErrorLoc = S->getLocStart(); + NoteLoc = ErrorLoc = S->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } if (ErrorFound != NoError && DiagId != 0 && NoteId != 0) { @@ -6125,13 +6125,13 @@ C->getClauseKind() == OMPC_update || C->getClauseKind() == OMPC_capture) { if (AtomicKind != OMPC_unknown) { - Diag(C->getLocStart(), diag::err_omp_atomic_several_clauses) - << SourceRange(C->getLocStart(), C->getLocEnd()); + Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses) + << SourceRange(C->getBeginLoc(), C->getLocEnd()); Diag(AtomicKindLoc, diag::note_omp_atomic_previous_clause) << getOpenMPClauseName(AtomicKind); } else { AtomicKind = C->getClauseKind(); - AtomicKindLoc = C->getLocStart(); + AtomicKindLoc = C->getBeginLoc(); } } } @@ -6219,7 +6219,7 @@ } } else { ErrorFound = NotAnExpression; - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } if (ErrorFound != NoError) { @@ -6281,7 +6281,7 @@ } } else { ErrorFound = NotAnExpression; - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } if (ErrorFound != NoError) { @@ -6465,7 +6465,7 @@ if (!FirstBinOp || FirstBinOp->getOpcode() != BO_Assign) { ErrorFound = NotAnAssignmentOp; NoteLoc = ErrorLoc = FirstBinOp ? FirstBinOp->getOperatorLoc() - : First->getLocStart(); + : First->getBeginLoc(); NoteRange = ErrorRange = FirstBinOp ? FirstBinOp->getSourceRange() : SourceRange(ErrorLoc, ErrorLoc); @@ -6475,7 +6475,7 @@ ErrorFound = NotAnAssignmentOp; NoteLoc = ErrorLoc = SecondBinOp ? SecondBinOp->getOperatorLoc() - : Second->getLocStart(); + : Second->getBeginLoc(); NoteRange = ErrorRange = SecondBinOp ? SecondBinOp->getSourceRange() : SourceRange(ErrorLoc, ErrorLoc); @@ -6509,15 +6509,15 @@ } } } else { - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = - SourceRange(Body->getLocStart(), Body->getLocStart()); + SourceRange(Body->getBeginLoc(), Body->getBeginLoc()); ErrorFound = NotTwoSubstatements; } } else { - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = - SourceRange(Body->getLocStart(), Body->getLocStart()); + SourceRange(Body->getBeginLoc(), Body->getBeginLoc()); ErrorFound = NotACompoundStatement; } if (ErrorFound != NoError) { @@ -6590,7 +6590,7 @@ Diag(StartLoc, diag::err_omp_target_contains_not_only_teams); Diag(DSAStack->getInnerTeamsRegionLoc(), diag::note_omp_nested_teams_construct_here); - Diag(S->getLocStart(), diag::note_omp_nested_statement_here) + Diag(S->getBeginLoc(), diag::note_omp_nested_statement_here) << isa(S); return StmtError(); } @@ -6894,11 +6894,11 @@ if (!PrevClause) PrevClause = C; else if (PrevClause->getClauseKind() != C->getClauseKind()) { - S.Diag(C->getLocStart(), + S.Diag(C->getBeginLoc(), diag::err_omp_grainsize_num_tasks_mutually_exclusive) << getOpenMPClauseName(C->getClauseKind()) << getOpenMPClauseName(PrevClause->getClauseKind()); - S.Diag(PrevClause->getLocStart(), + S.Diag(PrevClause->getBeginLoc(), diag::note_omp_previous_grainsize_num_tasks) << getOpenMPClauseName(PrevClause->getClauseKind()); ErrorFound = true; @@ -6927,8 +6927,8 @@ } } if (ReductionClause && NogroupClause) { - S.Diag(ReductionClause->getLocStart(), diag::err_omp_reduction_with_nogroup) - << SourceRange(NogroupClause->getLocStart(), + S.Diag(ReductionClause->getBeginLoc(), diag::err_omp_reduction_with_nogroup) + << SourceRange(NogroupClause->getBeginLoc(), NogroupClause->getLocEnd()); return true; } @@ -8923,7 +8923,7 @@ if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() && !ChunkSize->isInstantiationDependent() && !ChunkSize->containsUnexpandedParameterPack()) { - SourceLocation ChunkSizeLoc = ChunkSize->getLocStart(); + SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc(); ExprResult Val = PerformOpenMPImplicitIntegerConversion(ChunkSizeLoc, ChunkSize); if (Val.isInvalid()) @@ -10430,7 +10430,7 @@ } if (BOK == BO_Comma && DeclareReductionRef.isUnset()) { // Not allowed reduction identifier is found. - S.Diag(ReductionId.getLocStart(), + S.Diag(ReductionId.getBeginLoc(), diag::err_omp_unknown_reduction_identifier) << Type << ReductionIdRange; continue; @@ -10687,18 +10687,18 @@ CallExpr(Context, OVE, Args, Context.VoidTy, VK_RValue, ELoc); } else { ReductionOp = S.BuildBinOp( - Stack->getCurScope(), ReductionId.getLocStart(), BOK, LHSDRE, RHSDRE); + Stack->getCurScope(), ReductionId.getBeginLoc(), BOK, LHSDRE, RHSDRE); if (ReductionOp.isUsable()) { if (BOK != BO_LT && BOK != BO_GT) { ReductionOp = - S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(), + S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), BO_Assign, LHSDRE, ReductionOp.get()); } else { auto *ConditionalOp = new (Context) ConditionalOperator(ReductionOp.get(), ELoc, LHSDRE, ELoc, RHSDRE, Type, VK_LValue, OK_Ordinary); ReductionOp = - S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(), + S.BuildBinOp(Stack->getCurScope(), ReductionId.getBeginLoc(), BO_Assign, LHSDRE, ConditionalOp); } if (ReductionOp.isUsable()) @@ -10744,7 +10744,7 @@ EmitError = RedId != ParentRedId; } if (EmitError) { - S.Diag(ReductionId.getLocStart(), + S.Diag(ReductionId.getBeginLoc(), diag::err_omp_reduction_identifier_mismatch) << ReductionIdRange << RefExpr->getSourceRange(); S.Diag(ParentSR.getBegin(), @@ -11028,7 +11028,7 @@ if (Step && !Step->isValueDependent() && !Step->isTypeDependent() && !Step->isInstantiationDependent() && !Step->containsUnexpandedParameterPack()) { - SourceLocation StepLoc = Step->getLocStart(); + SourceLocation StepLoc = Step->getBeginLoc(); ExprResult Val = PerformOpenMPImplicitIntegerConversion(StepLoc, Step); if (Val.isInvalid()) return nullptr; @@ -11129,7 +11129,7 @@ InitExpr, IV, Step, /* Subtract */ false); else Update = *CurPrivate; - Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getLocStart(), + Update = SemaRef.ActOnFinishFullExpr(Update.get(), DE->getBeginLoc(), /*DiscardedValue=*/true); // Build final: Var = InitExpr + NumIterations * Step @@ -11140,7 +11140,7 @@ InitExpr, NumIterations, Step, /*Subtract=*/false); else Final = *CurPrivate; - Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getLocStart(), + Final = SemaRef.ActOnFinishFullExpr(Final.get(), DE->getBeginLoc(), /*DiscardedValue=*/true); if (!Update.isUsable() || !Final.isUsable()) { @@ -11293,12 +11293,12 @@ // operator for the class type. QualType ElemType = Context.getBaseElementType(Type).getNonReferenceType(); VarDecl *SrcVD = - buildVarDecl(*this, DE->getLocStart(), ElemType.getUnqualifiedType(), + buildVarDecl(*this, DE->getBeginLoc(), ElemType.getUnqualifiedType(), ".copyin.src", VD->hasAttrs() ? &VD->getAttrs() : nullptr); DeclRefExpr *PseudoSrcExpr = buildDeclRefExpr( *this, SrcVD, ElemType.getUnqualifiedType(), DE->getExprLoc()); VarDecl *DstVD = - buildVarDecl(*this, DE->getLocStart(), ElemType, ".copyin.dst", + buildVarDecl(*this, DE->getBeginLoc(), ElemType, ".copyin.dst", VD->hasAttrs() ? &VD->getAttrs() : nullptr); DeclRefExpr *PseudoDstExpr = buildDeclRefExpr(*this, DstVD, ElemType, DE->getExprLoc()); @@ -11408,11 +11408,11 @@ Type = Context.getBaseElementType(Type.getNonReferenceType()) .getUnqualifiedType(); VarDecl *SrcVD = - buildVarDecl(*this, RefExpr->getLocStart(), Type, ".copyprivate.src", + buildVarDecl(*this, RefExpr->getBeginLoc(), Type, ".copyprivate.src", D->hasAttrs() ? &D->getAttrs() : nullptr); DeclRefExpr *PseudoSrcExpr = buildDeclRefExpr(*this, SrcVD, Type, ELoc); VarDecl *DstVD = - buildVarDecl(*this, RefExpr->getLocStart(), Type, ".copyprivate.dst", + buildVarDecl(*this, RefExpr->getBeginLoc(), Type, ".copyprivate.dst", D->hasAttrs() ? &D->getAttrs() : nullptr); DeclRefExpr *PseudoDstExpr = buildDeclRefExpr(*this, DstVD, Type, ELoc); ExprResult AssignmentOp = BuildBinOp( @@ -12785,7 +12785,7 @@ if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() && !ChunkSize->isInstantiationDependent() && !ChunkSize->containsUnexpandedParameterPack()) { - SourceLocation ChunkSizeLoc = ChunkSize->getLocStart(); + SourceLocation ChunkSizeLoc = ChunkSize->getBeginLoc(); ExprResult Val = PerformOpenMPImplicitIntegerConversion(ChunkSizeLoc, ChunkSize); if (Val.isInvalid()) @@ -13012,7 +13012,7 @@ if (!D || D->isInvalidDecl()) return; SourceRange SR = E ? E->getSourceRange() : D->getSourceRange(); - SourceLocation SL = E ? E->getLocStart() : D->getLocation(); + SourceLocation SL = E ? E->getBeginLoc() : D->getLocation(); if (auto *VD = dyn_cast(D)) { // Only global variables can be marked as declare target. if (VD->isLocalVarDeclOrParm()) Index: lib/Sema/SemaOverload.cpp =================================================================== --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -1263,7 +1263,7 @@ = S.Context.getCanonicalType(ToType).getUnqualifiedType(); if (Constructor->isCopyConstructor() && (FromCanon == ToCanon || - S.IsDerivedFrom(From->getLocStart(), FromCanon, ToCanon))) { + S.IsDerivedFrom(From->getBeginLoc(), FromCanon, ToCanon))) { // Turn this into a "standard" conversion sequence, so that it // gets ranked with standard conversion sequences. DeclAccessPair Found = ICS.UserDefined.FoundConversionFunction; @@ -1355,7 +1355,7 @@ QualType FromType = From->getType(); if (ToType->getAs() && FromType->getAs() && (S.Context.hasSameUnqualifiedType(FromType, ToType) || - S.IsDerivedFrom(From->getLocStart(), FromType, ToType))) { + S.IsDerivedFrom(From->getBeginLoc(), FromType, ToType))) { ICS.setStandard(); ICS.Standard.setAsIdentityConversion(); ICS.Standard.setFromType(FromType); @@ -1418,7 +1418,7 @@ = getLangOpts().ObjCAutoRefCount && (Action == AA_Passing || Action == AA_Sending); if (getLangOpts().ObjC1) - CheckObjCBridgeRelatedConversions(From->getLocStart(), + CheckObjCBridgeRelatedConversions(From->getBeginLoc(), ToType, From->getType(), From); ICS = ::TryImplicitConversion(*this, From, ToType, /*SuppressUserConversions=*/false, @@ -2011,7 +2011,7 @@ // We have already pre-calculated the promotion type, so this is trivial. if (ToType->isIntegerType() && - isCompleteType(From->getLocStart(), FromType)) + isCompleteType(From->getBeginLoc(), FromType)) return Context.hasSameUnqualifiedType( ToType, FromEnumType->getDecl()->getPromotionType()); @@ -2356,7 +2356,7 @@ if (getLangOpts().CPlusPlus && FromPointeeType->isRecordType() && ToPointeeType->isRecordType() && !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) && - IsDerivedFrom(From->getLocStart(), FromPointeeType, ToPointeeType)) { + IsDerivedFrom(From->getBeginLoc(), FromPointeeType, ToPointeeType)) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, ToType, Context); @@ -2983,7 +2983,7 @@ QualType ToClass(ToTypePtr->getClass(), 0); if (!Context.hasSameUnqualifiedType(FromClass, ToClass) && - IsDerivedFrom(From->getLocStart(), ToClass, FromClass)) { + IsDerivedFrom(From->getBeginLoc(), ToClass, FromClass)) { ConvertedType = Context.getMemberPointerType(FromTypePtr->getPointeeType(), ToClass.getTypePtr()); return true; @@ -3027,7 +3027,7 @@ CXXBasePaths Paths(/*FindAmbiguities=*/true, /*RecordPaths=*/true, /*DetectVirtual=*/true); bool DerivationOkay = - IsDerivedFrom(From->getLocStart(), ToClass, FromClass, Paths); + IsDerivedFrom(From->getBeginLoc(), ToClass, FromClass, Paths); assert(DerivationOkay && "Should not have been called if derivation isn't OK."); (void)DerivationOkay; @@ -3242,7 +3242,7 @@ OverloadCandidateSet::iterator Best; switch (auto Result = - CandidateSet.BestViableFunction(S, From->getLocStart(), + CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) { case OR_Deleted: case OR_Success: { @@ -3308,7 +3308,7 @@ // the parentheses of the initializer. if (S.Context.hasSameUnqualifiedType(ToType, From->getType()) || (From->getType()->getAs() && - S.IsDerivedFrom(From->getLocStart(), From->getType(), ToType))) + S.IsDerivedFrom(From->getBeginLoc(), From->getType(), ToType))) ConstructorsOnly = true; if (!S.isCompleteType(From->getExprLoc(), ToType)) { @@ -3376,7 +3376,7 @@ // Enumerate conversion functions, if we're allowed to. if (ConstructorsOnly || isa(From)) { - } else if (!S.isCompleteType(From->getLocStart(), From->getType())) { + } else if (!S.isCompleteType(From->getBeginLoc(), From->getType())) { // No conversion functions from incomplete types. } else if (const RecordType *FromRecordType = From->getType()->getAs()) { @@ -3416,7 +3416,7 @@ bool HadMultipleCandidates = (CandidateSet.size() > 1); OverloadCandidateSet::iterator Best; - switch (auto Result = CandidateSet.BestViableFunction(S, From->getLocStart(), + switch (auto Result = CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) { case OR_Success: case OR_Deleted: @@ -3496,13 +3496,13 @@ IsUserDefinedConversion(*this, From, ToType, ICS.UserDefined, CandidateSet, false, false); if (OvResult == OR_Ambiguous) - Diag(From->getLocStart(), diag::err_typecheck_ambiguous_condition) + Diag(From->getBeginLoc(), diag::err_typecheck_ambiguous_condition) << From->getType() << ToType << From->getSourceRange(); else if (OvResult == OR_No_Viable_Function && !CandidateSet.empty()) { - if (!RequireCompleteType(From->getLocStart(), ToType, + if (!RequireCompleteType(From->getBeginLoc(), ToType, diag::err_typecheck_nonviable_condition_incomplete, From->getType(), From->getSourceRange())) - Diag(From->getLocStart(), diag::err_typecheck_nonviable_condition) + Diag(From->getBeginLoc(), diag::err_typecheck_nonviable_condition) << false << From->getType() << From->getSourceRange() << ToType; } else return false; @@ -4750,7 +4750,7 @@ // We need a complete type for what follows. Incomplete types can never be // initialized from init lists. - if (!S.isCompleteType(From->getLocStart(), ToType)) + if (!S.isCompleteType(From->getBeginLoc(), ToType)) return Result; // Per DR1467: @@ -4767,7 +4767,7 @@ if (ToType->isRecordType()) { QualType InitType = From->getInit(0)->getType(); if (S.Context.hasSameUnqualifiedType(InitType, ToType) || - S.IsDerivedFrom(From->getLocStart(), InitType, ToType)) + S.IsDerivedFrom(From->getBeginLoc(), InitType, ToType)) return TryCopyInitialization(S, From->getInit(0), ToType, SuppressUserConversions, InOverloadResolution, @@ -4824,7 +4824,7 @@ } // Otherwise, look for the worst conversion. if (Result.isBad() || - CompareImplicitConversionSequences(S, From->getLocStart(), ICS, + CompareImplicitConversionSequences(S, From->getBeginLoc(), ICS, Result) == ImplicitConversionSequence::Worse) Result = ICS; @@ -4921,11 +4921,11 @@ bool dummy2 = false; bool dummy3 = false; Sema::ReferenceCompareResult RefRelationship - = S.CompareReferenceRelationship(From->getLocStart(), T1, T2, dummy1, + = S.CompareReferenceRelationship(From->getBeginLoc(), T1, T2, dummy1, dummy2, dummy3); if (RefRelationship >= Sema::Ref_Related) { - return TryReferenceInit(S, Init, ToType, /*FIXME*/From->getLocStart(), + return TryReferenceInit(S, Init, ToType, /*FIXME*/From->getBeginLoc(), SuppressUserConversions, /*AllowExplicit=*/false); } @@ -5006,7 +5006,7 @@ if (ToType->isReferenceType()) return TryReferenceInit(S, From, ToType, - /*FIXME:*/From->getLocStart(), + /*FIXME:*/From->getBeginLoc(), SuppressUserConversions, AllowExplicit); @@ -5177,7 +5177,7 @@ // Note that we always use the true parent context when performing // the actual argument initialization. ImplicitConversionSequence ICS = TryObjectArgumentInitialization( - *this, From->getLocStart(), From->getType(), FromClassification, Method, + *this, From->getBeginLoc(), From->getType(), FromClassification, Method, Method->getParent()); if (ICS.isBad()) { switch (ICS.Bad.Kind) { @@ -5186,7 +5186,7 @@ Qualifiers ToQs = DestType.getQualifiers(); unsigned CVR = FromQs.getCVRQualifiers() & ~ToQs.getCVRQualifiers(); if (CVR) { - Diag(From->getLocStart(), + Diag(From->getBeginLoc(), diag::err_member_function_call_bad_cvr) << Method->getDeclName() << FromRecordType << (CVR - 1) << From->getSourceRange(); @@ -5201,7 +5201,7 @@ case BadConversionSequence::rvalue_ref_to_lvalue: { bool IsRValueQualified = Method->getRefQualifier() == RefQualifierKind::RQ_RValue; - Diag(From->getLocStart(), diag::err_member_function_call_bad_ref) + Diag(From->getBeginLoc(), diag::err_member_function_call_bad_ref) << Method->getDeclName() << FromClassification.isRValue() << IsRValueQualified; Diag(Method->getLocation(), diag::note_previous_decl) @@ -5214,7 +5214,7 @@ break; } - return Diag(From->getLocStart(), + return Diag(From->getBeginLoc(), diag::err_member_function_call_bad_type) << ImplicitParamRecordType << FromRecordType << From->getSourceRange(); } @@ -5257,7 +5257,7 @@ return PerformImplicitConversion(From, Context.BoolTy, ICS, AA_Converting); if (!DiagnoseMultipleUserDefinedConversion(From, Context.BoolTy)) - return Diag(From->getLocStart(), + return Diag(From->getBeginLoc(), diag::err_typecheck_bool_condition) << From->getType() << From->getSourceRange(); return ExprError(); @@ -5372,7 +5372,7 @@ case ImplicitConversionSequence::AmbiguousConversion: case ImplicitConversionSequence::BadConversion: if (!S.DiagnoseMultipleUserDefinedConversion(From, T)) - return S.Diag(From->getLocStart(), + return S.Diag(From->getBeginLoc(), diag::err_typecheck_converted_constant_expression) << From->getType() << From->getSourceRange() << T; return ExprError(); @@ -5383,13 +5383,13 @@ // Check that we would only use permitted conversions. if (!CheckConvertedConstantConversions(S, *SCS)) { - return S.Diag(From->getLocStart(), + return S.Diag(From->getBeginLoc(), diag::err_typecheck_converted_constant_expression_disallowed) << From->getType() << From->getSourceRange() << T; } // [...] and where the reference binding (if any) binds directly. if (SCS->ReferenceBinding && !SCS->DirectBinding) { - return S.Diag(From->getLocStart(), + return S.Diag(From->getBeginLoc(), diag::err_typecheck_converted_constant_expression_indirect) << From->getType() << From->getSourceRange() << T; } @@ -5414,13 +5414,13 @@ break; case NK_Constant_Narrowing: - S.Diag(From->getLocStart(), diag::ext_cce_narrowing) + S.Diag(From->getBeginLoc(), diag::ext_cce_narrowing) << CCE << /*Constant*/1 << PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << T; break; case NK_Type_Narrowing: - S.Diag(From->getLocStart(), diag::ext_cce_narrowing) + S.Diag(From->getBeginLoc(), diag::ext_cce_narrowing) << CCE << /*Constant*/0 << From->getType() << T; break; } @@ -5457,7 +5457,7 @@ Notes[0].second.getDiagID() == diag::note_invalid_subexpr_in_const_expr) S.Diag(Notes[0].first, diag::err_expr_not_cce) << CCE; else { - S.Diag(From->getLocStart(), diag::err_expr_not_cce) + S.Diag(From->getBeginLoc(), diag::err_expr_not_cce) << CCE << From->getSourceRange(); for (unsigned I = 0; I < Notes.size(); ++I) S.Diag(Notes[I].first, Notes[I].second); @@ -5586,7 +5586,7 @@ ConvTy.getAsStringInternal(TypeStr, SemaRef.getPrintingPolicy()); Converter.diagnoseExplicitConv(SemaRef, Loc, T, ConvTy) - << FixItHint::CreateInsertion(From->getLocStart(), + << FixItHint::CreateInsertion(From->getBeginLoc(), "static_cast<" + TypeStr + ">(") << FixItHint::CreateInsertion( SemaRef.getLocForEndOfToken(From->getLocEnd()), ")"); @@ -6009,7 +6009,7 @@ QualType ClassType = Context.getTypeDeclType(Constructor->getParent()); if (Args.size() == 1 && Constructor->isSpecializationCopyingObject() && (Context.hasSameUnqualifiedType(ClassType, Args[0]->getType()) || - IsDerivedFrom(Args[0]->getLocStart(), Args[0]->getType(), + IsDerivedFrom(Args[0]->getBeginLoc(), Args[0]->getType(), ClassType))) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_illegal_constructor; @@ -6967,14 +6967,14 @@ // call on the stack and we don't need its arguments to be // well-formed. DeclRefExpr ConversionRef(Conversion, false, Conversion->getType(), - VK_LValue, From->getLocStart()); + VK_LValue, From->getBeginLoc()); ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack, Context.getPointerType(Conversion->getType()), CK_FunctionToPointerDecay, &ConversionRef, VK_RValue); QualType ConversionType = Conversion->getConversionType(); - if (!isCompleteType(From->getLocStart(), ConversionType)) { + if (!isCompleteType(From->getBeginLoc(), ConversionType)) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_final_conversion; return; @@ -6987,7 +6987,7 @@ // allocator). QualType CallResultType = ConversionType.getNonLValueExprType(Context); CallExpr Call(Context, &ConversionFn, None, CallResultType, VK, - From->getLocStart()); + From->getBeginLoc()); ImplicitConversionSequence ICS = TryCopyInitialization(*this, &Call, ToType, /*SuppressUserConversions=*/true, @@ -9506,7 +9506,7 @@ if (!isFunctionAlwaysEnabled(S.Context, FD)) { if (Complain) { if (InOverloadResolution) - S.Diag(FD->getLocStart(), + S.Diag(FD->getBeginLoc(), diag::note_addrof_ovl_candidate_disabled_by_enable_if_attr); else S.Diag(Loc, diag::err_addrof_function_disabled_by_enable_if_attr) << FD; @@ -11114,7 +11114,7 @@ // If any candidate has a placeholder return type, trigger its deduction // now. - if (completeFunctionType(S, FunDecl, SourceExpr->getLocStart(), + if (completeFunctionType(S, FunDecl, SourceExpr->getBeginLoc(), Complain)) { HasComplained |= Complain; return false; @@ -11190,7 +11190,7 @@ // here, since the no_viable diagnostic has index 0. UnresolvedSetIterator Result = S.getMostSpecialized( MatchesCopy.begin(), MatchesCopy.end(), FailedCandidates, - SourceExpr->getLocStart(), S.PDiag(), + SourceExpr->getBeginLoc(), S.PDiag(), S.PDiag(diag::err_addr_ovl_ambiguous) << Matches[0].second->getDeclName(), S.PDiag(diag::note_ovl_candidate) @@ -11226,7 +11226,7 @@ public: void ComplainNoMatchesFound() const { assert(Matches.empty()); - S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_no_viable) + S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_no_viable) << OvlExpr->getName() << TargetFunctionType << OvlExpr->getSourceRange(); if (FailedCandidates.empty()) @@ -11244,7 +11244,7 @@ if (!functionHasPassObjectSizeParams(Fun)) S.NoteOverloadCandidate(*I, Fun, TargetFunctionType, /*TakingAddress=*/true); - FailedCandidates.NoteCandidates(S, OvlExpr->getLocStart()); + FailedCandidates.NoteCandidates(S, OvlExpr->getBeginLoc()); } } @@ -11266,19 +11266,19 @@ } void ComplainIsStaticMemberFunctionFromBoundPointer() const { - S.Diag(OvlExpr->getLocStart(), + S.Diag(OvlExpr->getBeginLoc(), diag::err_invalid_form_pointer_member_function) << OvlExpr->getSourceRange(); } void ComplainOfInvalidConversion() const { - S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_not_func_ptrref) + S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_not_func_ptrref) << OvlExpr->getName() << TargetType; } void ComplainMultipleMatchesFound() const { assert(Matches.size() > 1); - S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_ambiguous) + S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_ambiguous) << OvlExpr->getName() << OvlExpr->getSourceRange(); S.NoteAllOverloadCandidates(OvlExpr, TargetFunctionType, @@ -11530,7 +11530,7 @@ ExprResult SingleFunctionExpression; if (FunctionDecl *fn = ResolveSingleFunctionTemplateSpecialization( ovl.Expression, /*complain*/ false, &found)) { - if (DiagnoseUseOfDecl(fn, SrcExpr.get()->getLocStart())) { + if (DiagnoseUseOfDecl(fn, SrcExpr.get()->getBeginLoc())) { SrcExpr = ExprError(); return true; } @@ -11966,7 +11966,7 @@ OverloadCandidateSet::iterator Best; if (CandidateSet->empty() || - CandidateSet->BestViableFunction(*this, Fn->getLocStart(), Best) == + CandidateSet->BestViableFunction(*this, Fn->getBeginLoc(), Best) == OR_No_Viable_Function) { // In Microsoft mode, if we are inside a template class member function then // create a type dependent CallExpr. The goal is to postpone name lookup @@ -12043,20 +12043,20 @@ } } - SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_no_viable_function_in_call) + SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_no_viable_function_in_call) << ULE->getName() << Fn->getSourceRange(); CandidateSet->NoteCandidates(SemaRef, OCD_AllCandidates, Args); break; } case OR_Ambiguous: - SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_ambiguous_call) + SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_ambiguous_call) << ULE->getName() << Fn->getSourceRange(); CandidateSet->NoteCandidates(SemaRef, OCD_ViableCandidates, Args); break; case OR_Deleted: { - SemaRef.Diag(Fn->getLocStart(), diag::err_ovl_deleted_call) + SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_deleted_call) << (*Best)->Function->isDeleted() << ULE->getName() << SemaRef.getDeletedOrUnavailableSuffix((*Best)->Function) @@ -12116,7 +12116,7 @@ OverloadCandidateSet::iterator Best; OverloadingResult OverloadResult = - CandidateSet.BestViableFunction(*this, Fn->getLocStart(), Best); + CandidateSet.BestViableFunction(*this, Fn->getBeginLoc(), Best); return FinishOverloadedCallExpr(*this, S, Fn, ULE, LParenLoc, Args, RParenLoc, ExecConfig, &CandidateSet, @@ -12841,7 +12841,7 @@ = new (Context) CXXMemberCallExpr(Context, MemExprE, Args, resultType, valueKind, RParenLoc); - if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(), + if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getBeginLoc(), call, nullptr)) return ExprError(); @@ -12927,7 +12927,7 @@ UnbridgedCasts.restore(); OverloadCandidateSet::iterator Best; - switch (CandidateSet.BestViableFunction(*this, UnresExpr->getLocStart(), + switch (CandidateSet.BestViableFunction(*this, UnresExpr->getBeginLoc(), Best)) { case OR_Success: Method = cast(Best->Function); @@ -13044,14 +13044,14 @@ if (isa(MemExpr->getBase()->IgnoreParenCasts()) && MemExpr->performsVirtualDispatch(getLangOpts())) { - Diag(MemExpr->getLocStart(), + Diag(MemExpr->getBeginLoc(), diag::warn_call_to_pure_virtual_member_function_from_ctor_dtor) << MD->getDeclName() << isa(CurContext) << MD->getParent()->getDeclName(); - Diag(MD->getLocStart(), diag::note_previous_decl) << MD->getDeclName(); + Diag(MD->getBeginLoc(), diag::note_previous_decl) << MD->getDeclName(); if (getLangOpts().AppleKext) - Diag(MemExpr->getLocStart(), + Diag(MemExpr->getBeginLoc(), diag::note_pure_qualified_call_kext) << MD->getParent()->getDeclName() << MD->getDeclName(); @@ -13062,7 +13062,7 @@ dyn_cast(TheCall->getMethodDecl())) { // a->A::f() doesn't go through the vtable, except in AppleKext mode. bool CallCanBeVirtual = !MemExpr->hasQualifier() || getLangOpts().AppleKext; - CheckVirtualDtorCall(DD, MemExpr->getLocStart(), /*IsDelete=*/false, + CheckVirtualDtorCall(DD, MemExpr->getBeginLoc(), /*IsDelete=*/false, CallCanBeVirtual, /*WarnOnNonAbstractTypes=*/true, MemExpr->getMemberLoc()); } @@ -13167,7 +13167,7 @@ // Perform overload resolution. OverloadCandidateSet::iterator Best; - switch (CandidateSet.BestViableFunction(*this, Object.get()->getLocStart(), + switch (CandidateSet.BestViableFunction(*this, Object.get()->getBeginLoc(), Best)) { case OR_Success: // Overload resolution succeeded; we'll build the appropriate call @@ -13176,25 +13176,25 @@ case OR_No_Viable_Function: if (CandidateSet.empty()) - Diag(Object.get()->getLocStart(), diag::err_ovl_no_oper) + Diag(Object.get()->getBeginLoc(), diag::err_ovl_no_oper) << Object.get()->getType() << /*call*/ 1 << Object.get()->getSourceRange(); else - Diag(Object.get()->getLocStart(), + Diag(Object.get()->getBeginLoc(), diag::err_ovl_no_viable_object_call) << Object.get()->getType() << Object.get()->getSourceRange(); CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args); break; case OR_Ambiguous: - Diag(Object.get()->getLocStart(), + Diag(Object.get()->getBeginLoc(), diag::err_ovl_ambiguous_object_call) << Object.get()->getType() << Object.get()->getSourceRange(); CandidateSet.NoteCandidates(*this, OCD_ViableCandidates, Args); break; case OR_Deleted: - Diag(Object.get()->getLocStart(), + Diag(Object.get()->getBeginLoc(), diag::err_ovl_deleted_object_call) << Best->Function->isDeleted() << Object.get()->getType() @@ -13596,7 +13596,7 @@ } OverloadCandidateSet::iterator Best; OverloadingResult OverloadResult = - CandidateSet->BestViableFunction(*this, Fn->getLocStart(), Best); + CandidateSet->BestViableFunction(*this, Fn->getBeginLoc(), Best); if (OverloadResult == OR_No_Viable_Function) { *CallExpr = ExprError(); Index: lib/Sema/SemaPseudoObject.cpp =================================================================== --- lib/Sema/SemaPseudoObject.cpp +++ lib/Sema/SemaPseudoObject.cpp @@ -977,7 +977,7 @@ ExprResult ObjCPropertyOpBuilder::complete(Expr *SyntacticForm) { if (isWeakProperty() && !S.isUnevaluatedContext() && !S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, - SyntacticForm->getLocStart())) + SyntacticForm->getBeginLoc())) S.getCurFunction()->recordUseOfWeak(SyntacticRefExpr, SyntacticRefExpr->isMessagingGetter()); Index: lib/Sema/SemaStmt.cpp =================================================================== --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -918,7 +918,7 @@ // Check the unconverted value is within the range of possible values of // the switch expression. - checkCaseValue(*this, Lo->getLocStart(), LoVal, + checkCaseValue(*this, Lo->getBeginLoc(), LoVal, CondWidthBeforePromotion, CondIsSignedBeforePromotion); // FIXME: This duplicates the check performed for warn_not_in_enum below. @@ -979,17 +979,17 @@ CaseVals[i-1].first.toString(CaseValStr); if (PrevString == CurrString) - Diag(CaseVals[i].second->getLHS()->getLocStart(), + Diag(CaseVals[i].second->getLHS()->getBeginLoc(), diag::err_duplicate_case) << (PrevString.empty() ? StringRef(CaseValStr) : PrevString); else - Diag(CaseVals[i].second->getLHS()->getLocStart(), + Diag(CaseVals[i].second->getLHS()->getBeginLoc(), diag::err_duplicate_case_differing_expr) << (PrevString.empty() ? StringRef(CaseValStr) : PrevString) << (CurrString.empty() ? StringRef(CaseValStr) : CurrString) << CaseValStr; - Diag(CaseVals[i-1].second->getLHS()->getLocStart(), + Diag(CaseVals[i-1].second->getLHS()->getBeginLoc(), diag::note_duplicate_case_prev); // FIXME: We really want to remove the bogus case stmt from the // substmt, but we have no way to do this right now. @@ -1018,7 +1018,7 @@ // Check the unconverted value is within the range of possible values of // the switch expression. - checkCaseValue(*this, Hi->getLocStart(), HiVal, + checkCaseValue(*this, Hi->getBeginLoc(), HiVal, CondWidthBeforePromotion, CondIsSignedBeforePromotion); // Convert the value to the same width/sign as the condition. @@ -1026,8 +1026,8 @@ // If the low value is bigger than the high value, the case is empty. if (LoVal > HiVal) { - Diag(CR->getLHS()->getLocStart(), diag::warn_case_empty_range) - << SourceRange(CR->getLHS()->getLocStart(), + Diag(CR->getLHS()->getBeginLoc(), diag::warn_case_empty_range) + << SourceRange(CR->getLHS()->getBeginLoc(), Hi->getLocEnd()); CaseRanges.erase(CaseRanges.begin()+i); --i; @@ -1082,9 +1082,9 @@ if (OverlapStmt) { // If we have a duplicate, report it. - Diag(CR->getLHS()->getLocStart(), diag::err_duplicate_case) + Diag(CR->getLHS()->getBeginLoc(), diag::err_duplicate_case) << OverlapVal.toString(10); - Diag(OverlapStmt->getLHS()->getLocStart(), + Diag(OverlapStmt->getLHS()->getBeginLoc(), diag::note_duplicate_case_prev); // FIXME: We really want to remove the bogus case stmt from the // substmt, but we have no way to do this right now. @@ -1492,7 +1492,7 @@ if (!Second) return; if (S.Diags.isIgnored(diag::warn_variables_not_in_loop_body, - Second->getLocStart())) + Second->getBeginLoc())) return; PartialDiagnostic PDiag = S.PDiag(diag::warn_variables_not_in_loop_body); @@ -1668,7 +1668,7 @@ if (!Body || !Third) return; if (S.Diags.isIgnored(diag::warn_redundant_loop_iteration, - Third->getLocStart())) + Third->getBeginLoc())) return; // Get the last statement from the loop body. @@ -1914,7 +1914,7 @@ } else { Expr *FirstE = cast(First); if (!FirstE->isTypeDependent() && !FirstE->isLValue()) - return StmtError(Diag(First->getLocStart(), + return StmtError(Diag(First->getBeginLoc(), diag::err_selector_element_not_lvalue) << First->getSourceRange()); @@ -2087,7 +2087,7 @@ // Build auto && __range = range-init // Divide by 2, since the variables are in the inner scope (loop body). const auto DepthStr = std::to_string(S->getDepth() / 2); - SourceLocation RangeLoc = Range->getLocStart(); + SourceLocation RangeLoc = Range->getBeginLoc(); VarDecl *RangeVar = BuildForRangeVarDecl(*this, RangeLoc, Context.getAutoRRefDeductType(), std::string("__range") + DepthStr); @@ -2169,7 +2169,7 @@ if (RangeStatus != Sema::FRS_Success) { if (RangeStatus == Sema::FRS_DiagnosticIssued) - SemaRef.Diag(BeginRange->getLocStart(), diag::note_in_for_range) + SemaRef.Diag(BeginRange->getBeginLoc(), diag::note_in_for_range) << ColonLoc << BEF_begin << BeginRange->getType(); return RangeStatus; } @@ -2195,7 +2195,7 @@ EndRange, EndExpr); if (RangeStatus != Sema::FRS_Success) { if (RangeStatus == Sema::FRS_DiagnosticIssued) - SemaRef.Diag(EndRange->getLocStart(), diag::note_in_for_range) + SemaRef.Diag(EndRange->getBeginLoc(), diag::note_in_for_range) << ColonLoc << BEF_end << EndRange->getType(); return RangeStatus; } @@ -2451,7 +2451,7 @@ QualType ArrayTy = PVD->getOriginalType(); QualType PointerTy = PVD->getType(); if (PointerTy->isPointerType() && ArrayTy->isArrayType()) { - Diag(Range->getLocStart(), diag::err_range_on_array_parameter) + Diag(Range->getBeginLoc(), diag::err_range_on_array_parameter) << RangeLoc << PVD << ArrayTy << PointerTy; Diag(PVD->getLocation(), diag::note_declared_at); return StmtError(); @@ -2473,7 +2473,7 @@ // Otherwise, emit diagnostics if we haven't already. if (RangeStatus == FRS_NoViableFunction) { Expr *Range = BEFFailure ? EndRangeRef.get() : BeginRangeRef.get(); - Diag(Range->getLocStart(), diag::err_for_range_invalid) + Diag(Range->getBeginLoc(), diag::err_for_range_invalid) << RangeLoc << Range->getType() << BEFFailure; CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Range); } @@ -2660,7 +2660,7 @@ NonReferenceType.removeLocalConst(); QualType NewReferenceType = SemaRef.Context.getLValueReferenceType(E->getType().withConst()); - SemaRef.Diag(VD->getLocStart(), diag::note_use_type_or_non_reference) + SemaRef.Diag(VD->getBeginLoc(), diag::note_use_type_or_non_reference) << NonReferenceType << NewReferenceType << VD->getSourceRange(); } else { // The range always returns a copy, so a temporary is always created. @@ -2669,7 +2669,7 @@ << VD << RangeInitType; QualType NonReferenceType = VariableType.getNonReferenceType(); NonReferenceType.removeLocalConst(); - SemaRef.Diag(VD->getLocStart(), diag::note_use_non_reference_type) + SemaRef.Diag(VD->getBeginLoc(), diag::note_use_non_reference_type) << NonReferenceType << VD->getSourceRange(); } } @@ -2705,7 +2705,7 @@ // if doing so will prevent a copy. SemaRef.Diag(VD->getLocation(), diag::warn_for_range_copy) << VD << VariableType << InitExpr->getType(); - SemaRef.Diag(VD->getLocStart(), diag::note_use_reference_type) + SemaRef.Diag(VD->getBeginLoc(), diag::note_use_reference_type) << SemaRef.Context.getLValueReferenceType(VariableType) << VD->getSourceRange(); } @@ -2721,11 +2721,11 @@ static void DiagnoseForRangeVariableCopies(Sema &SemaRef, const CXXForRangeStmt *ForStmt) { if (SemaRef.Diags.isIgnored(diag::warn_for_range_const_reference_copy, - ForStmt->getLocStart()) && + ForStmt->getBeginLoc()) && SemaRef.Diags.isIgnored(diag::warn_for_range_variable_always_copy, - ForStmt->getLocStart()) && + ForStmt->getBeginLoc()) && SemaRef.Diags.isIgnored(diag::warn_for_range_copy, - ForStmt->getLocStart())) { + ForStmt->getBeginLoc())) { return; } @@ -2951,7 +2951,7 @@ Expr *InitExpr = &AsRvalue; InitializationKind Kind = InitializationKind::CreateCopy( - Value->getLocStart(), Value->getLocStart()); + Value->getBeginLoc(), Value->getBeginLoc()); InitializationSequence Seq(S, Entity, Kind, InitExpr); @@ -3969,7 +3969,7 @@ // declarations that are invalid, since we can't usefully report on them. if (!H->getExceptionDecl()) { if (i < NumHandlers - 1) - return StmtError(Diag(H->getLocStart(), diag::err_early_catch_all)); + return StmtError(Diag(H->getBeginLoc(), diag::err_early_catch_all)); continue; } else if (H->getExceptionDecl()->isInvalidDecl()) continue; Index: lib/Sema/SemaStmtAsm.cpp =================================================================== --- lib/Sema/SemaStmtAsm.cpp +++ lib/Sema/SemaStmtAsm.cpp @@ -47,10 +47,10 @@ const Expr *E2 = E->IgnoreParenNoopCasts(S.Context); if (E != E2 && E2->isLValue()) { if (!S.getLangOpts().HeinousExtensions) - S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue) + S.Diag(E2->getBeginLoc(), diag::err_invalid_asm_cast_lvalue) << E->getSourceRange(); else - S.Diag(E2->getLocStart(), diag::warn_invalid_asm_cast_lvalue) + S.Diag(E2->getBeginLoc(), diag::warn_invalid_asm_cast_lvalue) << E->getSourceRange(); // Accept, even if we emitted an error diagnostic. return false; @@ -90,13 +90,13 @@ while (WorkList.size()) { Expr *E = WorkList.pop_back_val(); if (isa(E)) { - S.Diag(E->getLocStart(), diag::err_asm_naked_this_ref); + S.Diag(E->getBeginLoc(), diag::err_asm_naked_this_ref); S.Diag(Func->getAttr()->getLocation(), diag::note_attribute); return true; } if (DeclRefExpr *DRE = dyn_cast(E)) { if (isa(DRE->getDecl())) { - S.Diag(DRE->getLocStart(), diag::err_asm_naked_parm_ref); + S.Diag(DRE->getBeginLoc(), diag::err_asm_naked_parm_ref); S.Diag(Func->getAttr()->getLocation(), diag::note_attribute); return true; } @@ -131,7 +131,7 @@ EType = ExprGlobalRegVar; if (EType != ExprSafeType) { - S.Diag(E->getLocStart(), diag::err_asm_non_addr_value_in_memory_constraint) + S.Diag(E->getBeginLoc(), diag::err_asm_non_addr_value_in_memory_constraint) << EType << is_input_expr << Info.getConstraintStr() << E->getSourceRange(); return true; @@ -185,7 +185,7 @@ Clobber = Target.getNormalizedGCCRegisterName(Clobber, true); // Go over the output's registers we collected if (InOutVars.count(Clobber)) - return Clobbers[i]->getLocStart(); + return Clobbers[i]->getBeginLoc(); } return SourceLocation(); } @@ -226,7 +226,7 @@ TargetInfo::ConstraintInfo Info(Literal->getString(), OutputName); if (!Context.getTargetInfo().validateOutputConstraint(Info)) - return StmtError(Diag(Literal->getLocStart(), + return StmtError(Diag(Literal->getBeginLoc(), diag::err_asm_invalid_output_constraint) << Info.getConstraintStr()); @@ -265,10 +265,10 @@ case Expr::MLV_LValueCast: { const Expr *LVal = OutputExpr->IgnoreParenNoopCasts(Context); if (!getLangOpts().HeinousExtensions) { - Diag(LVal->getLocStart(), diag::err_invalid_asm_cast_lvalue) + Diag(LVal->getBeginLoc(), diag::err_invalid_asm_cast_lvalue) << OutputExpr->getSourceRange(); } else { - Diag(LVal->getLocStart(), diag::warn_invalid_asm_cast_lvalue) + Diag(LVal->getBeginLoc(), diag::warn_invalid_asm_cast_lvalue) << OutputExpr->getSourceRange(); } // Accept, even if we emitted an error diagnostic. @@ -276,12 +276,12 @@ } case Expr::MLV_IncompleteType: case Expr::MLV_IncompleteVoidType: - if (RequireCompleteType(OutputExpr->getLocStart(), Exprs[i]->getType(), + if (RequireCompleteType(OutputExpr->getBeginLoc(), Exprs[i]->getType(), diag::err_dereference_incomplete_type)) return StmtError(); LLVM_FALLTHROUGH; default: - return StmtError(Diag(OutputExpr->getLocStart(), + return StmtError(Diag(OutputExpr->getBeginLoc(), diag::err_asm_invalid_lvalue_in_output) << OutputExpr->getSourceRange()); } @@ -289,7 +289,7 @@ unsigned Size = Context.getTypeSize(OutputExpr->getType()); if (!Context.getTargetInfo().validateOutputSize(Literal->getString(), Size)) - return StmtError(Diag(OutputExpr->getLocStart(), + return StmtError(Diag(OutputExpr->getBeginLoc(), diag::err_asm_invalid_output_size) << Info.getConstraintStr()); } @@ -307,7 +307,7 @@ TargetInfo::ConstraintInfo Info(Literal->getString(), InputName); if (!Context.getTargetInfo().validateInputConstraint(OutputConstraintInfos, Info)) { - return StmtError(Diag(Literal->getLocStart(), + return StmtError(Diag(Literal->getBeginLoc(), diag::err_asm_invalid_input_constraint) << Info.getConstraintStr()); } @@ -331,7 +331,7 @@ // Only allow void types for memory constraints. if (Info.allowsMemory() && !Info.allowsRegister()) { if (CheckAsmLValue(InputExpr, *this)) - return StmtError(Diag(InputExpr->getLocStart(), + return StmtError(Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_lvalue_in_input) << Info.getConstraintStr() << InputExpr->getSourceRange()); @@ -340,10 +340,10 @@ llvm::APSInt Result; if (!InputExpr->EvaluateAsInt(Result, Context)) return StmtError( - Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) + Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected) << Info.getConstraintStr() << InputExpr->getSourceRange()); if (!Info.isValidAsmImmediate(Result)) - return StmtError(Diag(InputExpr->getLocStart(), + return StmtError(Diag(InputExpr->getBeginLoc(), diag::err_invalid_asm_value_for_constraint) << Result.toString(10) << Info.getConstraintStr() << InputExpr->getSourceRange()); @@ -359,7 +359,7 @@ if (Info.allowsRegister()) { if (InputExpr->getType()->isVoidType()) { - return StmtError(Diag(InputExpr->getLocStart(), + return StmtError(Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_type_in_input) << InputExpr->getType() << Info.getConstraintStr() << InputExpr->getSourceRange()); @@ -373,14 +373,14 @@ continue; if (!Ty->isVoidType() || !Info.allowsMemory()) - if (RequireCompleteType(InputExpr->getLocStart(), Exprs[i]->getType(), + if (RequireCompleteType(InputExpr->getBeginLoc(), Exprs[i]->getType(), diag::err_dereference_incomplete_type)) return StmtError(); unsigned Size = Context.getTypeSize(Ty); if (!Context.getTargetInfo().validateInputSize(Literal->getString(), Size)) - return StmtError(Diag(InputExpr->getLocStart(), + return StmtError(Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_input_size) << Info.getConstraintStr()); } @@ -393,7 +393,7 @@ StringRef Clobber = Literal->getString(); if (!Context.getTargetInfo().isValidClobber(Clobber)) - return StmtError(Diag(Literal->getLocStart(), + return StmtError(Diag(Literal->getBeginLoc(), diag::err_asm_unknown_register_name) << Clobber); } @@ -446,7 +446,7 @@ if (!Context.getTargetInfo().validateConstraintModifier( Literal->getString(), Piece.getModifier(), Size, SuggestedModifier)) { - Diag(Exprs[ConstraintIdx]->getLocStart(), + Diag(Exprs[ConstraintIdx]->getBeginLoc(), diag::warn_asm_mismatched_size_modifier); if (!SuggestedModifier.empty()) { @@ -469,7 +469,7 @@ if (NumAlternatives == ~0U) NumAlternatives = AltCount; else if (NumAlternatives != AltCount) - return StmtError(Diag(NS->getOutputExpr(i)->getLocStart(), + return StmtError(Diag(NS->getOutputExpr(i)->getBeginLoc(), diag::err_asm_unexpected_constraint_alternatives) << NumAlternatives << AltCount); } @@ -482,7 +482,7 @@ if (NumAlternatives == ~0U) NumAlternatives = AltCount; else if (NumAlternatives != AltCount) - return StmtError(Diag(NS->getInputExpr(i)->getLocStart(), + return StmtError(Diag(NS->getInputExpr(i)->getBeginLoc(), diag::err_asm_unexpected_constraint_alternatives) << NumAlternatives << AltCount); @@ -499,10 +499,10 @@ // Make sure no more than one input constraint matches each output. assert(TiedTo < InputMatchedToOutput.size() && "TiedTo value out of range"); if (InputMatchedToOutput[TiedTo] != ~0U) { - Diag(NS->getInputExpr(i)->getLocStart(), + Diag(NS->getInputExpr(i)->getBeginLoc(), diag::err_asm_input_duplicate_match) << TiedTo; - Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getLocStart(), + Diag(NS->getInputExpr(InputMatchedToOutput[TiedTo])->getBeginLoc(), diag::note_asm_input_duplicate_first) << TiedTo; return StmtError(); @@ -590,7 +590,7 @@ continue; } - Diag(InputExpr->getLocStart(), + Diag(InputExpr->getBeginLoc(), diag::err_asm_tying_incompatible_types) << InTy << OutTy << OutputExpr->getSourceRange() << InputExpr->getSourceRange(); Index: lib/Sema/SemaStmtAttr.cpp =================================================================== --- lib/Sema/SemaStmtAttr.cpp +++ lib/Sema/SemaStmtAttr.cpp @@ -29,7 +29,7 @@ A.getAttributeSpellingListIndex()); if (!isa(St)) { S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_wrong_target) - << Attr.getSpelling() << St->getLocStart(); + << Attr.getSpelling() << St->getBeginLoc(); if (isa(St)) { SourceLocation L = S.getLocForEndOfToken(Range.getEnd()); S.Diag(L, diag::note_fallthrough_insert_semi_fixit) @@ -96,7 +96,7 @@ .Case("unroll", "#pragma unroll") .Case("nounroll", "#pragma nounroll") .Default("#pragma clang loop"); - S.Diag(St->getLocStart(), diag::err_pragma_loop_precedes_nonloop) << Pragma; + S.Diag(St->getBeginLoc(), diag::err_pragma_loop_precedes_nonloop) << Pragma; return nullptr; } @@ -136,7 +136,7 @@ Option == LoopHintAttr::InterleaveCount || Option == LoopHintAttr::UnrollCount) { assert(ValueExpr && "Attribute must have a valid value expression."); - if (S.CheckLoopHintExpr(ValueExpr, St->getLocStart())) + if (S.CheckLoopHintExpr(ValueExpr, St->getBeginLoc())) return nullptr; State = LoopHintAttr::Numeric; } else if (Option == LoopHintAttr::Vectorize || @@ -308,7 +308,7 @@ // if we're here, then we parsed a known attribute, but didn't recognize // it as a statement attribute => it is declaration attribute S.Diag(A.getRange().getBegin(), diag::err_decl_attribute_invalid_on_stmt) - << A.getName() << St->getLocStart(); + << A.getName() << St->getBeginLoc(); return nullptr; } } Index: lib/Sema/SemaTemplate.cpp =================================================================== --- lib/Sema/SemaTemplate.cpp +++ lib/Sema/SemaTemplate.cpp @@ -194,7 +194,7 @@ QualType ObjectType = ObjectTypePtr.get(); - LookupResult R(*this, TName, Name.getLocStart(), LookupOrdinaryName); + LookupResult R(*this, TName, Name.getBeginLoc(), LookupOrdinaryName); if (LookupTemplateName(R, S, SS, ObjectType, EnteringContext, MemberOfUnknownSpecialization)) return TNK_Non_template; @@ -539,7 +539,7 @@ // If this is a dependent-scope lookup, diagnose that the 'template' keyword // was missing. if (MissingTemplateKeyword) { - Diag(NameInfo.getLocStart(), diag::err_template_kw_missing) + Diag(NameInfo.getBeginLoc(), diag::err_template_kw_missing) << "" << NameInfo.getName().getAsString() << SourceRange(Less, Greater); return; @@ -892,7 +892,7 @@ // convertTypeTemplateArgumentToTemplate. return ParsedTemplateArgument(ParsedTemplateArgument::Type, ParsedType.get().getAsOpaquePtr(), - TInfo->getTypeLoc().getLocStart()); + TInfo->getTypeLoc().getBeginLoc()); } /// ActOnTypeParameter - Called when a C++ template type parameter @@ -1115,7 +1115,7 @@ bool IsParameterPack = D.hasEllipsis(); NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create(Context, Context.getTranslationUnitDecl(), - D.getLocStart(), + D.getBeginLoc(), D.getIdentifierLoc(), Depth, Position, ParamName, T, IsParameterPack, TInfo); @@ -1459,9 +1459,9 @@ }(); if (RedeclACMismatch) { - Diag(CurAC ? CurAC->getLocStart() : NameLoc, + Diag(CurAC ? CurAC->getBeginLoc() : NameLoc, diag::err_template_different_associated_constraints); - Diag(PrevAC ? PrevAC->getLocStart() : PrevClassTemplate->getLocation(), + Diag(PrevAC ? PrevAC->getBeginLoc() : PrevClassTemplate->getLocation(), diag::note_template_prev_declaration) << /*declaration*/0; return true; } @@ -1763,7 +1763,7 @@ TypeSourceInfo *NewTInfo = TLB.getTypeSourceInfo(SemaRef.Context, NewType); return buildDeductionGuide(TemplateParams, CD->isExplicit(), NewTInfo, - CD->getLocStart(), CD->getLocation(), + CD->getBeginLoc(), CD->getLocation(), CD->getLocEnd()); } @@ -1806,7 +1806,7 @@ // TemplateTypeParmDecl's index cannot be changed after creation, so // substitute it directly. auto *NewTTP = TemplateTypeParmDecl::Create( - SemaRef.Context, DC, TTP->getLocStart(), TTP->getLocation(), + SemaRef.Context, DC, TTP->getBeginLoc(), TTP->getLocation(), /*Depth*/0, Depth1IndexAdjustment + TTP->getIndex(), TTP->getIdentifier(), TTP->wasDeclaredWithTypename(), TTP->isParameterPack()); @@ -1876,7 +1876,7 @@ EPI.HasTrailingReturn = true; QualType Result = SemaRef.BuildFunctionType( - ReturnType, ParamTypes, TL.getLocStart(), DeductionGuideName, EPI); + ReturnType, ParamTypes, TL.getBeginLoc(), DeductionGuideName, EPI); if (Result.isNull()) return QualType(); @@ -3250,7 +3250,7 @@ Decl = ClassTemplateSpecializationDecl::Create(Context, ClassTemplate->getTemplatedDecl()->getTagKind(), ClassTemplate->getDeclContext(), - ClassTemplate->getTemplatedDecl()->getLocStart(), + ClassTemplate->getTemplatedDecl()->getBeginLoc(), ClassTemplate->getLocation(), ClassTemplate, Converted, nullptr); @@ -4218,12 +4218,12 @@ // a "not a template" case. FIXME: Refactor isTemplateName so we don't // need to do this. DeclarationNameInfo DNI = GetNameFromUnqualifiedId(Name); - LookupResult R(*this, DNI.getName(), Name.getLocStart(), + LookupResult R(*this, DNI.getName(), Name.getBeginLoc(), LookupOrdinaryName); bool MOUS; if (!LookupTemplateName(R, S, SS, ObjectType.get(), EnteringContext, MOUS, TemplateKWLoc)) - Diag(Name.getLocStart(), diag::err_no_member) + Diag(Name.getBeginLoc(), diag::err_no_member) << DNI.getName() << LookupCtx << SS.getRange(); return TNK_Non_template; } else { @@ -4241,7 +4241,7 @@ // We don't get here if naming the constructor would be valid, so we // just reject immediately and recover by treating the // injected-class-name as naming the template. - Diag(Name.getLocStart(), + Diag(Name.getBeginLoc(), diag::ext_out_of_line_qualified_id_type_names_constructor) << Name.Identifier << 0 /*injected-class-name used as template name*/ << 1 /*'template' keyword was used*/; @@ -4270,7 +4270,7 @@ break; } - Diag(Name.getLocStart(), + Diag(Name.getBeginLoc(), diag::err_template_kw_refers_to_non_template) << GetNameFromUnqualifiedId(Name).getName() << Name.getSourceRange() @@ -5629,7 +5629,7 @@ if (Arg->isNullPointerConstant(S.Context, Expr::NPC_NeverValueDependent)) { std::string Code = "static_cast<" + ParamType.getAsString() + ">("; S.Diag(Arg->getExprLoc(), diag::err_template_arg_untyped_null_constant) - << ParamType << FixItHint::CreateInsertion(Arg->getLocStart(), Code) + << ParamType << FixItHint::CreateInsertion(Arg->getBeginLoc(), Code) << FixItHint::CreateInsertion(S.getLocForEndOfToken(Arg->getLocEnd()), ")"); S.Diag(Param->getLocation(), diag::note_template_param_here); @@ -5670,7 +5670,7 @@ unsigned ArgQuals = ArgType.getCVRQualifiers(); if ((ParamQuals | ArgQuals) != ParamQuals) { - S.Diag(Arg->getLocStart(), + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_ref_bind_ignores_quals) << ParamType << Arg->getType() << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); @@ -5686,10 +5686,10 @@ ParamType.getNonReferenceType())) { // We can't perform this conversion or binding. if (ParamType->isReferenceType()) - S.Diag(Arg->getLocStart(), diag::err_template_arg_no_ref_bind) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_no_ref_bind) << ParamType << ArgIn->getType() << Arg->getSourceRange(); else - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_convertible) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_convertible) << ArgIn->getType() << ParamType << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; @@ -5736,7 +5736,7 @@ } if (FirstOpLoc.isValid()) { if (ExtWarnMSTemplateArg) - S.Diag(ArgIn->getLocStart(), diag::ext_ms_deref_template_argument) + S.Diag(ArgIn->getBeginLoc(), diag::ext_ms_deref_template_argument) << ArgIn->getSourceRange(); if (FirstOpKind == UO_AddrOf) @@ -5745,7 +5745,7 @@ // We cannot let pointers get dereferenced here, that is obviously not a // constant expression. assert(FirstOpKind == UO_Deref); - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) << Arg->getSourceRange(); } } @@ -5770,7 +5770,7 @@ bool ExtraParens = false; while (ParenExpr *Parens = dyn_cast(Arg)) { if (!Invalid && !ExtraParens) { - S.Diag(Arg->getLocStart(), + S.Diag(Arg->getBeginLoc(), S.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) @@ -5836,7 +5836,7 @@ } if (!DRE) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; @@ -5844,7 +5844,7 @@ // Cannot refer to non-static data members if (isa(Entity) || isa(Entity)) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_field) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_field) << Entity << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; @@ -5853,7 +5853,7 @@ // Cannot refer to non-static member functions if (CXXMethodDecl *Method = dyn_cast(Entity)) { if (!Method->isStatic()) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_method) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_method) << Method << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; @@ -5866,7 +5866,7 @@ // A non-type template argument must refer to an object or function. if (!Func && !Var) { // We found something, but we don't know specifically what it is. - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_object_or_func) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_object_or_func) << Arg->getSourceRange(); S.Diag(DRE->getDecl()->getLocation(), diag::note_template_arg_refers_here); return true; @@ -5874,14 +5874,14 @@ // Address / reference template args must have external linkage in C++98. if (Entity->getFormalLinkage() == InternalLinkage) { - S.Diag(Arg->getLocStart(), S.getLangOpts().CPlusPlus11 ? + S.Diag(Arg->getBeginLoc(), S.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_template_arg_object_internal : diag::ext_template_arg_object_internal) << !Func << Entity << Arg->getSourceRange(); S.Diag(Entity->getLocation(), diag::note_template_arg_internal_object) << !Func; } else if (!Entity->hasLinkage()) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_object_no_linkage) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_object_no_linkage) << !Func << Entity << Arg->getSourceRange(); S.Diag(Entity->getLocation(), diag::note_template_arg_internal_object) << !Func; @@ -5914,7 +5914,7 @@ } else { // A value of reference type is not an object. if (Var->getType()->isReferenceType()) { - S.Diag(Arg->getLocStart(), + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_reference_var) << Var->getType() << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); @@ -5923,7 +5923,7 @@ // A template argument must have static storage duration. if (Var->getTLSKind()) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_thread_local) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_thread_local) << Arg->getSourceRange(); S.Diag(Var->getLocation(), diag::note_template_arg_refers_here); return true; @@ -5961,15 +5961,15 @@ // taking the address of the entity. ArgType = S.Context.getPointerType(Var->getType()); if (!S.Context.hasSameUnqualifiedType(ArgType, ParamType)) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_address_of) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_address_of) << ParamType; S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_address_of) + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_address_of) << ParamType - << FixItHint::CreateInsertion(Arg->getLocStart(), "&"); + << FixItHint::CreateInsertion(Arg->getBeginLoc(), "&"); S.Diag(Param->getLocation(), diag::note_template_param_here); } @@ -5983,7 +5983,7 @@ // Create the template argument. Converted = TemplateArgument(cast(Entity->getCanonicalDecl()), ParamType); - S.MarkAnyDeclReferenced(Arg->getLocStart(), Entity, false); + S.MarkAnyDeclReferenced(Arg->getBeginLoc(), Entity, false); return false; } @@ -6012,7 +6012,7 @@ bool ExtraParens = false; while (ParenExpr *Parens = dyn_cast(Arg)) { if (!Invalid && !ExtraParens) { - S.Diag(Arg->getLocStart(), + S.Diag(Arg->getBeginLoc(), S.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) @@ -6078,14 +6078,14 @@ } else if (!S.Context.hasSameUnqualifiedType( ResultArg->getType(), ParamType.getNonReferenceType())) { // We can't perform this conversion. - S.Diag(ResultArg->getLocStart(), diag::err_template_arg_not_convertible) + S.Diag(ResultArg->getBeginLoc(), diag::err_template_arg_not_convertible) << ResultArg->getType() << ParamType << ResultArg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } if (!DRE) - return S.Diag(Arg->getLocStart(), + return S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_pointer_to_member_form) << Arg->getSourceRange(); @@ -6109,7 +6109,7 @@ } // We found something else, but we don't know specifically what it is. - S.Diag(Arg->getLocStart(), + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_pointer_to_member_form) << Arg->getSourceRange(); S.Diag(DRE->getDecl()->getLocation(), diag::note_template_arg_refers_here); @@ -6127,7 +6127,7 @@ QualType ParamType, Expr *Arg, TemplateArgument &Converted, CheckTemplateArgumentKind CTAK) { - SourceLocation StartLoc = Arg->getLocStart(); + SourceLocation StartLoc = Arg->getBeginLoc(); // If the parameter type somehow involves auto, deduce the type now. if (getLangOpts().CPlusPlus17 && ParamType->isUndeducedType()) { @@ -6248,7 +6248,7 @@ // FIXME: We need TemplateArgument representation and mangling for these. if (!Value.getMemberPointerPath().empty()) { - Diag(Arg->getLocStart(), + Diag(Arg->getBeginLoc(), diag::err_template_arg_member_ptr_base_derived_not_supported) << Value.getMemberPointerDecl() << ParamType << Arg->getSourceRange(); @@ -6274,7 +6274,7 @@ Converted = TemplateArgument(ArgResult.get()); break; } - Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref) + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) << Arg->getSourceRange(); return ExprError(); } @@ -6384,7 +6384,7 @@ // -- the name of a non-type template-parameter; or llvm::APSInt Value; if (!ArgType->isIntegralOrEnumerationType()) { - Diag(Arg->getLocStart(), + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_integral_or_enumeral) << ArgType << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); @@ -6424,7 +6424,7 @@ Arg = ImpCastExprToType(Arg, ParamType, CK_IntegralCast).get(); } else { // We can't perform this conversion. - Diag(Arg->getLocStart(), + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_convertible) << Arg->getType() << ParamType << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); @@ -6465,7 +6465,7 @@ // Complain if an unsigned parameter received a negative value. if (IntegerType->isUnsignedIntegerOrEnumerationType() && (OldValue.isSigned() && OldValue.isNegative())) { - Diag(Arg->getLocStart(), diag::warn_template_arg_negative) + Diag(Arg->getBeginLoc(), diag::warn_template_arg_negative) << OldValue.toString(10) << Value.toString(10) << Param->getType() << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); @@ -6480,7 +6480,7 @@ else RequiredBits = OldValue.getMinSignedBits(); if (RequiredBits > AllowedBits) { - Diag(Arg->getLocStart(), + Diag(Arg->getBeginLoc(), diag::warn_template_arg_too_large) << OldValue.toString(10) << Value.toString(10) << Param->getType() << Arg->getSourceRange(); @@ -6526,7 +6526,7 @@ if (FunctionDecl *Fn = ResolveAddressOfOverloadedFunction(Arg, ParamType, true, FoundResult)) { - if (DiagnoseUseOfDecl(Fn, Arg->getLocStart())) + if (DiagnoseUseOfDecl(Fn, Arg->getBeginLoc())) return ExprError(); Arg = FixOverloadedFunctionReference(Arg, FoundResult, Fn); @@ -6579,7 +6579,7 @@ ParamRefType->getPointeeType(), true, FoundResult)) { - if (DiagnoseUseOfDecl(Fn, Arg->getLocStart())) + if (DiagnoseUseOfDecl(Fn, Arg->getBeginLoc())) return ExprError(); Arg = FixOverloadedFunctionReference(Arg, FoundResult, Fn); @@ -7357,7 +7357,7 @@ ParamUseRange = findTemplateParameter( Param->getDepth(), Param->getTypeSourceInfo()->getTypeLoc()); if (ParamUseRange.isValid()) { - S.Diag(IsDefaultArgument ? TemplateNameLoc : ArgExpr->getLocStart(), + S.Diag(IsDefaultArgument ? TemplateNameLoc : ArgExpr->getBeginLoc(), diag::err_dependent_typed_non_type_arg_in_partial_spec) << Param->getType(); S.Diag(Param->getLocation(), diag::note_template_param_here) @@ -8573,7 +8573,7 @@ for (auto &B : Def->bases()) { if (auto *BT = dyn_cast_or_null( B.getType()->getAsCXXRecordDecl())) - S.propagateDLLAttrToBaseClassTemplate(Def, A, BT, B.getLocStart()); + S.propagateDLLAttrToBaseClassTemplate(Def, A, BT, B.getBeginLoc()); } S.referenceDLLExportedClassMethods(); @@ -8990,7 +8990,7 @@ DeclarationName Name = NameInfo.getName(); if (!Name) { if (!D.isInvalidType()) - Diag(D.getDeclSpec().getLocStart(), + Diag(D.getDeclSpec().getBeginLoc(), diag::err_explicit_instantiation_requires_name) << D.getDeclSpec().getSourceRange() << D.getSourceRange(); @@ -9046,7 +9046,7 @@ // A deduction guide is not on the list of entities that can be explicitly // instantiated. if (Name.getNameKind() == DeclarationName::CXXDeductionGuideName) { - Diag(D.getDeclSpec().getLocStart(), diag::err_deduction_guide_specialized) + Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_specialized) << /*explicit instantiation*/ 0; return true; } @@ -9105,7 +9105,7 @@ // // This includes auto-typed variable template instantiations. if (R->isUndeducedType()) { - Diag(T->getTypeLoc().getLocStart(), + Diag(T->getTypeLoc().getBeginLoc(), diag::err_auto_not_allowed_var_inst); return true; } @@ -9175,7 +9175,7 @@ // Check the new variable specialization against the parsed input. if (PrevTemplate && Prev && !Context.hasSameType(Prev->getType(), R)) { - Diag(T->getTypeLoc().getLocStart(), + Diag(T->getTypeLoc().getBeginLoc(), diag::err_invalid_var_template_spec_type) << 0 << PrevTemplate << R << Prev->getType(); Diag(PrevTemplate->getLocation(), diag::note_template_declared_here) @@ -9293,7 +9293,7 @@ PDiag(DiagID) << Specialization->getType(), PDiag(diag::note_explicit_instantiation_here), Specialization->getType()->getAs(), - Specialization->getLocation(), FPT, D.getLocStart()); + Specialization->getLocation(), FPT, D.getBeginLoc()); // In Microsoft mode, mismatching exception specifications just cause a // warning. if (!getLangOpts().MicrosoftExt && Result) Index: lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- lib/Sema/SemaTemplateDeduction.cpp +++ lib/Sema/SemaTemplateDeduction.cpp @@ -4423,11 +4423,11 @@ if (const AutoType *AT = Type.getType()->getAs()) { if (AT->isDecltypeAuto()) { if (isa(Init)) { - Diag(Init->getLocStart(), diag::err_decltype_auto_initializer_list); + Diag(Init->getBeginLoc(), diag::err_decltype_auto_initializer_list); return DAR_FailedAlreadyDiagnosed; } - QualType Deduced = BuildDecltypeType(Init, Init->getLocStart(), false); + QualType Deduced = BuildDecltypeType(Init, Init->getBeginLoc(), false); if (Deduced.isNull()) return DAR_FailedAlreadyDiagnosed; // FIXME: Support a non-canonical deduced type for 'auto'. @@ -4438,7 +4438,7 @@ return DAR_Succeeded; } else if (!getLangOpts().CPlusPlus) { if (isa(Init)) { - Diag(Init->getLocStart(), diag::err_auto_init_list_from_c); + Diag(Init->getBeginLoc(), diag::err_auto_init_list_from_c); return DAR_FailedAlreadyDiagnosed; } } Index: lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- lib/Sema/SemaTemplateInstantiate.cpp +++ lib/Sema/SemaTemplateInstantiate.cpp @@ -1789,7 +1789,7 @@ ExprResult NewArg = SubstExpr(Arg, TemplateArgs); if (NewArg.isUsable()) { // It would be nice if we still had this. - SourceLocation EqualLoc = NewArg.get()->getLocStart(); + SourceLocation EqualLoc = NewArg.get()->getBeginLoc(); SetParamDefaultArgument(NewParm, NewArg.get(), EqualLoc); } } else { @@ -2337,7 +2337,7 @@ Expr *Init = NewInit.get(); assert((!Init || !isa(Init)) && "call-style init in class"); ActOnFinishCXXInClassMemberInitializer( - Instantiation, Init ? Init->getLocStart() : SourceLocation(), Init); + Instantiation, Init ? Init->getBeginLoc() : SourceLocation(), Init); if (auto *L = getASTMutationListener()) L->DefaultMemberInitializerInstantiated(Instantiation); Index: lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- lib/Sema/SemaTemplateInstantiateDecl.cpp +++ lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -562,7 +562,7 @@ RD->getEnclosingNamespaceContext() == SemaRef.getStdNamespace() && RD->getIdentifier() && RD->getIdentifier()->isStr("common_type") && D->getIdentifier() && D->getIdentifier()->isStr("type") && - SemaRef.getSourceManager().isInSystemHeader(D->getLocStart())) + SemaRef.getSourceManager().isInSystemHeader(D->getBeginLoc())) // Fold it to the (non-reference) type which g++ would have produced. DI = SemaRef.Context.getTrivialTypeSourceInfo( DI->getType().getNonReferenceType()); @@ -570,10 +570,10 @@ // Create the new typedef TypedefNameDecl *Typedef; if (IsTypeAlias) - Typedef = TypeAliasDecl::Create(SemaRef.Context, Owner, D->getLocStart(), + Typedef = TypeAliasDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(), D->getIdentifier(), DI); else - Typedef = TypedefDecl::Create(SemaRef.Context, Owner, D->getLocStart(), + Typedef = TypedefDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(), D->getIdentifier(), DI); if (Invalid) Typedef->setInvalidDecl(); @@ -872,7 +872,7 @@ MSPropertyDecl *Property = MSPropertyDecl::Create( SemaRef.Context, Owner, D->getLocation(), D->getDeclName(), DI->getType(), - DI, D->getLocStart(), D->getGetterId(), D->getSetterId()); + DI, D->getBeginLoc(), D->getGetterId(), D->getSetterId()); SemaRef.InstantiateAttrs(TemplateArgs, D, Property, LateAttrs, StartingScope); @@ -932,7 +932,7 @@ if (!InstTy) return nullptr; - FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getLocStart(), + FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getBeginLoc(), D->getFriendLoc(), InstTy); if (!FD) return nullptr; @@ -991,7 +991,7 @@ PrevDecl = cast(Prev); } - EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getLocStart(), + EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(), D->getIdentifier(), PrevDecl, D->isScoped(), D->isScopedUsingClassTag(), D->isFixed()); @@ -1252,7 +1252,7 @@ CXXRecordDecl *RecordInst = CXXRecordDecl::Create(SemaRef.Context, Pattern->getTagKind(), DC, - Pattern->getLocStart(), Pattern->getLocation(), + Pattern->getBeginLoc(), Pattern->getLocation(), Pattern->getIdentifier(), PrevDecl, /*DelayTypeCreation=*/true); @@ -1486,7 +1486,7 @@ CXXRecordDecl *Record = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner, - D->getLocStart(), D->getLocation(), + D->getBeginLoc(), D->getLocation(), D->getIdentifier(), PrevDecl); // Substitute the nested name specifier, if any. @@ -2119,7 +2119,7 @@ assert(D->getTypeForDecl()->isTemplateTypeParmType()); TemplateTypeParmDecl *Inst = TemplateTypeParmDecl::Create( - SemaRef.Context, Owner, D->getLocStart(), D->getLocation(), + SemaRef.Context, Owner, D->getBeginLoc(), D->getLocation(), D->getDepth() - TemplateArgs.getNumSubstitutedLevels(), D->getIndex(), D->getIdentifier(), D->wasDeclaredWithTypename(), D->isParameterPack()); Inst->setAccess(AS_public); @@ -2935,7 +2935,7 @@ = ClassTemplateSpecializationDecl::Create(SemaRef.Context, D->getTagKind(), Owner, - D->getLocStart(), + D->getBeginLoc(), D->getLocation(), InstClassTemplate, Converted, @@ -3008,7 +3008,7 @@ // Check that the template argument list is well-formed for this template. SmallVector Converted; if (SemaRef.CheckTemplateArgumentList( - VarTemplate, VarTemplate->getLocStart(), + VarTemplate, VarTemplate->getBeginLoc(), const_cast(VarTemplateArgsInfo), false, Converted)) return nullptr; @@ -3241,7 +3241,7 @@ = ClassTemplatePartialSpecializationDecl::Create(SemaRef.Context, PartialSpec->getTagKind(), Owner, - PartialSpec->getLocStart(), + PartialSpec->getBeginLoc(), PartialSpec->getLocation(), InstParams, ClassTemplate, @@ -3823,7 +3823,7 @@ std::make_pair(Function, PointOfInstantiation)); } else if (TSK == TSK_ImplicitInstantiation) { if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() && - !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) { + !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) { Diag(PointOfInstantiation, diag::warn_func_template_missing) << Function; Diag(PatternDecl->getLocation(), diag::note_forward_template_decl); @@ -4366,7 +4366,7 @@ } else if (TSK == TSK_ImplicitInstantiation) { // Warn about missing definition at the end of translation unit. if (AtEndOfTU && !getDiagnostics().hasErrorOccurred() && - !getSourceManager().isInSystemHeader(PatternDecl->getLocStart())) { + !getSourceManager().isInSystemHeader(PatternDecl->getBeginLoc())) { Diag(PointOfInstantiation, diag::warn_var_template_missing) << Var; Diag(PatternDecl->getLocation(), diag::note_forward_template_decl); Index: lib/Sema/SemaTemplateVariadic.cpp =================================================================== --- lib/Sema/SemaTemplateVariadic.cpp +++ lib/Sema/SemaTemplateVariadic.cpp @@ -392,7 +392,7 @@ SmallVector Unexpanded; CollectUnexpandedParameterPacksVisitor(Unexpanded).TraverseStmt(E); assert(!Unexpanded.empty() && "Unable to find unexpanded parameter packs"); - return DiagnoseUnexpandedParameterPacks(E->getLocStart(), UPPC, Unexpanded); + return DiagnoseUnexpandedParameterPacks(E->getBeginLoc(), UPPC, Unexpanded); } bool Sema::DiagnoseUnexpandedParameterPack(const CXXScopeSpec &SS, @@ -1125,7 +1125,7 @@ isa(E)) { S.Diag(E->getExprLoc(), diag::err_fold_expression_bad_operand) << E->getSourceRange() - << FixItHint::CreateInsertion(E->getLocStart(), "(") + << FixItHint::CreateInsertion(E->getBeginLoc(), "(") << FixItHint::CreateInsertion(E->getLocEnd(), ")"); } } Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -656,7 +656,7 @@ // faking up the function chunk is still the right thing to do. // Otherwise, we need to fake up a function declarator. - SourceLocation loc = declarator.getLocStart(); + SourceLocation loc = declarator.getBeginLoc(); // ...and *prepend* it to the declarator. SourceLocation NoLoc; @@ -808,7 +808,7 @@ rangeToRemove = attr.getLocalSourceRange(); if (attr.getTypePtr()->getImmediateNullability()) { typeArg = attr.getTypePtr()->getModifiedType(); - S.Diag(attr.getLocStart(), + S.Diag(attr.getBeginLoc(), diag::err_objc_type_arg_explicit_nullability) << typeArg << FixItHint::CreateRemoval(rangeToRemove); diagnosed = true; @@ -816,7 +816,7 @@ } if (!diagnosed) { - S.Diag(qual.getLocStart(), diag::err_objc_type_arg_qualified) + S.Diag(qual.getBeginLoc(), diag::err_objc_type_arg_qualified) << typeArg << typeArg.getQualifiers().getAsString() << FixItHint::CreateRemoval(rangeToRemove); } @@ -878,7 +878,7 @@ } // Diagnose the mismatch. - S.Diag(typeArgInfo->getTypeLoc().getLocStart(), + S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(), diag::err_objc_type_arg_does_not_match_bound) << typeArg << bound << typeParam->getDeclName(); S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here) @@ -906,7 +906,7 @@ continue; // Diagnose the mismatch. - S.Diag(typeArgInfo->getTypeLoc().getLocStart(), + S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(), diag::err_objc_type_arg_does_not_match_bound) << typeArg << bound << typeParam->getDeclName(); S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here) @@ -924,7 +924,7 @@ } // Diagnose non-id-compatible type arguments. - S.Diag(typeArgInfo->getTypeLoc().getLocStart(), + S.Diag(typeArgInfo->getTypeLoc().getBeginLoc(), diag::err_objc_type_arg_not_id_compatible) << typeArg << typeArgInfo->getTypeLoc().getSourceRange(); @@ -1186,7 +1186,7 @@ DeclSpec &DS = declarator.getMutableDeclSpec(); SourceLocation DeclLoc = declarator.getIdentifierLoc(); if (DeclLoc.isInvalid()) - DeclLoc = DS.getLocStart(); + DeclLoc = DS.getBeginLoc(); ASTContext &Context = S.Context; @@ -1269,7 +1269,7 @@ if (DS.isEmpty()) { S.Diag(DeclLoc, diag::ext_missing_declspec) << DS.getSourceRange() - << FixItHint::CreateInsertion(DS.getLocStart(), "int"); + << FixItHint::CreateInsertion(DS.getBeginLoc(), "int"); } } else if (!DS.hasTypeSpecifier()) { // C99 and C++ require a type specifier. For example, C99 6.7.2p2 says: @@ -2117,7 +2117,7 @@ if (!getLangOpts().CPlusPlus11 && ArraySize && !ArraySize->isTypeDependent() && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { - Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) + Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int) << ArraySize->getType() << ArraySize->getSourceRange(); return QualType(); } @@ -2137,7 +2137,7 @@ // of a VLA. if (getLangOpts().CPlusPlus11 && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { - Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) + Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int) << ArraySize->getType() << ArraySize->getSourceRange(); return QualType(); } @@ -2151,23 +2151,23 @@ // have a value greater than zero. if (ConstVal.isSigned() && ConstVal.isNegative()) { if (Entity) - Diag(ArraySize->getLocStart(), diag::err_decl_negative_array_size) + Diag(ArraySize->getBeginLoc(), diag::err_decl_negative_array_size) << getPrintableNameForEntity(Entity) << ArraySize->getSourceRange(); else - Diag(ArraySize->getLocStart(), diag::err_typecheck_negative_array_size) + Diag(ArraySize->getBeginLoc(), diag::err_typecheck_negative_array_size) << ArraySize->getSourceRange(); return QualType(); } if (ConstVal == 0) { // GCC accepts zero sized static arrays. We allow them when // we're not in a SFINAE context. - Diag(ArraySize->getLocStart(), + Diag(ArraySize->getBeginLoc(), isSFINAEContext()? diag::err_typecheck_zero_array_size : diag::ext_typecheck_zero_array_size) << ArraySize->getSourceRange(); if (ASM == ArrayType::Static) { - Diag(ArraySize->getLocStart(), + Diag(ArraySize->getBeginLoc(), diag::warn_typecheck_zero_static_array_size) << ArraySize->getSourceRange(); ASM = ArrayType::Normal; @@ -2178,7 +2178,7 @@ unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, T, ConstVal); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { - Diag(ArraySize->getLocStart(), diag::err_array_too_large) + Diag(ArraySize->getBeginLoc(), diag::err_array_too_large) << ConstVal.toString(10) << ArraySize->getSourceRange(); return QualType(); @@ -2873,7 +2873,7 @@ TemplateTypeParmDecl *CorrespondingTemplateParam = TemplateTypeParmDecl::Create( SemaRef.Context, SemaRef.Context.getTranslationUnitDecl(), - /*KeyLoc*/SourceLocation(), /*NameLoc*/D.getLocStart(), + /*KeyLoc*/SourceLocation(), /*NameLoc*/D.getBeginLoc(), TemplateParameterDepth, AutoParameterPosition, /*Identifier*/nullptr, false, IsParameterPack); LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam); @@ -3302,8 +3302,8 @@ << D.getIdentifier(); // FIXME: A cast to void is probably a better suggestion in cases where it's // valid (when there is no initializer and we're not in a condition). - S.Diag(D.getLocStart(), diag::note_function_style_cast_add_parentheses) - << FixItHint::CreateInsertion(D.getLocStart(), "(") + S.Diag(D.getBeginLoc(), diag::note_function_style_cast_add_parentheses) + << FixItHint::CreateInsertion(D.getBeginLoc(), "(") << FixItHint::CreateInsertion(S.getLocForEndOfToken(D.getLocEnd()), ")"); S.Diag(Paren.Loc, diag::note_remove_parens_for_variable_declaration) << FixItHint::CreateRemoval(Paren.Loc) @@ -4386,14 +4386,14 @@ } else if (FTI.hasTrailingReturnType()) { // T must be exactly 'auto' at this point. See CWG issue 681. if (isa(T)) { - S.Diag(D.getLocStart(), + S.Diag(D.getBeginLoc(), diag::err_trailing_return_in_parens) << T << D.getSourceRange(); D.setInvalidType(true); } else if (D.getName().getKind() == UnqualifiedIdKind::IK_DeductionGuideName) { if (T != Context.DependentTy) { - S.Diag(D.getDeclSpec().getLocStart(), + S.Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_with_complex_decl) << D.getSourceRange(); D.setInvalidType(true); @@ -4475,7 +4475,7 @@ if (T->isObjCObjectType()) { SourceLocation DiagLoc, FixitLoc; if (TInfo) { - DiagLoc = TInfo->getTypeLoc().getLocStart(); + DiagLoc = TInfo->getTypeLoc().getBeginLoc(); FixitLoc = S.getLocForEndOfToken(TInfo->getTypeLoc().getLocEnd()); } else { DiagLoc = D.getDeclSpec().getTypeSpecTypeLoc(); @@ -4887,7 +4887,7 @@ !IsTypedefName && D.getContext() != DeclaratorContext::TemplateArgContext && D.getContext() != DeclaratorContext::TemplateTypeArgContext) { - SourceLocation Loc = D.getLocStart(); + SourceLocation Loc = D.getBeginLoc(); SourceRange RemovalRange; unsigned I; if (D.isFunctionDeclarator(I)) { @@ -7097,7 +7097,7 @@ assert(0 && "Unable to find corresponding image type."); } - S.Diag(TypedefTy->getDecl()->getLocStart(), + S.Diag(TypedefTy->getDecl()->getBeginLoc(), diag::note_opencl_typedef_access_qualifier) << PrevAccessQual; } else if (CurType->isPipeType()) { if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) { @@ -7345,7 +7345,7 @@ diag::err_objc_kindof_wrong_position) << FixItHint::CreateRemoval(attr.getLoc()) << FixItHint::CreateInsertion( - state.getDeclarator().getDeclSpec().getLocStart(), "__kindof "); + state.getDeclarator().getDeclSpec().getBeginLoc(), "__kindof "); break; } @@ -7859,7 +7859,7 @@ Diag(RD->getLocation(), diag::note_non_literal_virtual_base) << getLiteralDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases(); for (const auto &I : RD->vbases()) - Diag(I.getLocStart(), diag::note_constexpr_virtual_base_here) + Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here) << I.getSourceRange(); } else if (!RD->isAggregate() && !RD->hasConstexprNonCopyMoveConstructor() && !RD->hasTrivialDefaultConstructor()) { @@ -7867,7 +7867,7 @@ } else if (RD->hasNonLiteralTypeFieldsOrBases()) { for (const auto &I : RD->bases()) { if (!I.getType()->isLiteralType(Context)) { - Diag(I.getLocStart(), + Diag(I.getBeginLoc(), diag::note_non_literal_base_class) << RD << I.getType() << I.getSourceRange(); return true; Index: lib/Sema/TreeTransform.h =================================================================== --- lib/Sema/TreeTransform.h +++ lib/Sema/TreeTransform.h @@ -3394,7 +3394,7 @@ // If this was list initialization, revert to syntactic list form. if (Construct->isListInitialization()) - return getDerived().RebuildInitList(Construct->getLocStart(), NewArgs, + return getDerived().RebuildInitList(Construct->getBeginLoc(), NewArgs, Construct->getLocEnd()); // Build a ParenListExpr to represent anything else. @@ -6412,7 +6412,7 @@ // Rebuild the type. Result = getDerived().RebuildObjCObjectType( BaseType, - TL.getLocStart(), + TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos, TL.getTypeArgsRAngleLoc(), @@ -6656,7 +6656,7 @@ if (Then.isInvalid()) return StmtError(); } else { - Then = new (getSema().Context) NullStmt(S->getThen()->getLocStart()); + Then = new (getSema().Context) NullStmt(S->getThen()->getBeginLoc()); } // Transform the "else" branch. @@ -7708,7 +7708,7 @@ return getDerived().RebuildOMPExecutableDirective( D->getDirectiveKind(), DirName, CancelRegion, TClauses, - AssociatedStmt.get(), D->getLocStart(), D->getLocEnd()); + AssociatedStmt.get(), D->getBeginLoc(), D->getLocEnd()); } template @@ -7716,7 +7716,7 @@ TreeTransform::TransformOMPParallelDirective(OMPParallelDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7727,7 +7727,7 @@ TreeTransform::TransformOMPSimdDirective(OMPSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7738,7 +7738,7 @@ TreeTransform::TransformOMPForDirective(OMPForDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_for, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7749,7 +7749,7 @@ TreeTransform::TransformOMPForSimdDirective(OMPForSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_for_simd, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7760,7 +7760,7 @@ TreeTransform::TransformOMPSectionsDirective(OMPSectionsDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_sections, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7771,7 +7771,7 @@ TreeTransform::TransformOMPSectionDirective(OMPSectionDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_section, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7782,7 +7782,7 @@ TreeTransform::TransformOMPSingleDirective(OMPSingleDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_single, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7793,7 +7793,7 @@ TreeTransform::TransformOMPMasterDirective(OMPMasterDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_master, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7803,7 +7803,7 @@ StmtResult TreeTransform::TransformOMPCriticalDirective(OMPCriticalDirective *D) { getDerived().getSema().StartOpenMPDSABlock( - OMPD_critical, D->getDirectiveName(), nullptr, D->getLocStart()); + OMPD_critical, D->getDirectiveName(), nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7814,7 +7814,7 @@ OMPParallelForDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7825,7 +7825,7 @@ OMPParallelForSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for_simd, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7836,7 +7836,7 @@ OMPParallelSectionsDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_sections, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7847,7 +7847,7 @@ TreeTransform::TransformOMPTaskDirective(OMPTaskDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_task, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7858,7 +7858,7 @@ OMPTaskyieldDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_taskyield, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7869,7 +7869,7 @@ TreeTransform::TransformOMPBarrierDirective(OMPBarrierDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_barrier, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7880,7 +7880,7 @@ TreeTransform::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_taskwait, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7891,7 +7891,7 @@ OMPTaskgroupDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_taskgroup, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7902,7 +7902,7 @@ TreeTransform::TransformOMPFlushDirective(OMPFlushDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_flush, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7913,7 +7913,7 @@ TreeTransform::TransformOMPOrderedDirective(OMPOrderedDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_ordered, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7924,7 +7924,7 @@ TreeTransform::TransformOMPAtomicDirective(OMPAtomicDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_atomic, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7935,7 +7935,7 @@ TreeTransform::TransformOMPTargetDirective(OMPTargetDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7946,7 +7946,7 @@ OMPTargetDataDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_data, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7957,7 +7957,7 @@ OMPTargetEnterDataDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_enter_data, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7968,7 +7968,7 @@ OMPTargetExitDataDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_exit_data, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7979,7 +7979,7 @@ OMPTargetParallelDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -7990,7 +7990,7 @@ OMPTargetParallelForDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8001,7 +8001,7 @@ OMPTargetUpdateDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_update, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8012,7 +8012,7 @@ TreeTransform::TransformOMPTeamsDirective(OMPTeamsDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_teams, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8023,7 +8023,7 @@ OMPCancellationPointDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_cancellation_point, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8034,7 +8034,7 @@ TreeTransform::TransformOMPCancelDirective(OMPCancelDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_cancel, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8045,7 +8045,7 @@ TreeTransform::TransformOMPTaskLoopDirective(OMPTaskLoopDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8056,7 +8056,7 @@ OMPTaskLoopSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_taskloop_simd, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8067,7 +8067,7 @@ OMPDistributeDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8078,7 +8078,7 @@ OMPDistributeParallelForDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( - OMPD_distribute_parallel_for, DirName, nullptr, D->getLocStart()); + OMPD_distribute_parallel_for, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8090,7 +8090,7 @@ OMPDistributeParallelForSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( - OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getLocStart()); + OMPD_distribute_parallel_for_simd, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8101,7 +8101,7 @@ OMPDistributeSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute_simd, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8113,7 +8113,7 @@ DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for_simd, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8124,7 +8124,7 @@ OMPTargetSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_simd, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8135,7 +8135,7 @@ OMPTeamsDistributeDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8146,7 +8146,7 @@ OMPTeamsDistributeSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( - OMPD_teams_distribute_simd, DirName, nullptr, D->getLocStart()); + OMPD_teams_distribute_simd, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8157,7 +8157,7 @@ OMPTeamsDistributeParallelForSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( - OMPD_teams_distribute_parallel_for_simd, DirName, nullptr, D->getLocStart()); + OMPD_teams_distribute_parallel_for_simd, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8168,7 +8168,7 @@ OMPTeamsDistributeParallelForDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute_parallel_for, - DirName, nullptr, D->getLocStart()); + DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8179,7 +8179,7 @@ OMPTargetTeamsDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams, DirName, - nullptr, D->getLocStart()); + nullptr, D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8190,7 +8190,7 @@ OMPTargetTeamsDistributeDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams_distribute, - DirName, nullptr, D->getLocStart()); + DirName, nullptr, D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8203,7 +8203,7 @@ DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( OMPD_target_teams_distribute_parallel_for, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8216,7 +8216,7 @@ DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( OMPD_target_teams_distribute_parallel_for_simd, DirName, nullptr, - D->getLocStart()); + D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8228,7 +8228,7 @@ OMPTargetTeamsDistributeSimdDirective *D) { DeclarationNameInfo DirName; getDerived().getSema().StartOpenMPDSABlock( - OMPD_target_teams_distribute_simd, DirName, nullptr, D->getLocStart()); + OMPD_target_teams_distribute_simd, DirName, nullptr, D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8244,7 +8244,7 @@ if (Cond.isInvalid()) return nullptr; return getDerived().RebuildOMPIfClause( - C->getNameModifier(), Cond.get(), C->getLocStart(), C->getLParenLoc(), + C->getNameModifier(), Cond.get(), C->getBeginLoc(), C->getLParenLoc(), C->getNameModifierLoc(), C->getColonLoc(), C->getLocEnd()); } @@ -8253,7 +8253,7 @@ ExprResult Cond = getDerived().TransformExpr(C->getCondition()); if (Cond.isInvalid()) return nullptr; - return getDerived().RebuildOMPFinalClause(Cond.get(), C->getLocStart(), + return getDerived().RebuildOMPFinalClause(Cond.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8264,7 +8264,7 @@ if (NumThreads.isInvalid()) return nullptr; return getDerived().RebuildOMPNumThreadsClause( - NumThreads.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + NumThreads.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8274,7 +8274,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPSafelenClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8284,7 +8284,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPSimdlenClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8294,14 +8294,14 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPCollapseClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template OMPClause * TreeTransform::TransformOMPDefaultClause(OMPDefaultClause *C) { return getDerived().RebuildOMPDefaultClause( - C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getLocStart(), + C->getDefaultKind(), C->getDefaultKindKwLoc(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8309,7 +8309,7 @@ OMPClause * TreeTransform::TransformOMPProcBindClause(OMPProcBindClause *C) { return getDerived().RebuildOMPProcBindClause( - C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getLocStart(), + C->getProcBindKind(), C->getProcBindKindKwLoc(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8321,7 +8321,7 @@ return nullptr; return getDerived().RebuildOMPScheduleClause( C->getFirstScheduleModifier(), C->getSecondScheduleModifier(), - C->getScheduleKind(), E.get(), C->getLocStart(), C->getLParenLoc(), + C->getScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getFirstScheduleModifierLoc(), C->getSecondScheduleModifierLoc(), C->getScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd()); } @@ -8335,7 +8335,7 @@ if (E.isInvalid()) return nullptr; } - return getDerived().RebuildOMPOrderedClause(C->getLocStart(), C->getLocEnd(), + return getDerived().RebuildOMPOrderedClause(C->getBeginLoc(), C->getLocEnd(), C->getLParenLoc(), E.get()); } @@ -8425,7 +8425,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPPrivateClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8440,7 +8440,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPFirstprivateClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8455,7 +8455,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPLastprivateClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8469,7 +8469,7 @@ return nullptr; Vars.push_back(EVar.get()); } - return getDerived().RebuildOMPSharedClause(Vars, C->getLocStart(), + return getDerived().RebuildOMPSharedClause(Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8516,7 +8516,7 @@ UnresolvedReductions.push_back(nullptr); } return getDerived().RebuildOMPReductionClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(), + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } @@ -8561,7 +8561,7 @@ UnresolvedReductions.push_back(nullptr); } return getDerived().RebuildOMPTaskReductionClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(), + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } @@ -8606,7 +8606,7 @@ UnresolvedReductions.push_back(nullptr); } return getDerived().RebuildOMPInReductionClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getColonLoc(), + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), C->getLocEnd(), ReductionIdScopeSpec, NameInfo, UnresolvedReductions); } @@ -8625,7 +8625,7 @@ if (Step.isInvalid()) return nullptr; return getDerived().RebuildOMPLinearClause( - Vars, Step.get(), C->getLocStart(), C->getLParenLoc(), C->getModifier(), + Vars, Step.get(), C->getBeginLoc(), C->getLParenLoc(), C->getModifier(), C->getModifierLoc(), C->getColonLoc(), C->getLocEnd()); } @@ -8644,7 +8644,7 @@ if (Alignment.isInvalid()) return nullptr; return getDerived().RebuildOMPAlignedClause( - Vars, Alignment.get(), C->getLocStart(), C->getLParenLoc(), + Vars, Alignment.get(), C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(), C->getLocEnd()); } @@ -8659,7 +8659,7 @@ return nullptr; Vars.push_back(EVar.get()); } - return getDerived().RebuildOMPCopyinClause(Vars, C->getLocStart(), + return getDerived().RebuildOMPCopyinClause(Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8675,7 +8675,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPCopyprivateClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8688,7 +8688,7 @@ return nullptr; Vars.push_back(EVar.get()); } - return getDerived().RebuildOMPFlushClause(Vars, C->getLocStart(), + return getDerived().RebuildOMPFlushClause(Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8705,7 +8705,7 @@ } return getDerived().RebuildOMPDependClause( C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(), Vars, - C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8715,7 +8715,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPDeviceClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8730,7 +8730,7 @@ } return getDerived().RebuildOMPMapClause( C->getMapTypeModifier(), C->getMapType(), C->isImplicitMapType(), - C->getMapLoc(), C->getColonLoc(), Vars, C->getLocStart(), + C->getMapLoc(), C->getColonLoc(), Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8741,7 +8741,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPNumTeamsClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8751,7 +8751,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPThreadLimitClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8761,7 +8761,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPPriorityClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8771,7 +8771,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPGrainsizeClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8781,7 +8781,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPNumTasksClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8789,7 +8789,7 @@ ExprResult E = getDerived().TransformExpr(C->getHint()); if (E.isInvalid()) return nullptr; - return getDerived().RebuildOMPHintClause(E.get(), C->getLocStart(), + return getDerived().RebuildOMPHintClause(E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8800,7 +8800,7 @@ if (E.isInvalid()) return nullptr; return getDerived().RebuildOMPDistScheduleClause( - C->getDistScheduleKind(), E.get(), C->getLocStart(), C->getLParenLoc(), + C->getDistScheduleKind(), E.get(), C->getBeginLoc(), C->getLParenLoc(), C->getDistScheduleKindLoc(), C->getCommaLoc(), C->getLocEnd()); } @@ -8820,7 +8820,7 @@ return 0; Vars.push_back(EVar.get()); } - return getDerived().RebuildOMPToClause(Vars, C->getLocStart(), + return getDerived().RebuildOMPToClause(Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8834,7 +8834,7 @@ return 0; Vars.push_back(EVar.get()); } - return getDerived().RebuildOMPFromClause(Vars, C->getLocStart(), + return getDerived().RebuildOMPFromClause(Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } @@ -8850,7 +8850,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPUseDevicePtrClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8865,7 +8865,7 @@ Vars.push_back(EVar.get()); } return getDerived().RebuildOMPIsDevicePtrClause( - Vars, C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + Vars, C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } //===----------------------------------------------------------------------===// @@ -8973,7 +8973,7 @@ ExprResult TreeTransform::TransformUserDefinedLiteral(UserDefinedLiteral *E) { if (FunctionDecl *FD = E->getDirectCallee()) - SemaRef.MarkFunctionReferenced(E->getLocStart(), FD); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), FD); return SemaRef.MaybeBindToTemporary(E); } @@ -9228,7 +9228,7 @@ return E; return getDerived().RebuildArraySubscriptExpr(LHS.get(), - /*FIXME:*/E->getLHS()->getLocStart(), + /*FIXME:*/E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc()); } @@ -9676,7 +9676,7 @@ ExprResult TreeTransform::TransformImplicitValueInitExpr( ImplicitValueInitExpr *E) { - TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName()); + TemporaryBase Rebase(*this, E->getBeginLoc(), DeclarationName()); // FIXME: Will we ever have proper type location here? Will we actually // need to transform the type? @@ -10009,7 +10009,7 @@ return E; return getDerived().RebuildCXXTypeidExpr(E->getType(), - E->getLocStart(), + E->getBeginLoc(), TInfo, E->getLocEnd()); } @@ -10031,7 +10031,7 @@ return E; return getDerived().RebuildCXXTypeidExpr(E->getType(), - E->getLocStart(), + E->getBeginLoc(), SubExpr.get(), E->getLocEnd()); } @@ -10050,7 +10050,7 @@ return E; return getDerived().RebuildCXXUuidofExpr(E->getType(), - E->getLocStart(), + E->getBeginLoc(), TInfo, E->getLocEnd()); } @@ -10067,7 +10067,7 @@ return E; return getDerived().RebuildCXXUuidofExpr(E->getType(), - E->getLocStart(), + E->getBeginLoc(), SubExpr.get(), E->getLocEnd()); } @@ -10092,11 +10092,11 @@ if (!getDerived().AlwaysRebuild() && T == E->getType()) { // Make sure that we capture 'this'. - getSema().CheckCXXThisCapture(E->getLocStart()); + getSema().CheckCXXThisCapture(E->getBeginLoc()); return E; } - return getDerived().RebuildCXXThisExpr(E->getLocStart(), T, E->isImplicit()); + return getDerived().RebuildCXXThisExpr(E->getBeginLoc(), T, E->isImplicit()); } template @@ -10118,7 +10118,7 @@ ExprResult TreeTransform::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { ParmVarDecl *Param - = cast_or_null(getDerived().TransformDecl(E->getLocStart(), + = cast_or_null(getDerived().TransformDecl(E->getBeginLoc(), E->getParam())); if (!Param) return ExprError(); @@ -10134,7 +10134,7 @@ ExprResult TreeTransform::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) { FieldDecl *Field - = cast_or_null(getDerived().TransformDecl(E->getLocStart(), + = cast_or_null(getDerived().TransformDecl(E->getBeginLoc(), E->getField())); if (!Field) return ExprError(); @@ -10196,7 +10196,7 @@ FunctionDecl *OperatorNew = nullptr; if (E->getOperatorNew()) { OperatorNew = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew())); if (!OperatorNew) return ExprError(); @@ -10205,7 +10205,7 @@ FunctionDecl *OperatorDelete = nullptr; if (E->getOperatorDelete()) { OperatorDelete = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete())); if (!OperatorDelete) return ExprError(); @@ -10221,9 +10221,9 @@ // Mark any declarations we need as referenced. // FIXME: instantiation-specific. if (OperatorNew) - SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorNew); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorNew); if (OperatorDelete) - SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorDelete); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete); if (E->isArray() && !E->getAllocatedType()->isDependentType()) { QualType ElementType @@ -10231,7 +10231,7 @@ if (const RecordType *RecordT = ElementType->getAs()) { CXXRecordDecl *Record = cast(RecordT->getDecl()); if (CXXDestructorDecl *Destructor = SemaRef.LookupDestructor(Record)) { - SemaRef.MarkFunctionReferenced(E->getLocStart(), Destructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Destructor); } } } @@ -10253,7 +10253,7 @@ = dyn_cast(ArrayT)) { ArraySize = IntegerLiteral::Create(SemaRef.Context, ConsArrayT->getSize(), SemaRef.Context.getSizeType(), - /*FIXME:*/ E->getLocStart()); + /*FIXME:*/ E->getBeginLoc()); AllocType = ConsArrayT->getElementType(); } else if (const DependentSizedArrayType *DepArrayT = dyn_cast(ArrayT)) { @@ -10264,11 +10264,11 @@ } } - return getDerived().RebuildCXXNewExpr(E->getLocStart(), + return getDerived().RebuildCXXNewExpr(E->getBeginLoc(), E->isGlobalNew(), - /*FIXME:*/E->getLocStart(), + /*FIXME:*/E->getBeginLoc(), PlacementArgs, - /*FIXME:*/E->getLocStart(), + /*FIXME:*/E->getBeginLoc(), E->getTypeIdParens(), AllocType, AllocTypeInfo, @@ -10288,7 +10288,7 @@ FunctionDecl *OperatorDelete = nullptr; if (E->getOperatorDelete()) { OperatorDelete = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete())); if (!OperatorDelete) return ExprError(); @@ -10300,14 +10300,14 @@ // Mark any declarations we need as referenced. // FIXME: instantiation-specific. if (OperatorDelete) - SemaRef.MarkFunctionReferenced(E->getLocStart(), OperatorDelete); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), OperatorDelete); if (!E->getArgument()->isTypeDependent()) { QualType Destroyed = SemaRef.Context.getBaseElementType( E->getDestroyedType()); if (const RecordType *DestroyedRec = Destroyed->getAs()) { CXXRecordDecl *Record = cast(DestroyedRec->getDecl()); - SemaRef.MarkFunctionReferenced(E->getLocStart(), + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), SemaRef.LookupDestructor(Record)); } } @@ -10315,7 +10315,7 @@ return E; } - return getDerived().RebuildCXXDeleteExpr(E->getLocStart(), + return getDerived().RebuildCXXDeleteExpr(E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(), Operand.get()); @@ -10652,7 +10652,7 @@ return E; return getDerived().RebuildTypeTrait(E->getTrait(), - E->getLocStart(), + E->getBeginLoc(), Args, E->getLocEnd()); } @@ -10681,7 +10681,7 @@ } return getDerived().RebuildArrayTypeTrait(E->getTrait(), - E->getLocStart(), + E->getBeginLoc(), T, SubExpr.get(), E->getLocEnd()); @@ -10703,7 +10703,7 @@ } return getDerived().RebuildExpressionTrait( - E->getTrait(), E->getLocStart(), SubExpr.get(), E->getLocEnd()); + E->getTrait(), E->getBeginLoc(), SubExpr.get(), E->getLocEnd()); } template @@ -10789,7 +10789,7 @@ !E->isListInitialization()) return getDerived().TransformExpr(E->getArg(0)); - TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName()); + TemporaryBase Rebase(*this, /*FIXME*/E->getBeginLoc(), DeclarationName()); QualType T = getDerived().TransformType(E->getType()); if (T.isNull()) @@ -10797,7 +10797,7 @@ CXXConstructorDecl *Constructor = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), + getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor())); if (!Constructor) return ExprError(); @@ -10814,11 +10814,11 @@ !ArgumentChanged) { // Mark the constructor as referenced. // FIXME: Instantiation-specific - SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor); return E; } - return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(), + return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getBeginLoc(), Constructor, E->isElidable(), Args, E->hadMultipleCandidates(), @@ -10837,7 +10837,7 @@ return ExprError(); CXXConstructorDecl *Constructor = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), E->getConstructor())); + getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor())); if (!Constructor) return ExprError(); @@ -10846,7 +10846,7 @@ Constructor == E->getConstructor()) { // Mark the constructor as referenced. // FIXME: Instantiation-specific - SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor); return E; } @@ -10887,7 +10887,7 @@ CXXConstructorDecl *Constructor = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), + getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor())); if (!Constructor) return ExprError(); @@ -10904,7 +10904,7 @@ Constructor == E->getConstructor() && !ArgumentChanged) { // FIXME: Instantiation-specific - SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor); return SemaRef.MaybeBindToTemporary(E); } @@ -11160,7 +11160,7 @@ if (Body.isInvalid()) { SavedContext.pop(); - getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/nullptr, + getSema().ActOnLambdaError(E->getBeginLoc(), /*CurScope=*/nullptr, /*IsInstantiation=*/true); return ExprError(); } @@ -11173,7 +11173,7 @@ /*IsInstantiation*/ true); SavedContext.pop(); - return getSema().BuildLambdaExpr(E->getLocStart(), Body.get()->getLocEnd(), + return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getLocEnd(), &LSICopy); } @@ -11620,7 +11620,7 @@ return E; return getDerived().RebuildCXXFoldExpr( - E->getLocStart(), LHS.get(), E->getOperator(), E->getEllipsisLoc(), + E->getBeginLoc(), LHS.get(), E->getOperator(), E->getEllipsisLoc(), RHS.get(), E->getLocEnd()); } @@ -11641,7 +11641,7 @@ return true; Result = getDerived().RebuildCXXFoldExpr( - E->getLocStart(), Out.get(), E->getOperator(), E->getEllipsisLoc(), + E->getBeginLoc(), Out.get(), E->getOperator(), E->getEllipsisLoc(), Result.get(), E->getLocEnd()); if (Result.isInvalid()) return true; @@ -11657,7 +11657,7 @@ if (Out.get()->containsUnexpandedParameterPack()) { // We still have a pack; retain a pack expansion for this slice. Result = getDerived().RebuildCXXFoldExpr( - E->getLocStart(), + E->getBeginLoc(), LeftFold ? Result.get() : Out.get(), E->getOperator(), E->getEllipsisLoc(), LeftFold ? Out.get() : Result.get(), @@ -11685,7 +11685,7 @@ return true; Result = getDerived().RebuildCXXFoldExpr( - E->getLocStart(), Result.get(), + E->getBeginLoc(), Result.get(), E->getOperator(), E->getEllipsisLoc(), Out.get(), E->getLocEnd()); if (Result.isInvalid()) @@ -11775,7 +11775,7 @@ bool RetainExpansion = false; Optional OrigNumExpansions = OrigElement.NumExpansions; Optional NumExpansions = OrigNumExpansions; - SourceRange PatternRange(OrigElement.Key->getLocStart(), + SourceRange PatternRange(OrigElement.Key->getBeginLoc(), OrigElement.Value->getLocEnd()); if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc, PatternRange, @@ -12652,7 +12652,7 @@ if (!First->getType()->isOverloadableType() && !Second->getType()->isOverloadableType()) return getSema().CreateBuiltinArraySubscriptExpr(First, - Callee->getLocStart(), + Callee->getBeginLoc(), Second, OpLoc); } else if (Op == OO_Arrow) { // -> is never a builtin operation. @@ -12727,7 +12727,7 @@ RBrace = SourceLocation::getFromRawEncoding( NameLoc.CXXOperatorName.EndOpNameLoc); } else { - LBrace = Callee->getLocStart(); + LBrace = Callee->getBeginLoc(); RBrace = OpLoc; } @@ -12799,7 +12799,7 @@ template StmtResult TreeTransform::TransformCapturedStmt(CapturedStmt *S) { - SourceLocation Loc = S->getLocStart(); + SourceLocation Loc = S->getBeginLoc(); CapturedDecl *CD = S->getCapturedDecl(); unsigned NumParams = CD->getNumParams(); unsigned ContextParamPos = CD->getContextParamPosition(); Index: lib/Serialization/ASTReader.cpp =================================================================== --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -9672,7 +9672,7 @@ unsigned NumBases = DD->NumBases; if (NumBases == 0) return SourceRange(); auto bases = DD->bases(); - return SourceRange(bases[0].getLocStart(), + return SourceRange(bases[0].getBeginLoc(), bases[NumBases - 1].getLocEnd()); }; @@ -10174,9 +10174,9 @@ unsigned FirstODRHash = ComputeODRHash(FirstExpr); unsigned SecondODRHash = ComputeODRHash(SecondExpr); if (FirstODRHash != SecondODRHash) { - ODRDiagError(FirstExpr->getLocStart(), FirstExpr->getSourceRange(), + ODRDiagError(FirstExpr->getBeginLoc(), FirstExpr->getSourceRange(), StaticAssertCondition); - ODRDiagNote(SecondExpr->getLocStart(), + ODRDiagNote(SecondExpr->getBeginLoc(), SecondExpr->getSourceRange(), StaticAssertCondition); Diagnosed = true; break; @@ -10189,17 +10189,17 @@ SourceLocation FirstLoc, SecondLoc; SourceRange FirstRange, SecondRange; if (FirstStr) { - FirstLoc = FirstStr->getLocStart(); + FirstLoc = FirstStr->getBeginLoc(); FirstRange = FirstStr->getSourceRange(); } else { - FirstLoc = FirstSA->getLocStart(); + FirstLoc = FirstSA->getBeginLoc(); FirstRange = FirstSA->getSourceRange(); } if (SecondStr) { - SecondLoc = SecondStr->getLocStart(); + SecondLoc = SecondStr->getBeginLoc(); SecondRange = SecondStr->getSourceRange(); } else { - SecondLoc = SecondSA->getLocStart(); + SecondLoc = SecondSA->getBeginLoc(); SecondRange = SecondSA->getSourceRange(); } ODRDiagError(FirstLoc, FirstRange, StaticAssertOnlyMessage) @@ -10212,9 +10212,9 @@ if (FirstStr && SecondStr && FirstStr->getString() != SecondStr->getString()) { - ODRDiagError(FirstStr->getLocStart(), FirstStr->getSourceRange(), + ODRDiagError(FirstStr->getBeginLoc(), FirstStr->getSourceRange(), StaticAssertMessage); - ODRDiagNote(SecondStr->getLocStart(), SecondStr->getSourceRange(), + ODRDiagNote(SecondStr->getBeginLoc(), SecondStr->getSourceRange(), StaticAssertMessage); Diagnosed = true; break; Index: lib/Serialization/ASTWriter.cpp =================================================================== --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5254,7 +5254,7 @@ } Record.push_back(RD->getTagKind()); Record.AddSourceLocation(RD->getLocation()); - Record.AddSourceLocation(RD->getLocStart()); + Record.AddSourceLocation(RD->getBeginLoc()); Record.AddSourceRange(RD->getBraceRange()); // Instantiation may change attributes; write them all out afresh. Index: lib/Serialization/ASTWriterDecl.cpp =================================================================== --- lib/Serialization/ASTWriterDecl.cpp +++ lib/Serialization/ASTWriterDecl.cpp @@ -328,7 +328,7 @@ StringRef Arg = D->getArg(); Record.push_back(Arg.size()); VisitDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.push_back(D->getCommentKind()); Record.AddString(Arg); Code = serialization::DECL_PRAGMA_COMMENT; @@ -340,7 +340,7 @@ StringRef Value = D->getValue(); Record.push_back(Name.size() + 1 + Value.size()); VisitDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.AddString(Name); Record.AddString(Value); Code = serialization::DECL_PRAGMA_DETECT_MISMATCH; @@ -360,7 +360,7 @@ void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) { VisitNamedDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.AddTypeRef(QualType(D->getTypeForDecl(), 0)); } @@ -854,7 +854,7 @@ void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) { VisitDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.AddDeclRef(D->getPropertyDecl()); Record.AddDeclRef(D->getPropertyIvarDecl()); Record.AddSourceLocation(D->getPropertyIvarDeclLoc()); @@ -1142,7 +1142,7 @@ void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) { VisitNamedDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Code = serialization::DECL_LABEL; } @@ -1151,7 +1151,7 @@ VisitRedeclarable(D); VisitNamedDecl(D); Record.push_back(D->isInline()); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.AddSourceLocation(D->getRBraceLoc()); if (D->isOriginalNamespace()) @@ -1733,7 +1733,7 @@ void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) { VisitValueDecl(D); - Record.AddSourceLocation(D->getLocStart()); + Record.AddSourceLocation(D->getBeginLoc()); Record.AddStmt(D->getCombiner()); Record.AddStmt(D->getInitializer()); Record.push_back(D->getInitializerKind()); Index: lib/Serialization/ASTWriterStmt.cpp =================================================================== --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1823,7 +1823,7 @@ void OMPClauseWriter::writeClause(OMPClause *C) { Record.push_back(C->getClauseKind()); Visit(C); - Record.AddSourceLocation(C->getLocStart()); + Record.AddSourceLocation(C->getBeginLoc()); Record.AddSourceLocation(C->getLocEnd()); } @@ -2278,7 +2278,7 @@ // OpenMP Directives. //===----------------------------------------------------------------------===// void ASTStmtWriter::VisitOMPExecutableDirective(OMPExecutableDirective *E) { - Record.AddSourceLocation(E->getLocStart()); + Record.AddSourceLocation(E->getBeginLoc()); Record.AddSourceLocation(E->getLocEnd()); OMPClauseWriter ClauseWriter(Record); for (unsigned i = 0; i < E->getNumClauses(); ++i) { Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -262,7 +262,7 @@ currentBlock = block; // Skip statements in macros. - if (S->getLocStart().isMacroID()) + if (S->getBeginLoc().isMacroID()) return; // Only cover dead stores from regular assignments. ++/-- dead stores Index: lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp +++ lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp @@ -287,7 +287,7 @@ CheckerContext &C) const { const LangOptions &Opts = C.getLangOpts(); const SourceManager &SM = C.getSourceManager(); - FullSourceLoc FL(CE->getArg(0)->getLocStart(), SM); + FullSourceLoc FL(CE->getArg(0)->getBeginLoc(), SM); std::string HashContent = GetIssueString(SM, FL, getCheckName().getName(), "Category", C.getLocationContext()->getDecl(), Opts); Index: lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp +++ lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp @@ -83,7 +83,7 @@ // that dispatch_once is a macro that wraps a call to _dispatch_once. // _dispatch_once is then a function which then calls the real dispatch_once. // Users do not care; they just want the warning at the top-level call. - if (CE->getLocStart().isMacroID()) { + if (CE->getBeginLoc().isMacroID()) { StringRef TrimmedFName = FName.ltrim('_'); if (TrimmedFName != FName) FName = TrimmedFName; Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -311,7 +311,7 @@ // Retrieve the associated statement. const Stmt *S = TrackedNullab->getNullabilitySource(); - if (!S || S->getLocStart().isInvalid()) { + if (!S || S->getBeginLoc().isInvalid()) { S = PathDiagnosticLocation::getStmt(N); } @@ -766,7 +766,7 @@ // CG headers are misannotated. Do not warn for symbols that are the results // of CG calls. const SourceManager &SM = C.getSourceManager(); - StringRef FilePath = SM.getFilename(SM.getSpellingLoc(Decl->getLocStart())); + StringRef FilePath = SM.getFilename(SM.getSpellingLoc(Decl->getBeginLoc())); if (llvm::sys::path::filename(FilePath).startswith("CG")) { State = State->set(Region, Nullability::Contradicted); C.addTransition(State); Index: lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp +++ lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp @@ -77,7 +77,7 @@ // to zero literals in non-pedantic mode. // FIXME: Introduce an AST matcher to implement the macro-related logic? bool MacroIndicatesWeShouldSkipTheCheck = false; - SourceLocation Loc = CheckIfNull->getLocStart(); + SourceLocation Loc = CheckIfNull->getBeginLoc(); if (Loc.isMacroID()) { StringRef MacroName = Lexer::getImmediateMacroName( Loc, ACtx.getSourceManager(), ACtx.getLangOpts()); Index: lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp +++ lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp @@ -98,7 +98,7 @@ SourceManager &SM) { for (const auto *I : C->decls()) if (const auto *FD = dyn_cast(I)) { - SourceLocation L = FD->getLocStart(); + SourceLocation L = FD->getBeginLoc(); if (SM.getFileID(L) == FID) Scan(M, FD->getBody()); } Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2526,7 +2526,7 @@ if (RegionDescription) { os << " stored into '" << *RegionDescription << '\''; if (IncludeAllocationLine) { - FullSourceLoc SL(AllocStmt->getLocStart(), Ctx.getSourceManager()); + FullSourceLoc SL(AllocStmt->getBeginLoc(), Ctx.getSourceManager()); os << " (allocated on line " << SL.getSpellingLineNumber() << ")"; } } Index: lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp @@ -79,17 +79,17 @@ const CompoundLiteralExpr *CL = CR->getLiteralExpr(); os << "stack memory associated with a compound literal " "declared on line " - << SM.getExpansionLineNumber(CL->getLocStart()) << " returned to caller"; + << SM.getExpansionLineNumber(CL->getBeginLoc()) << " returned to caller"; range = CL->getSourceRange(); } else if (const auto *AR = dyn_cast(R)) { const Expr *ARE = AR->getExpr(); - SourceLocation L = ARE->getLocStart(); + SourceLocation L = ARE->getBeginLoc(); range = ARE->getSourceRange(); os << "stack memory allocated by call to alloca() on line " << SM.getExpansionLineNumber(L); } else if (const auto *BR = dyn_cast(R)) { const BlockDecl *BD = BR->getCodeRegion()->getDecl(); - SourceLocation L = BD->getLocStart(); + SourceLocation L = BD->getBeginLoc(); range = BD->getSourceRange(); os << "stack-allocated block declared on line " << SM.getExpansionLineNumber(L); Index: lib/StaticAnalyzer/Checkers/TraversalChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/TraversalChecker.cpp +++ lib/StaticAnalyzer/Checkers/TraversalChecker.cpp @@ -47,7 +47,7 @@ // It is mildly evil to print directly to llvm::outs() rather than emitting // warnings, but this ensures things do not get filtered out by the rest of // the static analyzer machinery. - SourceLocation Loc = Parent->getLocStart(); + SourceLocation Loc = Parent->getBeginLoc(); llvm::outs() << C.getSourceManager().getSpellingLineNumber(Loc) << " " << Parent->getStmtClassName() << "\n"; } Index: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -150,7 +150,7 @@ if (const Stmt *S = getUnreachableStmt(CB)) { // In macros, 'do {...} while (0)' is often used. Don't warn about the // condition 0 when it is unreachable. - if (S->getLocStart().isMacroID()) + if (S->getBeginLoc().isMacroID()) if (const auto *I = dyn_cast(S)) if (I->getValue() == 0ULL) if (const Stmt *Parent = PM->getParent(S)) Index: lib/StaticAnalyzer/Core/BugReporter.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporter.cpp +++ lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1632,8 +1632,8 @@ if (isConditionForTerminator(end, endParent)) continue; - SourceLocation FirstLoc = start->getLocStart(); - SourceLocation SecondLoc = end->getLocStart(); + SourceLocation FirstLoc = start->getBeginLoc(); + SourceLocation SecondLoc = end->getBeginLoc(); if (!SM.isWrittenInSameFile(FirstLoc, SecondLoc)) continue; Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -596,7 +596,7 @@ if (auto Loc = matchAssignment(N, BRC)) { if (isFunctionMacroExpansion(*Loc, SMgr)) { std::string MacroName = getMacroName(*Loc, BRC); - SourceLocation BugLoc = BugPoint->getStmt()->getLocStart(); + SourceLocation BugLoc = BugPoint->getStmt()->getBeginLoc(); if (!BugLoc.isMacroID() || getMacroName(BugLoc, BRC) != MacroName) BR.markInvalid(getTag(), MacroName.c_str()); } @@ -645,12 +645,12 @@ if (const Expr *RHS = VD->getInit()) if (RegionOfInterest->isSubRegionOf( State->getLValue(VD, LCtx).getAsRegion())) - return RHS->getLocStart(); + return RHS->getBeginLoc(); } else if (const auto *BO = dyn_cast(S)) { const MemRegion *R = N->getSVal(BO->getLHS()).getAsRegion(); const Expr *RHS = BO->getRHS(); if (BO->isAssignmentOp() && RegionOfInterest->isSubRegionOf(R)) { - return RHS->getLocStart(); + return RHS->getBeginLoc(); } } return None; @@ -1387,7 +1387,7 @@ CurTerminatorStmt = BE->getSrc()->getTerminator().getStmt(); } else if (auto SP = CurPoint.getAs()) { const Stmt *CurStmt = SP->getStmt(); - if (!CurStmt->getLocStart().isMacroID()) + if (!CurStmt->getBeginLoc().isMacroID()) return nullptr; CFGStmtMap *Map = CurLC->getAnalysisDeclContext()->getCFGStmtMap(); @@ -1399,9 +1399,9 @@ if (!CurTerminatorStmt) return nullptr; - SourceLocation TerminatorLoc = CurTerminatorStmt->getLocStart(); + SourceLocation TerminatorLoc = CurTerminatorStmt->getBeginLoc(); if (TerminatorLoc.isMacroID()) { - SourceLocation BugLoc = BugPoint->getStmt()->getLocStart(); + SourceLocation BugLoc = BugPoint->getStmt()->getBeginLoc(); // Suppress reports unless we are in that same macro. if (!BugLoc.isMacroID() || @@ -1943,7 +1943,7 @@ // Use heuristics to determine if Ex is a macro expending to a literal and // if so, use the macro's name. - SourceLocation LocStart = Ex->getLocStart(); + SourceLocation LocStart = Ex->getBeginLoc(); SourceLocation LocEnd = Ex->getLocEnd(); if (LocStart.isMacroID() && LocEnd.isMacroID() && (isa(Ex) || @@ -1958,9 +1958,9 @@ bool beginAndEndAreTheSameMacro = StartName.equals(EndName); bool partOfParentMacro = false; - if (ParentEx->getLocStart().isMacroID()) { + if (ParentEx->getBeginLoc().isMacroID()) { StringRef PName = Lexer::getImmediateMacroNameForDiagnostics( - ParentEx->getLocStart(), BRC.getSourceManager(), + ParentEx->getBeginLoc(), BRC.getSourceManager(), BRC.getASTContext().getLangOpts()); partOfParentMacro = PName.equals(StartName); } Index: lib/StaticAnalyzer/Core/CheckerHelpers.cpp =================================================================== --- lib/StaticAnalyzer/Core/CheckerHelpers.cpp +++ lib/StaticAnalyzer/Core/CheckerHelpers.cpp @@ -21,7 +21,7 @@ // Recursively find any substatements containing macros bool containsMacro(const Stmt *S) { - if (S->getLocStart().isMacroID()) + if (S->getBeginLoc().isMacroID()) return true; if (S->getLocEnd().isMacroID()) Index: lib/StaticAnalyzer/Core/ExprEngine.cpp =================================================================== --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -745,7 +745,7 @@ G.reclaimRecentlyAllocatedNodes(); PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - currStmt->getLocStart(), + currStmt->getBeginLoc(), "Error evaluating statement"); // Remove dead bindings and symbols. @@ -772,7 +772,7 @@ void ExprEngine::ProcessLoopExit(const Stmt* S, ExplodedNode *Pred) { PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - S->getLocStart(), + S->getBeginLoc(), "Error evaluating end of the loop"); ExplodedNodeSet Dst; Dst.Add(Pred); @@ -916,7 +916,7 @@ else { NodeBuilder Bldr(Pred, Dst, *currBldrCtx); const LocationContext *LCtx = Pred->getLocationContext(); - PostImplicitCall PP(NE->getOperatorNew(), NE->getLocStart(), LCtx); + PostImplicitCall PP(NE->getOperatorNew(), NE->getBeginLoc(), LCtx); Bldr.generateNode(PP, Pred->getState(), Pred); } Engine.enqueue(Dst, currBldrCtx->getBlock(), currStmtIdx); @@ -973,7 +973,7 @@ const CXXRecordDecl *RD = BTy->getAsCXXRecordDecl(); const CXXDestructorDecl *Dtor = RD->getDestructor(); - PostImplicitCall PP(Dtor, DE->getLocStart(), LCtx); + PostImplicitCall PP(Dtor, DE->getBeginLoc(), LCtx); NodeBuilder Bldr(Pred, Dst, *currBldrCtx); Bldr.generateNode(PP, Pred->getState(), Pred); return; @@ -1064,7 +1064,7 @@ State = cleanupElidedDestructor(State, BTE, LC); NodeBuilder Bldr(Pred, Dst, *currBldrCtx); PostImplicitCall PP(D.getDestructorDecl(getContext()), - D.getBindTemporaryExpr()->getLocStart(), + D.getBindTemporaryExpr()->getBeginLoc(), Pred->getLocationContext()); Bldr.generateNode(PP, State, Pred); return; @@ -1172,7 +1172,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &DstTop) { PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - S->getLocStart(), + S->getBeginLoc(), "Error evaluating statement"); ExplodedNodeSet Dst; StmtNodeBuilder Bldr(Pred, DstTop, *currBldrCtx); @@ -2079,7 +2079,7 @@ Condition = ResolveCondition(Condition, BldCtx.getBlock()); PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - Condition->getLocStart(), + Condition->getBeginLoc(), "Error evaluating branch"); ExplodedNodeSet CheckersOutSet; @@ -3085,7 +3085,7 @@ << E.getDst()->getBlockID() << ')'; if (const Stmt *T = E.getSrc()->getTerminator()) { - SourceLocation SLoc = T->getLocStart(); + SourceLocation SLoc = T->getBeginLoc(); Out << "\\|Terminator: "; LangOptions LO; // FIXME. @@ -3147,7 +3147,7 @@ Out << S->getStmtClassName() << ' ' << (const void*) S << ' '; LangOptions LO; // FIXME. S->printPretty(Out, nullptr, PrintingPolicy(LO)); - printLocation(Out, S->getLocStart()); + printLocation(Out, S->getBeginLoc()); if (Loc.getAs()) Out << "\\lPreStmt\\l;"; Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -194,7 +194,7 @@ FullSourceLoc L( SMgr.getExpansionLoc(path.back()->getLocation().asLocation()), SMgr); - FullSourceLoc FunL(SMgr.getExpansionLoc(Body->getLocStart()), SMgr); + FullSourceLoc FunL(SMgr.getExpansionLoc(Body->getBeginLoc()), SMgr); offsetDecl = L.getExpansionLineNumber() - FunL.getExpansionLineNumber(); } } Index: lib/StaticAnalyzer/Core/PathDiagnostic.cpp =================================================================== --- lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -536,7 +536,7 @@ static SourceLocation getValidSourceLocation(const Stmt* S, LocationOrAnalysisDeclContext LAC, bool UseEnd = false) { - SourceLocation L = UseEnd ? S->getLocEnd() : S->getLocStart(); + SourceLocation L = UseEnd ? S->getLocEnd() : S->getBeginLoc(); assert(!LAC.isNull() && "A valid LocationContext or AnalysisDeclContext should " "be passed to PathDiagnosticLocation upon creation."); @@ -562,13 +562,13 @@ if (!Parent) { const Stmt *Body = ADC->getBody(); if (Body) - L = Body->getLocStart(); + L = Body->getBeginLoc(); else L = ADC->getDecl()->getLocEnd(); break; } - L = UseEnd ? Parent->getLocEnd() : Parent->getLocStart(); + L = UseEnd ? Parent->getLocEnd() : Parent->getBeginLoc(); } while (!L.isValid()); } @@ -635,7 +635,7 @@ PathDiagnosticLocation PathDiagnosticLocation::createBegin(const Decl *D, const SourceManager &SM) { - return PathDiagnosticLocation(D->getLocStart(), SM, SingleLocK); + return PathDiagnosticLocation(D->getBeginLoc(), SM, SingleLocK); } PathDiagnosticLocation @@ -695,7 +695,7 @@ // FIXME: Should handle CXXTryStmt if analyser starts supporting C++. if (const auto *CS = dyn_cast_or_null(LC->getDecl()->getBody())) if (!CS->body_empty()) { - SourceLocation Loc = (*CS->body_begin())->getLocStart(); + SourceLocation Loc = (*CS->body_begin())->getBeginLoc(); return PathDiagnosticLocation(Loc, SM, SingleLocK); } @@ -736,10 +736,10 @@ } else if (Optional BE = P.getAs()) { CFGElement BlockFront = BE->getBlock()->front(); if (auto StmtElt = BlockFront.getAs()) { - return PathDiagnosticLocation(StmtElt->getStmt()->getLocStart(), SMng); + return PathDiagnosticLocation(StmtElt->getStmt()->getBeginLoc(), SMng); } else if (auto NewAllocElt = BlockFront.getAs()) { return PathDiagnosticLocation( - NewAllocElt->getAllocatorExpr()->getLocStart(), SMng); + NewAllocElt->getAllocatorExpr()->getBeginLoc(), SMng); } llvm_unreachable("Unexpected CFG element at front of block"); } else { @@ -845,7 +845,7 @@ if (P.getAs()) return PathDiagnosticLocation::createEnd(S, SM, LC); - if (S->getLocStart().isValid()) + if (S->getBeginLoc().isValid()) return PathDiagnosticLocation(S, SM, LC); return PathDiagnosticLocation(getValidSourceLocation(S, LC), SM); } @@ -904,7 +904,7 @@ const auto *DS = cast(S); if (DS->isSingleDecl()) { // Should always be the case, but we'll be defensive. - return SourceRange(DS->getLocStart(), + return SourceRange(DS->getBeginLoc(), DS->getSingleDecl()->getLocation()); } break; Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp =================================================================== --- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -508,14 +508,14 @@ // site and the end of scope (leak report location). if (UPDLoc.isValid()) { FullSourceLoc UFunL(SM->getExpansionLoc( - D->getUniqueingDecl()->getBody()->getLocStart()), *SM); + D->getUniqueingDecl()->getBody()->getBeginLoc()), *SM); o << " issue_hash_function_offset" << L.getExpansionLineNumber() - UFunL.getExpansionLineNumber() << "\n"; // Otherwise, use the location on which the bug is reported. } else { - FullSourceLoc FunL(SM->getExpansionLoc(Body->getLocStart()), *SM); + FullSourceLoc FunL(SM->getExpansionLoc(Body->getBeginLoc()), *SM); o << " issue_hash_function_offset" << L.getExpansionLineNumber() - FunL.getExpansionLineNumber() << "\n"; Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -682,7 +682,7 @@ // - System headers: don't run any checks. SourceManager &SM = Ctx->getSourceManager(); const Stmt *Body = D->getBody(); - SourceLocation SL = Body ? Body->getLocStart() : D->getLocation(); + SourceLocation SL = Body ? Body->getBeginLoc() : D->getLocation(); SL = SM.getExpansionLoc(SL); if (!Opts->AnalyzeAll && !Mgr->isInCodeFile(SL)) { Index: lib/Tooling/Refactoring/Extract/Extract.cpp =================================================================== --- lib/Tooling/Refactoring/Extract/Extract.cpp +++ lib/Tooling/Refactoring/Extract/Extract.cpp @@ -52,7 +52,7 @@ while (const auto *RD = dyn_cast(D->getLexicalDeclContext())) D = RD; } - return D->getLocStart(); + return D->getBeginLoc(); } } // end anonymous namespace @@ -102,7 +102,7 @@ assert(ParentDecl && "missing parent"); // Compute the source range of the code that should be extracted. - SourceRange ExtractedRange(Code[0]->getLocStart(), + SourceRange ExtractedRange(Code[0]->getBeginLoc(), Code[Code.size() - 1]->getLocEnd()); // FIXME (Alex L): Add code that accounts for macro locations. Index: lib/Tooling/Refactoring/Rename/USRFinder.cpp =================================================================== --- lib/Tooling/Refactoring/Rename/USRFinder.cpp +++ lib/Tooling/Refactoring/Rename/USRFinder.cpp @@ -83,7 +83,7 @@ // see. If both start and end is either before or after the point we're // looking for the point cannot be inside of this decl. Don't even look at it. for (auto *CurrDecl : Context.getTranslationUnitDecl()->decls()) { - SourceLocation StartLoc = CurrDecl->getLocStart(); + SourceLocation StartLoc = CurrDecl->getBeginLoc(); SourceLocation EndLoc = CurrDecl->getLocEnd(); if (StartLoc.isValid() && EndLoc.isValid() && SM.isBeforeInTranslationUnit(StartLoc, Point) != Index: lib/Tooling/Refactoring/Rename/USRLocFinder.cpp =================================================================== --- lib/Tooling/Refactoring/Rename/USRLocFinder.cpp +++ lib/Tooling/Refactoring/Rename/USRLocFinder.cpp @@ -117,7 +117,7 @@ return NestedNameSpecifier.getBeginLoc(); TL = TL.getNextTypeLoc(); } - return TL.getLocStart(); + return TL.getBeginLoc(); } SourceLocation EndLocationForType(TypeLoc TL) { @@ -255,7 +255,7 @@ Decl = UsingShadow->getTargetDecl(); } - auto StartLoc = Expr->getLocStart(); + auto StartLoc = Expr->getBeginLoc(); // For template function call expressions like `foo()`, we want to // restrict the end of location to just before the `<` character. SourceLocation EndLoc = Expr->hasExplicitTemplateArgs() @@ -576,7 +576,7 @@ // Hanlde using declarations explicitly as "using a::Foo" don't trigger // typeLoc for "a::Foo". for (const auto *Using : Finder.getUsingDecls()) - Replace(Using->getLocStart(), Using->getLocEnd(), "using " + NewName.str()); + Replace(Using->getBeginLoc(), Using->getLocEnd(), "using " + NewName.str()); return AtomicChanges; } Index: tools/clang-func-mapping/ClangFnMapGen.cpp =================================================================== --- tools/clang-func-mapping/ClangFnMapGen.cpp +++ tools/clang-func-mapping/ClangFnMapGen.cpp @@ -80,7 +80,7 @@ case ExternalLinkage: case VisibleNoLinkage: case UniqueExternalLinkage: - if (SM.isInMainFile(Body->getLocStart())) + if (SM.isInMainFile(Body->getBeginLoc())) Index[LookupName] = CurrentFileName; default: break; Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -565,7 +565,7 @@ if (const ObjCObjectType *ObjT = A->getInterface()->getAs()) return Visit(cxcursor::MakeCursorObjCClassRef( ObjT->getInterface(), - A->getInterfaceLoc()->getTypeLoc().getLocStart(), TU)); + A->getInterfaceLoc()->getTypeLoc().getBeginLoc(), TU)); } // If pointing inside a macro definition, check if the token is an identifier @@ -993,7 +993,7 @@ Decl *D_next = *next; if (!D_next) break; - SourceLocation L = D_next->getLocStart(); + SourceLocation L = D_next->getBeginLoc(); if (!L.isValid()) break; if (SM.isBeforeInTranslationUnit(L, EndLoc)) { @@ -1038,7 +1038,7 @@ // additional ones we've collected. Then visit them. for (auto *SubDecl : D->decls()) { if (!SubDecl || SubDecl->getLexicalDeclContext() != D || - SubDecl->getLocStart().isInvalid()) + SubDecl->getBeginLoc().isInvalid()) continue; DeclsInContainer.push_back(SubDecl); } @@ -1046,8 +1046,8 @@ // Now sort the Decls so that they appear in lexical order. llvm::sort(DeclsInContainer.begin(), DeclsInContainer.end(), [&SM](Decl *A, Decl *B) { - SourceLocation L_A = A->getLocStart(); - SourceLocation L_B = B->getLocStart(); + SourceLocation L_A = A->getBeginLoc(); + SourceLocation L_B = B->getBeginLoc(); return L_A != L_B ? SM.isBeforeInTranslationUnit(L_A, L_B) : SM.isBeforeInTranslationUnit(A->getLocEnd(), B->getLocEnd()); @@ -1578,7 +1578,7 @@ } bool CursorVisitor::VisitObjCTypeParamTypeLoc(ObjCTypeParamTypeLoc TL) { - if (Visit(MakeCursorTypeRef(TL.getDecl(), TL.getLocStart(), TU))) + if (Visit(MakeCursorTypeRef(TL.getDecl(), TL.getBeginLoc(), TU))) return true; for (unsigned I = 0, N = TL.getNumProtocols(); I != N; ++I) { if (Visit(MakeCursorObjCProtocolRef(TL.getProtocol(I), TL.getProtocolLoc(I), @@ -4341,7 +4341,7 @@ if (const ObjCPropertyRefExpr *PropRef = dyn_cast(E)) return PropRef->getLocation(); - return E->getLocStart(); + return E->getBeginLoc(); } extern "C" { @@ -5754,7 +5754,7 @@ TSInfo->getTypeLoc().getBeginLoc()); return cxloc::translateSourceLocation(getCursorContext(C), - BaseSpec->getLocStart()); + BaseSpec->getBeginLoc()); } case CXCursor_LabelRef: { @@ -5778,7 +5778,7 @@ if (clang_isStatement(C.kind)) return cxloc::translateSourceLocation(getCursorContext(C), - getCursorStmt(C)->getLocStart()); + getCursorStmt(C)->getBeginLoc()); if (C.kind == CXCursor_PreprocessingDirective) { SourceLocation L = cxcursor::getCursorPreprocessingDirective(C).getBegin(); @@ -5978,10 +5978,10 @@ SourceLocation StartLoc; if (const DeclaratorDecl *DD = dyn_cast(D)) { if (TypeSourceInfo *TI = DD->getTypeSourceInfo()) - StartLoc = TI->getTypeLoc().getLocStart(); + StartLoc = TI->getTypeLoc().getBeginLoc(); } else if (const TypedefDecl *Typedef = dyn_cast(D)) { if (TypeSourceInfo *TI = Typedef->getTypeSourceInfo()) - StartLoc = TI->getTypeLoc().getLocStart(); + StartLoc = TI->getTypeLoc().getBeginLoc(); } if (StartLoc.isValid() && R.getBegin().isValid() && @@ -7031,9 +7031,9 @@ const Expr *E = getCursorExpr(cursor); if (const Decl *D = getCursorParentDecl(cursor)) { const unsigned I = NextToken(); - if (E->getLocStart().isValid() && D->getLocation().isValid() && - E->getLocStart() == D->getLocation() && - E->getLocStart() == GetTokenLoc(I)) { + if (E->getBeginLoc().isValid() && D->getLocation().isValid() && + E->getBeginLoc() == D->getLocation() && + E->getBeginLoc() == GetTokenLoc(I)) { updateCursorAnnotation(Cursors[I], updateC); AdvanceToken(); } Index: tools/libclang/CXIndexDataConsumer.cpp =================================================================== --- tools/libclang/CXIndexDataConsumer.cpp +++ tools/libclang/CXIndexDataConsumer.cpp @@ -307,7 +307,7 @@ const IBOutletCollectionAttr * IBAttr = cast(IBInfo.A); SourceLocation InterfaceLocStart = - IBAttr->getInterfaceLoc()->getTypeLoc().getLocStart(); + IBAttr->getInterfaceLoc()->getTypeLoc().getBeginLoc(); IBInfo.IBCollInfo.attrInfo = &IBInfo; IBInfo.IBCollInfo.classLoc = IdxCtx.getIndexLoc(InterfaceLocStart); IBInfo.IBCollInfo.objcClass = nullptr; Index: unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp =================================================================== --- unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp +++ unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp @@ -61,7 +61,7 @@ } template void match(StringRef Path, const T *D) { - Match(Path, D->getLocStart()); + Match(Path, D->getBeginLoc()); } }; Index: unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp +++ unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp @@ -16,7 +16,7 @@ class VarDeclVisitor : public ExpectedLocationVisitor { public: bool VisitVarDecl(VarDecl *Variable) { - Match(Variable->getNameAsString(), Variable->getLocStart()); + Match(Variable->getNameAsString(), Variable->getBeginLoc()); return true; } }; @@ -36,7 +36,7 @@ bool shouldVisitImplicitCode() const { return true; } bool VisitParmVarDecl(ParmVarDecl *ParamVar) { - Match(ParamVar->getNameAsString(), ParamVar->getLocStart()); + Match(ParamVar->getNameAsString(), ParamVar->getBeginLoc()); return true; } }; Index: unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp @@ -18,7 +18,7 @@ class AttrVisitor : public ExpectedLocationVisitor { public: bool VisitMemberExpr(MemberExpr *ME) { - Match(ME->getMemberDecl()->getNameAsString(), ME->getLocStart()); + Match(ME->getMemberDecl()->getNameAsString(), ME->getBeginLoc()); return true; } bool VisitAttr(Attr *A) { Index: unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp @@ -18,7 +18,7 @@ public: bool VisitCXXMemberCallExpr(CXXMemberCallExpr *Call) { Match(Call->getMethodDecl()->getQualifiedNameAsString(), - Call->getLocStart()); + Call->getBeginLoc()); return true; } }; Index: unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp @@ -19,7 +19,7 @@ bool shouldTraversePostOrder() const { return true; } bool VisitInitListExpr(InitListExpr *ILE) { - Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getLocStart()); + Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getBeginLoc()); return true; } }; Index: unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp @@ -23,7 +23,7 @@ } bool VisitInitListExpr(InitListExpr *ILE) { - Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getLocStart()); + Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getBeginLoc()); return true; } }; Index: unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp @@ -19,7 +19,7 @@ : public ExpectedLocationVisitor { public: bool VisitInitListExpr(InitListExpr *ILE) { - Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getLocStart()); + Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getBeginLoc()); return true; } }; Index: unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp =================================================================== --- unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp +++ unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp @@ -21,7 +21,7 @@ } bool VisitInitListExpr(InitListExpr *ILE) { - Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getLocStart()); + Match(ILE->isSemanticForm() ? "semantic" : "syntactic", ILE->getBeginLoc()); return true; } };