Index: cfe/trunk/docs/RAVFrontendAction.rst =================================================================== --- cfe/trunk/docs/RAVFrontendAction.rst +++ cfe/trunk/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: cfe/trunk/include/clang/AST/Comment.h =================================================================== --- cfe/trunk/include/clang/AST/Comment.h +++ cfe/trunk/include/clang/AST/Comment.h @@ -349,8 +349,7 @@ } SourceRange getCommandNameRange() const { - return SourceRange(getLocStart().getLocWithOffset(-1), - getLocEnd()); + return SourceRange(getBeginLoc().getLocWithOffset(-1), getLocEnd()); } RenderKind getRenderKind() const { @@ -564,9 +563,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) { @@ -660,13 +659,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 { @@ -686,7 +685,7 @@ if (Args.size() > 0) { SourceLocation NewLocEnd = Args.back().Range.getEnd(); if (NewLocEnd.isValid()) - setSourceRange(SourceRange(getLocStart(), NewLocEnd)); + setSourceRange(SourceRange(getBeginLoc(), NewLocEnd)); } } @@ -702,7 +701,7 @@ Paragraph = PC; SourceLocation NewLocEnd = PC->getLocEnd(); if (NewLocEnd.isValid()) - setSourceRange(SourceRange(getLocStart(), NewLocEnd)); + setSourceRange(SourceRange(getBeginLoc(), NewLocEnd)); } CommandMarkerKind getCommandMarker() const LLVM_READONLY { @@ -1103,9 +1102,9 @@ if (Blocks.empty()) return; - setSourceRange(SourceRange(Blocks.front()->getLocStart(), - Blocks.back()->getLocEnd())); - setLocation(Blocks.front()->getLocStart()); + setSourceRange( + SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getLocEnd())); + setLocation(Blocks.front()->getBeginLoc()); } static bool classof(const Comment *C) { Index: cfe/trunk/include/clang/AST/Decl.h =================================================================== --- cfe/trunk/include/clang/AST/Decl.h +++ cfe/trunk/include/clang/AST/Decl.h @@ -3117,7 +3117,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: cfe/trunk/include/clang/AST/DeclCXX.h =================================================================== --- cfe/trunk/include/clang/AST/DeclCXX.h +++ cfe/trunk/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). @@ -3687,7 +3687,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: cfe/trunk/include/clang/AST/DeclObjC.h =================================================================== --- cfe/trunk/include/clang/AST/DeclObjC.h +++ cfe/trunk/include/clang/AST/DeclObjC.h @@ -290,7 +290,7 @@ SourceLocation getSelectorStartLoc() const { if (isImplicit()) - return getLocStart(); + return getBeginLoc(); return getSelectorLoc(0); } Index: cfe/trunk/include/clang/AST/DeclarationName.h =================================================================== --- cfe/trunk/include/clang/AST/DeclarationName.h +++ cfe/trunk/include/clang/AST/DeclarationName.h @@ -639,7 +639,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(); } @@ -647,7 +647,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: Index: cfe/trunk/include/clang/AST/Expr.h =================================================================== --- cfe/trunk/include/clang/AST/Expr.h +++ cfe/trunk/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 { @@ -1550,7 +1550,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return Val->getLocStart(); + return Val->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { return Val->getLocEnd(); } @@ -1896,7 +1896,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 { @@ -2282,7 +2282,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; } @@ -2798,7 +2798,7 @@ if (!Init) return SourceLocation(); if (LParenLoc.isInvalid()) - return Init->getLocStart(); + return Init->getBeginLoc(); return LParenLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } @@ -2998,7 +2998,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 { @@ -3191,7 +3191,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 { @@ -3476,7 +3476,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 { @@ -3566,7 +3566,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 { @@ -4471,7 +4471,7 @@ return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc(); } SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getLocStart(), getLocEnd()); + return SourceRange(getBeginLoc(), getLocEnd()); } }; @@ -4710,7 +4710,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 { @@ -5026,7 +5026,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; } @@ -5276,7 +5276,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: cfe/trunk/include/clang/AST/ExprCXX.h =================================================================== --- cfe/trunk/include/clang/AST/ExprCXX.h +++ cfe/trunk/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) { @@ -532,7 +532,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(); } @@ -643,7 +643,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(); } @@ -785,7 +785,7 @@ MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {} SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(getLocStart(), getLocEnd()); + return SourceRange(getBeginLoc(), getLocEnd()); } bool isImplicitAccess() const { @@ -795,7 +795,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 @@ -865,7 +865,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(); } @@ -1271,7 +1271,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(); } @@ -2397,7 +2397,7 @@ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } SourceLocation getBeginLoc() const LLVM_READONLY { - return Base->getLocStart(); + return Base->getBeginLoc(); } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY; @@ -2908,7 +2908,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(); } @@ -3056,7 +3056,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 { @@ -3142,7 +3142,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(); } @@ -3496,7 +3496,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(); @@ -3648,10 +3648,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(); } @@ -3802,7 +3802,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(); } @@ -4229,7 +4229,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: cfe/trunk/include/clang/AST/ExprObjC.h =================================================================== --- cfe/trunk/include/clang/AST/ExprObjC.h +++ cfe/trunk/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,8 @@ 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 +861,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 +1387,7 @@ SourceLocation getSelectorStartLoc() const { if (isImplicit()) - return getLocStart(); + return getBeginLoc(); return getSelectorLoc(0); } @@ -1498,7 +1499,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 +1578,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 { Index: cfe/trunk/include/clang/AST/ExprOpenMP.h =================================================================== --- cfe/trunk/include/clang/AST/ExprOpenMP.h +++ cfe/trunk/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: cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h =================================================================== --- cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h +++ cfe/trunk/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: cfe/trunk/include/clang/AST/RawCommentList.h =================================================================== --- cfe/trunk/include/clang/AST/RawCommentList.h +++ cfe/trunk/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: cfe/trunk/include/clang/AST/Stmt.h =================================================================== --- cfe/trunk/include/clang/AST/Stmt.h +++ cfe/trunk/include/clang/AST/Stmt.h @@ -2316,7 +2316,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: cfe/trunk/include/clang/AST/StmtCXX.h =================================================================== --- cfe/trunk/include/clang/AST/StmtCXX.h +++ cfe/trunk/include/clang/AST/StmtCXX.h @@ -410,8 +410,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 { @@ -479,7 +479,7 @@ SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } SourceLocation getEndLoc() const LLVM_READONLY { - return getOperand() ? getOperand()->getLocEnd() : getLocStart(); + return getOperand() ? getOperand()->getLocEnd() : getBeginLoc(); } child_range children() { Index: cfe/trunk/include/clang/AST/StmtDataCollectors.td =================================================================== --- cfe/trunk/include/clang/AST/StmtDataCollectors.td +++ cfe/trunk/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: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h +++ cfe/trunk/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: cfe/trunk/include/clang/Sema/Initialization.h =================================================================== --- cfe/trunk/include/clang/Sema/Initialization.h +++ cfe/trunk/include/clang/Sema/Initialization.h @@ -671,10 +671,11 @@ 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: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h =================================================================== --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h @@ -178,10 +178,9 @@ PathDiagnosticLocation() = default; /// Create a location corresponding to the given statement. - PathDiagnosticLocation(const Stmt *s, - const SourceManager &sm, + PathDiagnosticLocation(const Stmt *s, const SourceManager &sm, LocationOrAnalysisDeclContext lac) - : K(s->getLocStart().isValid() ? StmtK : SingleLocK), + : K(s->getBeginLoc().isValid() ? StmtK : SingleLocK), S(K == StmtK ? s : nullptr), SM(&sm), Loc(genLocation(SourceLocation(), lac)), Range(genRange(lac)) { assert(K == SingleLocK || S); Index: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp +++ cfe/trunk/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,8 @@ 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 +929,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 +942,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 +965,7 @@ ClassString = "instancetype"; } else { - R = SourceRange(OM->getLocStart(), OM->getLocStart()); + R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc()); ClassString = OM->isInstanceMethod() ? '-' : '+'; ClassString += " (instancetype)"; } @@ -986,7 +987,7 @@ } } else { - R = SourceRange(OM->getLocStart(), OM->getLocStart()); + R = SourceRange(OM->getBeginLoc(), OM->getBeginLoc()); ClassString = "+ ("; ClassString += IDecl->getName(); ClassString += "*)"; } @@ -1395,7 +1396,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: cfe/trunk/lib/ARCMigrate/TransAPIUses.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransAPIUses.cpp +++ cfe/trunk/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: cfe/trunk/lib/ARCMigrate/TransAutoreleasePool.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransAutoreleasePool.cpp +++ cfe/trunk/lib/ARCMigrate/TransAutoreleasePool.cpp @@ -135,14 +135,14 @@ "to true?"); Pass.TA.insertAfterToken(afterSemi, "\n}"); Pass.TA.increaseIndentation( - SourceRange(scope.getIndentedRange().getBegin(), - (*retI)->getLocEnd()), - scope.CompoundParent->getLocStart()); + SourceRange(scope.getIndentedRange().getBegin(), + (*retI)->getLocEnd()), + scope.CompoundParent->getBeginLoc()); } else { Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {"); Pass.TA.replaceStmt(*scope.End, "}"); Pass.TA.increaseIndentation(scope.getIndentedRange(), - scope.CompoundParent->getLocStart()); + scope.CompoundParent->getBeginLoc()); } } @@ -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: cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransGCCalls.cpp +++ cfe/trunk/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: cfe/trunk/lib/ARCMigrate/TransProtectedScope.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransProtectedScope.cpp +++ cfe/trunk/lib/ARCMigrate/TransProtectedScope.cpp @@ -77,8 +77,9 @@ 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: cfe/trunk/lib/ARCMigrate/TransRetainReleaseDealloc.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransRetainReleaseDealloc.cpp +++ cfe/trunk/lib/ARCMigrate/TransRetainReleaseDealloc.cpp @@ -71,9 +71,10 @@ // will likely die immediately while previously it was kept alive // by the autorelease pool. This is bad practice in general, leave it // and emit an error to force the user to restructure their code. - Pass.TA.reportError("it is not safe to remove an unused 'autorelease' " + Pass.TA.reportError( + "it is not safe to remove an unused 'autorelease' " "message; its receiver may be destroyed immediately", - E->getLocStart(), E->getSourceRange()); + E->getBeginLoc(), E->getSourceRange()); return true; } } @@ -89,7 +90,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,15 +99,17 @@ std::string err = "it is not safe to remove '"; err += E->getSelector().getAsString() + "' message on " "a global variable"; - Pass.TA.reportError(err, rec->getLocStart()); + Pass.TA.reportError(err, rec->getBeginLoc()); return true; } if (E->getMethodFamily() == OMF_release && isDelegateMessage(rec)) { - Pass.TA.reportError("it is not safe to remove 'retain' " + Pass.TA.reportError( + "it is not safe to remove 'retain' " "message on the result of a 'delegate' message; " "the object that was passed to 'setDelegate:' may not be " - "properly retained", rec->getLocStart()); + "properly retained", + rec->getBeginLoc()); return true; } } Index: cfe/trunk/lib/ARCMigrate/TransUnbridgedCasts.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransUnbridgedCasts.cpp +++ cfe/trunk/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; } @@ -225,13 +225,12 @@ } TA.clearDiagnostic(diag::err_arc_mismatched_cast, - diag::err_arc_cast_requires_bridge, - E->getLocStart()); + diag::err_arc_cast_requires_bridge, E->getBeginLoc()); if (Kind == OBC_Bridge || !Pass.CFBridgingFunctionsDefined()) { if (CStyleCastExpr *CCE = dyn_cast(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 +250,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 +367,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 +379,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: cfe/trunk/lib/ARCMigrate/TransformActions.cpp =================================================================== --- cfe/trunk/lib/ARCMigrate/TransformActions.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/ASTContext.cpp =================================================================== --- cfe/trunk/lib/AST/ASTContext.cpp +++ cfe/trunk/lib/AST/ASTContext.cpp @@ -193,7 +193,7 @@ isa(D) || isa(D) || isa(D)) - DeclLoc = D->getLocStart(); + DeclLoc = D->getBeginLoc(); else { DeclLoc = D->getLocation(); if (DeclLoc.isMacroID()) { @@ -201,7 +201,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: cfe/trunk/lib/AST/ASTDumper.cpp =================================================================== --- cfe/trunk/lib/AST/ASTDumper.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/ASTImporter.cpp =================================================================== --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -1852,7 +1852,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); @@ -1961,7 +1961,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) { @@ -2070,7 +2070,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())) @@ -2139,7 +2139,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; @@ -2300,7 +2300,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)) { @@ -4239,7 +4239,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()))) @@ -4294,7 +4294,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; @@ -4506,7 +4506,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. @@ -4734,7 +4734,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. @@ -4927,8 +4927,8 @@ } Stmt *ASTNodeImporter::VisitStmt(Stmt *S) { - Importer.FromDiag(S->getLocStart(), diag::err_unsupported_ast_node) - << S->getStmtClassName(); + Importer.FromDiag(S->getBeginLoc(), diag::err_unsupported_ast_node) + << S->getStmtClassName(); return nullptr; } @@ -5444,8 +5444,8 @@ // Import Expressions //---------------------------------------------------------------------------- Expr *ASTNodeImporter::VisitExpr(Expr *E) { - Importer.FromDiag(E->getLocStart(), diag::err_unsupported_ast_node) - << E->getStmtClassName(); + Importer.FromDiag(E->getBeginLoc(), diag::err_unsupported_ast_node) + << E->getStmtClassName(); return nullptr; } @@ -5472,8 +5472,8 @@ if (T.isNull()) return nullptr; - return new (Importer.getToContext()) GNUNullExpr( - T, Importer.Import(E->getLocStart())); + return new (Importer.getToContext()) + GNUNullExpr(T, Importer.Import(E->getBeginLoc())); } Expr *ASTNodeImporter::VisitPredefinedExpr(PredefinedExpr *E) { @@ -5486,7 +5486,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) { @@ -5861,8 +5861,8 @@ return nullptr; return new (Importer.getToContext()) ArrayTypeTraitExpr( - Importer.Import(E->getLocStart()), E->getTrait(), ToQueried, - E->getValue(), Dim, Importer.Import(E->getLocEnd()), T); + Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried, + E->getValue(), Dim, Importer.Import(E->getLocEnd()), T); } Expr *ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) { @@ -5875,8 +5875,8 @@ return nullptr; return new (Importer.getToContext()) ExpressionTraitExpr( - Importer.Import(E->getLocStart()), E->getTrait(), ToQueried, - E->getValue(), Importer.Import(E->getLocEnd()), T); + Importer.Import(E->getBeginLoc()), E->getTrait(), ToQueried, + E->getValue(), Importer.Import(E->getLocEnd()), T); } Expr *ASTNodeImporter::VisitOpaqueValueExpr(OpaqueValueExpr *E) { @@ -6060,7 +6060,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; @@ -6076,7 +6076,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; } @@ -6084,7 +6084,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; } @@ -6124,9 +6124,9 @@ else CanThrow = E->getValue() ? CT_Can : CT_Cannot; - return new (Importer.getToContext()) CXXNoexceptExpr( - T, Operand, CanThrow, - Importer.Import(E->getLocStart()), Importer.Import(E->getLocEnd())); + return new (Importer.getToContext()) + CXXNoexceptExpr(T, Operand, CanThrow, Importer.Import(E->getBeginLoc()), + Importer.Import(E->getLocEnd())); } Expr *ASTNodeImporter::VisitCXXThrowExpr(CXXThrowExpr *E) { @@ -6326,13 +6326,9 @@ return nullptr; return new (Importer.getToContext()) CXXDeleteExpr( - T, E->isGlobalDelete(), - E->isArrayForm(), - E->isArrayFormAsWritten(), - E->doesUsualArrayDeleteWantSize(), - OperatorDeleteDecl, - ToArg, - Importer.Import(E->getLocStart())); + T, E->isGlobalDelete(), E->isArrayForm(), E->isArrayFormAsWritten(), + E->doesUsualArrayDeleteWantSize(), OperatorDeleteDecl, ToArg, + Importer.Import(E->getBeginLoc())); } Expr *ASTNodeImporter::VisitCXXConstructExpr(CXXConstructExpr *E) { @@ -6847,7 +6843,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) { @@ -6920,7 +6916,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); } @@ -7000,8 +6996,8 @@ if (T.isNull()) return nullptr; - return ToContext.getTrivialTypeSourceInfo(T, - Import(FromTSI->getTypeLoc().getLocStart())); + return ToContext.getTrivialTypeSourceInfo( + T, Import(FromTSI->getTypeLoc().getBeginLoc())); } Attr *ASTImporter::Import(const Attr *FromAttr) { Index: cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp =================================================================== --- cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/Decl.cpp =================================================================== --- cfe/trunk/lib/AST/Decl.cpp +++ cfe/trunk/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(); } @@ -3159,7 +3159,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(); @@ -4548,14 +4548,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: cfe/trunk/lib/AST/DeclObjC.cpp =================================================================== --- cfe/trunk/lib/AST/DeclObjC.cpp +++ cfe/trunk/lib/AST/DeclObjC.cpp @@ -357,7 +357,7 @@ SourceLocation ObjCInterfaceDecl::getSuperClassLoc() const { if (TypeSourceInfo *superTInfo = getSuperClassTInfo()) - return superTInfo->getTypeLoc().getLocStart(); + return superTInfo->getTypeLoc().getBeginLoc(); return SourceLocation(); } Index: cfe/trunk/lib/AST/DeclOpenMP.cpp =================================================================== --- cfe/trunk/lib/AST/DeclOpenMP.cpp +++ cfe/trunk/lib/AST/DeclOpenMP.cpp @@ -112,5 +112,5 @@ SourceRange OMPCapturedExprDecl::getSourceRange() const { assert(hasInit()); - return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd()); + return SourceRange(getInit()->getBeginLoc(), getInit()->getLocEnd()); } Index: cfe/trunk/lib/AST/DeclTemplate.cpp =================================================================== --- cfe/trunk/lib/AST/DeclTemplate.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/Expr.cpp =================================================================== --- cfe/trunk/lib/AST/Expr.cpp +++ cfe/trunk/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; @@ -2041,7 +2041,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. @@ -2049,7 +2049,7 @@ E = InitExprs.end(); I != E; ++I) { if (Stmt *S = *I) { - Beg = S->getLocStart(); + Beg = S->getBeginLoc(); break; } } @@ -2274,12 +2274,12 @@ 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(), - CE->getArg(NumArgs-1)->getLocEnd()); + R2 = SourceRange(CE->getArg(0)->getBeginLoc(), + CE->getArg(NumArgs - 1)->getLocEnd()); return true; } } @@ -2296,7 +2296,7 @@ if (const CXXRecordDecl *Type = getType()->getAsCXXRecordDecl()) { if (Type->hasAttr()) { WarnE = this; - Loc = getLocStart(); + Loc = getBeginLoc(); R1 = getSourceRange(); return true; } @@ -2396,7 +2396,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); @@ -3866,8 +3866,8 @@ DesignatedInitExpr *DIE = const_cast(this); if (size() == 1) return DIE->getDesignator(0)->getSourceRange(); - return SourceRange(DIE->getDesignator(0)->getLocStart(), - DIE->getDesignator(size()-1)->getLocEnd()); + return SourceRange(DIE->getDesignator(0)->getBeginLoc(), + DIE->getDesignator(size() - 1)->getLocEnd()); } SourceLocation DesignatedInitExpr::getBeginLoc() const { @@ -3945,7 +3945,7 @@ } SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const { - return getBase()->getLocStart(); + return getBase()->getBeginLoc(); } SourceLocation DesignatedInitUpdateExpr::getEndLoc() const { Index: cfe/trunk/lib/AST/ExprCXX.cpp =================================================================== --- cfe/trunk/lib/AST/ExprCXX.cpp +++ cfe/trunk/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(); } @@ -708,7 +708,7 @@ } SourceLocation CXXFunctionalCastExpr::getBeginLoc() const { - return getTypeInfoAsWritten()->getTypeLoc().getLocStart(); + return getTypeInfoAsWritten()->getTypeLoc().getBeginLoc(); } SourceLocation CXXFunctionalCastExpr::getEndLoc() const { Index: cfe/trunk/lib/AST/ExprConstant.cpp =================================================================== --- cfe/trunk/lib/AST/ExprConstant.cpp +++ cfe/trunk/lib/AST/ExprConstant.cpp @@ -832,7 +832,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; @@ -2554,8 +2554,8 @@ if (Info.checkingPotentialConstantExpression()) return false; // FIXME: implement capture evaluation during constant expr evaluation. - Info.FFDiag(E->getLocStart(), - diag::note_unimplemented_constexpr_lambda_feature_ast) + Info.FFDiag(E->getBeginLoc(), + diag::note_unimplemented_constexpr_lambda_feature_ast) << "captures not currently allowed"; return false; } @@ -3845,8 +3845,8 @@ const Expr *InitE = VD->getInit(); if (!InitE) { - Info.FFDiag(VD->getLocStart(), diag::note_constexpr_uninitialized) - << false << VD->getType(); + Info.FFDiag(VD->getBeginLoc(), diag::note_constexpr_uninitialized) + << false << VD->getType(); Val = APValue(); return false; } @@ -3991,7 +3991,8 @@ 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!"); @@ -4082,7 +4083,7 @@ return ESR_Succeeded; } - Info.FFDiag(S->getLocStart()); + Info.FFDiag(S->getBeginLoc()); return ESR_Failed; case Stmt::NullStmtClass: @@ -5077,8 +5078,8 @@ if (BI + 1 == BE) { const Expr *FinalExpr = dyn_cast(*BI); if (!FinalExpr) { - Info.FFDiag((*BI)->getLocStart(), - diag::note_constexpr_stmt_expr_unsupported); + Info.FFDiag((*BI)->getBeginLoc(), + diag::note_constexpr_stmt_expr_unsupported); return false; } return this->Visit(FinalExpr); @@ -5092,8 +5093,8 @@ // 'break', or 'continue', it would be nice to propagate that to // the outer statement evaluation rather than bailing out. if (ESR != ESR_Failed) - Info.FFDiag((*BI)->getLocStart(), - diag::note_constexpr_stmt_expr_unsupported); + Info.FFDiag((*BI)->getBeginLoc(), + diag::note_constexpr_stmt_expr_unsupported); return false; } } @@ -10901,7 +10902,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(); } @@ -10909,7 +10910,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) @@ -10993,7 +10994,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 @@ -11003,7 +11004,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: @@ -11038,7 +11039,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())) @@ -11068,7 +11069,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); @@ -11083,7 +11084,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: @@ -11110,7 +11111,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: { @@ -11132,7 +11133,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: @@ -11161,11 +11162,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()); } } } @@ -11174,10 +11175,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); @@ -11222,7 +11223,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(); } } @@ -11235,7 +11236,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: cfe/trunk/lib/AST/RawCommentList.cpp =================================================================== --- cfe/trunk/lib/AST/RawCommentList.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/SelectorLocationsKind.cpp =================================================================== --- cfe/trunk/lib/AST/SelectorLocationsKind.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/Stmt.cpp =================================================================== --- cfe/trunk/lib/AST/Stmt.cpp +++ cfe/trunk/lib/AST/Stmt.cpp @@ -185,14 +185,12 @@ return bad(); } - typedef SourceLocation getLocStart_t() const; - template good implements_getLocStart(getLocStart_t T::*) { + typedef SourceLocation getBeginLoc_t() const; + template good implements_getBeginLoc(getBeginLoc_t T::*) { return good(); } LLVM_ATTRIBUTE_UNUSED - static bad implements_getLocStart(getLocStart_t Stmt::*) { - return bad(); - } + static bad implements_getBeginLoc(getBeginLoc_t Stmt::*) { return bad(); } typedef SourceLocation getLocEnd_t() const; template good implements_getLocEnd(getLocEnd_t T::*) { @@ -205,8 +203,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)) @@ -217,9 +215,9 @@ LLVM_ATTRIBUTE_UNUSED static inline void check_implementations() { #define ABSTRACT_STMT(type) -#define STMT(type, base) \ - ASSERT_IMPLEMENTS_children(type); \ - ASSERT_IMPLEMENTS_getLocStart(type); \ +#define STMT(type, base) \ + ASSERT_IMPLEMENTS_children(type); \ + ASSERT_IMPLEMENTS_getBeginLoc(type); \ ASSERT_IMPLEMENTS_getLocEnd(type); #include "clang/AST/StmtNodes.inc" } @@ -257,8 +255,8 @@ template SourceRange getSourceRangeImpl(const Stmt *stmt, SourceRange (Stmt::*v)() const) { - return SourceRange(static_cast(stmt)->getLocStart(), - static_cast(stmt)->getLocEnd()); + return SourceRange(static_cast(stmt)->getBeginLoc(), + static_cast(stmt)->getLocEnd()); } } // namespace @@ -280,9 +278,9 @@ switch (getStmtClass()) { case Stmt::NoStmtClass: llvm_unreachable("statement without class"); #define ABSTRACT_STMT(type) -#define STMT(type, base) \ - case Stmt::type##Class: \ - return static_cast(this)->getLocStart(); +#define STMT(type, base) \ + case Stmt::type##Class: \ + return static_cast(this)->getBeginLoc(); #include "clang/AST/StmtNodes.inc" } llvm_unreachable("unknown statement kind"); Index: cfe/trunk/lib/AST/StmtPrinter.cpp =================================================================== --- cfe/trunk/lib/AST/StmtPrinter.cpp +++ cfe/trunk/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: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp +++ cfe/trunk/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: cfe/trunk/lib/Analysis/CloneDetection.cpp =================================================================== --- cfe/trunk/lib/Analysis/CloneDetection.cpp +++ cfe/trunk/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: cfe/trunk/lib/Analysis/Consumed.cpp =================================================================== --- cfe/trunk/lib/Analysis/Consumed.cpp +++ cfe/trunk/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: cfe/trunk/lib/Analysis/LiveVariables.cpp =================================================================== --- cfe/trunk/lib/Analysis/LiveVariables.cpp +++ cfe/trunk/lib/Analysis/LiveVariables.cpp @@ -619,8 +619,8 @@ 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(), de = declVec.end(); di != de; ++di) { Index: cfe/trunk/lib/Analysis/ReachableCode.cpp =================================================================== --- cfe/trunk/lib/Analysis/ReachableCode.cpp +++ cfe/trunk/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: cfe/trunk/lib/Analysis/ThreadSafety.cpp =================================================================== --- cfe/trunk/lib/Analysis/ThreadSafety.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGAtomic.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGAtomic.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGBlocks.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGBlocks.cpp +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp @@ -1308,7 +1308,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 @@ -1403,7 +1403,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. @@ -1712,7 +1712,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); @@ -1898,7 +1898,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: cfe/trunk/lib/CodeGen/CGBuiltin.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/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()); } } Index: cfe/trunk/lib/CodeGen/CGCall.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGCall.cpp +++ cfe/trunk/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)); @@ -4502,8 +4502,8 @@ if (isVirtual()) { const CallExpr *CE = getVirtualCallExpr(); return CGF.CGM.getCXXABI().getVirtualFunctionPointer( - CGF, getVirtualMethodDecl(), getThisAddress(), - getFunctionType(), CE ? CE->getLocStart() : SourceLocation()); + CGF, getVirtualMethodDecl(), getThisAddress(), getFunctionType(), + CE ? CE->getBeginLoc() : SourceLocation()); } return *this; Index: cfe/trunk/lib/CodeGen/CGClass.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGClass.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGCoroutine.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGCoroutine.cpp +++ cfe/trunk/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,8 +707,8 @@ if (CurCoro.Data && CurCoro.Data->CoroBegin) { return RValue::get(CurCoro.Data->CoroBegin); } - CGM.Error(E->getLocStart(), "this builtin expect that __builtin_coro_begin " - "has been used earlier in this function"); + CGM.Error(E->getBeginLoc(), "this builtin expect that __builtin_coro_begin " + "has been used earlier in this function"); auto NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy()); return RValue::get(NullPtr); } @@ -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: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGException.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGException.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGExpr.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -1076,7 +1076,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())) @@ -4226,8 +4226,8 @@ if (SanOpts.has(SanitizerKind::CFIDerivedCast)) EmitVTablePtrCheckForCast(E->getType(), Derived.getPointer(), - /*MayBeNull=*/false, - CFITCK_DerivedCast, E->getLocStart()); + /*MayBeNull=*/false, CFITCK_DerivedCast, + E->getBeginLoc()); return MakeAddrLValue(Derived, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); @@ -4243,8 +4243,8 @@ if (SanOpts.has(SanitizerKind::CFIUnrelatedCast)) EmitVTablePtrCheckForCast(E->getType(), V.getPointer(), - /*MayBeNull=*/false, - CFITCK_UnrelatedCast, E->getLocStart()); + /*MayBeNull=*/false, CFITCK_UnrelatedCast, + E->getBeginLoc()); return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(), CGM.getTBAAInfoForSubobject(LV, E->getType())); @@ -4653,10 +4653,8 @@ DecodeAddrUsedInPrologue(CalleePtr, CalleeRTTIEncoded); llvm::Value *CalleeRTTIMatch = Builder.CreateICmpEQ(CalleeRTTI, FTRTTIConst); - llvm::Constant *StaticData[] = { - EmitCheckSourceLocation(E->getLocStart()), - EmitCheckTypeDescriptor(CalleeType) - }; + llvm::Constant *StaticData[] = {EmitCheckSourceLocation(E->getBeginLoc()), + EmitCheckTypeDescriptor(CalleeType)}; EmitCheck(std::make_pair(CalleeRTTIMatch, SanitizerKind::Function), SanitizerHandler::FunctionTypeMismatch, StaticData, CalleePtr); @@ -4690,7 +4688,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: cfe/trunk/lib/CodeGen/CGExprCXX.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGExprScalar.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp +++ cfe/trunk/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) { @@ -1745,11 +1745,10 @@ Derived.getPointer(), DestTy->getPointeeType()); if (CGF.SanOpts.has(SanitizerKind::CFIDerivedCast)) - CGF.EmitVTablePtrCheckForCast(DestTy->getPointeeType(), - Derived.getPointer(), - /*MayBeNull=*/true, - CodeGenFunction::CFITCK_DerivedCast, - CE->getLocStart()); + CGF.EmitVTablePtrCheckForCast( + DestTy->getPointeeType(), Derived.getPointer(), + /*MayBeNull=*/true, CodeGenFunction::CFITCK_DerivedCast, + CE->getBeginLoc()); return Derived.getPointer(); } Index: cfe/trunk/lib/CodeGen/CGObjC.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGObjC.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp +++ cfe/trunk/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. @@ -5788,7 +5788,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(); } @@ -6286,7 +6286,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; { @@ -7802,7 +7802,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); @@ -7816,7 +7816,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, @@ -7947,7 +7947,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 @@ -8855,8 +8855,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)}; @@ -8881,8 +8881,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: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CGStmt.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGStmt.cpp +++ cfe/trunk/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. @@ -2293,9 +2293,8 @@ F->addFnAttr(llvm::Attribute::NoUnwind); // Generate the function. - StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, - CD->getLocation(), - CD->getBody()->getLocStart()); + StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, CD->getLocation(), + CD->getBody()->getBeginLoc()); // Set the context parameter in CapturedStmtInfo. Address DeclPtr = GetAddrOfLocalVar(CD->getContextParam()); CapturedStmtInfo->setContextValue(Builder.CreateLoad(DeclPtr)); @@ -2305,8 +2304,9 @@ Ctx.getTagDeclType(RD)); for (auto *FD : RD->fields()) { if (FD->hasCapturedVLAType()) { - auto *ExprArg = EmitLoadOfLValue(EmitLValueForField(Base, FD), - S.getLocStart()).getScalarVal(); + auto *ExprArg = + EmitLoadOfLValue(EmitLValueForField(Base, FD), S.getBeginLoc()) + .getScalarVal(); auto VAT = FD->getCapturedVLAType(); VLASizeMap[VAT->getSizeExpr()] = ExprArg; } Index: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp +++ cfe/trunk/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")); @@ -2351,11 +2351,10 @@ LoopArguments, CGDispatchBounds); } if (isOpenMPSimdDirective(S.getDirectiveKind())) { - EmitOMPSimdFinal(S, - [IL, &S](CodeGenFunction &CGF) { - return CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart())); - }); + EmitOMPSimdFinal(S, [IL, &S](CodeGenFunction &CGF) { + return CGF.Builder.CreateIsNotNull( + CGF.EmitLoadOfScalar(IL, S.getBeginLoc())); + }); } EmitOMPReductionClauseFinal( S, /*ReductionKind=*/isOpenMPSimdDirective(S.getDirectiveKind()) @@ -2365,17 +2364,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 +2431,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 +2449,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 +2484,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 +2508,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 +2536,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 +2551,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 +2572,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 +2580,7 @@ CGF.EmitOMPLastprivateClauseFinal( S, /*NoFinals=*/false, CGF.Builder.CreateIsNotNull( - CGF.EmitLoadOfScalar(IL, S.getLocStart()))); + CGF.EmitLoadOfScalar(IL, S.getBeginLoc()))); }; bool HasCancel = false; @@ -2598,7 +2597,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 +2609,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 +2651,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 +2659,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 +2670,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 +2684,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 +2827,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 +2871,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 +2902,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 +2951,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 +3048,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 +3090,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 +3121,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 +3148,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 +3157,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 +3194,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 +3204,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 +3216,7 @@ FlushClause->varlist_end()); return llvm::None; }(), - S.getLocStart()); + S.getBeginLoc()); } void CodeGenFunction::EmitOMPDistributeLoop(const OMPLoopDirective &S, @@ -3286,7 +3285,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 +3306,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 +3327,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 +3356,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 +3369,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 +3393,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 +3447,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 +3455,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 +3917,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 +4036,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 +4393,7 @@ void CodeGenFunction::EmitOMPCancellationPointDirective( const OMPCancellationPointDirective &S) { - CGM.getOpenMPRuntime().emitCancellationPointCall(*this, S.getLocStart(), + CGM.getOpenMPRuntime().emitCancellationPointCall(*this, S.getBeginLoc(), S.getCancelRegion()); } @@ -4407,7 +4406,7 @@ break; } } - CGM.getOpenMPRuntime().emitCancelCall(*this, S.getLocStart(), IfCond, + CGM.getOpenMPRuntime().emitCancelCall(*this, S.getBeginLoc(), IfCond, S.getCancelRegion()); } @@ -4864,7 +4863,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 +4872,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 +4890,7 @@ CGF.EmitOMPTaskBasedDirective(S, OMPD_taskloop, BodyGen, TaskGen, Data); }, - S.getLocStart()); + S.getBeginLoc()); } } Index: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp @@ -2089,9 +2089,8 @@ SanitizerScope SanScope(this); llvm::Value *Zero = llvm::Constant::getNullValue(Size->getType()); llvm::Constant *StaticArgs[] = { - EmitCheckSourceLocation(size->getLocStart()), - EmitCheckTypeDescriptor(size->getType()) - }; + EmitCheckSourceLocation(size->getBeginLoc()), + EmitCheckTypeDescriptor(size->getType())}; EmitCheck(std::make_pair(Builder.CreateICmpSGT(Size, Zero), SanitizerKind::VLABound), SanitizerHandler::VLABoundNotPositive, StaticArgs, Size); @@ -2319,7 +2318,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 +2344,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: cfe/trunk/lib/CodeGen/CodeGenModule.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp @@ -683,8 +683,8 @@ unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; - getDiags().Report(Context.getFullLoc(S->getLocStart()), DiagID) - << Msg << S->getSourceRange(); + getDiags().Report(Context.getFullLoc(S->getBeginLoc()), DiagID) + << Msg << S->getSourceRange(); } /// ErrorUnsupported - Print out an error that codegen doesn't support the @@ -4814,7 +4814,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()) @@ -5077,7 +5077,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: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp +++ cfe/trunk/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: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp =================================================================== --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp +++ cfe/trunk/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: cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp =================================================================== --- cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp +++ cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -420,8 +420,8 @@ commit.replace(MsgRange, "@[]"); return true; } - SourceRange ArgRange(Msg->getArg(0)->getLocStart(), - Msg->getArg(Msg->getNumArgs()-2)->getLocEnd()); + SourceRange ArgRange(Msg->getArg(0)->getBeginLoc(), + Msg->getArg(Msg->getNumArgs() - 2)->getLocEnd()); commit.replaceWithInner(MsgRange, ArgRange); commit.insertWrap("@[", ArgRange, "]"); return true; @@ -550,8 +550,8 @@ // 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(), - Msg->getArg(SentinelIdx-1)->getLocEnd()); + SourceRange ArgRange(Msg->getArg(1)->getBeginLoc(), + Msg->getArg(SentinelIdx - 1)->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; @@ -591,8 +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(), - Keys.back()->getLocEnd()); + SourceRange ArgRange(Keys.front()->getBeginLoc(), Keys.back()->getLocEnd()); commit.insertWrap("@{", ArgRange, "}"); commit.replaceWithInner(MsgRange, ArgRange); return true; @@ -1131,7 +1130,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: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp =================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -265,8 +265,8 @@ // Measure the old text. int Size = Rewrite.getRangeSize(SrcRange); if (Size == -1) { - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) - << Old->getSourceRange(); + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) + << Old->getSourceRange(); return; } // Get the new text. @@ -282,8 +282,8 @@ } if (SilenceRewriteMacroWarning) return; - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) - << Old->getSourceRange(); + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) + << Old->getSourceRange(); } void InsertText(SourceLocation Loc, StringRef Str, @@ -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,16 +923,15 @@ 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"); const char *semiBuf = strchr(startBuf, ';'); assert((*semiBuf == ';') && "@synthesize: can't find ';'"); startGetterSetterLoc = startLoc.getLocWithOffset(semiBuf-startBuf+1); - } - else + } else startGetterSetterLoc = IMD ? IMD->getLocEnd() : CID->getLocEnd(); if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic) @@ -1061,7 +1060,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 +1108,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 +1128,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 +1153,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 +1188,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 +1197,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 +1337,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 +1361,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 +1607,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 +1637,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 +1685,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 +1859,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 +1882,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 +1914,7 @@ WarnAboutReturnGotoStmts(SubStmt); if (isa(S) || isa(S)) { - Diags.Report(Context->getFullLoc(S->getLocStart()), + Diags.Report(Context->getFullLoc(S->getBeginLoc()), TryFinallyContainsReturnDiag); } } @@ -1923,7 +1922,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 +1943,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 +1957,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 +1966,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 +1987,7 @@ Result += "_"; Result += catchDecl->getNameAsString(); Result += "; "; - SourceLocation lBraceLoc = Catch->getCatchBody()->getLocStart(); + SourceLocation lBraceLoc = Catch->getCatchBody()->getBeginLoc(); ReplaceText(lBraceLoc, 1, Result); AtRemoved = true; } @@ -2001,7 +2000,7 @@ } if (finalStmt) { buf.clear(); - SourceLocation FinallyLoc = finalStmt->getLocStart(); + SourceLocation FinallyLoc = finalStmt->getBeginLoc(); if (noCatch) { ConvertSourceLocationToLineDirective(FinallyLoc, buf); @@ -2013,10 +2012,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 +2034,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 +2169,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 +2295,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 +2624,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 +2708,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 +2831,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 +3069,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 +3168,7 @@ FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef); else { assert(CurMethodDef && "SynthMsgSendStretCallExpr - CurMethodDef is null"); - FunLocStart = CurMethodDef->getLocStart(); + FunLocStart = CurMethodDef->getBeginLoc(); } InsertText(FunLocStart, str); @@ -3563,8 +3562,8 @@ } Stmt *RewriteModernObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { - Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(), - Exp->getLocEnd()); + Stmt *ReplacingStmt = + SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); // Now do the actual rewrite. ReplaceStmt(Exp, ReplacingStmt); @@ -3896,7 +3895,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); @@ -4461,9 +4460,9 @@ } void RewriteModernObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { - //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); - //SourceLocation FunLocStart = MD->getLocStart(); - SourceLocation FunLocStart = MD->getLocStart(); + // fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); + // SourceLocation FunLocStart = MD->getBeginLoc(); + SourceLocation FunLocStart = MD->getBeginLoc(); std::string FuncName; BuildUniqueMethodName(FuncName, MD); SynthesizeBlockLiterals(FunLocStart, FuncName); @@ -4778,7 +4777,7 @@ std::string Str = "("; Str += TypeString; Str += ")"; - InsertText(IC->getSubExpr()->getLocStart(), Str); + InsertText(IC->getSubExpr()->getBeginLoc(), Str); } void RewriteModernObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) { @@ -5069,7 +5068,7 @@ FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef); else { assert(CurMethodDef && "RewriteByRefVar - CurMethodDef is null"); - FunLocStart = CurMethodDef->getLocStart(); + FunLocStart = CurMethodDef->getBeginLoc(); } InsertText(FunLocStart, ByrefType); @@ -5156,7 +5155,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 +5536,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 +5675,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: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp =================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp +++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -216,8 +216,8 @@ // Measure the old text. int Size = Rewrite.getRangeSize(SrcRange); if (Size == -1) { - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) - << Old->getSourceRange(); + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) + << Old->getSourceRange(); return; } // Get the new text. @@ -233,8 +233,8 @@ } if (SilenceRewriteMacroWarning) return; - Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag) - << Old->getSourceRange(); + Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag) + << Old->getSourceRange(); } void InsertText(SourceLocation Loc, StringRef Str, @@ -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,11 +901,11 @@ void RewriteObjC::RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl, const std::string &typedefString) { - SourceLocation startLoc = ClassDecl->getLocStart(); - const char *startBuf = SM->getCharacterData(startLoc); - const char *semiPtr = strchr(startBuf, ';'); - // Replace the @class with typedefs corresponding to the classes. - ReplaceText(startLoc, semiPtr-startBuf+1, typedefString); + SourceLocation startLoc = ClassDecl->getBeginLoc(); + const char *startBuf = SM->getCharacterData(startLoc); + const char *semiPtr = strchr(startBuf, ';'); + // Replace the @class with typedefs corresponding to the classes. + ReplaceText(startLoc, semiPtr - startBuf + 1, typedefString); } void RewriteObjC::RewriteForwardClassDecl(DeclGroupRef D) { @@ -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,8 +3008,8 @@ } Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) { - Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(), - Exp->getLocEnd()); + Stmt *ReplacingStmt = + SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd()); // Now do the actual rewrite. ReplaceStmt(Exp, ReplacingStmt); @@ -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); @@ -3635,9 +3635,9 @@ } void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) { - //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); - //SourceLocation FunLocStart = MD->getLocStart(); - SourceLocation FunLocStart = MD->getLocStart(); + // fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n"); + // 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,8 +5873,8 @@ CK_BitCast, IV->getBase()); // Don't forget the parens to enforce the proper binding. - ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(), - IV->getBase()->getLocEnd(), castExpr); + 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 // embedded rewrites. For example, [newInv->_container addObject:0]. Index: cfe/trunk/lib/Index/IndexBody.cpp =================================================================== --- cfe/trunk/lib/Index/IndexBody.cpp +++ cfe/trunk/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,8 +312,8 @@ SmallVector Relations; addCallRole(Roles, Relations); Roles |= (unsigned)SymbolRole::Implicit; - return IndexCtx.handleReference(MD, E->getLocStart(), - Parent, ParentDC, Roles, Relations, E); + return IndexCtx.handleReference(MD, E->getBeginLoc(), Parent, ParentDC, + Roles, Relations, E); } bool VisitObjCBoxedExpr(ObjCBoxedExpr *E) { Index: cfe/trunk/lib/Index/IndexDecl.cpp =================================================================== --- cfe/trunk/lib/Index/IndexDecl.cpp +++ cfe/trunk/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: cfe/trunk/lib/Index/USRGeneration.cpp =================================================================== --- cfe/trunk/lib/Index/USRGeneration.cpp +++ cfe/trunk/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: cfe/trunk/lib/Parse/ParseDecl.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseDecl.cpp +++ cfe/trunk/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: cfe/trunk/lib/Parse/ParseExpr.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseExpr.cpp +++ cfe/trunk/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: cfe/trunk/lib/Parse/ParseExprCXX.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseExprCXX.cpp +++ cfe/trunk/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: cfe/trunk/lib/Parse/ParseObjc.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseObjc.cpp +++ cfe/trunk/lib/Parse/ParseObjc.cpp @@ -178,8 +178,7 @@ Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); if (Decl) - Diag(Decl->getLocStart(), diag::note_objc_container_start) - << (int) ock; + Diag(Decl->getBeginLoc(), diag::note_objc_container_start) << (int)ock; } /// @@ -690,8 +689,8 @@ case tok::objc_interface: Diag(AtLoc, diag::err_objc_missing_end) << FixItHint::CreateInsertion(AtLoc, "@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) - << (int) Actions.getObjCContainerKind(); + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) + << (int)Actions.getObjCContainerKind(); ConsumeToken(); break; @@ -776,8 +775,8 @@ } else { Diag(Tok, diag::err_objc_missing_end) << FixItHint::CreateInsertion(Tok.getLocation(), "\n@end\n"); - Diag(CDecl->getLocStart(), diag::note_objc_container_start) - << (int) Actions.getObjCContainerKind(); + Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) + << (int)Actions.getObjCContainerKind(); AtEnd.setBegin(Tok.getLocation()); AtEnd.setEnd(Tok.getLocation()); } @@ -2223,7 +2222,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: cfe/trunk/lib/Parse/ParseStmt.cpp =================================================================== --- cfe/trunk/lib/Parse/ParseStmt.cpp +++ cfe/trunk/lib/Parse/ParseStmt.cpp @@ -1897,10 +1897,11 @@ if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) { R = ParseInitializer(); if (R.isUsable()) - Diag(R.get()->getLocStart(), getLangOpts().CPlusPlus11 ? - diag::warn_cxx98_compat_generalized_initializer_lists : - diag::ext_generalized_initializer_lists) - << R.get()->getSourceRange(); + Diag(R.get()->getBeginLoc(), + getLangOpts().CPlusPlus11 + ? diag::warn_cxx98_compat_generalized_initializer_lists + : diag::ext_generalized_initializer_lists) + << R.get()->getSourceRange(); } else R = ParseExpression(); if (R.isInvalid()) { Index: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp =================================================================== --- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp +++ cfe/trunk/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,7 @@ 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( @@ -781,9 +780,8 @@ } else { // If condition is always false, remove all but the 'else'. if (Else) - Fixit1 = FixItHint::CreateRemoval( - CharSourceRange::getCharRange(If->getLocStart(), - Else->getLocStart())); + Fixit1 = FixItHint::CreateRemoval(CharSourceRange::getCharRange( + If->getBeginLoc(), Else->getBeginLoc())); else Fixit1 = FixItHint::CreateRemoval(If->getSourceRange()); } @@ -797,7 +795,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,8 +807,8 @@ << (Use.getKind() == UninitUse::AfterDecl ? 4 : 5) << const_cast(VD->getLexicalDeclContext()) << VD->getSourceRange(); - S.Diag(Use.getUser()->getLocStart(), diag::note_uninit_var_use) - << IsCapturedByBlock << Use.getUser()->getSourceRange(); + S.Diag(Use.getUser()->getBeginLoc(), diag::note_uninit_var_use) + << IsCapturedByBlock << Use.getUser()->getSourceRange(); return; case UninitUse::Maybe: @@ -880,8 +878,8 @@ 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(), - BO->getOperatorLoc())); + Fixit1 = FixItHint::CreateRemoval( + SourceRange(BO->getBeginLoc(), BO->getOperatorLoc())); else // false && y -> false, true || y -> true. Fixit1 = FixItHint::CreateReplacement(BO->getSourceRange(), FixitStr); @@ -943,8 +941,8 @@ 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) - << IsCapturedByBlock << User->getSourceRange(); + 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) << RemoveDiagKind << Str << I->Output << Fixit1 << Fixit2; @@ -953,7 +951,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,9 +983,8 @@ ContainsReference CR(S.Context, DRE); CR.Visit(Initializer); if (CR.doesContainReference()) { - S.Diag(DRE->getLocStart(), - diag::warn_uninit_self_reference_in_init) - << VD->getDeclName() << VD->getLocation() << DRE->getSourceRange(); + S.Diag(DRE->getBeginLoc(), diag::warn_uninit_self_reference_in_init) + << VD->getDeclName() << VD->getLocation() << DRE->getSourceRange(); return true; } } @@ -996,9 +993,9 @@ } 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(); + << VD->getDeclName(); else DiagUninitUse(S, VD, Use, true); } @@ -1007,8 +1004,8 @@ // 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) - << VD->getDeclName(); + S.Diag(VD->getBeginLoc(), diag::note_var_declared_here) + << VD->getDeclName(); return true; } @@ -1098,7 +1095,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 +1263,12 @@ IsTemplateInstantiation)) continue; - S.Diag(Label->getLocStart(), - PerFunction ? diag::warn_unannotated_fallthrough_per_function - : diag::warn_unannotated_fallthrough); + 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 +1294,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,9 +1393,9 @@ 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. // This enum should stay in sync with the cases in @@ -1467,15 +1464,15 @@ continue; // Show the first time the object was read. - S.Diag(FirstRead->getLocStart(), DiagKind) - << int(ObjectKind) << KeyProp << int(FunctionKind) - << FirstRead->getSourceRange(); + S.Diag(FirstRead->getBeginLoc(), DiagKind) + << int(ObjectKind) << KeyProp << int(FunctionKind) + << FirstRead->getSourceRange(); // Print all the other accesses as notes. 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 +1535,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 +1602,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 +1613,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 +1627,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 +2067,7 @@ // Install the logical handler for -Wtautological-overlap-compare llvm::Optional LEH; if (!Diags.isIgnored(diag::warn_tautological_overlap_comparison, - D->getLocStart())) { + D->getBeginLoc())) { LEH.emplace(S); AC.getCFGBuildOptions().Observer = &*LEH; } @@ -2147,9 +2144,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 +2161,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 +2186,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 +2216,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: cfe/trunk/lib/Sema/JumpDiagnostics.cpp =================================================================== --- cfe/trunk/lib/Sema/JumpDiagnostics.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/Sema.cpp =================================================================== --- cfe/trunk/lib/Sema/Sema.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaAttr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaAttr.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaCast.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaCast.cpp +++ cfe/trunk/lib/Sema/SemaCast.cpp @@ -1277,7 +1277,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) @@ -1294,7 +1294,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; @@ -2619,9 +2619,9 @@ } else if (!SrcType->isArithmeticType()) { if (!DestType->isIntegralType(Self.Context) && DestType->isArithmeticType()) { - Self.Diag(SrcExpr.get()->getLocStart(), - diag::err_cast_pointer_to_non_pointer_int) - << DestType << SrcExpr.get()->getSourceRange(); + Self.Diag(SrcExpr.get()->getBeginLoc(), + diag::err_cast_pointer_to_non_pointer_int) + << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); return; } @@ -2630,8 +2630,8 @@ if (Self.getLangOpts().OpenCL && !Self.getOpenCLOptions().isEnabled("cl_khr_fp16")) { if (DestType->isHalfType()) { - Self.Diag(SrcExpr.get()->getLocStart(), diag::err_opencl_cast_to_half) - << DestType << SrcExpr.get()->getSourceRange(); + Self.Diag(SrcExpr.get()->getBeginLoc(), diag::err_opencl_cast_to_half) + << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); return; } @@ -2651,18 +2651,18 @@ 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(); + << SrcType << DestType << Sema::AA_Casting + << SrcExpr.get()->getSourceRange(); return; } } } 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(); + << 1 << SrcType << DestType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); return; } @@ -2710,10 +2710,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: cfe/trunk/lib/Sema/SemaChecking.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaChecking.cpp +++ cfe/trunk/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,8 +135,8 @@ Expr *ValArg = TheCall->getArg(0); QualType Ty = ValArg->getType(); if (!Ty->isIntegerType()) { - S.Diag(ValArg->getLocStart(), diag::err_builtin_annotation_first_arg) - << ValArg->getSourceRange(); + S.Diag(ValArg->getBeginLoc(), diag::err_builtin_annotation_first_arg) + << ValArg->getSourceRange(); return true; } @@ -144,8 +144,8 @@ 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) - << StrArg->getSourceRange(); + 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,8 +390,8 @@ static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) { if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) { - S.Diag(Call->getLocStart(), diag::err_opencl_requires_extension) - << 1 << Call->getDirectCallee() << "cl_khr_subgroups"; + S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension) + << 1 << Call->getDirectCallee() << "cl_khr_subgroups"; return true; } return false; @@ -407,16 +407,14 @@ // First argument is an ndrange_t type. Expr *NDRangeArg = TheCall->getArg(0); if (NDRangeArg->getType().getUnqualifiedType().getAsString() != "ndrange_t") { - S.Diag(NDRangeArg->getLocStart(), - diag::err_opencl_builtin_expected_type) + S.Diag(NDRangeArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "'ndrange_t'"; return true; } Expr *BlockArg = TheCall->getArg(1); if (!isBlockPointer(BlockArg)) { - S.Diag(BlockArg->getLocStart(), - diag::err_opencl_builtin_expected_type) + S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; } @@ -432,8 +430,7 @@ Expr *BlockArg = TheCall->getArg(0); if (!isBlockPointer(BlockArg)) { - S.Diag(BlockArg->getLocStart(), - diag::err_opencl_builtin_expected_type) + S.Diag(BlockArg->getBeginLoc(), diag::err_opencl_builtin_expected_type) << TheCall->getDirectCallee() << "block"; return true; } @@ -467,7 +464,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 +504,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 +515,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 +523,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 +531,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 +542,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 +550,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 +565,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 +574,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 +587,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 +599,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 +613,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 +628,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 +647,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 +661,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 +685,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 +718,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 +728,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 +739,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 +762,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 +790,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 +809,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 +826,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 +834,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 +869,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 +1168,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,9 +1178,9 @@ const Expr *FnPtrArg = TheCall->getArg(1)->IgnoreImpCasts(); const QualType FnPtrArgType = FnPtrArg->getType(); if (!FnPtrArgType->isPointerType()) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) - << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 - << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) + << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 + << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); } @@ -1191,15 +1188,15 @@ FnPtrArgType->getPointeeType()->getAs(); if (!FuncType) { - Diag(FnPtrArg->getLocStart(), diag::err_typecheck_convert_incompatible) - << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 - << 2 << FnPtrArgType << "'int (*)(const char *, ...)'"; + Diag(FnPtrArg->getBeginLoc(), diag::err_typecheck_convert_incompatible) + << FnPtrArgType << "'int (*)(const char *, ...)'" << 1 << 0 << 3 << 2 + << FnPtrArgType << "'int (*)(const char *, ...)'"; return ExprError(); } 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 +1205,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 +1256,7 @@ return ExprError(); if (CheckCXXThrowOperand( - TheCall->getLocStart(), + TheCall->getBeginLoc(), Context.getExceptionObjectType(FDecl->getParamDecl(0)->getType()), TheCall)) return ExprError(); @@ -1477,8 +1474,8 @@ TV = Result.getLimitedValue(64); if ((TV > 63) || (mask & (1ULL << TV)) == 0) - return Diag(TheCall->getLocStart(), diag::err_invalid_neon_type_code) - << TheCall->getArg(ImmArg)->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_invalid_neon_type_code) + << TheCall->getArg(ImmArg)->getSourceRange(); } if (PtrArgNum >= 0) { @@ -1503,7 +1500,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,8 +1554,8 @@ const PointerType *pointerType = PointerArg->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) - << PointerArg->getType() << PointerArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) + << PointerArg->getType() << PointerArg->getSourceRange(); return true; } @@ -1574,10 +1571,9 @@ CastKind CastNeeded = CK_NoOp; if (!AddrType.isAtLeastAsQualifiedAs(ValType)) { CastNeeded = CK_BitCast; - Diag(DRE->getLocStart(), diag::ext_typecheck_convert_discards_qualifiers) - << PointerArg->getType() - << Context.getPointerType(AddrType) - << AA_Passing << PointerArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::ext_typecheck_convert_discards_qualifiers) + << PointerArg->getType() << Context.getPointerType(AddrType) + << AA_Passing << PointerArg->getSourceRange(); } // Finally, do the cast and replace the argument with the corrected version. @@ -1592,16 +1588,16 @@ // 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) - << PointerArg->getType() << PointerArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr) + << PointerArg->getType() << PointerArg->getSourceRange(); return true; } // 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) - << PointerArg->getType() << PointerArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_exclusive_builtin_pointer_size) + << PointerArg->getType() << PointerArg->getSourceRange(); return true; } @@ -1614,8 +1610,8 @@ case Qualifiers::OCL_Weak: case Qualifiers::OCL_Strong: case Qualifiers::OCL_Autoreleasing: - Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership) - << ValType << PointerArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) + << ValType << PointerArg->getSourceRange(); return true; } @@ -2491,7 +2487,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 +2495,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 +2504,7 @@ return TI.hasFeature(F); }); if (!IsValid) - return Diag(TheCall->getLocStart(), + return Diag(TheCall->getBeginLoc(), diag::err_hexagon_builtin_unsupported_hvx); } @@ -2935,13 +2931,13 @@ BuiltinID == PPC::BI__builtin_divdeu; if (Is64BitBltin && !IsTarget64Bit) - return Diag(TheCall->getLocStart(), diag::err_64_bit_builtin_32_bit_tgt) - << TheCall->getSourceRange(); + 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 +2969,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 +3033,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 +3053,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,8 +3263,8 @@ (HasRC && Result.getZExtValue() >= 8 && Result.getZExtValue() <= 11)) return false; - return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_rounding) - << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_rounding) + << Arg->getSourceRange(); } // Check if the gather/scatter scale is legal. @@ -3370,8 +3366,8 @@ if (Result == 1 || Result == 2 || Result == 4 || Result == 8) return false; - return Diag(TheCall->getLocStart(), diag::err_x86_builtin_invalid_scale) - << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_x86_builtin_invalid_scale) + << Arg->getSourceRange(); } static bool isX86_32Builtin(unsigned BuiltinID) { @@ -3395,7 +3391,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,10 +4313,10 @@ << 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(); + << 0 << AdjustedNumArgs << TheCall->getNumArgs() + << TheCall->getCallee()->getSourceRange(); return ExprError(); } @@ -4333,8 +4329,8 @@ Ptr = ConvertedPtr.get(); const PointerType *pointerType = Ptr->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) - << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) + << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4343,13 +4339,13 @@ QualType ValType = AtomTy; // 'C' if (IsC11) { if (!AtomTy->isAtomicType()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_atomic) - << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic) + << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } if ((Form != Load && Form != LoadCopy && 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,8 +4353,8 @@ ValType = AtomTy->getAs()->getValueType(); } else if (Form != Load && Form != LoadCopy) { if (ValType.isConstQualified()) { - Diag(DRE->getLocStart(), diag::err_atomic_op_needs_non_const_pointer) - << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_non_const_pointer) + << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } } @@ -4368,33 +4364,33 @@ // 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) - << IsC11 << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr) + << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } if (IsMinMax) { 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) - << IsC11 << Ptr->getType() << Ptr->getSourceRange(); + 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) - << IsC11 << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_atomic_int_or_ptr) + << IsC11 << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4402,8 +4398,8 @@ !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) - << Ptr->getType() << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_op_needs_trivial_copy) + << Ptr->getType() << Ptr->getSourceRange(); return ExprError(); } @@ -4418,8 +4414,8 @@ 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) - << ValType << Ptr->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) + << ValType << Ptr->getSourceRange(); return ExprError(); } @@ -4457,7 +4453,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 +4467,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 +4489,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 +4554,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,25 +4564,26 @@ 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(), - SubExprs, ResultType, Op, - TheCall->getRParenLoc()); + AtomicExpr *AE = + new (Context) AtomicExpr(TheCall->getCallee()->getBeginLoc(), SubExprs, + ResultType, Op, TheCall->getRParenLoc()); if ((Op == AtomicExpr::AO__c11_atomic_load || Op == AtomicExpr::AO__c11_atomic_store || 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); + Op == AtomicExpr::AO__opencl_atomic_load) + ? 0 + : 1); return AE; } @@ -4651,21 +4648,21 @@ const PointerType *pointerType = FirstArg->getType()->getAs(); if (!pointerType) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer) - << FirstArg->getType() << FirstArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) + << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } QualType ValType = pointerType->getPointeeType(); if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType()) { - Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer_intptr) - << FirstArg->getType() << FirstArg->getSourceRange(); + 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,8 +4676,8 @@ case Qualifiers::OCL_Weak: case Qualifiers::OCL_Strong: case Qualifiers::OCL_Autoreleasing: - Diag(DRE->getLocStart(), diag::err_arc_atomic_ownership) - << ValType << FirstArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_arc_atomic_ownership) + << ValType << FirstArg->getSourceRange(); return ExprError(); } @@ -4730,8 +4727,8 @@ case 8: SizeIndex = 3; break; case 16: SizeIndex = 4; break; default: - Diag(DRE->getLocStart(), diag::err_atomic_builtin_pointer_size) - << FirstArg->getType() << FirstArg->getSourceRange(); + Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_pointer_size) + << FirstArg->getType() << FirstArg->getSourceRange(); return ExprError(); } @@ -4929,7 +4926,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 +5023,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 +5035,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,8 +5067,8 @@ StringLiteral *Literal = dyn_cast(Arg); if (!Literal || !Literal->isAscii()) { - Diag(Arg->getLocStart(), diag::err_cfstring_literal_not_string_constant) - << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::err_cfstring_literal_not_string_constant) + << Arg->getSourceRange(); return true; } @@ -5087,8 +5084,8 @@ ToPtr + NumBytes, llvm::strictConversion); // Check for conversion failure. if (Result != llvm::conversionOK) - Diag(Arg->getLocStart(), - diag::warn_cfstring_truncated) << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::warn_cfstring_truncated) + << Arg->getSourceRange(); } return false; } @@ -5106,7 +5103,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 +5130,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 +5139,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 +5147,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 +5170,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,12 +5199,12 @@ 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(), - (*(TheCall->arg_end()-1))->getLocEnd()); + << 0 /*function call*/ << 2 << TheCall->getNumArgs() + << Fn->getSourceRange() + << SourceRange(TheCall->getArg(2)->getBeginLoc(), + (*(TheCall->arg_end() - 1))->getLocEnd()); return true; } @@ -5249,7 +5246,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 +5263,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,20 +5302,18 @@ Context.getPointerType(Context.CharTy.withConst()); if (!Arg1Ty->isPointerType() || Arg1Ty->getPointeeType().withoutLocalFastQualifiers() != Context.CharTy) - Diag(Arg1->getLocStart(), diag::err_typecheck_convert_incompatible) - << Arg1->getType() << ConstCharPtrTy - << 1 /* different class */ - << 0 /* qualifier difference */ - << 3 /* parameter mismatch */ + Diag(Arg1->getBeginLoc(), diag::err_typecheck_convert_incompatible) + << Arg1->getType() << ConstCharPtrTy << 1 /* different class */ + << 0 /* qualifier difference */ + << 3 /* parameter mismatch */ << 2 << Arg1->getType() << ConstCharPtrTy; const QualType SizeTy = Context.getSizeType(); if (Arg2Ty->getCanonicalTypeInternal().withoutLocalFastQualifiers() != SizeTy) - Diag(Arg2->getLocStart(), diag::err_typecheck_convert_incompatible) - << Arg2->getType() << SizeTy - << 1 /* different class */ - << 0 /* qualifier difference */ - << 3 /* parameter mismatch */ + Diag(Arg2->getBeginLoc(), diag::err_typecheck_convert_incompatible) + << Arg2->getType() << SizeTy << 1 /* different class */ + << 0 /* qualifier difference */ + << 3 /* parameter mismatch */ << 3 << Arg2->getType() << SizeTy; return false; @@ -5331,11 +5326,11 @@ 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(), - (*(TheCall->arg_end()-1))->getLocEnd()); + << 0 /*function call*/ << 2 << TheCall->getNumArgs() + << SourceRange(TheCall->getArg(2)->getBeginLoc(), + (*(TheCall->arg_end() - 1))->getLocEnd()); ExprResult OrigArg0 = TheCall->getArg(0); ExprResult OrigArg1 = TheCall->getArg(1); @@ -5358,10 +5353,11 @@ // 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()); + << OrigArg0.get()->getType() << OrigArg1.get()->getType() + << SourceRange(OrigArg0.get()->getBeginLoc(), + OrigArg1.get()->getLocEnd()); return false; } @@ -5375,11 +5371,11 @@ 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(), - (*(TheCall->arg_end()-1))->getLocEnd()); + << 0 /*function call*/ << NumArgs << TheCall->getNumArgs() + << SourceRange(TheCall->getArg(NumArgs)->getBeginLoc(), + (*(TheCall->arg_end() - 1))->getLocEnd()); Expr *OrigArg = TheCall->getArg(NumArgs-1); @@ -5388,9 +5384,9 @@ // 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(); + << OrigArg->getType() << OrigArg->getSourceRange(); // If this is an implicit conversion from float -> float, double, or // long double, remove it. @@ -5438,22 +5434,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 +5457,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,11 +5490,11 @@ QualType RHSType = TheCall->getArg(1)->getType(); if (!LHSType->isVectorType() || !RHSType->isVectorType()) - return ExprError(Diag(TheCall->getLocStart(), - diag::err_vec_builtin_non_vector) - << TheCall->getDirectCallee() - << SourceRange(TheCall->getArg(0)->getLocStart(), - TheCall->getArg(1)->getLocEnd())); + return ExprError( + Diag(TheCall->getBeginLoc(), diag::err_vec_builtin_non_vector) + << TheCall->getDirectCallee() + << SourceRange(TheCall->getArg(0)->getBeginLoc(), + TheCall->getArg(1)->getLocEnd())); numElements = LHSType->getAs()->getNumElements(); unsigned numResElements = TheCall->getNumArgs() - 2; @@ -5509,16 +5505,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 +5530,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 +5539,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 +5552,7 @@ } return new (Context) ShuffleVectorExpr(Context, exprs, resType, - TheCall->getCallee()->getLocStart(), + TheCall->getCallee()->getBeginLoc(), TheCall->getRParenLoc()); } @@ -5619,9 +5615,9 @@ if (Arg->isInstantiationDependent()) return false; if (Arg->HasSideEffects(Context)) - Diag(Arg->getLocStart(), diag::warn_assume_side_effects) - << Arg->getSourceRange() - << cast(TheCall->getCalleeDecl())->getIdentifier(); + Diag(Arg->getBeginLoc(), diag::warn_assume_side_effects) + << Arg->getSourceRange() + << cast(TheCall->getCalleeDecl())->getIdentifier(); return false; } @@ -5638,25 +5634,22 @@ if (const auto *UE = dyn_cast(Arg->IgnoreParenImpCasts())) if (UE->getKind() == UETT_AlignOf) - Diag(TheCall->getLocStart(), diag::warn_alloca_align_alignof) - << Arg->getSourceRange(); + Diag(TheCall->getBeginLoc(), diag::warn_alloca_align_alignof) + << Arg->getSourceRange(); llvm::APSInt Result = Arg->EvaluateKnownConstInt(Context); if (!Result.isPowerOf2()) - return Diag(TheCall->getLocStart(), - diag::err_alignment_not_power_of_two) - << Arg->getSourceRange(); + 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) - << (unsigned)Context.getCharWidth() - << Arg->getSourceRange(); + 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) - << std::numeric_limits::max() - << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_alignment_too_big) + << std::numeric_limits::max() << Arg->getSourceRange(); } return false; @@ -5683,9 +5676,8 @@ return true; if (!Result.isPowerOf2()) - return Diag(TheCall->getLocStart(), - diag::err_alignment_not_power_of_two) - << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_alignment_not_power_of_two) + << Arg->getSourceRange(); } if (NumArgs > 2) { @@ -5766,7 +5758,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,8 +5783,8 @@ if (Arg->isTypeDependent() || Arg->isValueDependent()) return false; if (!Arg->isIntegerConstantExpr(Result, Context)) - return Diag(TheCall->getLocStart(), diag::err_constant_integer_arg_type) - << FDecl->getDeclName() << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_constant_integer_arg_type) + << FDecl->getDeclName() << Arg->getSourceRange(); return false; } @@ -5814,15 +5806,15 @@ 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, - PDiag(diag::warn_argument_invalid_range) - << Result.toString(10) << Low << High - << Arg->getSourceRange()); + DiagRuntimeBehavior(TheCall->getBeginLoc(), TheCall, + PDiag(diag::warn_argument_invalid_range) + << Result.toString(10) << Low << High + << Arg->getSourceRange()); } return false; @@ -5844,8 +5836,8 @@ return true; if (Result.getSExtValue() % Num != 0) - return Diag(TheCall->getLocStart(), diag::err_argument_not_multiple) - << Num << Arg->getSourceRange(); + return Diag(TheCall->getBeginLoc(), diag::err_argument_not_multiple) + << Num << Arg->getSourceRange(); return false; } @@ -5876,7 +5868,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 +5877,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 +5919,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 +5947,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 +5958,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 +5968,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 +6115,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 +6505,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 +6825,7 @@ if (!ArgExpr) return; - SourceLocation Loc = ArgExpr->getLocStart(); + SourceLocation Loc = ArgExpr->getBeginLoc(); if (S.getSourceManager().isInSystemMacro(Loc)) return; @@ -7279,9 +7271,8 @@ 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) - << "c_str()" - << FixItHint::CreateInsertion(EndLoc, ".c_str()"); + S.Diag(E->getBeginLoc(), diag::note_printf_c_str) + << "c_str()" << FixItHint::CreateInsertion(EndLoc, ".c_str()"); return true; } } @@ -7355,22 +7346,22 @@ ArgType(S.Context.IntTy) : ArgType::CPointerTy; if (AT.isValid() && !AT.matchesType(S.Context, Ex->getType())) EmitFormatDiagnostic( - S.PDiag(diag::warn_format_conversion_argument_type_mismatch) - << AT.getRepresentativeTypeName(S.Context) << Ex->getType() - << false << Ex->getSourceRange(), - Ex->getLocStart(), /*IsStringLocation*/false, - getSpecifierRange(startSpecifier, specifierLen)); + S.PDiag(diag::warn_format_conversion_argument_type_mismatch) + << AT.getRepresentativeTypeName(S.Context) << Ex->getType() + << false << Ex->getSourceRange(), + Ex->getBeginLoc(), /*IsStringLocation*/ false, + getSpecifierRange(startSpecifier, specifierLen)); // Type check the second argument (char * for both %b and %D) Ex = getDataArg(argIndex + 1); const analyze_printf::ArgType &AT2 = ArgType::CStrTy; if (AT2.isValid() && !AT2.matchesType(S.Context, Ex->getType())) EmitFormatDiagnostic( - S.PDiag(diag::warn_format_conversion_argument_type_mismatch) - << AT2.getRepresentativeTypeName(S.Context) << Ex->getType() - << false << Ex->getSourceRange(), - Ex->getLocStart(), /*IsStringLocation*/false, - getSpecifierRange(startSpecifier, specifierLen)); + S.PDiag(diag::warn_format_conversion_argument_type_mismatch) + << AT2.getRepresentativeTypeName(S.Context) << Ex->getType() + << false << Ex->getSourceRange(), + Ex->getBeginLoc(), /*IsStringLocation*/ false, + getSpecifierRange(startSpecifier, specifierLen)); return true; } @@ -7668,7 +7659,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 +7711,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,13 +7740,13 @@ } else if (!requiresParensToAddCast(E)) { // If the expression has high enough precedence, // just write the C-style cast. - Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(), - CastFix.str())); + 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(), - CastFix.str())); + Hints.push_back( + FixItHint::CreateInsertion(E->getBeginLoc(), CastFix.str())); SourceLocation After = S.getLocForEndOfToken(E->getLocEnd()); Hints.push_back(FixItHint::CreateInsertion(After, ")")); @@ -7775,18 +7766,17 @@ : 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 // specifier, but we've decided that the specifier is probably correct // and we should cast instead. Just use the normal warning message. EmitFormatDiagnostic( - S.PDiag(diag::warn_format_conversion_argument_type_mismatch) - << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum - << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, - SpecRange, Hints); + S.PDiag(diag::warn_format_conversion_argument_type_mismatch) + << AT.getRepresentativeTypeName(S.Context) << ExprTy << IsEnum + << E->getSourceRange(), + E->getBeginLoc(), /*IsStringLocation*/ false, SpecRange, Hints); } } } else { @@ -7806,41 +7796,34 @@ 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: case Sema::VAK_MSVCUndefined: - EmitFormatDiagnostic( - S.PDiag(diag::warn_non_pod_vararg_with_format_string) - << S.getLangOpts().CPlusPlus11 - << ExprTy - << CallType - << AT.getRepresentativeTypeName(S.Context) - << CSR - << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, CSR); + EmitFormatDiagnostic(S.PDiag(diag::warn_non_pod_vararg_with_format_string) + << S.getLangOpts().CPlusPlus11 << ExprTy + << CallType + << AT.getRepresentativeTypeName(S.Context) << CSR + << E->getSourceRange(), + E->getBeginLoc(), /*IsStringLocation*/ false, CSR); checkForCStrMembers(AT, E); break; case Sema::VAK_Invalid: if (ExprTy->isObjCObjectType()) EmitFormatDiagnostic( - S.PDiag(diag::err_cannot_pass_objc_interface_to_vararg_format) - << S.getLangOpts().CPlusPlus11 - << ExprTy - << CallType - << AT.getRepresentativeTypeName(S.Context) - << CSR - << E->getSourceRange(), - E->getLocStart(), /*IsStringLocation*/false, CSR); + S.PDiag(diag::err_cannot_pass_objc_interface_to_vararg_format) + << S.getLangOpts().CPlusPlus11 << ExprTy << CallType + << AT.getRepresentativeTypeName(S.Context) << CSR + << E->getSourceRange(), + 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) - << isa(E) << ExprTy << CallType - << AT.getRepresentativeTypeName(S.Context) - << E->getSourceRange(); + S.Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg_format) + << isa(E) << ExprTy << CallType + << AT.getRepresentativeTypeName(S.Context) << E->getSourceRange(); break; } @@ -8010,7 +7993,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 +8002,7 @@ EmitFormatDiagnostic(S.PDiag(Diag) << AT.getRepresentativeTypeName(S.Context) << Ex->getType() << false << Ex->getSourceRange(), - Ex->getLocStart(), + Ex->getBeginLoc(), /*IsStringLocation*/ false, getSpecifierRange(startSpecifier, specifierLen)); } @@ -8040,9 +8023,9 @@ // CHECK: is the format string a wide literal? if (!FExpr->isAscii() && !FExpr->isUTF8()) { CheckFormatHandler::EmitFormatDiagnostic( - S, inFunctionCall, Args[format_idx], - S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getLocStart(), - /*IsStringLocation*/true, OrigFormatExpr->getSourceRange()); + S, inFunctionCall, Args[format_idx], + S.PDiag(diag::warn_format_string_is_wide_literal), FExpr->getBeginLoc(), + /*IsStringLocation*/ true, OrigFormatExpr->getSourceRange()); return; } @@ -8064,7 +8047,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; } @@ -8072,9 +8055,9 @@ // CHECK: empty format string? if (StrLen == 0 && numDataArgs > 0) { CheckFormatHandler::EmitFormatDiagnostic( - S, inFunctionCall, Args[format_idx], - S.PDiag(diag::warn_empty_format_string), FExpr->getLocStart(), - /*IsStringLocation*/true, OrigFormatExpr->getSourceRange()); + S, inFunctionCall, Args[format_idx], + S.PDiag(diag::warn_empty_format_string), FExpr->getBeginLoc(), + /*IsStringLocation*/ true, OrigFormatExpr->getSourceRange()); return; } @@ -8855,7 +8838,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 +9060,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,8 +9092,8 @@ return; const Expr *OriginalSizeArg = Call->getArg(2); - Diag(CompareWithSrcDRE->getLocStart(), diag::warn_strlcpycat_wrong_size) - << OriginalSizeArg->getSourceRange() << FnName; + Diag(CompareWithSrcDRE->getBeginLoc(), diag::warn_strlcpycat_wrong_size) + << OriginalSizeArg->getSourceRange() << FnName; // Output a FIXIT hint if the destination is an array (rather than a // pointer to an array). This could be enhanced to handle some @@ -9126,9 +9109,9 @@ DstArg->printPretty(OS, nullptr, getPrintingPolicy()); OS << ")"; - Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size) - << FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(), - OS.str()); + Diag(OriginalSizeArg->getBeginLoc(), diag::note_strlcpycat_wrong_size) + << FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(), + OS.str()); } /// Check if two expressions refer to the same declaration. @@ -9161,7 +9144,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 +9176,7 @@ return; // Generate the diagnostic. - SourceLocation SL = LenArg->getLocStart(); + SourceLocation SL = LenArg->getBeginLoc(); SourceRange SR = LenArg->getSourceRange(); SourceManager &SM = getSourceManager(); @@ -9740,7 +9723,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,10 +10530,9 @@ ElementResult, false, false) != Sema::Compatible) { - S.Diag(Element->getLocStart(), - diag::warn_objc_collection_literal_element) - << ElementType << ElementKind << TargetElementType - << Element->getSourceRange(); + S.Diag(Element->getBeginLoc(), diag::warn_objc_collection_literal_element) + << ElementType << ElementKind << TargetElementType + << Element->getSourceRange(); } if (auto ArrayLiteral = dyn_cast(Element)) @@ -10626,7 +10608,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 +11051,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 +11265,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; @@ -12185,8 +12167,8 @@ SourceLocation RBracketLoc = SourceMgr.getSpellingLoc( ASE->getRBracketLoc()); if (SourceMgr.isInSystemHeader(RBracketLoc)) { - SourceLocation IndexLoc = SourceMgr.getSpellingLoc( - IndexExpr->getLocStart()); + SourceLocation IndexLoc = + SourceMgr.getSpellingLoc(IndexExpr->getBeginLoc()); if (SourceMgr.isWrittenInSameFile(RBracketLoc, IndexLoc)) return; } @@ -12196,11 +12178,11 @@ 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) - << IndexExpr->getSourceRange()); + << size.toString(10, true) + << (unsigned)size.getLimitedValue(~0U) + << IndexExpr->getSourceRange()); } else { unsigned DiagID = diag::warn_array_index_precedes_bounds; if (!ASE) { @@ -12208,9 +12190,9 @@ if (index.isNegative()) index = -index; } - DiagRuntimeBehavior(BaseExpr->getLocStart(), BaseExpr, + DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr, PDiag(DiagID) << index.toString(10, true) - << IndexExpr->getSourceRange()); + << IndexExpr->getSourceRange()); } if (!ND) { @@ -12225,9 +12207,9 @@ } if (ND) - DiagRuntimeBehavior(ND->getLocStart(), BaseExpr, + DiagRuntimeBehavior(ND->getBeginLoc(), BaseExpr, PDiag(diag::note_array_index_out_of_bounds) - << ND->getDeclName()); + << ND->getDeclName()); } void Sema::CheckArrayAccess(const Expr *expr) { @@ -12967,15 +12949,13 @@ if (!ProbableTypo) { bool BodyColInvalid; unsigned BodyCol = SourceMgr.getPresumedColumnNumber( - PossibleBody->getLocStart(), - &BodyColInvalid); + PossibleBody->getBeginLoc(), &BodyColInvalid); if (BodyColInvalid) return; bool StmtColInvalid; - unsigned StmtCol = SourceMgr.getPresumedColumnNumber( - S->getLocStart(), - &StmtColInvalid); + unsigned StmtCol = + SourceMgr.getPresumedColumnNumber(S->getBeginLoc(), &StmtColInvalid); if (StmtColInvalid) return; @@ -13495,7 +13475,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: cfe/trunk/lib/Sema/SemaCoroutine.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaCoroutine.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaDecl.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp +++ cfe/trunk/lib/Sema/SemaDecl.cpp @@ -1739,8 +1739,8 @@ tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), true); if (AfterColon.isInvalid()) return; - Hint = FixItHint::CreateRemoval(CharSourceRange:: - getCharRange(D->getLocStart(), AfterColon)); + Hint = FixItHint::CreateRemoval( + CharSourceRange::getCharRange(D->getBeginLoc(), AfterColon)); } } @@ -4351,8 +4351,8 @@ Record = UT->getDecl(); if (Record && getLangOpts().MicrosoftExt) { - Diag(DS.getLocStart(), diag::ext_ms_anonymous_record) - << Record->isUnion() << DS.getSourceRange(); + Diag(DS.getBeginLoc(), diag::ext_ms_anonymous_record) + << Record->isUnion() << DS.getSourceRange(); return BuildMicrosoftCAnonymousStruct(S, DS, Record); } @@ -4375,8 +4375,8 @@ 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) - << DS.getSourceRange(); + Diag(DS.getBeginLoc(), diag::ext_typedef_without_a_name) + << DS.getSourceRange(); else DeclaresAnything = false; } @@ -4400,7 +4400,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; } @@ -4810,14 +4810,11 @@ // Create a declaration for this anonymous struct/union. NamedDecl *Anon = nullptr; if (RecordDecl *OwningClass = dyn_cast(Owner)) { - Anon = FieldDecl::Create(Context, OwningClass, - DS.getLocStart(), - Record->getLocation(), - /*IdentifierInfo=*/nullptr, - Context.getTypeDeclType(Record), - TInfo, - /*BitWidth=*/nullptr, /*Mutable=*/false, - /*InitStyle=*/ICIS_NoInit); + Anon = FieldDecl::Create( + Context, OwningClass, DS.getBeginLoc(), Record->getLocation(), + /*IdentifierInfo=*/nullptr, Context.getTypeDeclType(Record), TInfo, + /*BitWidth=*/nullptr, /*Mutable=*/false, + /*InitStyle=*/ICIS_NoInit); Anon->setAccess(AS); if (getLangOpts().CPlusPlus) FieldCollector->Add(cast(Anon)); @@ -4832,11 +4829,9 @@ SC = SC_None; } - Anon = VarDecl::Create(Context, Owner, - DS.getLocStart(), + Anon = VarDecl::Create(Context, Owner, DS.getBeginLoc(), Record->getLocation(), /*IdentifierInfo=*/nullptr, - Context.getTypeDeclType(Record), - TInfo, SC); + Context.getTypeDeclType(Record), TInfo, SC); // Default-initialize the implicit variable. This initialization will be // trivial in almost all cases, except if a union member has an in-class @@ -4908,15 +4903,11 @@ QualType RecTy = Context.getTypeDeclType(Record); // Create a declaration for this anonymous struct. - NamedDecl *Anon = FieldDecl::Create(Context, - ParentDecl, - DS.getLocStart(), - DS.getLocStart(), - /*IdentifierInfo=*/nullptr, - RecTy, - TInfo, - /*BitWidth=*/nullptr, /*Mutable=*/false, - /*InitStyle=*/ICIS_NoInit); + NamedDecl *Anon = + FieldDecl::Create(Context, ParentDecl, DS.getBeginLoc(), DS.getBeginLoc(), + /*IdentifierInfo=*/nullptr, RecTy, TInfo, + /*BitWidth=*/nullptr, /*Mutable=*/false, + /*InitStyle=*/ICIS_NoInit); Anon->setImplicit(); // Add the anonymous struct object to the current context. @@ -5344,9 +5335,8 @@ return ActOnDecompositionDeclarator(S, D, TemplateParamLists); } else if (!Name) { if (!D.isInvalidType()) // Reject this if we think it is valid. - Diag(D.getDeclSpec().getLocStart(), - diag::err_declarator_need_ident) - << D.getDeclSpec().getSourceRange() << D.getSourceRange(); + Diag(D.getDeclSpec().getBeginLoc(), diag::err_declarator_need_ident) + << D.getDeclSpec().getSourceRange() << D.getSourceRange(); return nullptr; } else if (DiagnoseUnexpandedParameterPack(NameInfo, UPPC_DeclarationType)) return nullptr; @@ -6378,7 +6368,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(); } } @@ -6452,9 +6442,8 @@ VarTemplateDecl *NewTemplate = nullptr; TemplateParameterList *TemplateParams = nullptr; if (!getLangOpts().CPlusPlus) { - NewVD = VarDecl::Create(Context, DC, D.getLocStart(), - D.getIdentifierLoc(), II, - R, TInfo, SC); + NewVD = VarDecl::Create(Context, DC, D.getBeginLoc(), D.getIdentifierLoc(), + II, R, TInfo, SC); if (R->getContainedDeducedType()) ParsingInitForAutoVars.insert(NewVD); @@ -6516,7 +6505,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 @@ -6575,11 +6564,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. @@ -6796,7 +6785,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); } } @@ -6926,12 +6915,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()) { @@ -7933,10 +7922,8 @@ (D.isFunctionDeclarator() && D.getFunctionTypeInfo().hasPrototype) || (!R->getAsAdjusted() && R->isFunctionProtoType()); - NewFD = FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), NameInfo, R, - TInfo, SC, isInline, - HasPrototype, false); + NewFD = FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), NameInfo, + R, TInfo, SC, isInline, HasPrototype, false); if (D.isInvalidType()) NewFD->setInvalidDecl(); @@ -7961,22 +7948,20 @@ "Constructors can only be declared in a member context"); R = SemaRef.CheckConstructorDeclarator(D, R, SC); - return CXXConstructorDecl::Create(SemaRef.Context, cast(DC), - D.getLocStart(), NameInfo, - R, TInfo, isExplicit, isInline, - /*isImplicitlyDeclared=*/false, - isConstexpr); + return CXXConstructorDecl::Create( + SemaRef.Context, cast(DC), D.getBeginLoc(), NameInfo, R, + TInfo, isExplicit, isInline, + /*isImplicitlyDeclared=*/false, isConstexpr); } else if (Name.getNameKind() == DeclarationName::CXXDestructorName) { // This is a C++ destructor declaration. if (DC->isRecord()) { R = SemaRef.CheckDestructorDeclarator(D, R, SC); CXXRecordDecl *Record = cast(DC); - CXXDestructorDecl *NewDD = CXXDestructorDecl::Create( - SemaRef.Context, Record, - D.getLocStart(), - NameInfo, R, TInfo, isInline, - /*isImplicitlyDeclared=*/false); + CXXDestructorDecl *NewDD = + CXXDestructorDecl::Create(SemaRef.Context, Record, D.getBeginLoc(), + NameInfo, R, TInfo, isInline, + /*isImplicitlyDeclared=*/false); // If the class is complete, then we now create the implicit exception // specification. If the class is incomplete or dependent, we can't do @@ -7996,10 +7981,9 @@ // Create a FunctionDecl to satisfy the function definition parsing // code path. - return FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), - D.getIdentifierLoc(), Name, R, TInfo, - SC, isInline, + return FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), + D.getIdentifierLoc(), Name, R, TInfo, SC, + isInline, /*hasPrototype=*/true, isConstexpr); } @@ -8012,15 +7996,14 @@ SemaRef.CheckConversionDeclarator(D, R, SC); IsVirtualOkay = true; - return CXXConversionDecl::Create(SemaRef.Context, cast(DC), - D.getLocStart(), NameInfo, - R, TInfo, isInline, isExplicit, - isConstexpr, SourceLocation()); + return CXXConversionDecl::Create( + SemaRef.Context, cast(DC), 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()) { @@ -8037,11 +8020,9 @@ } // This is a C++ method declaration. - CXXMethodDecl *Ret = CXXMethodDecl::Create(SemaRef.Context, - cast(DC), - D.getLocStart(), NameInfo, R, - TInfo, SC, isInline, - isConstexpr, SourceLocation()); + CXXMethodDecl *Ret = CXXMethodDecl::Create( + SemaRef.Context, cast(DC), D.getBeginLoc(), NameInfo, R, + TInfo, SC, isInline, isConstexpr, SourceLocation()); IsVirtualOkay = !Ret->isStatic(); return Ret; } else { @@ -8053,10 +8034,9 @@ // Determine whether the function was written with a // prototype. This true when: // - we're in C++ (where every function has a prototype), - return FunctionDecl::Create(SemaRef.Context, DC, - D.getLocStart(), - NameInfo, R, TInfo, SC, isInline, - true/*HasPrototype*/, isConstexpr); + return FunctionDecl::Create(SemaRef.Context, DC, D.getBeginLoc(), NameInfo, + R, TInfo, SC, isInline, true /*HasPrototype*/, + isConstexpr); } } @@ -8421,7 +8401,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 @@ -8491,8 +8471,7 @@ << FixItHint::CreateInsertion(InsertLoc, "<>"); } } - } - else { + } else { // All template param lists were matched against the scope specifier: // this is NOT (an explicit specialization of) a template. if (TemplateParamLists.size() > 0) @@ -10111,7 +10090,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; } @@ -10714,11 +10693,10 @@ return; } - S.DiagRuntimeBehavior(DRE->getLocStart(), DRE, + S.DiagRuntimeBehavior(DRE->getBeginLoc(), DRE, S.PDiag(diag) - << DRE->getDecl() - << OrigDecl->getLocation() - << DRE->getSourceRange()); + << DRE->getDecl() << OrigDecl->getLocation() + << DRE->getSourceRange()); } }; @@ -10817,7 +10795,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; @@ -10825,7 +10803,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; @@ -10834,7 +10812,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; @@ -11139,7 +11117,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); } @@ -11271,9 +11249,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(); @@ -11288,8 +11266,8 @@ // Suggest adding 'constexpr' in C++11 for literal types. } 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 "); + << DclT << Init->getSourceRange() + << FixItHint::CreateInsertion(VDecl->getBeginLoc(), "constexpr "); VDecl->setConstexpr(true); } else { @@ -12370,11 +12348,9 @@ // Temporarily put parameter variables in the translation unit, not // the enclosing context. This prevents them from accidentally // looking like class members in C++. - ParmVarDecl *New = CheckParameter(Context.getTranslationUnitDecl(), - D.getLocStart(), - D.getIdentifierLoc(), II, - parmDeclType, TInfo, - SC); + ParmVarDecl *New = + CheckParameter(Context.getTranslationUnitDecl(), D.getBeginLoc(), + D.getIdentifierLoc(), II, parmDeclType, TInfo, SC); if (D.isInvalidType()) New->setInvalidDecl(); @@ -13111,7 +13087,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)) { @@ -13262,7 +13238,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; @@ -13568,11 +13544,9 @@ } // Scope manipulation handled by caller. - TypedefDecl *NewTD = TypedefDecl::Create(Context, CurContext, - D.getLocStart(), - D.getIdentifierLoc(), - D.getIdentifier(), - TInfo); + TypedefDecl *NewTD = + TypedefDecl::Create(Context, CurContext, D.getBeginLoc(), + D.getIdentifierLoc(), D.getIdentifier(), TInfo); // Bail out immediately if we have an invalid declaration. if (D.isInvalidType()) { @@ -14863,12 +14837,11 @@ // class itself; this is known as the injected-class-name. For // purposes of access checking, the injected-class-name is treated // as if it were a public member name. - CXXRecordDecl *InjectedClassName - = CXXRecordDecl::Create(Context, Record->getTagKind(), CurContext, - Record->getLocStart(), Record->getLocation(), - Record->getIdentifier(), - /*PrevDecl=*/nullptr, - /*DelayTypeCreation=*/true); + CXXRecordDecl *InjectedClassName = CXXRecordDecl::Create( + Context, Record->getTagKind(), CurContext, Record->getBeginLoc(), + Record->getLocation(), Record->getIdentifier(), + /*PrevDecl=*/nullptr, + /*DelayTypeCreation=*/true); Context.getTypeDeclType(InjectedClassName, Record); InjectedClassName->setImplicit(); InjectedClassName->setAccess(AS_public); @@ -15135,7 +15108,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); @@ -16771,7 +16744,7 @@ switch (LSD->getLanguage()) { case LinkageSpecDecl::lang_c: if (ExternCLoc.isInvalid()) - ExternCLoc = LSD->getLocStart(); + ExternCLoc = LSD->getBeginLoc(); break; case LinkageSpecDecl::lang_cxx: break; @@ -16787,8 +16760,9 @@ ? 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(), - diag::note_module_import_not_at_top_level) << DC; + 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) << M->getFullModuleName(); Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp @@ -367,10 +367,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 << AANT_ArgumentString; return false; } @@ -764,7 +764,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) << AI << Param->getSourceRange(); return false; @@ -977,7 +977,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; } @@ -992,7 +992,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) << AL; + S.Diag(D->getBeginLoc(), diag::err_attribute_only_once_per_parameter) << AL; return; } @@ -1005,7 +1005,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 << 0 << 3 << E->getSourceRange(); return; } @@ -1015,7 +1015,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) << AL << 1; + S.Diag(D->getBeginLoc(), diag::err_attribute_pointers_only) << AL << 1; return; } @@ -1565,7 +1565,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; @@ -4106,15 +4106,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, @@ -4665,7 +4665,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)) @@ -4707,7 +4707,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 << /*pointer-to-CF*/ 2 << AL.getRange(); return; } @@ -4728,7 +4728,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 << ExpectedDeclKind; return; } @@ -4760,7 +4760,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 << /*pointer-to-CF*/ 2 << AL.getRange(); } else { // Needs to be kept in sync with warn_ns_attribute_wrong_return_type. @@ -4773,7 +4773,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 << SubjectKind << Cf << AL.getRange(); } return; @@ -4819,7 +4819,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 << (isa(D) ? EP_ObjCMethod : EP_ObjCProperty) << /*non-retainable pointer*/ 2; @@ -4838,13 +4838,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) << Attrs + S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs << 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) << Attrs + S.Diag(D->getBeginLoc(), diag::warn_objc_requires_super_protocol) << Attrs << 1; return; } @@ -4857,7 +4857,7 @@ IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr; if (!Parm) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0; return; } @@ -4886,7 +4886,7 @@ IdentifierLoc *Parm = AL.isArgIdent(0) ? AL.getArgAsIdent(0) : nullptr; if (!Parm) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0; return; } @@ -4900,7 +4900,7 @@ IdentifierInfo *RelatedClass = AL.isArgIdent(0) ? AL.getArgAsIdent(0)->Ident : nullptr; if (!RelatedClass) { - S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL << 0; + S.Diag(D->getBeginLoc(), diag::err_objc_attr_not_id) << AL << 0; return; } IdentifierInfo *ClassMethod = @@ -4970,7 +4970,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 << ExpectedVariable; } @@ -5293,7 +5293,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) @@ -7062,7 +7062,7 @@ return {" ", Loc, ""}; } static AttributeInsertion createInsertionBefore(const NamedDecl *D) { - return {"", D->getLocStart(), "\n"}; + return {"", D->getBeginLoc(), "\n"}; } }; @@ -7592,18 +7592,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; } @@ -7692,7 +7692,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: cfe/trunk/lib/Sema/SemaDeclCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp @@ -94,17 +94,17 @@ // 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(); + << Param->getDeclName() << DefaultArg->getSourceRange(); } else if (VarDecl *VDecl = dyn_cast(Decl)) { // C++ [dcl.fct.default]p7 // 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(); + << VDecl->getDeclName() << DefaultArg->getSourceRange(); } return false; @@ -115,9 +115,9 @@ // 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(); + << ThisE->getSourceRange(); } bool CheckDefaultArgumentVisitor::VisitPseudoObjectExpr(PseudoObjectExpr *POE) { @@ -144,8 +144,7 @@ if (Lambda->capture_begin() == Lambda->capture_end()) return false; - return S->Diag(Lambda->getLocStart(), - diag::err_lambda_capture_default_arg); + return S->Diag(Lambda->getBeginLoc(), diag::err_lambda_capture_default_arg); } } @@ -1283,9 +1282,9 @@ << RD << BaseType; for (auto &BS : *BestPath) { if (BS.Base->getAccessSpecifier() != AS_public) { - S.Diag(BS.Base->getLocStart(), diag::note_access_constrained_by_path) - << (BS.Base->getAccessSpecifier() == AS_protected) - << (BS.Base->getAccessSpecifierAsWritten() == AS_none); + S.Diag(BS.Base->getBeginLoc(), diag::note_access_constrained_by_path) + << (BS.Base->getAccessSpecifier() == AS_protected) + << (BS.Base->getAccessSpecifierAsWritten() == AS_none); break; } } @@ -1619,8 +1618,8 @@ << isa(NewFD) << getRecordDiagFromTagKind(RD->getTagKind()) << RD->getNumVBases(); for (const auto &I : RD->vbases()) - Diag(I.getLocStart(), - diag::note_constexpr_virtual_base_here) << I.getSourceRange(); + Diag(I.getBeginLoc(), diag::note_constexpr_virtual_base_here) + << I.getSourceRange(); return false; } } @@ -1704,11 +1703,11 @@ 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) - << isa(Dcl); + ? diag::warn_cxx11_compat_constexpr_type_definition + : diag::ext_constexpr_type_definition) + << isa(Dcl); continue; case Decl::EnumConstant: @@ -1759,12 +1758,12 @@ // 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) - << isa(Dcl); + SemaRef.Diag(DS->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) + << isa(Dcl); return false; } } @@ -1843,17 +1842,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()) { @@ -1866,13 +1865,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, @@ -1895,7 +1894,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, @@ -1910,7 +1909,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, @@ -1924,12 +1923,12 @@ // 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) - << isa(Dcl); + SemaRef.Diag(S->getBeginLoc(), diag::err_constexpr_body_invalid_stmt) + << isa(Dcl); return false; } @@ -1948,8 +1947,8 @@ // 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) - << isa(Dcl); + Diag(Body->getBeginLoc(), diag::err_constexpr_function_try_block) + << isa(Dcl); return false; } @@ -2408,10 +2407,8 @@ // 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::err_duplicate_base_class) - << KnownBase->getType() - << Bases[idx]->getSourceRange(); + Diag(Bases[idx]->getBeginLoc(), diag::err_duplicate_base_class) + << KnownBase->getType() << Bases[idx]->getSourceRange(); // Delete the duplicate base class specifier; we're going to // overwrite its pointer later. @@ -2434,9 +2431,9 @@ 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) - << getRecordDiagFromTagKind(RD->getTagKind()) << RD - << RD->getSourceRange(); + Diag(KnownBase->getBeginLoc(), diag::err_invalid_base_in_interface) + << getRecordDiagFromTagKind(RD->getTagKind()) << RD + << RD->getSourceRange(); Invalid = true; } if (RD->hasAttr()) @@ -2470,9 +2467,9 @@ (void)found; if (Paths.isAmbiguous(CanonicalBase)) - Diag(Bases[idx]->getLocStart (), diag::warn_inaccessible_base_class) - << BaseType << getAmbiguousPathsDisplayString(Paths) - << Bases[idx]->getSourceRange(); + Diag(Bases[idx]->getBeginLoc(), diag::warn_inaccessible_base_class) + << BaseType << getAmbiguousPathsDisplayString(Paths) + << Bases[idx]->getSourceRange(); else assert(Bases[idx]->isVirtual()); } @@ -2919,7 +2916,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); @@ -3157,17 +3154,17 @@ 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) - << TD->getAccess(); + 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()) { if (const auto *AccessSpec = dyn_cast(D)) LastAccessSpec = AccessSpec; } assert(LastAccessSpec && "differing access with no access specifier"); - Diag(LastAccessSpec->getLocStart(), diag::note_deduction_guide_access) - << AS; + Diag(LastAccessSpec->getBeginLoc(), diag::note_deduction_guide_access) + << AS; } } } @@ -3651,10 +3648,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()) { @@ -3921,10 +3918,8 @@ const CXXBaseSpecifier *BaseSpec = DirectBaseSpec ? DirectBaseSpec : VirtualBaseSpec; - Diag(BaseSpec->getLocStart(), - diag::note_base_class_specified_here) - << BaseSpec->getType() - << BaseSpec->getSourceRange(); + Diag(BaseSpec->getBeginLoc(), diag::note_base_class_specified_here) + << BaseSpec->getType() << BaseSpec->getSourceRange(); TyD = Type; } @@ -4003,7 +3998,7 @@ nullptr); InitializationKind Kind = InitList ? InitializationKind::CreateDirectList( - IdLoc, Init->getLocStart(), Init->getLocEnd()) + IdLoc, Init->getBeginLoc(), Init->getLocEnd()) : InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(), InitRange.getEnd()); @@ -4056,7 +4051,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); @@ -4227,7 +4222,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); @@ -5184,10 +5179,9 @@ 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(), + << Base.getType() << Base.getSourceRange(), Context.getTypeDeclType(ClassDecl)); MarkFunctionReferenced(Location, Dtor); @@ -6555,7 +6549,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; } @@ -6569,7 +6563,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)); @@ -6871,10 +6865,10 @@ << 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; + << getEffectiveCSM() << MD->getParent() << /*IsField*/ false + << Base->getType() << DiagKind << IsDtorCallInCtor; } if (DiagKind == 1) @@ -6943,10 +6937,10 @@ // 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; + << getEffectiveCSM() << MD->getParent() << /*IsField*/ false + << Base->getType() << /*Deleted*/ 1 << /*IsDtorCallInCtor*/ false; S.NoteDeletedFunction(BaseCtor); } return BaseCtor->isDeleted(); @@ -7557,7 +7551,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; @@ -7597,14 +7591,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; } @@ -8640,13 +8634,13 @@ if (Chunk.Kind == DeclaratorChunk::Paren) continue; if (Chunk.Kind != DeclaratorChunk::Function || FoundFunction) { - Diag(D.getDeclSpec().getLocStart(), - diag::err_deduction_guide_with_complex_decl) - << D.getSourceRange(); + 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; } @@ -8678,10 +8672,11 @@ } 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(); + << GuidedTemplate << TSI->getType() + << MightInstantiateToSpecialization + << TSI->getTypeLoc().getSourceRange(); } // Keep going to check that we don't have any inner declarator pieces (we @@ -9362,7 +9357,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; } @@ -9377,24 +9372,23 @@ case UnqualifiedIdKind::IK_ConstructorName: case UnqualifiedIdKind::IK_ConstructorTemplateId: // C++11 inheriting constructors. - Diag(Name.getLocStart(), - getLangOpts().CPlusPlus11 ? - diag::warn_cxx98_compat_using_decl_constructor : - diag::err_using_decl_constructor) - << SS.getRange(); + Diag(Name.getBeginLoc(), + getLangOpts().CPlusPlus11 + ? diag::warn_cxx98_compat_using_decl_constructor + : diag::err_using_decl_constructor) + << SS.getRange(); if (getLangOpts().CPlusPlus11) break; return nullptr; case UnqualifiedIdKind::IK_DestructorName: - Diag(Name.getLocStart(), diag::err_using_decl_destructor) - << SS.getRange(); + 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) - << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); + Diag(Name.getBeginLoc(), diag::err_using_decl_template_id) + << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); return nullptr; case UnqualifiedIdKind::IK_DeductionGuideName: @@ -9408,10 +9402,10 @@ // Warn about access declarations. if (UsingLoc.isInvalid()) { - Diag(Name.getLocStart(), - getLangOpts().CPlusPlus11 ? diag::err_access_decl - : diag::warn_access_decl_deprecated) - << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using "); + Diag(Name.getBeginLoc(), getLangOpts().CPlusPlus11 + ? diag::err_access_decl + : diag::warn_access_decl_deprecated) + << FixItHint::CreateInsertion(SS.getRange().getBegin(), "using "); } if (EllipsisLoc.isInvalid()) { @@ -12113,14 +12107,14 @@ if (Existing && Existing != &BI) { S.Diag(CurrentLocation, diag::warn_vbase_moved_multiple_times) << Class << Base; - S.Diag(Existing->getLocStart(), 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) - << (Base->getCanonicalDecl() == - BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl()) - << Base << BI.getType() << BaseSpec->getSourceRange(); + S.Diag(Existing->getBeginLoc(), diag::note_vbase_moved_here) + << (Base->getCanonicalDecl() == + Existing->getType()->getAsCXXRecordDecl()->getCanonicalDecl()) + << Base << Existing->getType() << Existing->getSourceRange(); + S.Diag(BI.getBeginLoc(), diag::note_vbase_moved_here) + << (Base->getCanonicalDecl() == + BI.getType()->getAsCXXRecordDecl()->getCanonicalDecl()) + << Base << BI.getType() << BaseSpec->getSourceRange(); // Only diagnose each vbase once. Existing = nullptr; @@ -13724,10 +13718,8 @@ Invalid = true; } - VarDecl *ExDecl = BuildExceptionDeclaration(S, TInfo, - D.getLocStart(), - D.getIdentifierLoc(), - D.getIdentifier()); + VarDecl *ExDecl = BuildExceptionDeclaration( + S, TInfo, D.getBeginLoc(), D.getIdentifierLoc(), D.getIdentifier()); if (Invalid) ExDecl->setInvalidDecl(); @@ -13883,7 +13875,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); } @@ -14025,7 +14017,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); @@ -14568,8 +14560,8 @@ if (!SubStmt) continue; if (isa(SubStmt)) - Self.Diag(SubStmt->getLocStart(), - diag::err_return_in_constructor_handler); + Self.Diag(SubStmt->getBeginLoc(), + diag::err_return_in_constructor_handler); if (!isa(SubStmt)) SearchForReturnInStmt(Self, SubStmt); } @@ -15475,7 +15467,7 @@ if (PrevDecl && !isDeclInScope(PrevDecl, Record, S)) PrevDecl = nullptr; - SourceLocation TSSL = D.getLocStart(); + SourceLocation TSSL = D.getBeginLoc(); MSPropertyDecl *NewPD = MSPropertyDecl::Create(Context, Record, Loc, II, T, TInfo, TSSL, MSPropertyAttr.getPropertyDataGetter(), Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp @@ -717,21 +717,22 @@ 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); + << paramName << typeBound + << FixItHint::CreateRemoval(rangeToRemove); diagnosed = true; } } } if (!diagnosed) { - Diag(qual ? qual.getLocStart() - : typeBoundInfo->getTypeLoc().getLocStart(), - diag::err_objc_type_param_bound_qualified) - << paramName << typeBound << typeBound.getQualifiers().getAsString() - << FixItHint::CreateRemoval(rangeToRemove); + Diag(qual ? qual.getBeginLoc() + : typeBoundInfo->getTypeLoc().getBeginLoc(), + diag::err_objc_type_param_bound_qualified) + << paramName << typeBound + << typeBound.getQualifiers().getAsString() + << FixItHint::CreateRemoval(rangeToRemove); } // If the type bound has qualifiers other than CVR, we need to strip @@ -865,7 +866,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 +887,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 +2165,10 @@ } else if (ImplIvar->isBitField() && ClsIvar->isBitField() && ImplIvar->getBitWidthValue(Context) != ClsIvar->getBitWidthValue(Context)) { - Diag(ImplIvar->getBitWidth()->getLocStart(), - diag::err_conflicting_ivar_bitwidth) << ImplIvar->getIdentifier(); - Diag(ClsIvar->getBitWidth()->getLocStart(), + Diag(ImplIvar->getBitWidth()->getBeginLoc(), + diag::err_conflicting_ivar_bitwidth) + << ImplIvar->getIdentifier(); + Diag(ClsIvar->getBitWidth()->getBeginLoc(), diag::note_previous_definition); } // Make sure the names are identical. @@ -2206,7 +2208,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,12 +3582,12 @@ 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(); + << Methods[0]->getSourceRange(); for (unsigned I = 1, N = Methods.size(); I != N; ++I) { - Diag(Methods[I]->getLocStart(), diag::note_also_found) - << Methods[I]->getSourceRange(); + Diag(Methods[I]->getBeginLoc(), diag::note_also_found) + << Methods[I]->getSourceRange(); } } } @@ -4485,7 +4487,7 @@ QualType T; for (const ParmVarDecl *P : Method->parameters()) { if (P->getType()->isVectorType()) { - Loc = P->getLocStart(); + Loc = P->getBeginLoc(); T = P->getType(); break; } Index: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaExpr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExpr.cpp +++ cfe/trunk/lib/Sema/SemaExpr.cpp @@ -503,11 +503,12 @@ SourceLocation(), S.LookupOrdinaryName); if (ObjectSetClass) { SourceLocation RHSLocEnd = S.getLocForEndOfToken(RHS->getLocEnd()); - S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign) << - FixItHint::CreateInsertion(OIRE->getLocStart(), "object_setClass(") << - FixItHint::CreateReplacement(SourceRange(OIRE->getOpLoc(), - AssignLoc), ",") << - FixItHint::CreateInsertion(RHSLocEnd, ")"); + S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_assign) + << FixItHint::CreateInsertion(OIRE->getBeginLoc(), + "object_setClass(") + << FixItHint::CreateReplacement( + SourceRange(OIRE->getOpLoc(), AssignLoc), ",") + << FixItHint::CreateInsertion(RHSLocEnd, ")"); } else S.Diag(OIRE->getLocation(), diag::warn_objc_isa_assign); @@ -517,11 +518,11 @@ &S.Context.Idents.get("object_getClass"), SourceLocation(), S.LookupOrdinaryName); if (ObjectGetClass) - S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use) << - FixItHint::CreateInsertion(OIRE->getLocStart(), "object_getClass(") << - FixItHint::CreateReplacement( - SourceRange(OIRE->getOpLoc(), - OIRE->getLocEnd()), ")"); + S.Diag(OIRE->getExprLoc(), diag::warn_objc_isa_use) + << FixItHint::CreateInsertion(OIRE->getBeginLoc(), + "object_getClass(") + << FixItHint::CreateReplacement( + SourceRange(OIRE->getOpLoc(), OIRE->getLocEnd()), ")"); else S.Diag(OIRE->getLocation(), diag::warn_objc_isa_use); } @@ -576,10 +577,10 @@ &Context.Idents.get("object_getClass"), SourceLocation(), LookupOrdinaryName); if (ObjectGetClass) - Diag(E->getExprLoc(), diag::warn_objc_isa_use) << - FixItHint::CreateInsertion(OISA->getLocStart(), "object_getClass(") << - FixItHint::CreateReplacement( - SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")"); + Diag(E->getExprLoc(), diag::warn_objc_isa_use) + << FixItHint::CreateInsertion(OISA->getBeginLoc(), "object_getClass(") + << FixItHint::CreateReplacement( + SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()), ")"); else Diag(E->getExprLoc(), diag::warn_objc_isa_use); } @@ -820,40 +821,38 @@ switch (VAK) { case VAK_ValidInCXX11: DiagRuntimeBehavior( - E->getLocStart(), nullptr, - PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) - << Ty << CT); + E->getBeginLoc(), nullptr, + PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT); LLVM_FALLTHROUGH; case VAK_Valid: 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()"); + << Ty << CT << hasCStrMethod(E) << ".c_str()"); } break; case VAK_Undefined: case VAK_MSVCUndefined: - DiagRuntimeBehavior( - E->getLocStart(), nullptr, - PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg) - << getLangOpts().CPlusPlus11 << Ty << CT); + DiagRuntimeBehavior(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::err_cannot_pass_non_trivial_c_struct_to_vararg) << Ty << CT; + Diag(E->getBeginLoc(), + diag::err_cannot_pass_non_trivial_c_struct_to_vararg) + << Ty << CT; else if (Ty->isObjCObjectType()) - DiagRuntimeBehavior( - E->getLocStart(), nullptr, - PDiag(diag::err_cannot_pass_objc_interface_to_vararg) - << Ty << CT); + DiagRuntimeBehavior(E->getBeginLoc(), nullptr, + PDiag(diag::err_cannot_pass_objc_interface_to_vararg) + << Ty << CT); else - Diag(E->getLocStart(), diag::err_cannot_pass_to_vararg) - << isa(E) << Ty << CT; + Diag(E->getBeginLoc(), diag::err_cannot_pass_to_vararg) + << isa(E) << Ty << CT; break; } } @@ -891,20 +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->getLocEnd()); + ExprResult Call = ActOnCallExpr(TUScope, TrapFn.get(), E->getBeginLoc(), + None, E->getLocEnd()); if (Call.isInvalid()) return ExprError(); - ExprResult Comma = ActOnBinOp(TUScope, E->getLocStart(), tok::comma, - Call.get(), E); + ExprResult Comma = + ActOnBinOp(TUScope, E->getBeginLoc(), tok::comma, Call.get(), E); if (Comma.isInvalid()) return ExprError(); return Comma.get(); @@ -1437,9 +1435,9 @@ // 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) - << ControllingExpr->getSourceRange() << ControllingExpr->getType() - << (unsigned) CompatIndices.size(); + Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_multi_match) + << ControllingExpr->getSourceRange() << ControllingExpr->getType() + << (unsigned)CompatIndices.size(); for (unsigned I : CompatIndices) { Diag(Types[I]->getTypeLoc().getBeginLoc(), diag::note_compat_assoc) @@ -1456,8 +1454,8 @@ // 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) - << ControllingExpr->getSourceRange() << ControllingExpr->getType(); + Diag(ControllingExpr->getBeginLoc(), diag::err_generic_sel_no_match) + << ControllingExpr->getSourceRange() << ControllingExpr->getType(); return ExprError(); } @@ -1682,7 +1680,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); @@ -4487,8 +4485,8 @@ // 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) << - LHSExp->getSourceRange(); + Diag(LHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue) + << LHSExp->getSourceRange(); LHSExp = ImpCastExprToType(LHSExp, Context.getArrayDecayedType(LHSTy), CK_ArrayToPointerDecay).get(); LHSTy = LHSExp->getType(); @@ -4498,8 +4496,8 @@ 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) << - RHSExp->getSourceRange(); + Diag(RHSExp->getBeginLoc(), diag::ext_subscript_non_lvalue) + << RHSExp->getSourceRange(); RHSExp = ImpCastExprToType(RHSExp, Context.getArrayDecayedType(RHSTy), CK_ArrayToPointerDecay).get(); RHSTy = RHSExp->getType(); @@ -4526,8 +4524,8 @@ // 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) - << ResultType << BaseExpr->getSourceRange(); + Diag(BaseExpr->getBeginLoc(), diag::err_subscript_function_type) + << ResultType << BaseExpr->getSourceRange(); return ExprError(); } @@ -4593,7 +4591,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; } @@ -4615,9 +4613,9 @@ // Check the expression as an initializer for the parameter. InitializedEntity Entity = InitializedEntity::InitializeParameter(Context, Param); - InitializationKind Kind - = InitializationKind::CreateCopy(Param->getLocation(), - /*FIXME:EqualLoc*/UninstExpr->getLocStart()); + InitializationKind Kind = InitializationKind::CreateCopy( + Param->getLocation(), + /*FIXME:EqualLoc*/ UninstExpr->getBeginLoc()); Expr *ResultE = Result.getAs(); InitializationSequence InitSeq(*this, Entity, Kind, ResultE); @@ -4639,7 +4637,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; } @@ -4724,7 +4722,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, @@ -4815,8 +4813,7 @@ // Emit the location of the prototype. if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig) - Diag(FDecl->getLocStart(), diag::note_callee_decl) - << FDecl; + Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl; return true; } @@ -4838,28 +4835,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) - << FDecl; + Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl; // This deletes the extra arguments. Call->setNumArgs(Context, NumParams); @@ -4869,8 +4865,8 @@ SmallVector AllArgs; VariadicCallType CallType = getVariadicCallType(FDecl, Proto, Fn); - Invalid = GatherArgumentsForCall(Call->getLocStart(), FDecl, - Proto, 0, Args, AllArgs, CallType); + Invalid = GatherArgumentsForCall(Call->getBeginLoc(), FDecl, Proto, 0, Args, + AllArgs, CallType); if (Invalid) return true; unsigned TotalNumArgs = AllArgs.size(); @@ -4898,8 +4894,7 @@ if (ArgIx < Args.size()) { Arg = Args[ArgIx++]; - if (RequireCompleteType(Arg->getLocStart(), - ProtoArgType, + if (RequireCompleteType(Arg->getBeginLoc(), ProtoArgType, diag::err_call_incomplete_argument, Arg)) return true; @@ -5207,7 +5202,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) @@ -5319,9 +5314,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,9 +5344,9 @@ Context.DependentTy, VK_RValue, RParenLoc); } else { - tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs( + tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs( *this, dyn_cast(Fn->IgnoreParens()), - Fn->getLocStart()); + Fn->getBeginLoc()); return new (Context) CallExpr( Context, Fn, ArgExprs, Context.DependentTy, VK_RValue, RParenLoc); @@ -5432,9 +5427,8 @@ NDecl = cast(NakedFn)->getMemberDecl(); if (FunctionDecl *FD = dyn_cast_or_null(NDecl)) { - if (CallingNDeclIndirectly && - !checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - Fn->getLocStart())) + if (CallingNDeclIndirectly && !checkAddressOfFunctionIsAvailable( + FD, /*Complain=*/true, Fn->getBeginLoc())) return ExprError(); if (getLangOpts().OpenCL && checkOpenCLDisabledDecl(*FD, *Fn)) @@ -5601,7 +5595,7 @@ } // Check for a valid return type - if (CheckCallReturnType(FuncT->getReturnType(), Fn->getLocStart(), TheCall, + if (CheckCallReturnType(FuncT->getReturnType(), Fn->getBeginLoc(), TheCall, FDecl)) return ExprError(); @@ -5657,8 +5651,7 @@ Arg = ArgE.getAs(); } - if (RequireCompleteType(Arg->getLocStart(), - Arg->getType(), + if (RequireCompleteType(Arg->getBeginLoc(), Arg->getType(), diag::err_call_incomplete_argument, Arg)) return ExprError(); @@ -6396,11 +6389,11 @@ Expr *RHSExpr = RHS.get(); if (!LHSExpr->getType()->isVoidType()) - S.Diag(RHSExpr->getLocStart(), diag::ext_typecheck_cond_one_void) - << RHSExpr->getSourceRange(); + 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) - << LHSExpr->getSourceRange(); + 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); return S.Context.VoidTy; @@ -7217,14 +7210,15 @@ << Condition->getSourceRange() << BinaryOperator::getOpcodeStr(CondOpcode); - SuggestParentheses(Self, OpLoc, - Self.PDiag(diag::note_precedence_silence) - << BinaryOperator::getOpcodeStr(CondOpcode), - SourceRange(Condition->getLocStart(), Condition->getLocEnd())); + SuggestParentheses( + Self, OpLoc, + Self.PDiag(diag::note_precedence_silence) + << BinaryOperator::getOpcodeStr(CondOpcode), + SourceRange(Condition->getBeginLoc(), Condition->getLocEnd())); SuggestParentheses(Self, OpLoc, - Self.PDiag(diag::note_precedence_conditional_first), - SourceRange(CondRHS->getLocStart(), RHSExpr->getLocEnd())); + Self.PDiag(diag::note_precedence_conditional_first), + SourceRange(CondRHS->getBeginLoc(), RHSExpr->getLocEnd())); } /// Compute the nullability of a conditional expression. @@ -8136,7 +8130,7 @@ return Incompatible; } if (getLangOpts().ObjC1 && - (CheckObjCBridgeRelatedConversions(E->getLocStart(), LHSType, + (CheckObjCBridgeRelatedConversions(E->getBeginLoc(), LHSType, E->getType(), E, Diagnose) || ConversionToObjCStringLiteralCheck(LHSType, E, Diagnose))) { if (!Diagnose) @@ -8921,7 +8915,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(); @@ -8929,7 +8923,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 @@ -8962,7 +8956,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() && @@ -8979,7 +8973,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 { @@ -9651,7 +9645,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)); @@ -9684,7 +9678,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()) @@ -9695,7 +9689,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()) @@ -9732,7 +9726,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; @@ -9886,7 +9880,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; @@ -9895,7 +9889,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? @@ -9970,9 +9964,9 @@ assert(Type->isArithmeticType() || Type->isEnumeralType()); bool HasNarrowing = checkThreeWayNarrowingConversion( - S, Type, LHS.get(), LHSType, LHS.get()->getLocStart()); - HasNarrowing |= checkThreeWayNarrowingConversion( - S, Type, RHS.get(), RHSType, RHS.get()->getLocStart()); + S, Type, LHS.get(), LHSType, LHS.get()->getBeginLoc()); + HasNarrowing |= checkThreeWayNarrowingConversion(S, Type, RHS.get(), RHSType, + RHS.get()->getBeginLoc()); if (HasNarrowing) return QualType(); @@ -11148,15 +11142,14 @@ if (ImplicitCastExpr *ICE = dyn_cast(RHSCheck)) RHSCheck = ICE->getSubExpr(); if (UnaryOperator *UO = dyn_cast(RHSCheck)) { - if ((UO->getOpcode() == UO_Plus || - UO->getOpcode() == UO_Minus) && + if ((UO->getOpcode() == UO_Plus || UO->getOpcode() == UO_Minus) && Loc.isFileID() && UO->getOperatorLoc().isFileID() && // Only if the two operators are exactly adjacent. 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()); @@ -11186,7 +11179,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) { @@ -11267,9 +11260,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()), @@ -11549,7 +11542,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); @@ -12004,7 +11997,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); @@ -12033,7 +12026,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 @@ -12196,10 +12189,12 @@ SourceLocation(), LookupOrdinaryName); 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::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc), ",") << - FixItHint::CreateInsertion(RHSLocEnd, ")"); + Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign) + << FixItHint::CreateInsertion(LHS.get()->getBeginLoc(), + "object_setClass(") + << FixItHint::CreateReplacement(SourceRange(OISA->getOpLoc(), OpLoc), + ",") + << FixItHint::CreateInsertion(RHSLocEnd, ")"); } else Diag(LHS.get()->getExprLoc(), diag::warn_objc_isa_assign); @@ -12256,13 +12251,14 @@ if (isLeftBitwise || isRightBitwise) return; - SourceRange DiagRange = isLeftComp ? SourceRange(LHSExpr->getLocStart(), - OpLoc) - : SourceRange(OpLoc, RHSExpr->getLocEnd()); + 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 ParensRange = + isLeftComp + ? 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; @@ -12396,10 +12392,9 @@ S.PDiag(diag::note_precedence_silence) << (Kind == OO_LessLess ? "<<" : ">>"), OCE->getSourceRange()); - SuggestParentheses(S, OpLoc, - S.PDiag(diag::note_evaluate_comparison_first), - SourceRange(OCE->getArg(1)->getLocStart(), - RHSExpr->getLocEnd())); + SuggestParentheses( + S, OpLoc, S.PDiag(diag::note_evaluate_comparison_first), + SourceRange(OCE->getArg(1)->getBeginLoc(), RHSExpr->getLocEnd())); } /// DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky @@ -13069,9 +13064,9 @@ // FIXME: An integral constant expression? if (!Idx->isTypeDependent() && !Idx->isValueDependent() && !Idx->getType()->isIntegerType()) - return ExprError(Diag(Idx->getLocStart(), - diag::err_typecheck_subscript_not_integer) - << Idx->getSourceRange()); + return ExprError( + Diag(Idx->getBeginLoc(), diag::err_typecheck_subscript_not_integer) + << Idx->getSourceRange()); // Record this array index. Comps.push_back(OffsetOfNode(OC.LocStart, Exprs.size(), OC.LocEnd)); @@ -13363,7 +13358,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); } } @@ -13542,7 +13537,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)); } } @@ -13592,9 +13587,10 @@ if (!IsMS && !E->isTypeDependent() && !Context.hasSameType(VaListType, E->getType())) - return ExprError(Diag(E->getLocStart(), - diag::err_first_argument_to_va_arg_not_of_type_va_list) - << OrigExpr->getType() << E->getSourceRange()); + return ExprError( + Diag(E->getBeginLoc(), + diag::err_first_argument_to_va_arg_not_of_type_va_list) + << OrigExpr->getType() << E->getSourceRange()); if (!TInfo->getType()->isDependentType()) { if (RequireCompleteType(TInfo->getTypeLoc().getBeginLoc(), TInfo->getType(), @@ -13685,9 +13681,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; } @@ -13708,7 +13704,7 @@ return !S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - SrcExpr->getLocStart()); + SrcExpr->getBeginLoc()); } bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, @@ -13961,7 +13957,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: @@ -14191,7 +14187,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. @@ -15021,7 +15017,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); } @@ -15075,7 +15071,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 @@ -15433,8 +15429,8 @@ if (Method->isPure()) MightBeOdrUse = false; } - SourceLocation Loc = E->getMemberLoc().isValid() ? - E->getMemberLoc() : E->getLocStart(); + SourceLocation Loc = + E->getMemberLoc().isValid() ? E->getMemberLoc() : E->getBeginLoc(); MarkExprReferenced(*this, Loc, E->getMemberDecl(), E, MightBeOdrUse); } @@ -15530,34 +15526,34 @@ } void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { - S.MarkFunctionReferenced(E->getLocStart(), - const_cast(E->getTemporary()->getDestructor())); + 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.LookupDestructor(Record)); + S.MarkFunctionReferenced(E->getBeginLoc(), S.LookupDestructor(Record)); } Inherited::VisitCXXDeleteExpr(E); } void VisitCXXConstructExpr(CXXConstructExpr *E) { - S.MarkFunctionReferenced(E->getLocStart(), E->getConstructor()); + S.MarkFunctionReferenced(E->getBeginLoc(), E->getConstructor()); Inherited::VisitCXXConstructExpr(E); } @@ -15728,7 +15724,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, "(") @@ -15746,7 +15742,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. @@ -16443,13 +16439,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: cfe/trunk/lib/Sema/SemaExprCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -419,8 +419,8 @@ // 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) - << SS.getScopeRep(); + Diag(Name.getBeginLoc(), diag::err_literal_operator_id_outside_namespace) + << SS.getScopeRep(); return true; case NestedNameSpecifier::Global: @@ -1793,20 +1793,21 @@ // A new-expression that creates an object of type T initializes that // object as follows: InitializationKind Kind - // - If the new-initializer is omitted, the object is default- - // initialized (8.5); if no initialization is performed, - // the object has indeterminate value - = initStyle == CXXNewExpr::NoInit - ? InitializationKind::CreateDefault(TypeRange.getBegin()) - // - Otherwise, the new-initializer is interpreted according to the - // initialization rules of 8.5 for direct-initialization. - : initStyle == CXXNewExpr::ListInit - ? InitializationKind::CreateDirectList(TypeRange.getBegin(), - Initializer->getLocStart(), - Initializer->getLocEnd()) - : InitializationKind::CreateDirect(TypeRange.getBegin(), - DirectInitRange.getBegin(), - DirectInitRange.getEnd()); + // - If the new-initializer is omitted, the object is default- + // initialized (8.5); if no initialization is performed, + // the object has indeterminate value + = initStyle == CXXNewExpr::NoInit + ? InitializationKind::CreateDefault(TypeRange.getBegin()) + // - Otherwise, the new-initializer is interpreted according to + // the + // initialization rules of 8.5 for direct-initialization. + : initStyle == CXXNewExpr::ListInit + ? InitializationKind::CreateDirectList( + TypeRange.getBegin(), Initializer->getBeginLoc(), + Initializer->getLocEnd()) + : InitializationKind::CreateDirect(TypeRange.getBegin(), + DirectInitRange.getBegin(), + DirectInitRange.getEnd()); // C++11 [dcl.spec.auto]p6. Deduce the type which 'auto' stands in for. auto *Deduced = AllocType->getContainedDeducedType(); @@ -1837,12 +1838,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; @@ -1989,7 +1990,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()); } @@ -1998,19 +1999,18 @@ unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, AllocType, Value); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) - return ExprError(Diag(ArraySize->getLocStart(), - diag::err_array_too_large) - << Value.toString(10) - << ArraySize->getSourceRange()); + return ExprError( + Diag(ArraySize->getBeginLoc(), diag::err_array_too_large) + << Value.toString(10) << ArraySize->getSourceRange()); } 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) - << ArraySize->getSourceRange() - << FixItHint::CreateRemoval(TypeIdParens.getBegin()) - << FixItHint::CreateRemoval(TypeIdParens.getEnd()); + Diag(ArraySize->getBeginLoc(), diag::ext_new_paren_array_nonconst) + << ArraySize->getSourceRange() + << FixItHint::CreateRemoval(TypeIdParens.getBegin()) + << FixItHint::CreateRemoval(TypeIdParens.getEnd()); TypeIdParens = SourceRange(); } @@ -2072,8 +2072,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 @@ -2086,7 +2086,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(); @@ -2593,7 +2593,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()) @@ -3162,12 +3162,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: @@ -3286,10 +3286,10 @@ 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(); + << Pointee.getUnqualifiedType() + << Pointee.getQualifiers().getAddressSpaceAttributePrintValue(); CXXRecordDecl *PointeeRD = nullptr; if (Pointee->isVoidType() && !isSFINAEContext()) { @@ -3427,7 +3427,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"); @@ -3529,7 +3529,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()); @@ -3817,14 +3817,10 @@ From = Res.get(); } - ExprResult CastArg - = BuildCXXCastArgument(*this, - From->getLocStart(), - ToType.getNonReferenceType(), - CastKind, cast(FD), - ICS.UserDefined.FoundConversionFunction, - ICS.UserDefined.HadMultipleCandidates, - From); + ExprResult CastArg = BuildCXXCastArgument( + *this, From->getBeginLoc(), ToType.getNonReferenceType(), CastKind, + cast(FD), ICS.UserDefined.FoundConversionFunction, + ICS.UserDefined.HadMultipleCandidates, From); if (CastArg.isInvalid()) return ExprError(); @@ -3912,7 +3908,7 @@ if (!Fn) return ExprError(); - if (DiagnoseUseOfDecl(Fn, From->getLocStart())) + if (DiagnoseUseOfDecl(Fn, From->getBeginLoc())) return ExprError(); From = FixOverloadedFunctionReference(From, Found, Fn); @@ -4051,15 +4047,15 @@ 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; + << 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; + << From->getType() << ToType << Action << From->getSourceRange() + << 0; if (From->getType()->isObjCObjectPointerType() && ToType->isObjCObjectPointerType()) @@ -4068,13 +4064,11 @@ !CheckObjCARCUnavailableWeakConversion(ToType, From->getType())) { if (Action == AA_Initializing) - Diag(From->getLocStart(), - diag::err_arc_weak_unavailable_assign); + Diag(From->getBeginLoc(), diag::err_arc_weak_unavailable_assign); else - Diag(From->getLocStart(), - diag::err_arc_convesion_of_weak_unavailable) - << (Action == AA_Casting) << From->getType() << ToType - << From->getSourceRange(); + Diag(From->getBeginLoc(), diag::err_arc_convesion_of_weak_unavailable) + << (Action == AA_Casting) << From->getType() << ToType + << From->getSourceRange(); } CastKind Kind; @@ -4130,12 +4124,9 @@ case ICK_Derived_To_Base: { CXXCastPath BasePath; - if (CheckDerivedToBaseConversion(From->getType(), - ToType.getNonReferenceType(), - From->getLocStart(), - From->getSourceRange(), - &BasePath, - CStyle)) + if (CheckDerivedToBaseConversion( + From->getType(), ToType.getNonReferenceType(), From->getBeginLoc(), + From->getSourceRange(), &BasePath, CStyle)) return ExprError(); From = ImpCastExprToType(From, ToType.getNonReferenceType(), @@ -4276,10 +4267,11 @@ if (SCS.DeprecatedStringLiteralToCharPtr && !getLangOpts().WritableStrings) { - Diag(From->getLocStart(), getLangOpts().CPlusPlus11 - ? diag::ext_deprecated_string_literal_conversion - : diag::warn_deprecated_string_literal_conversion) - << ToType.getNonReferenceType(); + Diag(From->getBeginLoc(), + getLangOpts().CPlusPlus11 + ? diag::ext_deprecated_string_literal_conversion + : diag::warn_deprecated_string_literal_conversion) + << ToType.getNonReferenceType(); } break; @@ -4302,7 +4294,7 @@ // _Nullable type to a _Nonnull one, complain. if (!isCast(CCK)) diagnoseNullableToNonnullConversion(ToType, InitialFromType, - From->getLocStart()); + From->getBeginLoc()); return From; } @@ -4932,7 +4924,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))); } @@ -5427,10 +5419,10 @@ } CXXCastPath BasePath; - if (CheckDerivedToBaseConversion(LHSType, Class, Loc, - SourceRange(LHS.get()->getLocStart(), - RHS.get()->getLocEnd()), - &BasePath)) + if (CheckDerivedToBaseConversion( + LHSType, Class, Loc, + SourceRange(LHS.get()->getBeginLoc(), RHS.get()->getLocEnd()), + &BasePath)) return QualType(); // Cast LHS to type of use. @@ -5524,8 +5516,8 @@ HaveConversion = false; ToType = To->getType(); - InitializationKind Kind = InitializationKind::CreateCopy(To->getLocStart(), - SourceLocation()); + InitializationKind Kind = + InitializationKind::CreateCopy(To->getBeginLoc(), SourceLocation()); // C++11 5.16p3 // The process for determining whether an operand expression E1 of type T1 // can be converted to match an operand expression E2 of type T2 is defined @@ -5670,8 +5662,8 @@ /// TryClassUnification. static bool ConvertForConditional(Sema &Self, ExprResult &E, QualType T) { InitializedEntity Entity = InitializedEntity::InitializeTemporary(T); - InitializationKind Kind = InitializationKind::CreateCopy(E.get()->getLocStart(), - SourceLocation()); + InitializationKind Kind = + InitializationKind::CreateCopy(E.get()->getBeginLoc(), SourceLocation()); Expr *Arg = E.get(); InitializationSequence InitSeq(Self, Entity, Kind, Arg); ExprResult Result = InitSeq.Perform(Self, Entity, Kind, Arg); @@ -6577,8 +6569,7 @@ continue; if (CheckCallReturnType(Call->getCallReturnType(Context), - Call->getLocStart(), - Call, Call->getDirectCallee())) + Call->getBeginLoc(), Call, Call->getDirectCallee())) return ExprError(); } @@ -6713,7 +6704,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: cfe/trunk/lib/Sema/SemaExprObjC.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprObjC.cpp +++ cfe/trunk/lib/Sema/SemaExprObjC.cpp @@ -50,8 +50,8 @@ // ObjC strings can't be wide or UTF. if (!S->isAscii()) { - Diag(S->getLocStart(), diag::err_cfstring_literal_not_string_constant) - << S->getSourceRange(); + Diag(S->getBeginLoc(), diag::err_cfstring_literal_not_string_constant) + << S->getSourceRange(); return true; } @@ -107,8 +107,8 @@ } 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 - << S->getSourceRange(); + Diag(S->getBeginLoc(), diag::err_no_nsconstant_string_class) + << NSIdent << S->getSourceRange(); Ty = Context.getObjCIdType(); } } else { @@ -399,9 +399,8 @@ InitializedEntity Entity = InitializedEntity::InitializeParameter(S.Context, T, /*Consumed=*/false); - InitializationKind Kind - = InitializationKind::CreateCopy(Element->getLocStart(), - SourceLocation()); + InitializationKind Kind = InitializationKind::CreateCopy( + Element->getBeginLoc(), SourceLocation()); InitializationSequence Seq(S, Entity, Kind, Element); if (!Seq.Failed()) return Seq.Perform(S, Entity, Kind, Element); @@ -432,12 +431,12 @@ isa(OrigElement)) ? 2 : 3; - S.Diag(OrigElement->getLocStart(), diag::err_box_literal_collection) - << Which << OrigElement->getSourceRange() - << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@"); + S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection) + << Which << OrigElement->getSourceRange() + << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@"); - Result = S.BuildObjCNumericLiteral(OrigElement->getLocStart(), - OrigElement); + Result = + S.BuildObjCNumericLiteral(OrigElement->getBeginLoc(), OrigElement); if (Result.isInvalid()) return ExprError(); @@ -448,11 +447,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) - << 0 << OrigElement->getSourceRange() - << FixItHint::CreateInsertion(OrigElement->getLocStart(), "@"); + S.Diag(OrigElement->getBeginLoc(), diag::err_box_literal_collection) + << 0 << OrigElement->getSourceRange() + << FixItHint::CreateInsertion(OrigElement->getBeginLoc(), "@"); - Result = S.BuildObjCStringLiteral(OrigElement->getLocStart(), String); + Result = S.BuildObjCStringLiteral(OrigElement->getBeginLoc(), String); if (Result.isInvalid()) return ExprError(); @@ -462,8 +461,8 @@ } if (!Recovered) { - S.Diag(Element->getLocStart(), diag::err_invalid_collection_element) - << Element->getType(); + S.Diag(Element->getBeginLoc(), diag::err_invalid_collection_element) + << Element->getType(); return ExprError(); } } @@ -481,9 +480,9 @@ break; } if (!hasMacro) - S.Diag(Element->getLocStart(), + S.Diag(Element->getBeginLoc(), diag::warn_concatenated_nsarray_literal) - << Element->getType(); + << Element->getType(); } } } @@ -491,9 +490,9 @@ // Make sure that the element has the type that the container factory // function expects. return S.PerformCopyInitialization( - InitializedEntity::InitializeParameter(S.Context, T, - /*Consumed=*/false), - Element->getLocStart(), Element); + InitializedEntity::InitializeParameter(S.Context, T, + /*Consumed=*/false), + Element->getBeginLoc(), Element); } ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { @@ -1034,8 +1033,8 @@ !Element.Value->containsUnexpandedParameterPack()) { Diag(Element.EllipsisLoc, diag::err_pack_expansion_without_parameter_packs) - << SourceRange(Element.Key->getLocStart(), - Element.Value->getLocEnd()); + << SourceRange(Element.Key->getBeginLoc(), + Element.Value->getLocEnd()); return ExprError(); } @@ -1693,12 +1692,12 @@ } 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(), - Args.back()->getLocEnd()); + << 2 /*method*/ << NumNamedArgs << static_cast(Args.size()) + << Method->getSourceRange() + << SourceRange(Args[NumNamedArgs]->getBeginLoc(), + Args.back()->getLocEnd()); } } @@ -2323,7 +2322,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 +2581,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 +2634,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,8 +2855,8 @@ return ExprError(); forwardClass = OCIType->getInterfaceDecl(); - Diag(Receiver ? Receiver->getLocStart() - : SuperLoc, diag::note_receiver_is_id); + Diag(Receiver ? Receiver->getBeginLoc() : SuperLoc, + diag::note_receiver_is_id); Method = nullptr; } else { Method = ClassDecl->lookupInstanceMethod(Sel); @@ -3776,8 +3775,8 @@ (CastClass && CastClass->isSuperClassOf(ExprClass))) return true; if (warn) - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge) - << T << Target->getName() << castType->getPointeeType(); + S.Diag(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge) + << T << Target->getName() << castType->getPointeeType(); return false; } else if (castType->isObjCIdType() || (S.Context.ObjCObjectAdoptsQTypeProtocols( @@ -3788,20 +3787,21 @@ return true; else { if (warn) { - S.Diag(castExpr->getLocStart(), 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(castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge) + << T << Target->getName() << castType; + 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) - << castExpr->getType() << Parm; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(castExpr->getBeginLoc(), + diag::err_objc_cf_bridged_not_interface) + << castExpr->getType() << Parm; + 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,10 @@ (ExprClass && CastClass->isSuperClassOf(ExprClass))) return true; if (warn) { - S.Diag(castExpr->getLocStart(), diag::warn_objc_invalid_bridge_to_cf) - << castExpr->getType()->getPointeeType() << T; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(castExpr->getBeginLoc(), + diag::warn_objc_invalid_bridge_to_cf) + << castExpr->getType()->getPointeeType() << T; + S.Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); } return false; } else if (castExpr->getType()->isObjCIdType() || @@ -3855,20 +3856,22 @@ return true; else { if (warn) { - S.Diag(castExpr->getLocStart(), 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(castExpr->getBeginLoc(), + diag::warn_objc_invalid_bridge_to_cf) + << castExpr->getType() << castType; + 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) - << castExpr->getType() << castType; - S.Diag(TDNDecl->getLocStart(), diag::note_declared_at); + S.Diag(castExpr->getBeginLoc(), + diag::err_objc_ns_bridged_invalid_cfobject) + << castExpr->getType() << castType; + 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,8 +3948,8 @@ ARCConversionTypeClass castExprACTC = classifyTypeForARCConversion(castType); if (srcExprACTC != ACTC_retainable || castExprACTC != ACTC_coreFoundation) return; - CheckObjCBridgeRelatedConversions(castExpr->getLocStart(), - castType, SrcType, castExpr); + CheckObjCBridgeRelatedConversions(castExpr->getBeginLoc(), castType, SrcType, + castExpr); } bool Sema::CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, @@ -3991,7 +3994,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 +4005,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 +4020,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 +4034,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; } @@ -4070,11 +4073,12 @@ SourceLocation SrcExprEndLoc = getLocForEndOfToken(SrcExpr->getLocEnd()); // 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(SrcExprEndLoc, "]"); - Diag(RelatedClass->getLocStart(), diag::note_declared_at); - Diag(TDNDecl->getLocStart(), diag::note_declared_at); + << SrcType << DestType << ClassMethod->getSelector() << false + << FixItHint::CreateInsertion(SrcExpr->getBeginLoc(), + ExpressionString) + << FixItHint::CreateInsertion(SrcExprEndLoc, "]"); + Diag(RelatedClass->getBeginLoc(), diag::note_declared_at); + Diag(TDNDecl->getBeginLoc(), diag::note_declared_at); QualType receiverType = Context.getObjCInterfaceType(RelatedClass); // Argument. @@ -4113,11 +4117,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: cfe/trunk/lib/Sema/SemaInit.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaInit.cpp +++ cfe/trunk/lib/Sema/SemaInit.cpp @@ -194,15 +194,15 @@ // [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(); + << 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(); + << Str->getSourceRange(); } // Set the type to the actual size that we are initializing. If we have @@ -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; @@ -925,11 +925,10 @@ } // Build a structured initializer list corresponding to this subobject. - InitListExpr *StructuredSubobjectInitList - = getStructuredSubobjectInit(ParentIList, Index, T, StructuredList, - StructuredIndex, - SourceRange(ParentIList->getInit(Index)->getLocStart(), - ParentIList->getSourceRange().getEnd())); + InitListExpr *StructuredSubobjectInitList = getStructuredSubobjectInit( + ParentIList, Index, T, StructuredList, StructuredIndex, + SourceRange(ParentIList->getInit(Index)->getBeginLoc(), + ParentIList->getSourceRange().getEnd())); unsigned StructuredSubobjectInitIndex = 0; // Check the element types and build the structural subobject. @@ -956,11 +955,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,8 +1079,8 @@ hadError = true; } // Special-case - SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK) - << IList->getInit(Index)->getSourceRange(); + 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 // elsewhere @@ -1103,8 +1102,8 @@ hadError = true; } - SemaRef.Diag(IList->getInit(Index)->getLocStart(), DK) - << initKind << IList->getInit(Index)->getSourceRange(); + SemaRef.Diag(IList->getInit(Index)->getBeginLoc(), DK) + << initKind << IList->getInit(Index)->getSourceRange(); } } @@ -1155,21 +1154,20 @@ // This type is invalid, issue a diagnostic. ++Index; if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type) - << DeclType; + SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type) + << DeclType; hadError = true; } else if (DeclType->isReferenceType()) { CheckReferenceType(Entity, IList, DeclType, Index, StructuredList, StructuredIndex); } else if (DeclType->isObjCObjectType()) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_init_objc_class) - << DeclType; + SemaRef.Diag(IList->getBeginLoc(), diag::err_init_objc_class) << DeclType; hadError = true; } else { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_illegal_initializer_type) - << DeclType; + SemaRef.Diag(IList->getBeginLoc(), diag::err_illegal_initializer_type) + << DeclType; hadError = true; } } @@ -1232,7 +1230,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,8 +1354,8 @@ // 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) - << IList->getSourceRange(); + SemaRef.Diag(IList->getBeginLoc(), diag::ext_complex_component_init) + << IList->getSourceRange(); // Initialize the complex number. QualType elementType = DeclType->getAs()->getElementType(); @@ -1378,11 +1376,11 @@ unsigned &StructuredIndex) { if (Index >= IList->getNumInits()) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), - SemaRef.getLangOpts().CPlusPlus11 ? - diag::warn_cxx98_compat_empty_scalar_initializer : - diag::err_empty_scalar_initializer) - << IList->getSourceRange(); + SemaRef.Diag(IList->getBeginLoc(), + SemaRef.getLangOpts().CPlusPlus11 + ? diag::warn_cxx98_compat_empty_scalar_initializer + : diag::err_empty_scalar_initializer) + << IList->getSourceRange(); hadError = !SemaRef.getLangOpts().CPlusPlus11; ++Index; ++StructuredIndex; @@ -1394,18 +1392,17 @@ // 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(); + << SubIList->getSourceRange(); CheckScalarType(Entity, SubIList, DeclType, Index, StructuredList, StructuredIndex); return; } else if (isa(expr)) { if (!VerifyOnly) - SemaRef.Diag(expr->getLocStart(), - diag::err_designator_for_scalar_init) - << DeclType << expr->getSourceRange(); + SemaRef.Diag(expr->getBeginLoc(), diag::err_designator_for_scalar_init) + << DeclType << expr->getSourceRange(); hadError = true; ++Index; ++StructuredIndex; @@ -1420,8 +1417,8 @@ } ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr, - /*TopLevelOfInitList=*/true); + SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr, + /*TopLevelOfInitList=*/true); Expr *ResultExpr = nullptr; @@ -1453,10 +1450,9 @@ // so that we know the location (or decl) of the "current object" being // initialized. if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), - diag::err_init_reference_member_uninitialized) - << DeclType - << IList->getSourceRange(); + SemaRef.Diag(IList->getBeginLoc(), + diag::err_init_reference_member_uninitialized) + << DeclType << IList->getSourceRange(); hadError = true; ++Index; ++StructuredIndex; @@ -1466,8 +1462,8 @@ Expr *expr = IList->getInit(Index); if (isa(expr) && !SemaRef.getLangOpts().CPlusPlus11) { if (!VerifyOnly) - SemaRef.Diag(IList->getLocStart(), diag::err_init_non_aggr_init_list) - << DeclType << IList->getSourceRange(); + SemaRef.Diag(IList->getBeginLoc(), diag::err_init_non_aggr_init_list) + << DeclType << IList->getSourceRange(); hadError = true; ++Index; ++StructuredIndex; @@ -1482,7 +1478,7 @@ } ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(), expr, + SemaRef.PerformCopyInitialization(Entity, expr->getBeginLoc(), expr, /*TopLevelOfInitList=*/true); if (Result.isInvalid()) @@ -1529,9 +1525,9 @@ return; } - ExprResult Result = - SemaRef.PerformCopyInitialization(Entity, Init->getLocStart(), Init, - /*TopLevelOfInitList=*/true); + ExprResult Result = + SemaRef.PerformCopyInitialization(Entity, Init->getBeginLoc(), Init, + /*TopLevelOfInitList=*/true); Expr *ResultExpr = nullptr; if (Result.isInvalid()) @@ -1586,7 +1582,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,11 +1597,11 @@ else llvm_unreachable("Invalid element type!"); - SemaRef.Diag(IList->getLocStart(), - SemaRef.Context.getTypeSize(VT) > 64 ? - diag::note_neon_vector_initializer_non_portable_q : - diag::note_neon_vector_initializer_non_portable) - << typeCode << typeSize; + SemaRef.Diag(IList->getBeginLoc(), + SemaRef.Context.getTypeSize(VT) > 64 + ? diag::note_neon_vector_initializer_non_portable_q + : diag::note_neon_vector_initializer_non_portable) + << typeCode << typeSize; } return; @@ -1646,9 +1642,9 @@ // 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; + << (numEltsInit < maxElements) << maxElements << numEltsInit; hadError = true; } } @@ -1686,9 +1682,9 @@ // 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(), - diag::err_variable_object_no_init) - << VAT->getSizeExpr()->getSourceRange(); + SemaRef.Diag(VAT->getSizeExpr()->getBeginLoc(), + diag::err_variable_object_no_init) + << VAT->getSizeExpr()->getSourceRange(); hadError = true; ++Index; ++StructuredIndex; @@ -1765,8 +1761,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(), - diag::ext_typecheck_zero_array_size); + SemaRef.Diag(IList->getBeginLoc(), diag::ext_typecheck_zero_array_size); } DeclType = SemaRef.Context.getConstantArrayType(elementType, maxElements, @@ -1815,9 +1810,8 @@ } if (!VerifyOnly) { - SemaRef.Diag(InitExpr->getLocStart(), - FlexArrayDiag) - << InitExpr->getLocStart(); + SemaRef.Diag(InitExpr->getBeginLoc(), FlexArrayDiag) + << InitExpr->getBeginLoc(); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << Field; } @@ -1881,7 +1875,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. @@ -1958,8 +1952,8 @@ if (VerifyOnly) InvalidUse = !SemaRef.CanUseDecl(*Field, TreatUnavailableAsInvalid); else - InvalidUse = SemaRef.DiagnoseUseOfDecl(*Field, - IList->getInit(Index)->getLocStart()); + InvalidUse = SemaRef.DiagnoseUseOfDecl( + *Field, IList->getInit(Index)->getBeginLoc()); if (InvalidUse) { ++Index; ++Field; @@ -2182,11 +2176,9 @@ ExistingInit = StructuredList->getArrayFiller(); if (!ExistingInit) - StructuredList = - getStructuredSubobjectInit(IList, Index, CurrentObjectType, - StructuredList, StructuredIndex, - SourceRange(D->getLocStart(), - DIE->getLocEnd())); + StructuredList = getStructuredSubobjectInit( + IList, Index, CurrentObjectType, StructuredList, StructuredIndex, + SourceRange(D->getBeginLoc(), DIE->getLocEnd())); else if (InitListExpr *Result = dyn_cast(ExistingInit)) StructuredList = Result; else { @@ -2194,10 +2186,9 @@ dyn_cast(ExistingInit)) StructuredList = E->getUpdater(); else { - DesignatedInitUpdateExpr *DIUE = - new (SemaRef.Context) DesignatedInitUpdateExpr(SemaRef.Context, - D->getLocStart(), ExistingInit, - DIE->getLocEnd()); + DesignatedInitUpdateExpr *DIUE = new (SemaRef.Context) + DesignatedInitUpdateExpr(SemaRef.Context, D->getBeginLoc(), + ExistingInit, DIE->getLocEnd()); StructuredList->updateInit(SemaRef.Context, StructuredIndex, DIUE); StructuredList = DIUE->getUpdater(); } @@ -2222,14 +2213,13 @@ // 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(); + << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange(); } } } @@ -2350,10 +2340,10 @@ 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(); + << /*FIXME:has side effects=*/0 + << ExistingInit->getSourceRange(); } // remove existing initializer @@ -2395,10 +2385,9 @@ if (!VerifyOnly) { DesignatedInitExpr::Designator *NextD = DIE->getDesignator(DesigIdx + 1); - SemaRef.Diag(NextD->getLocStart(), - diag::err_designator_into_flexible_array_member) - << SourceRange(NextD->getLocStart(), - DIE->getLocEnd()); + SemaRef.Diag(NextD->getBeginLoc(), + diag::err_designator_into_flexible_array_member) + << SourceRange(NextD->getBeginLoc(), DIE->getLocEnd()); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << *Field; } @@ -2409,9 +2398,9 @@ !isa(DIE->getInit())) { // The initializer is not an initializer list. if (!VerifyOnly) { - SemaRef.Diag(DIE->getInit()->getLocStart(), - diag::err_flexible_array_init_needs_braces) - << DIE->getInit()->getSourceRange(); + SemaRef.Diag(DIE->getInit()->getBeginLoc(), + diag::err_flexible_array_init_needs_braces) + << DIE->getInit()->getSourceRange(); SemaRef.Diag(Field->getLocation(), diag::note_flexible_array_member) << *Field; } @@ -2553,10 +2542,10 @@ DesignatedEndIndex.setIsUnsigned(MaxElements.isUnsigned()); if (DesignatedEndIndex >= MaxElements) { if (!VerifyOnly) - SemaRef.Diag(IndexExpr->getLocStart(), - diag::err_array_designator_too_large) - << DesignatedEndIndex.toString(10) << MaxElements.toString(10) - << IndexExpr->getSourceRange(); + SemaRef.Diag(IndexExpr->getBeginLoc(), + diag::err_array_designator_too_large) + << DesignatedEndIndex.toString(10) << MaxElements.toString(10) + << IndexExpr->getSourceRange(); ++Index; return true; } @@ -2728,10 +2717,8 @@ SemaRef.Diag(InitRange.getBegin(), diag::warn_subobject_initializer_overrides) << InitRange; - SemaRef.Diag(ExistingInit->getLocStart(), - diag::note_previous_initializer) - << /*FIXME:has side effects=*/0 - << ExistingInit->getSourceRange(); + SemaRef.Diag(ExistingInit->getBeginLoc(), diag::note_previous_initializer) + << /*FIXME:has side effects=*/0 << ExistingInit->getSourceRange(); } InitListExpr *Result @@ -2810,14 +2797,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(), - diag::warn_initializer_overrides) - << expr->getSourceRange(); - - SemaRef.Diag(PrevInit->getLocStart(), - diag::note_previous_initializer) - << /*FIXME:has side effects=*/0 - << PrevInit->getSourceRange(); + SemaRef.Diag(expr->getBeginLoc(), diag::warn_initializer_overrides) + << expr->getSourceRange(); + + SemaRef.Diag(PrevInit->getBeginLoc(), diag::note_previous_initializer) + << /*FIXME:has side effects=*/0 << PrevInit->getSourceRange(); } } @@ -2833,7 +2817,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,8 +2925,8 @@ Init.getAs()); if (!getLangOpts().C99) - Diag(DIE->getLocStart(), diag::ext_designated_init) - << DIE->getSourceRange(); + Diag(DIE->getBeginLoc(), diag::ext_designated_init) + << DIE->getSourceRange(); return DIE; } @@ -3583,7 +3567,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 +3958,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 +4015,7 @@ } if (DestType->isRecordType() && - !S.isCompleteType(InitList->getLocStart(), DestType)) { + !S.isCompleteType(InitList->getBeginLoc(), DestType)) { Sequence.setIncompleteTypeFailure(DestType); return; } @@ -4051,7 +4035,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,9 +4202,8 @@ bool DerivedToBase; bool ObjCConversion; bool ObjCLifetimeConversion; - assert(!S.CompareReferenceRelationship(Initializer->getLocStart(), - T1, T2, DerivedToBase, - ObjCConversion, + assert(!S.CompareReferenceRelationship(Initializer->getBeginLoc(), T1, T2, + DerivedToBase, ObjCConversion, ObjCLifetimeConversion) && "Must have incompatible references when binding via conversion"); (void)DerivedToBase; @@ -4313,7 +4296,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 +4422,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 +4850,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 +5293,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 +5484,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 +5518,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 +5741,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?"); } @@ -7067,18 +7050,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 @@ -7093,7 +7076,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)); } @@ -7235,8 +7218,8 @@ // 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) - << Init->getSourceRange(); + S.Diag(Init->getBeginLoc(), diag::warn_cxx98_compat_reference_list_init) + << Init->getSourceRange(); } // OpenCL v2.0 s6.13.11.1. atomic variables can be initialized in global scope @@ -7248,8 +7231,9 @@ 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(); } @@ -7365,10 +7349,9 @@ // 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()->getSourceRange(), - &BasePath, IgnoreBaseAccess)) + if (S.CheckDerivedToBaseConversion( + SourceType, Step->Type, CurInit.get()->getBeginLoc(), + CurInit.get()->getSourceRange(), &BasePath, IgnoreBaseAccess)) return ExprError(); ExprValueKind VK = @@ -7397,7 +7380,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(); } } @@ -7458,7 +7441,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. @@ -7525,10 +7508,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(); } } @@ -8023,7 +8006,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; } @@ -8078,7 +8061,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; @@ -8128,7 +8111,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) @@ -8157,9 +8140,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(), @@ -8193,7 +8176,7 @@ case FK_AddressOfUnaddressableFunction: { auto *FD = cast(cast(OnlyArg)->getDecl()); S.checkAddressOfFunctionIsAvailable(FD, /*Complain=*/true, - OnlyArg->getLocStart()); + OnlyArg->getBeginLoc()); break; } @@ -8374,8 +8357,8 @@ case FK_ConstructorOverloadFailed: { SourceRange ArgsRange; if (Args.size()) - ArgsRange = SourceRange(Args.front()->getLocStart(), - Args.back()->getLocEnd()); + ArgsRange = + SourceRange(Args.front()->getBeginLoc(), Args.back()->getLocEnd()); if (Failure == FK_ListConstructorOverloadFailed) { assert(Args.size() == 1 && @@ -8910,7 +8893,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() @@ -8920,7 +8903,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) @@ -8931,7 +8914,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) @@ -8959,9 +8942,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()), ")"); } @@ -8978,8 +8961,8 @@ Expr *InitE = Init.get(); assert(InitE && "No initialization expression"); - InitializationKind Kind - = InitializationKind::CreateCopy(InitE->getLocStart(), SourceLocation()); + InitializationKind Kind = + InitializationKind::CreateCopy(InitE->getBeginLoc(), SourceLocation()); InitializationSequence Seq(*this, Entity, Kind, InitE); return !Seq.Failed(); } @@ -8997,11 +8980,10 @@ assert(InitE && "No initialization expression?"); if (EqualLoc.isInvalid()) - EqualLoc = InitE->getLocStart(); + EqualLoc = InitE->getBeginLoc(); - InitializationKind Kind = InitializationKind::CreateCopy(InitE->getLocStart(), - EqualLoc, - AllowExplicit); + InitializationKind Kind = InitializationKind::CreateCopy( + InitE->getBeginLoc(), EqualLoc, AllowExplicit); InitializationSequence Seq(*this, Entity, Kind, InitE, TopLevelOfInitList); // Prevent infinite recursion when performing parameter copy-initialization. Index: cfe/trunk/lib/Sema/SemaLambda.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaLambda.cpp +++ cfe/trunk/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,10 +720,9 @@ // 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); + << ReturnType << CSI.ReturnType << isa(CSI); // Continue iterating so that we keep emitting diagnostics. } } @@ -762,9 +761,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) @@ -1286,16 +1285,13 @@ for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) { ParmVarDecl *From = CallOperator->getParamDecl(I); - 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->getLocation(), - From->getIdentifier(), - From->getType(), - From->getTypeSourceInfo(), - From->getStorageClass(), - /*DefaultArg=*/nullptr)); + InvokerParams.push_back(ParmVarDecl::Create( + S.Context, + // Temporarily add to the TU. This is set to the invoker below. + S.Context.getTranslationUnitDecl(), From->getBeginLoc(), + From->getLocation(), From->getIdentifier(), From->getType(), + From->getTypeSourceInfo(), From->getStorageClass(), + /*DefaultArg=*/nullptr)); CallOpConvTL.setParam(I, From); CallOpConvNameTL.setParam(I, From); } @@ -1747,14 +1743,11 @@ SmallVector BlockParams; 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->getLocation(), - From->getIdentifier(), - From->getType(), - From->getTypeSourceInfo(), - From->getStorageClass(), - /*DefaultArg=*/nullptr)); + BlockParams.push_back(ParmVarDecl::Create( + Context, Block, From->getBeginLoc(), From->getLocation(), + From->getIdentifier(), From->getType(), From->getTypeSourceInfo(), + From->getStorageClass(), + /*DefaultArg=*/nullptr)); } Block->setParams(BlockParams); Index: cfe/trunk/lib/Sema/SemaLookup.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaLookup.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaObjCProperty.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaObjCProperty.cpp +++ cfe/trunk/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,8 +1497,8 @@ Diag(PropertyDiagLoc, diag::err_atomic_property_nontrivial_assign_op) << property->getType(); - Diag(FuncDecl->getLocStart(), - diag::note_callee_decl) << FuncDecl; + Diag(FuncDecl->getBeginLoc(), diag::note_callee_decl) + << FuncDecl; } } PIDecl->setSetterCXXAssignment(Res.getAs()); @@ -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: cfe/trunk/lib/Sema/SemaOpenMP.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaOpenMP.cpp +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp @@ -1789,7 +1789,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) @@ -2569,7 +2569,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); @@ -2706,20 +2706,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; } @@ -2998,7 +2998,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; @@ -3032,7 +3032,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; @@ -3054,7 +3054,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; } @@ -3813,7 +3813,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()) @@ -3906,7 +3906,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()); @@ -3933,7 +3933,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; @@ -3973,7 +3973,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) @@ -4042,7 +4042,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; } @@ -4075,7 +4075,7 @@ if (UO->isIncrementDecrementOp() && getInitLCDecl(UO->getSubExpr()) == LCDecl) return setStep(SemaRef - .ActOnIntegerConstant(UO->getLocStart(), + .ActOnIntegerConstant(UO->getBeginLoc(), (UO->isDecrementOp() ? -1 : 1)) .get(), /*Subtract=*/false); @@ -4100,7 +4100,7 @@ if (getInitLCDecl(CE->getArg(0)) == LCDecl) return setStep(SemaRef .ActOnIntegerConstant( - CE->getLocStart(), + CE->getBeginLoc(), ((CE->getOperator() == OO_MinusMinus) ? -1 : 1)) .get(), /*Subtract=*/false); @@ -4120,7 +4120,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; } @@ -4164,7 +4164,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; } @@ -4378,7 +4378,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; @@ -4423,7 +4423,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; } @@ -4461,7 +4461,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) @@ -5001,7 +5001,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)) @@ -5014,7 +5014,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()); @@ -5081,7 +5081,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()); @@ -5097,7 +5097,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( @@ -5475,7 +5475,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(); } @@ -5483,7 +5483,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(); } @@ -5529,9 +5529,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(); } } @@ -5567,7 +5567,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(); @@ -5576,7 +5576,7 @@ DependentHint = true; } else { Hint = E->EvaluateKnownConstInt(Context); - HintLoc = C->getLocStart(); + HintLoc = C->getBeginLoc(); } } } @@ -5592,12 +5592,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; } } } @@ -5718,7 +5718,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(); } @@ -5726,7 +5726,7 @@ ->setHasCancel(DSAStack->isCancelRegion()); } } else { - Diag(AStmt->getLocStart(), + Diag(AStmt->getBeginLoc(), diag::err_omp_parallel_sections_not_compound_stmt); return StmtError(); } @@ -5810,7 +5810,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; @@ -5818,13 +5818,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; } @@ -5844,19 +5844,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; } } @@ -6077,12 +6077,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) { @@ -6134,13 +6134,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(); } } } @@ -6228,7 +6228,7 @@ } } else { ErrorFound = NotAnExpression; - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } if (ErrorFound != NoError) { @@ -6290,7 +6290,7 @@ } } else { ErrorFound = NotAnExpression; - NoteLoc = ErrorLoc = Body->getLocStart(); + NoteLoc = ErrorLoc = Body->getBeginLoc(); NoteRange = ErrorRange = SourceRange(NoteLoc, NoteLoc); } if (ErrorFound != NoError) { @@ -6474,7 +6474,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); @@ -6484,7 +6484,7 @@ ErrorFound = NotAnAssignmentOp; NoteLoc = ErrorLoc = SecondBinOp ? SecondBinOp->getOperatorLoc() - : Second->getLocStart(); + : Second->getBeginLoc(); NoteRange = ErrorRange = SecondBinOp ? SecondBinOp->getSourceRange() : SourceRange(ErrorLoc, ErrorLoc); @@ -6518,15 +6518,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) { @@ -6599,7 +6599,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(); } @@ -6903,11 +6903,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; @@ -6936,8 +6936,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; } @@ -8932,7 +8932,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()) @@ -10439,7 +10439,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; @@ -10696,18 +10696,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()) @@ -10753,7 +10753,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(), @@ -11037,7 +11037,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; @@ -11138,7 +11138,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 @@ -11149,7 +11149,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()) { @@ -11302,12 +11302,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()); @@ -11417,11 +11417,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( @@ -12794,7 +12794,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()) @@ -13021,7 +13021,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: cfe/trunk/lib/Sema/SemaOverload.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaOverload.cpp +++ cfe/trunk/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,8 +1418,8 @@ = getLangOpts().ObjCAutoRefCount && (Action == AA_Passing || Action == AA_Sending); if (getLangOpts().ObjC1) - CheckObjCBridgeRelatedConversions(From->getLocStart(), - ToType, From->getType(), From); + CheckObjCBridgeRelatedConversions(From->getBeginLoc(), ToType, + From->getType(), From); ICS = ::TryImplicitConversion(*this, From, ToType, /*SuppressUserConversions=*/false, AllowExplicit, @@ -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()); @@ -2353,10 +2353,10 @@ // // Note that we do not check for ambiguity or inaccessibility // here. That is handled by CheckPointerConversion. - if (getLangOpts().CPlusPlus && - FromPointeeType->isRecordType() && ToPointeeType->isRecordType() && + 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,8 +3242,7 @@ OverloadCandidateSet::iterator Best; switch (auto Result = - CandidateSet.BestViableFunction(S, From->getLocStart(), - Best)) { + CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) { case OR_Deleted: case OR_Success: { // Record the standard conversion we used and the conversion function. @@ -3308,7 +3307,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,10 +3375,10 @@ // 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()) { + } else if (const RecordType *FromRecordType = + From->getType()->getAs()) { if (CXXRecordDecl *FromRecordDecl = dyn_cast(FromRecordType->getDecl())) { // Add all of the conversion functions as candidates. @@ -3416,8 +3415,8 @@ bool HadMultipleCandidates = (CandidateSet.size() > 1); OverloadCandidateSet::iterator Best; - switch (auto Result = CandidateSet.BestViableFunction(S, From->getLocStart(), - Best)) { + switch (auto Result = + CandidateSet.BestViableFunction(S, From->getBeginLoc(), Best)) { case OR_Success: case OR_Deleted: // Record the standard conversion we used and the conversion function. @@ -3496,13 +3495,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 +4749,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 +4766,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, @@ -4823,10 +4822,9 @@ break; } // Otherwise, look for the worst conversion. - if (Result.isBad() || - CompareImplicitConversionSequences(S, From->getLocStart(), ICS, - Result) == - ImplicitConversionSequence::Worse) + if (Result.isBad() || CompareImplicitConversionSequences( + S, From->getBeginLoc(), ICS, Result) == + ImplicitConversionSequence::Worse) Result = ICS; } @@ -4920,12 +4918,12 @@ bool dummy1 = false; bool dummy2 = false; bool dummy3 = false; - Sema::ReferenceCompareResult RefRelationship - = S.CompareReferenceRelationship(From->getLocStart(), T1, T2, dummy1, + Sema::ReferenceCompareResult RefRelationship = + 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,9 +5004,8 @@ if (ToType->isReferenceType()) return TryReferenceInit(S, From, ToType, - /*FIXME:*/From->getLocStart(), - SuppressUserConversions, - AllowExplicit); + /*FIXME:*/ From->getBeginLoc(), + SuppressUserConversions, AllowExplicit); return TryImplicitConversion(S, From, ToType, SuppressUserConversions, @@ -5177,7 +5174,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,10 +5183,9 @@ Qualifiers ToQs = DestType.getQualifiers(); unsigned CVR = FromQs.getCVRQualifiers() & ~ToQs.getCVRQualifiers(); if (CVR) { - Diag(From->getLocStart(), - diag::err_member_function_call_bad_cvr) - << Method->getDeclName() << FromRecordType << (CVR - 1) - << From->getSourceRange(); + Diag(From->getBeginLoc(), diag::err_member_function_call_bad_cvr) + << Method->getDeclName() << FromRecordType << (CVR - 1) + << From->getSourceRange(); Diag(Method->getLocation(), diag::note_previous_decl) << Method->getDeclName(); return ExprError(); @@ -5201,9 +5197,9 @@ case BadConversionSequence::rvalue_ref_to_lvalue: { bool IsRValueQualified = Method->getRefQualifier() == RefQualifierKind::RQ_RValue; - Diag(From->getLocStart(), diag::err_member_function_call_bad_ref) - << Method->getDeclName() << FromClassification.isRValue() - << IsRValueQualified; + Diag(From->getBeginLoc(), diag::err_member_function_call_bad_ref) + << Method->getDeclName() << FromClassification.isRValue() + << IsRValueQualified; Diag(Method->getLocation(), diag::note_previous_decl) << Method->getDeclName(); return ExprError(); @@ -5214,9 +5210,9 @@ break; } - return Diag(From->getLocStart(), - diag::err_member_function_call_bad_type) - << ImplicitParamRecordType << FromRecordType << From->getSourceRange(); + return Diag(From->getBeginLoc(), diag::err_member_function_call_bad_type) + << ImplicitParamRecordType << FromRecordType + << From->getSourceRange(); } if (ICS.Standard.Second == ICK_Derived_To_Base) { @@ -5257,9 +5253,8 @@ return PerformImplicitConversion(From, Context.BoolTy, ICS, AA_Converting); if (!DiagnoseMultipleUserDefinedConversion(From, Context.BoolTy)) - return Diag(From->getLocStart(), - diag::err_typecheck_bool_condition) - << From->getType() << From->getSourceRange(); + return Diag(From->getBeginLoc(), diag::err_typecheck_bool_condition) + << From->getType() << From->getSourceRange(); return ExprError(); } @@ -5372,9 +5367,9 @@ 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; + << From->getType() << From->getSourceRange() << T; return ExprError(); case ImplicitConversionSequence::EllipsisConversion: @@ -5383,15 +5378,15 @@ // 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; + << 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; + << From->getType() << From->getSourceRange() << T; } ExprResult Result = @@ -5414,14 +5409,14 @@ break; case NK_Constant_Narrowing: - S.Diag(From->getLocStart(), diag::ext_cce_narrowing) - << CCE << /*Constant*/1 - << PreNarrowingValue.getAsString(S.Context, PreNarrowingType) << T; + 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) - << CCE << /*Constant*/0 << From->getType() << T; + S.Diag(From->getBeginLoc(), diag::ext_cce_narrowing) + << CCE << /*Constant*/ 0 << From->getType() << T; break; } @@ -5457,8 +5452,8 @@ 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) - << CCE << From->getSourceRange(); + 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 +5581,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 +6004,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; @@ -6947,15 +6942,15 @@ // lvalues/rvalues and the type. Fortunately, we can allocate this // 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()); + DeclRefExpr ConversionRef(Conversion, false, Conversion->getType(), 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; @@ -6968,7 +6963,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, @@ -9484,7 +9479,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; @@ -11092,7 +11087,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; @@ -11168,7 +11163,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) @@ -11204,7 +11199,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()) @@ -11222,7 +11217,7 @@ if (!functionHasPassObjectSizeParams(Fun)) S.NoteOverloadCandidate(*I, Fun, TargetFunctionType, /*TakingAddress=*/true); - FailedCandidates.NoteCandidates(S, OvlExpr->getLocStart()); + FailedCandidates.NoteCandidates(S, OvlExpr->getBeginLoc()); } } @@ -11244,21 +11239,20 @@ } void ComplainIsStaticMemberFunctionFromBoundPointer() const { - S.Diag(OvlExpr->getLocStart(), + S.Diag(OvlExpr->getBeginLoc(), diag::err_invalid_form_pointer_member_function) - << OvlExpr->getSourceRange(); + << OvlExpr->getSourceRange(); } void ComplainOfInvalidConversion() const { - S.Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_not_func_ptrref) - << OvlExpr->getName() << TargetType; + 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) - << OvlExpr->getName() - << OvlExpr->getSourceRange(); + S.Diag(OvlExpr->getBeginLoc(), diag::err_addr_ovl_ambiguous) + << OvlExpr->getName() << OvlExpr->getSourceRange(); S.NoteAllOverloadCandidates(OvlExpr, TargetFunctionType, /*TakingAddress=*/true); } @@ -11508,7 +11502,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; } @@ -11944,7 +11938,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 @@ -12021,24 +12015,23 @@ } } - 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) - << ULE->getName() << Fn->getSourceRange(); + 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) - << (*Best)->Function->isDeleted() - << ULE->getName() - << SemaRef.getDeletedOrUnavailableSuffix((*Best)->Function) - << Fn->getSourceRange(); + SemaRef.Diag(Fn->getBeginLoc(), diag::err_ovl_deleted_call) + << (*Best)->Function->isDeleted() << ULE->getName() + << SemaRef.getDeletedOrUnavailableSuffix((*Best)->Function) + << Fn->getSourceRange(); CandidateSet->NoteCandidates(SemaRef, OCD_AllCandidates, Args); // We emitted an error for the unavailable/deleted function call but keep @@ -12094,7 +12087,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, @@ -12819,7 +12812,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(); @@ -12905,7 +12898,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); @@ -13022,17 +13015,15 @@ 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(); + << 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::note_pure_qualified_call_kext) - << MD->getParent()->getDeclName() - << MD->getDeclName(); + Diag(MemExpr->getBeginLoc(), diag::note_pure_qualified_call_kext) + << MD->getParent()->getDeclName() << MD->getDeclName(); } } @@ -13040,7 +13031,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()); } @@ -13145,7 +13136,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 @@ -13154,30 +13145,26 @@ case OR_No_Viable_Function: if (CandidateSet.empty()) - Diag(Object.get()->getLocStart(), diag::err_ovl_no_oper) - << Object.get()->getType() << /*call*/ 1 - << Object.get()->getSourceRange(); + Diag(Object.get()->getBeginLoc(), diag::err_ovl_no_oper) + << Object.get()->getType() << /*call*/ 1 + << Object.get()->getSourceRange(); else - Diag(Object.get()->getLocStart(), - diag::err_ovl_no_viable_object_call) - << Object.get()->getType() << Object.get()->getSourceRange(); + 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::err_ovl_ambiguous_object_call) - << Object.get()->getType() << Object.get()->getSourceRange(); + 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::err_ovl_deleted_object_call) - << Best->Function->isDeleted() - << Object.get()->getType() - << getDeletedOrUnavailableSuffix(Best->Function) - << Object.get()->getSourceRange(); + Diag(Object.get()->getBeginLoc(), diag::err_ovl_deleted_object_call) + << Best->Function->isDeleted() << Object.get()->getType() + << getDeletedOrUnavailableSuffix(Best->Function) + << Object.get()->getSourceRange(); CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args); break; } @@ -13574,7 +13561,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: cfe/trunk/lib/Sema/SemaPseudoObject.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaPseudoObject.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaStmt.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaStmt.cpp +++ cfe/trunk/lib/Sema/SemaStmt.cpp @@ -918,8 +918,8 @@ // Check the unconverted value is within the range of possible values of // the switch expression. - checkCaseValue(*this, Lo->getLocStart(), LoVal, - CondWidthBeforePromotion, CondIsSignedBeforePromotion); + checkCaseValue(*this, Lo->getBeginLoc(), LoVal, CondWidthBeforePromotion, + CondIsSignedBeforePromotion); // FIXME: This duplicates the check performed for warn_not_in_enum below. checkEnumTypesInSwitchStmt(*this, CondExprBeforePromotion, @@ -979,17 +979,17 @@ CaseVals[i-1].first.toString(CaseValStr); if (PrevString == CurrString) - Diag(CaseVals[i].second->getLHS()->getLocStart(), - diag::err_duplicate_case) << - (PrevString.empty() ? StringRef(CaseValStr) : PrevString); + Diag(CaseVals[i].second->getLHS()->getBeginLoc(), + diag::err_duplicate_case) + << (PrevString.empty() ? StringRef(CaseValStr) : PrevString); else - Diag(CaseVals[i].second->getLHS()->getLocStart(), - diag::err_duplicate_case_differing_expr) << - (PrevString.empty() ? StringRef(CaseValStr) : PrevString) << - (CurrString.empty() ? StringRef(CaseValStr) : CurrString) << - CaseValStr; + 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,9 +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(), - Hi->getLocEnd()); + Diag(CR->getLHS()->getBeginLoc(), diag::warn_case_empty_range) + << SourceRange(CR->getLHS()->getBeginLoc(), Hi->getLocEnd()); CaseRanges.erase(CaseRanges.begin()+i); --i; --e; @@ -1082,9 +1081,9 @@ if (OverlapStmt) { // If we have a duplicate, report it. - Diag(CR->getLHS()->getLocStart(), diag::err_duplicate_case) - << OverlapVal.toString(10); - Diag(OverlapStmt->getLHS()->getLocStart(), + Diag(CR->getLHS()->getBeginLoc(), diag::err_duplicate_case) + << OverlapVal.toString(10); + 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 +1491,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 +1667,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,9 +1913,9 @@ } else { Expr *FirstE = cast(First); if (!FirstE->isTypeDependent() && !FirstE->isLValue()) - return StmtError(Diag(First->getLocStart(), - diag::err_selector_element_not_lvalue) - << First->getSourceRange()); + return StmtError( + Diag(First->getBeginLoc(), diag::err_selector_element_not_lvalue) + << First->getSourceRange()); FirstType = static_cast(First)->getType(); if (FirstType.isConstQualified()) @@ -2087,7 +2086,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 +2168,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 +2194,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,8 +2450,8 @@ QualType ArrayTy = PVD->getOriginalType(); QualType PointerTy = PVD->getType(); if (PointerTy->isPointerType() && ArrayTy->isArrayType()) { - Diag(Range->getLocStart(), diag::err_range_on_array_parameter) - << RangeLoc << PVD << ArrayTy << PointerTy; + Diag(Range->getBeginLoc(), diag::err_range_on_array_parameter) + << RangeLoc << PVD << ArrayTy << PointerTy; Diag(PVD->getLocation(), diag::note_declared_at); return StmtError(); } @@ -2473,7 +2472,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 +2659,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 +2668,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 +2704,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 +2720,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 +2950,7 @@ Expr *InitExpr = &AsRvalue; InitializationKind Kind = InitializationKind::CreateCopy( - Value->getLocStart(), Value->getLocStart()); + Value->getBeginLoc(), Value->getBeginLoc()); InitializationSequence Seq(S, Entity, Kind, InitExpr); @@ -3969,7 +3968,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: cfe/trunk/lib/Sema/SemaStmtAsm.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaStmtAsm.cpp +++ cfe/trunk/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,9 +226,9 @@ TargetInfo::ConstraintInfo Info(Literal->getString(), OutputName); if (!Context.getTargetInfo().validateOutputConstraint(Info)) - return StmtError(Diag(Literal->getLocStart(), - diag::err_asm_invalid_output_constraint) - << Info.getConstraintStr()); + return StmtError( + Diag(Literal->getBeginLoc(), diag::err_asm_invalid_output_constraint) + << Info.getConstraintStr()); ExprResult ER = CheckPlaceholderExpr(Exprs[i]); if (ER.isInvalid()) @@ -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,9 +289,9 @@ unsigned Size = Context.getTypeSize(OutputExpr->getType()); if (!Context.getTargetInfo().validateOutputSize(Literal->getString(), Size)) - return StmtError(Diag(OutputExpr->getLocStart(), - diag::err_asm_invalid_output_size) - << Info.getConstraintStr()); + return StmtError( + Diag(OutputExpr->getBeginLoc(), diag::err_asm_invalid_output_size) + << Info.getConstraintStr()); } SmallVector InputConstraintInfos; @@ -307,9 +307,9 @@ TargetInfo::ConstraintInfo Info(Literal->getString(), InputName); if (!Context.getTargetInfo().validateInputConstraint(OutputConstraintInfos, Info)) { - return StmtError(Diag(Literal->getLocStart(), - diag::err_asm_invalid_input_constraint) - << Info.getConstraintStr()); + return StmtError( + Diag(Literal->getBeginLoc(), diag::err_asm_invalid_input_constraint) + << Info.getConstraintStr()); } ExprResult ER = CheckPlaceholderExpr(Exprs[i]); @@ -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()); @@ -339,11 +339,11 @@ if (!InputExpr->isValueDependent()) { llvm::APSInt Result; if (!InputExpr->EvaluateAsInt(Result, Context)) - return StmtError( - Diag(InputExpr->getLocStart(), diag::err_asm_immediate_expected) - << Info.getConstraintStr() << InputExpr->getSourceRange()); + return StmtError( + 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,10 +359,10 @@ if (Info.allowsRegister()) { if (InputExpr->getType()->isVoidType()) { - return StmtError(Diag(InputExpr->getLocStart(), - diag::err_asm_invalid_type_in_input) - << InputExpr->getType() << Info.getConstraintStr() - << InputExpr->getSourceRange()); + return StmtError( + Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_type_in_input) + << InputExpr->getType() << Info.getConstraintStr() + << InputExpr->getSourceRange()); } } @@ -373,16 +373,16 @@ 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(), - diag::err_asm_invalid_input_size) - << Info.getConstraintStr()); + return StmtError( + Diag(InputExpr->getBeginLoc(), diag::err_asm_invalid_input_size) + << Info.getConstraintStr()); } // Check that the clobbers are valid. @@ -393,8 +393,9 @@ StringRef Clobber = Literal->getString(); if (!Context.getTargetInfo().isValidClobber(Clobber)) - return StmtError(Diag(Literal->getLocStart(), - diag::err_asm_unknown_register_name) << Clobber); + return StmtError( + Diag(Literal->getBeginLoc(), diag::err_asm_unknown_register_name) + << Clobber); } GCCAsmStmt *NS = @@ -446,7 +447,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 +470,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 +483,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 +500,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,10 +591,9 @@ continue; } - Diag(InputExpr->getLocStart(), - diag::err_asm_tying_incompatible_types) - << InTy << OutTy << OutputExpr->getSourceRange() - << InputExpr->getSourceRange(); + Diag(InputExpr->getBeginLoc(), diag::err_asm_tying_incompatible_types) + << InTy << OutTy << OutputExpr->getSourceRange() + << InputExpr->getSourceRange(); return StmtError(); } Index: cfe/trunk/lib/Sema/SemaStmtAttr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaStmtAttr.cpp +++ cfe/trunk/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) @@ -100,7 +100,7 @@ .Case("unroll_and_jam", "#pragma unroll_and_jam") .Case("nounroll_and_jam", "#pragma nounroll_and_jam") .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; } @@ -154,7 +154,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 || @@ -333,7 +333,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: cfe/trunk/lib/Sema/SemaTemplate.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplate.cpp +++ cfe/trunk/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,9 +539,8 @@ // If this is a dependent-scope lookup, diagnose that the 'template' keyword // was missing. if (MissingTemplateKeyword) { - Diag(NameInfo.getLocStart(), diag::err_template_kw_missing) - << "" << NameInfo.getName().getAsString() - << SourceRange(Less, Greater); + Diag(NameInfo.getBeginLoc(), diag::err_template_kw_missing) + << "" << NameInfo.getName().getAsString() << SourceRange(Less, Greater); return; } @@ -892,7 +891,7 @@ // convertTypeTemplateArgumentToTemplate. return ParsedTemplateArgument(ParsedTemplateArgument::Type, ParsedType.get().getAsOpaquePtr(), - TInfo->getTypeLoc().getLocStart()); + TInfo->getTypeLoc().getBeginLoc()); } /// ActOnTypeParameter - Called when a C++ template type parameter @@ -1113,12 +1112,10 @@ IdentifierInfo *ParamName = D.getIdentifier(); bool IsParameterPack = D.hasEllipsis(); - NonTypeTemplateParmDecl *Param - = NonTypeTemplateParmDecl::Create(Context, Context.getTranslationUnitDecl(), - D.getLocStart(), - D.getIdentifierLoc(), - Depth, Position, ParamName, T, - IsParameterPack, TInfo); + NonTypeTemplateParmDecl *Param = NonTypeTemplateParmDecl::Create( + Context, Context.getTranslationUnitDecl(), D.getBeginLoc(), + D.getIdentifierLoc(), Depth, Position, ParamName, T, IsParameterPack, + TInfo); Param->setAccess(AS_public); if (Invalid) @@ -1459,10 +1456,11 @@ }(); 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::note_template_prev_declaration) << /*declaration*/0; + Diag(PrevAC ? PrevAC->getBeginLoc() : PrevClassTemplate->getLocation(), + diag::note_template_prev_declaration) + << /*declaration*/ 0; return true; } @@ -1763,7 +1761,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,8 +1804,8 @@ // TemplateTypeParmDecl's index cannot be changed after creation, so // substitute it directly. auto *NewTTP = TemplateTypeParmDecl::Create( - SemaRef.Context, DC, TTP->getLocStart(), TTP->getLocation(), - /*Depth*/0, Depth1IndexAdjustment + TTP->getIndex(), + SemaRef.Context, DC, TTP->getBeginLoc(), TTP->getLocation(), + /*Depth*/ 0, Depth1IndexAdjustment + TTP->getIndex(), TTP->getIdentifier(), TTP->wasDeclaredWithTypename(), TTP->isParameterPack()); if (TTP->hasDefaultArgument()) { @@ -1876,7 +1874,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(); @@ -3247,13 +3245,11 @@ // This is the first time we have referenced this class template // specialization. Create the canonical declaration and add it to // the set of specializations. - Decl = ClassTemplateSpecializationDecl::Create(Context, - ClassTemplate->getTemplatedDecl()->getTagKind(), - ClassTemplate->getDeclContext(), - ClassTemplate->getTemplatedDecl()->getLocStart(), - ClassTemplate->getLocation(), - ClassTemplate, - Converted, nullptr); + Decl = ClassTemplateSpecializationDecl::Create( + Context, ClassTemplate->getTemplatedDecl()->getTagKind(), + ClassTemplate->getDeclContext(), + ClassTemplate->getTemplatedDecl()->getBeginLoc(), + ClassTemplate->getLocation(), ClassTemplate, Converted, nullptr); ClassTemplate->AddSpecialization(Decl, InsertPos); if (ClassTemplate->isOutOfLine()) Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext()); @@ -4218,12 +4214,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,10 +4237,11 @@ // 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*/; + << Name.Identifier + << 0 /*injected-class-name used as template name*/ + << 1 /*'template' keyword was used*/; } return TNK; } @@ -4270,11 +4267,9 @@ break; } - Diag(Name.getLocStart(), - diag::err_template_kw_refers_to_non_template) - << GetNameFromUnqualifiedId(Name).getName() - << Name.getSourceRange() - << TemplateKWLoc; + Diag(Name.getBeginLoc(), diag::err_template_kw_refers_to_non_template) + << GetNameFromUnqualifiedId(Name).getName() << Name.getSourceRange() + << TemplateKWLoc; return TNK_Non_template; } @@ -5629,7 +5624,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,9 +5665,9 @@ 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(); + << ParamType << Arg->getType() << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } @@ -5686,11 +5681,11 @@ ParamType.getNonReferenceType())) { // We can't perform this conversion or binding. if (ParamType->isReferenceType()) - S.Diag(Arg->getLocStart(), diag::err_template_arg_no_ref_bind) - << ParamType << ArgIn->getType() << Arg->getSourceRange(); + 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) - << ArgIn->getType() << ParamType << Arg->getSourceRange(); + 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,8 +5731,8 @@ } if (FirstOpLoc.isValid()) { if (ExtWarnMSTemplateArg) - S.Diag(ArgIn->getLocStart(), diag::ext_ms_deref_template_argument) - << ArgIn->getSourceRange(); + S.Diag(ArgIn->getBeginLoc(), diag::ext_ms_deref_template_argument) + << ArgIn->getSourceRange(); if (FirstOpKind == UO_AddrOf) AddressTaken = true; @@ -5745,8 +5740,8 @@ // 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) - << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) + << Arg->getSourceRange(); } } } else { @@ -5770,7 +5765,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,16 +5831,16 @@ } if (!DRE) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref) - << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) + << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } // Cannot refer to non-static data members if (isa(Entity) || isa(Entity)) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_field) - << Entity << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_field) + << Entity << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } @@ -5853,8 +5848,8 @@ // 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) - << Method << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_method) + << Method << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } @@ -5866,23 +5861,24 @@ // 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) - << Arg->getSourceRange(); + 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; } // Address / reference template args must have external linkage in C++98. if (Entity->getFormalLinkage() == InternalLinkage) { - S.Diag(Arg->getLocStart(), S.getLangOpts().CPlusPlus11 ? - diag::warn_cxx98_compat_template_arg_object_internal : - diag::ext_template_arg_object_internal) - << !Func << Entity << Arg->getSourceRange(); + 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) - << !Func << Entity << Arg->getSourceRange(); + 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; return true; @@ -5914,17 +5910,16 @@ } else { // A value of reference type is not an object. if (Var->getType()->isReferenceType()) { - S.Diag(Arg->getLocStart(), - diag::err_template_arg_reference_var) - << Var->getType() << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_reference_var) + << Var->getType() << Arg->getSourceRange(); S.Diag(Param->getLocation(), diag::note_template_param_here); return true; } // A template argument must have static storage duration. if (Var->getTLSKind()) { - S.Diag(Arg->getLocStart(), diag::err_template_arg_thread_local) - << Arg->getSourceRange(); + 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 +5956,14 @@ // 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) - << ParamType; + 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) - << ParamType - << FixItHint::CreateInsertion(Arg->getLocStart(), "&"); + S.Diag(Arg->getBeginLoc(), diag::err_template_arg_not_address_of) + << ParamType << FixItHint::CreateInsertion(Arg->getBeginLoc(), "&"); S.Diag(Param->getLocation(), diag::note_template_param_here); } @@ -5983,7 +5977,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,11 +6006,11 @@ bool ExtraParens = false; while (ParenExpr *Parens = dyn_cast(Arg)) { if (!Invalid && !ExtraParens) { - S.Diag(Arg->getLocStart(), - S.getLangOpts().CPlusPlus11 ? - diag::warn_cxx98_compat_template_arg_extra_parens : - diag::ext_template_arg_extra_parens) - << Arg->getSourceRange(); + S.Diag(Arg->getBeginLoc(), + S.getLangOpts().CPlusPlus11 + ? diag::warn_cxx98_compat_template_arg_extra_parens + : diag::ext_template_arg_extra_parens) + << Arg->getSourceRange(); ExtraParens = true; } @@ -6078,16 +6072,16 @@ } 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(); + << Arg->getSourceRange(); if (isa(DRE->getDecl()) || isa(DRE->getDecl()) || @@ -6109,9 +6103,8 @@ } // We found something else, but we don't know specifically what it is. - S.Diag(Arg->getLocStart(), - diag::err_template_arg_not_pointer_to_member_form) - << Arg->getSourceRange(); + 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); return true; } @@ -6127,7 +6120,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 +6241,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,8 +6267,8 @@ Converted = TemplateArgument(ArgResult.get()); break; } - Diag(Arg->getLocStart(), diag::err_template_arg_not_decl_ref) - << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_decl_ref) + << Arg->getSourceRange(); return ExprError(); } auto *VD = const_cast( @@ -6384,9 +6377,8 @@ // -- the name of a non-type template-parameter; or llvm::APSInt Value; if (!ArgType->isIntegralOrEnumerationType()) { - Diag(Arg->getLocStart(), - diag::err_template_arg_not_integral_or_enumeral) - << ArgType << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_integral_or_enumeral) + << ArgType << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); return ExprError(); } else if (!Arg->isValueDependent()) { @@ -6424,9 +6416,8 @@ Arg = ImpCastExprToType(Arg, ParamType, CK_IntegralCast).get(); } else { // We can't perform this conversion. - Diag(Arg->getLocStart(), - diag::err_template_arg_not_convertible) - << Arg->getType() << ParamType << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::err_template_arg_not_convertible) + << Arg->getType() << ParamType << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); return ExprError(); } @@ -6465,9 +6456,9 @@ // Complain if an unsigned parameter received a negative value. if (IntegerType->isUnsignedIntegerOrEnumerationType() && (OldValue.isSigned() && OldValue.isNegative())) { - Diag(Arg->getLocStart(), diag::warn_template_arg_negative) - << OldValue.toString(10) << Value.toString(10) << Param->getType() - << Arg->getSourceRange(); + 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,10 +6471,9 @@ else RequiredBits = OldValue.getMinSignedBits(); if (RequiredBits > AllowedBits) { - Diag(Arg->getLocStart(), - diag::warn_template_arg_too_large) - << OldValue.toString(10) << Value.toString(10) << Param->getType() - << Arg->getSourceRange(); + Diag(Arg->getBeginLoc(), diag::warn_template_arg_too_large) + << OldValue.toString(10) << Value.toString(10) << Param->getType() + << Arg->getSourceRange(); Diag(Param->getLocation(), diag::note_template_param_here); } } @@ -6526,7 +6516,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 +6569,7 @@ ParamRefType->getPointeeType(), true, FoundResult)) { - if (DiagnoseUseOfDecl(Fn, Arg->getLocStart())) + if (DiagnoseUseOfDecl(Fn, Arg->getBeginLoc())) return ExprError(); Arg = FixOverloadedFunctionReference(Arg, FoundResult, Fn); @@ -7357,9 +7347,9 @@ 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(); + << Param->getType(); S.Diag(Param->getLocation(), diag::note_template_param_here) << (IsDefaultArgument ? ParamUseRange : SourceRange()) << ParamUseRange; @@ -8573,7 +8563,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,10 +8980,9 @@ 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(); + << D.getDeclSpec().getSourceRange() << D.getSourceRange(); return true; } @@ -9046,8 +9035,8 @@ // 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) - << /*explicit instantiation*/ 0; + Diag(D.getDeclSpec().getBeginLoc(), diag::err_deduction_guide_specialized) + << /*explicit instantiation*/ 0; return true; } @@ -9105,7 +9094,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 +9164,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 +9282,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: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ cfe/trunk/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,10 +991,10 @@ PrevDecl = cast(Prev); } - EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner, D->getLocStart(), - D->getLocation(), D->getIdentifier(), - PrevDecl, D->isScoped(), - D->isScopedUsingClassTag(), D->isFixed()); + EnumDecl *Enum = + EnumDecl::Create(SemaRef.Context, Owner, D->getBeginLoc(), + D->getLocation(), D->getIdentifier(), PrevDecl, + D->isScoped(), D->isScopedUsingClassTag(), D->isFixed()); if (D->isFixed()) { if (TypeSourceInfo *TI = D->getIntegerTypeSourceInfo()) { // If we have type source information for the underlying type, it means it @@ -1250,11 +1250,10 @@ } } - CXXRecordDecl *RecordInst - = CXXRecordDecl::Create(SemaRef.Context, Pattern->getTagKind(), DC, - Pattern->getLocStart(), Pattern->getLocation(), - Pattern->getIdentifier(), PrevDecl, - /*DelayTypeCreation=*/true); + CXXRecordDecl *RecordInst = CXXRecordDecl::Create( + SemaRef.Context, Pattern->getTagKind(), DC, Pattern->getBeginLoc(), + Pattern->getLocation(), Pattern->getIdentifier(), PrevDecl, + /*DelayTypeCreation=*/true); if (QualifierLoc) RecordInst->setQualifierInfo(QualifierLoc); @@ -1484,10 +1483,9 @@ PrevDecl = cast(Prev); } - CXXRecordDecl *Record - = CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner, - D->getLocStart(), D->getLocation(), - D->getIdentifier(), PrevDecl); + CXXRecordDecl *Record = CXXRecordDecl::Create( + SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(), + D->getLocation(), D->getIdentifier(), PrevDecl); // Substitute the nested name specifier, if any. if (SubstQualifier(D, Record)) @@ -2119,7 +2117,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); @@ -2931,15 +2929,10 @@ } // Create the class template partial specialization declaration. - ClassTemplateSpecializationDecl *InstD - = ClassTemplateSpecializationDecl::Create(SemaRef.Context, - D->getTagKind(), - Owner, - D->getLocStart(), - D->getLocation(), - InstClassTemplate, - Converted, - PrevDecl); + ClassTemplateSpecializationDecl *InstD = + ClassTemplateSpecializationDecl::Create( + SemaRef.Context, D->getTagKind(), Owner, D->getBeginLoc(), + D->getLocation(), InstClassTemplate, Converted, PrevDecl); // Add this partial specialization to the set of class template partial // specializations. @@ -3008,7 +3001,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; @@ -3237,18 +3230,11 @@ // Create the class template partial specialization declaration. - ClassTemplatePartialSpecializationDecl *InstPartialSpec - = ClassTemplatePartialSpecializationDecl::Create(SemaRef.Context, - PartialSpec->getTagKind(), - Owner, - PartialSpec->getLocStart(), - PartialSpec->getLocation(), - InstParams, - ClassTemplate, - Converted, - InstTemplateArgs, - CanonType, - nullptr); + ClassTemplatePartialSpecializationDecl *InstPartialSpec = + ClassTemplatePartialSpecializationDecl::Create( + SemaRef.Context, PartialSpec->getTagKind(), Owner, + PartialSpec->getBeginLoc(), PartialSpec->getLocation(), InstParams, + ClassTemplate, Converted, InstTemplateArgs, CanonType, nullptr); // Substitute the nested name specifier, if any. if (SubstQualifier(PartialSpec, InstPartialSpec)) return nullptr; @@ -3823,7 +3809,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 +4352,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: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp +++ cfe/trunk/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: cfe/trunk/lib/Sema/SemaType.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaType.cpp +++ cfe/trunk/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,17 +808,17 @@ 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); + << typeArg << FixItHint::CreateRemoval(rangeToRemove); diagnosed = true; } } if (!diagnosed) { - S.Diag(qual.getLocStart(), diag::err_objc_type_arg_qualified) - << typeArg << typeArg.getQualifiers().getAsString() - << FixItHint::CreateRemoval(rangeToRemove); + S.Diag(qual.getBeginLoc(), diag::err_objc_type_arg_qualified) + << typeArg << typeArg.getQualifiers().getAsString() + << FixItHint::CreateRemoval(rangeToRemove); } } @@ -878,9 +878,9 @@ } // 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(); + << typeArg << bound << typeParam->getDeclName(); S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here) << typeParam->getDeclName(); @@ -906,9 +906,9 @@ 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(); + << typeArg << bound << typeParam->getDeclName(); S.Diag(typeParam->getLocation(), diag::note_objc_type_param_here) << typeParam->getDeclName(); @@ -924,10 +924,9 @@ } // 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(); + << typeArg << typeArgInfo->getTypeLoc().getSourceRange(); if (failOnError) return QualType(); @@ -1186,7 +1185,7 @@ DeclSpec &DS = declarator.getMutableDeclSpec(); SourceLocation DeclLoc = declarator.getIdentifierLoc(); if (DeclLoc.isInvalid()) - DeclLoc = DS.getLocStart(); + DeclLoc = DS.getBeginLoc(); ASTContext &Context = S.Context; @@ -1268,8 +1267,8 @@ // when one is not allowed. if (DS.isEmpty()) { S.Diag(DeclLoc, diag::ext_missing_declspec) - << DS.getSourceRange() - << FixItHint::CreateInsertion(DS.getLocStart(), "int"); + << DS.getSourceRange() + << FixItHint::CreateInsertion(DS.getBeginLoc(), "int"); } } else if (!DS.hasTypeSpecifier()) { // C99 and C++ require a type specifier. For example, C99 6.7.2p2 says: @@ -2117,8 +2116,8 @@ if (!getLangOpts().CPlusPlus11 && ArraySize && !ArraySize->isTypeDependent() && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { - Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) - << ArraySize->getType() << ArraySize->getSourceRange(); + Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int) + << ArraySize->getType() << ArraySize->getSourceRange(); return QualType(); } @@ -2137,8 +2136,8 @@ // of a VLA. if (getLangOpts().CPlusPlus11 && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { - Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) - << ArraySize->getType() << ArraySize->getSourceRange(); + Diag(ArraySize->getBeginLoc(), diag::err_array_size_non_int) + << ArraySize->getType() << ArraySize->getSourceRange(); return QualType(); } @@ -2151,25 +2150,25 @@ // have a value greater than zero. if (ConstVal.isSigned() && ConstVal.isNegative()) { if (Entity) - Diag(ArraySize->getLocStart(), diag::err_decl_negative_array_size) - << getPrintableNameForEntity(Entity) << ArraySize->getSourceRange(); + Diag(ArraySize->getBeginLoc(), diag::err_decl_negative_array_size) + << getPrintableNameForEntity(Entity) << ArraySize->getSourceRange(); else - Diag(ArraySize->getLocStart(), diag::err_typecheck_negative_array_size) - << ArraySize->getSourceRange(); + 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(), - isSFINAEContext()? diag::err_typecheck_zero_array_size - : diag::ext_typecheck_zero_array_size) - << ArraySize->getSourceRange(); + 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(); + << ArraySize->getSourceRange(); ASM = ArrayType::Normal; } } else if (!T->isDependentType() && !T->isVariablyModifiedType() && @@ -2178,9 +2177,8 @@ unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, T, ConstVal); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { - Diag(ArraySize->getLocStart(), diag::err_array_too_large) - << ConstVal.toString(10) - << ArraySize->getSourceRange(); + Diag(ArraySize->getBeginLoc(), diag::err_array_too_large) + << ConstVal.toString(10) << ArraySize->getSourceRange(); return QualType(); } } @@ -2873,9 +2871,9 @@ 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); + /*Identifier*/ nullptr, false, IsParameterPack); LSI->AutoTemplateParams.push_back(CorrespondingTemplateParam); // Replace the 'auto' in the function parameter with this invented // template type parameter. @@ -3302,8 +3300,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 +4384,13 @@ } else if (FTI.hasTrailingReturnType()) { // T must be exactly 'auto' at this point. See CWG issue 681. if (isa(T)) { - S.Diag(D.getLocStart(), - diag::err_trailing_return_in_parens) - << T << D.getSourceRange(); + 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 +4472,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 +4884,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,8 +7094,9 @@ assert(0 && "Unable to find corresponding image type."); } - S.Diag(TypedefTy->getDecl()->getLocStart(), - diag::note_opencl_typedef_access_qualifier) << PrevAccessQual; + S.Diag(TypedefTy->getDecl()->getBeginLoc(), + diag::note_opencl_typedef_access_qualifier) + << PrevAccessQual; } else if (CurType->isPipeType()) { if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) { QualType ElemType = CurType->getAs()->getElementType(); @@ -7362,9 +7360,10 @@ case TAL_DeclName: state.getSema().Diag(attr.getLoc(), diag::err_objc_kindof_wrong_position) - << FixItHint::CreateRemoval(attr.getLoc()) - << FixItHint::CreateInsertion( - state.getDeclarator().getDeclSpec().getLocStart(), "__kindof "); + << FixItHint::CreateRemoval(attr.getLoc()) + << FixItHint::CreateInsertion( + state.getDeclarator().getDeclSpec().getBeginLoc(), + "__kindof "); break; } @@ -7862,7 +7861,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()) { @@ -7870,9 +7869,8 @@ } else if (RD->hasNonLiteralTypeFieldsOrBases()) { for (const auto &I : RD->bases()) { if (!I.getType()->isLiteralType(Context)) { - Diag(I.getLocStart(), - diag::note_non_literal_base_class) - << RD << I.getType() << I.getSourceRange(); + Diag(I.getBeginLoc(), diag::note_non_literal_base_class) + << RD << I.getType() << I.getSourceRange(); return true; } } Index: cfe/trunk/lib/Sema/TreeTransform.h =================================================================== --- cfe/trunk/lib/Sema/TreeTransform.h +++ cfe/trunk/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. @@ -6411,16 +6411,10 @@ if (getDerived().AlwaysRebuild() || AnyChanged) { // Rebuild the type. Result = getDerived().RebuildObjCObjectType( - BaseType, - TL.getLocStart(), - TL.getTypeArgsLAngleLoc(), - NewTypeArgInfos, - TL.getTypeArgsRAngleLoc(), - TL.getProtocolLAngleLoc(), - llvm::makeArrayRef(TL.getTypePtr()->qual_begin(), - TL.getNumProtocols()), - TL.getProtocolLocs(), - TL.getProtocolRAngleLoc()); + BaseType, TL.getBeginLoc(), TL.getTypeArgsLAngleLoc(), NewTypeArgInfos, + TL.getTypeArgsRAngleLoc(), TL.getProtocolLAngleLoc(), + llvm::makeArrayRef(TL.getTypePtr()->qual_begin(), TL.getNumProtocols()), + TL.getProtocolLocs(), TL.getProtocolRAngleLoc()); if (Result.isNull()) return QualType(); @@ -6656,7 +6650,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 +7702,7 @@ return getDerived().RebuildOMPExecutableDirective( D->getDirectiveKind(), DirName, CancelRegion, TClauses, - AssociatedStmt.get(), D->getLocStart(), D->getLocEnd()); + AssociatedStmt.get(), D->getBeginLoc(), D->getLocEnd()); } template @@ -7716,7 +7710,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 +7721,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 +7732,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 +7743,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 +7754,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 +7765,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 +7776,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 +7787,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 +7797,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 +7808,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 +7819,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 +7830,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 +7841,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 +7852,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 +7863,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 +7874,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 +7885,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 +7896,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 +7907,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 +7918,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 +7929,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 +7940,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 +7951,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 +7962,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 +7973,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 +7984,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 +7995,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 +8006,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 +8017,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 +8028,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 +8039,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 +8050,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 +8061,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 +8072,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 +8084,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 +8095,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; @@ -8111,9 +8105,8 @@ StmtResult TreeTransform::TransformOMPTargetParallelForSimdDirective( OMPTargetParallelForSimdDirective *D) { DeclarationNameInfo DirName; - getDerived().getSema().StartOpenMPDSABlock(OMPD_target_parallel_for_simd, - DirName, nullptr, - D->getLocStart()); + getDerived().getSema().StartOpenMPDSABlock( + OMPD_target_parallel_for_simd, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8124,7 +8117,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 +8128,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 +8139,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 +8150,8 @@ 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; @@ -8167,8 +8161,8 @@ StmtResult TreeTransform::TransformOMPTeamsDistributeParallelForDirective( OMPTeamsDistributeParallelForDirective *D) { DeclarationNameInfo DirName; - getDerived().getSema().StartOpenMPDSABlock(OMPD_teams_distribute_parallel_for, - DirName, nullptr, D->getLocStart()); + getDerived().getSema().StartOpenMPDSABlock( + OMPD_teams_distribute_parallel_for, DirName, nullptr, D->getBeginLoc()); StmtResult Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8179,7 +8173,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; @@ -8189,8 +8183,8 @@ StmtResult TreeTransform::TransformOMPTargetTeamsDistributeDirective( OMPTargetTeamsDistributeDirective *D) { DeclarationNameInfo DirName; - getDerived().getSema().StartOpenMPDSABlock(OMPD_target_teams_distribute, - DirName, nullptr, D->getLocStart()); + getDerived().getSema().StartOpenMPDSABlock( + OMPD_target_teams_distribute, DirName, nullptr, D->getBeginLoc()); auto Res = getDerived().TransformOMPExecutableDirective(D); getDerived().getSema().EndOpenMPDSABlock(Res.get()); return Res; @@ -8203,7 +8197,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 +8210,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 +8222,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 +8238,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 +8247,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 +8258,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 +8268,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 +8278,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 +8288,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 +8303,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 +8315,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 +8329,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 +8419,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 +8434,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 +8449,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 +8463,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 +8510,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 +8555,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 +8600,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 +8619,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 +8638,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 +8653,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 +8669,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 +8682,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 +8699,7 @@ } return getDerived().RebuildOMPDependClause( C->getDependencyKind(), C->getDependencyLoc(), C->getColonLoc(), Vars, - C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + C->getBeginLoc(), C->getLParenLoc(), C->getLocEnd()); } template @@ -8714,8 +8708,8 @@ ExprResult E = getDerived().TransformExpr(C->getDevice()); if (E.isInvalid()) return nullptr; - return getDerived().RebuildOMPDeviceClause( - E.get(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd()); + return getDerived().RebuildOMPDeviceClause(E.get(), C->getBeginLoc(), + C->getLParenLoc(), C->getLocEnd()); } template @@ -8730,7 +8724,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 +8735,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 +8745,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 +8755,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 +8765,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 +8775,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 +8783,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 +8794,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 +8814,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 +8828,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 +8844,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 +8859,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 +8967,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); } @@ -9227,10 +9221,9 @@ RHS.get() == E->getRHS()) return E; - return getDerived().RebuildArraySubscriptExpr(LHS.get(), - /*FIXME:*/E->getLHS()->getLocStart(), - RHS.get(), - E->getRBracketLoc()); + return getDerived().RebuildArraySubscriptExpr( + LHS.get(), + /*FIXME:*/ E->getLHS()->getBeginLoc(), RHS.get(), E->getRBracketLoc()); } template @@ -9676,7 +9669,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? @@ -10008,10 +10001,8 @@ TInfo == E->getTypeOperandSourceInfo()) return E; - return getDerived().RebuildCXXTypeidExpr(E->getType(), - E->getLocStart(), - TInfo, - E->getLocEnd()); + return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(), + TInfo, E->getLocEnd()); } // We don't know whether the subexpression is potentially evaluated until @@ -10030,10 +10021,8 @@ SubExpr.get() == E->getExprOperand()) return E; - return getDerived().RebuildCXXTypeidExpr(E->getType(), - E->getLocStart(), - SubExpr.get(), - E->getLocEnd()); + return getDerived().RebuildCXXTypeidExpr(E->getType(), E->getBeginLoc(), + SubExpr.get(), E->getLocEnd()); } template @@ -10049,10 +10038,8 @@ TInfo == E->getTypeOperandSourceInfo()) return E; - return getDerived().RebuildCXXUuidofExpr(E->getType(), - E->getLocStart(), - TInfo, - E->getLocEnd()); + return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(), + TInfo, E->getLocEnd()); } EnterExpressionEvaluationContext Unevaluated( @@ -10066,10 +10053,8 @@ SubExpr.get() == E->getExprOperand()) return E; - return getDerived().RebuildCXXUuidofExpr(E->getType(), - E->getLocStart(), - SubExpr.get(), - E->getLocEnd()); + return getDerived().RebuildCXXUuidofExpr(E->getType(), E->getBeginLoc(), + SubExpr.get(), E->getLocEnd()); } template @@ -10092,11 +10077,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 @@ -10117,9 +10102,8 @@ template ExprResult TreeTransform::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) { - ParmVarDecl *Param - = cast_or_null(getDerived().TransformDecl(E->getLocStart(), - E->getParam())); + ParmVarDecl *Param = cast_or_null( + getDerived().TransformDecl(E->getBeginLoc(), E->getParam())); if (!Param) return ExprError(); @@ -10133,9 +10117,8 @@ template ExprResult TreeTransform::TransformCXXDefaultInitExpr(CXXDefaultInitExpr *E) { - FieldDecl *Field - = cast_or_null(getDerived().TransformDecl(E->getLocStart(), - E->getField())); + FieldDecl *Field = cast_or_null( + getDerived().TransformDecl(E->getBeginLoc(), E->getField())); if (!Field) return ExprError(); @@ -10196,8 +10179,7 @@ FunctionDecl *OperatorNew = nullptr; if (E->getOperatorNew()) { OperatorNew = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), - E->getOperatorNew())); + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorNew())); if (!OperatorNew) return ExprError(); } @@ -10205,8 +10187,7 @@ FunctionDecl *OperatorDelete = nullptr; if (E->getOperatorDelete()) { OperatorDelete = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), - E->getOperatorDelete())); + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete())); if (!OperatorDelete) return ExprError(); } @@ -10221,9 +10202,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 +10212,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 +10234,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,17 +10245,11 @@ } } - return getDerived().RebuildCXXNewExpr(E->getLocStart(), - E->isGlobalNew(), - /*FIXME:*/E->getLocStart(), - PlacementArgs, - /*FIXME:*/E->getLocStart(), - E->getTypeIdParens(), - AllocType, - AllocTypeInfo, - ArraySize.get(), - E->getDirectInitRange(), - NewInit.get()); + return getDerived().RebuildCXXNewExpr( + E->getBeginLoc(), E->isGlobalNew(), + /*FIXME:*/ E->getBeginLoc(), PlacementArgs, + /*FIXME:*/ E->getBeginLoc(), E->getTypeIdParens(), AllocType, + AllocTypeInfo, ArraySize.get(), E->getDirectInitRange(), NewInit.get()); } template @@ -10288,8 +10263,7 @@ FunctionDecl *OperatorDelete = nullptr; if (E->getOperatorDelete()) { OperatorDelete = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), - E->getOperatorDelete())); + getDerived().TransformDecl(E->getBeginLoc(), E->getOperatorDelete())); if (!OperatorDelete) return ExprError(); } @@ -10300,14 +10274,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,10 +10289,8 @@ return E; } - return getDerived().RebuildCXXDeleteExpr(E->getLocStart(), - E->isGlobalDelete(), - E->isArrayForm(), - Operand.get()); + return getDerived().RebuildCXXDeleteExpr( + E->getBeginLoc(), E->isGlobalDelete(), E->isArrayForm(), Operand.get()); } template @@ -10651,9 +10623,7 @@ if (!getDerived().AlwaysRebuild() && !ArgChanged) return E; - return getDerived().RebuildTypeTrait(E->getTrait(), - E->getLocStart(), - Args, + return getDerived().RebuildTypeTrait(E->getTrait(), E->getBeginLoc(), Args, E->getLocEnd()); } @@ -10680,11 +10650,8 @@ return E; } - return getDerived().RebuildArrayTypeTrait(E->getTrait(), - E->getLocStart(), - T, - SubExpr.get(), - E->getLocEnd()); + return getDerived().RebuildArrayTypeTrait(E->getTrait(), E->getBeginLoc(), T, + SubExpr.get(), E->getLocEnd()); } template @@ -10702,8 +10669,8 @@ return E; } - return getDerived().RebuildExpressionTrait( - E->getTrait(), E->getLocStart(), SubExpr.get(), E->getLocEnd()); + return getDerived().RebuildExpressionTrait(E->getTrait(), E->getBeginLoc(), + SubExpr.get(), E->getLocEnd()); } template @@ -10789,16 +10756,14 @@ !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()) return ExprError(); - CXXConstructorDecl *Constructor - = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), - E->getConstructor())); + CXXConstructorDecl *Constructor = cast_or_null( + getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor())); if (!Constructor) return ExprError(); @@ -10814,19 +10779,15 @@ !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(), - Constructor, - E->isElidable(), Args, - E->hadMultipleCandidates(), - E->isListInitialization(), - E->isStdInitListInitialization(), - E->requiresZeroInitialization(), - E->getConstructionKind(), - E->getParenOrBraceRange()); + return getDerived().RebuildCXXConstructExpr( + T, /*FIXME:*/ E->getBeginLoc(), Constructor, E->isElidable(), Args, + E->hadMultipleCandidates(), E->isListInitialization(), + E->isStdInitListInitialization(), E->requiresZeroInitialization(), + E->getConstructionKind(), E->getParenOrBraceRange()); } template @@ -10837,7 +10798,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 +10807,7 @@ Constructor == E->getConstructor()) { // Mark the constructor as referenced. // FIXME: Instantiation-specific - SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor); return E; } @@ -10885,10 +10846,8 @@ if (!T) return ExprError(); - CXXConstructorDecl *Constructor - = cast_or_null( - getDerived().TransformDecl(E->getLocStart(), - E->getConstructor())); + CXXConstructorDecl *Constructor = cast_or_null( + getDerived().TransformDecl(E->getBeginLoc(), E->getConstructor())); if (!Constructor) return ExprError(); @@ -10904,7 +10863,7 @@ Constructor == E->getConstructor() && !ArgumentChanged) { // FIXME: Instantiation-specific - SemaRef.MarkFunctionReferenced(E->getLocStart(), Constructor); + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), Constructor); return SemaRef.MaybeBindToTemporary(E); } @@ -11160,7 +11119,7 @@ if (Body.isInvalid()) { SavedContext.pop(); - getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/nullptr, + getSema().ActOnLambdaError(E->getBeginLoc(), /*CurScope=*/nullptr, /*IsInstantiation=*/true); return ExprError(); } @@ -11173,7 +11132,7 @@ /*IsInstantiation*/ true); SavedContext.pop(); - return getSema().BuildLambdaExpr(E->getLocStart(), Body.get()->getLocEnd(), + return getSema().BuildLambdaExpr(E->getBeginLoc(), Body.get()->getLocEnd(), &LSICopy); } @@ -11620,7 +11579,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 +11600,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,11 +11616,9 @@ if (Out.get()->containsUnexpandedParameterPack()) { // We still have a pack; retain a pack expansion for this slice. Result = getDerived().RebuildCXXFoldExpr( - E->getLocStart(), - LeftFold ? Result.get() : Out.get(), + E->getBeginLoc(), LeftFold ? Result.get() : Out.get(), E->getOperator(), E->getEllipsisLoc(), - LeftFold ? Out.get() : Result.get(), - E->getLocEnd()); + LeftFold ? Out.get() : Result.get(), E->getLocEnd()); } else if (Result.isUsable()) { // We've got down to a single element; build a binary operator. Result = getDerived().RebuildBinaryOperator( @@ -11685,8 +11642,7 @@ return true; Result = getDerived().RebuildCXXFoldExpr( - E->getLocStart(), Result.get(), - E->getOperator(), E->getEllipsisLoc(), + E->getBeginLoc(), Result.get(), E->getOperator(), E->getEllipsisLoc(), Out.get(), E->getLocEnd()); if (Result.isInvalid()) return true; @@ -11775,13 +11731,11 @@ 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, - Unexpanded, - Expand, RetainExpansion, - NumExpansions)) + if (getDerived().TryExpandParameterPacks(OrigElement.EllipsisLoc, + PatternRange, Unexpanded, Expand, + RetainExpansion, NumExpansions)) return ExprError(); if (!Expand) { @@ -12651,9 +12605,8 @@ if (Op == OO_Subscript) { if (!First->getType()->isOverloadableType() && !Second->getType()->isOverloadableType()) - return getSema().CreateBuiltinArraySubscriptExpr(First, - Callee->getLocStart(), - Second, OpLoc); + return getSema().CreateBuiltinArraySubscriptExpr( + First, Callee->getBeginLoc(), Second, OpLoc); } else if (Op == OO_Arrow) { // -> is never a builtin operation. return SemaRef.BuildOverloadedArrowExpr(nullptr, First, OpLoc); @@ -12727,8 +12680,8 @@ RBrace = SourceLocation::getFromRawEncoding( NameLoc.CXXOperatorName.EndOpNameLoc); } else { - LBrace = Callee->getLocStart(); - RBrace = OpLoc; + LBrace = Callee->getBeginLoc(); + RBrace = OpLoc; } return SemaRef.CreateOverloadedArraySubscriptExpr(LBrace, RBrace, @@ -12799,7 +12752,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: cfe/trunk/lib/Serialization/ASTReader.cpp =================================================================== --- cfe/trunk/lib/Serialization/ASTReader.cpp +++ cfe/trunk/lib/Serialization/ASTReader.cpp @@ -9693,7 +9693,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()); }; @@ -10195,10 +10195,10 @@ 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(), - SecondExpr->getSourceRange(), StaticAssertCondition); + ODRDiagNote(SecondExpr->getBeginLoc(), SecondExpr->getSourceRange(), + StaticAssertCondition); Diagnosed = true; break; } @@ -10210,17 +10210,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) @@ -10233,9 +10233,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: cfe/trunk/lib/Serialization/ASTWriter.cpp =================================================================== --- cfe/trunk/lib/Serialization/ASTWriter.cpp +++ cfe/trunk/lib/Serialization/ASTWriter.cpp @@ -5255,7 +5255,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: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp =================================================================== --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp +++ cfe/trunk/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)); } @@ -853,7 +853,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: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp =================================================================== --- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/TraversalChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/TraversalChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -682,7 +682,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()); } @@ -730,12 +730,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; @@ -1468,7 +1468,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(); @@ -1480,9 +1480,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() || @@ -2026,7 +2026,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) || @@ -2041,10 +2041,10 @@ bool beginAndEndAreTheSameMacro = StartName.equals(EndName); bool partOfParentMacro = false; - if (ParentEx->getLocStart().isMacroID()) { + if (ParentEx->getBeginLoc().isMacroID()) { StringRef PName = Lexer::getImmediateMacroNameForDiagnostics( - ParentEx->getLocStart(), BRC.getSourceManager(), - BRC.getASTContext().getLangOpts()); + ParentEx->getBeginLoc(), BRC.getSourceManager(), + BRC.getASTContext().getLangOpts()); partOfParentMacro = PName.equals(StartName); } Index: cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -712,7 +712,7 @@ G.reclaimRecentlyAllocatedNodes(); PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - currStmt->getLocStart(), + currStmt->getBeginLoc(), "Error evaluating statement"); // Remove dead bindings and symbols. @@ -739,7 +739,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); @@ -883,7 +883,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); @@ -940,7 +940,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; @@ -1031,7 +1031,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; @@ -1139,8 +1139,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &DstTop) { PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - S->getLocStart(), - "Error evaluating statement"); + S->getBeginLoc(), "Error evaluating statement"); ExplodedNodeSet Dst; StmtNodeBuilder Bldr(Pred, DstTop, *currBldrCtx); @@ -2046,7 +2045,7 @@ Condition = ResolveCondition(Condition, BldCtx.getBlock()); PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(), - Condition->getLocStart(), + Condition->getBeginLoc(), "Error evaluating branch"); ExplodedNodeSet CheckersOutSet; @@ -3041,7 +3040,7 @@ << E.getDst()->getBlockID() << ')'; if (const Stmt *T = E.getSrc()->getTerminator()) { - SourceLocation SLoc = T->getLocStart(); + SourceLocation SLoc = T->getBeginLoc(); Out << "\\|Terminator: "; LangOptions LO; // FIXME. @@ -3103,7 +3102,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: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ cfe/trunk/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: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp @@ -507,15 +507,17 @@ // the leak location even after code is added between the allocation // site and the end of scope (leak report location). if (UPDLoc.isValid()) { - FullSourceLoc UFunL(SM->getExpansionLoc( - D->getUniqueingDecl()->getBody()->getLocStart()), *SM); + FullSourceLoc UFunL( + SM->getExpansionLoc( + 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: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -681,7 +681,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: cfe/trunk/lib/Tooling/Refactoring/Extract/Extract.cpp =================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Extract/Extract.cpp +++ cfe/trunk/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: cfe/trunk/lib/Tooling/Refactoring/Rename/USRFinder.cpp =================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Rename/USRFinder.cpp +++ cfe/trunk/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: cfe/trunk/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp =================================================================== --- cfe/trunk/lib/Tooling/Refactoring/Rename/USRLocFinder.cpp +++ cfe/trunk/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: cfe/trunk/tools/clang-func-mapping/ClangFnMapGen.cpp =================================================================== --- cfe/trunk/tools/clang-func-mapping/ClangFnMapGen.cpp +++ cfe/trunk/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: cfe/trunk/tools/libclang/CIndex.cpp =================================================================== --- cfe/trunk/tools/libclang/CIndex.cpp +++ cfe/trunk/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,12 +1046,12 @@ // 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(); - return L_A != L_B ? - SM.isBeforeInTranslationUnit(L_A, L_B) : - SM.isBeforeInTranslationUnit(A->getLocEnd(), B->getLocEnd()); - }); + 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()); + }); // Now visit the decls. for (SmallVectorImpl::iterator I = DeclsInContainer.begin(), @@ -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), @@ -4342,8 +4342,8 @@ return SizeOfPack->getPackLoc(); if (const ObjCPropertyRefExpr *PropRef = dyn_cast(E)) return PropRef->getLocation(); - - return E->getLocStart(); + + return E->getBeginLoc(); } extern "C" { @@ -5790,9 +5790,9 @@ if (TypeSourceInfo *TSInfo = BaseSpec->getTypeSourceInfo()) return cxloc::translateSourceLocation(getCursorContext(C), TSInfo->getTypeLoc().getBeginLoc()); - + return cxloc::translateSourceLocation(getCursorContext(C), - BaseSpec->getLocStart()); + BaseSpec->getBeginLoc()); } case CXCursor_LabelRef: { @@ -5816,7 +5816,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(); @@ -6016,10 +6016,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() && @@ -7069,9 +7069,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: cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp =================================================================== --- cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp =================================================================== --- cfe/trunk/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/Attr.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/CXXMemberCall.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrder.cpp +++ cfe/trunk/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: cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp =================================================================== --- cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/InitListExprPreOrderNoQueue.cpp +++ cfe/trunk/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; } };