diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 2 | ||||
-rw-r--r-- | lib/AST/Expr.cpp | 24 | ||||
-rw-r--r-- | lib/AST/ExprCXX.cpp | 18 | ||||
-rw-r--r-- | lib/AST/Stmt.cpp | 6 | ||||
-rw-r--r-- | lib/AST/StmtObjC.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/CloneDetection.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/CoverageMappingGen.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 6 |
8 files changed, 33 insertions, 30 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 01fd10429f..18ba3b13b3 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -931,7 +931,7 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() { return this; } -SourceLocation ObjCMethodDecl::getLocEnd() const { +SourceLocation ObjCMethodDecl::getEndLoc() const { if (Stmt *Body = getBody()) return Body->getLocEnd(); return DeclEndLoc; diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 7556c76c38..50cff156d2 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -447,12 +447,12 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(const ASTContext &Context, return new (Mem) DeclRefExpr(EmptyShell()); } -SourceLocation DeclRefExpr::getLocStart() const { +SourceLocation DeclRefExpr::getBeginLoc() const { if (hasQualifier()) return getQualifierLoc().getBeginLoc(); return getNameInfo().getLocStart(); } -SourceLocation DeclRefExpr::getLocEnd() const { +SourceLocation DeclRefExpr::getEndLoc() const { if (hasExplicitTemplateArgs()) return getRAngleLoc(); return getNameInfo().getLocEnd(); @@ -1358,7 +1358,7 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const { return FnType->getReturnType(); } -SourceLocation CallExpr::getLocStart() const { +SourceLocation CallExpr::getBeginLoc() const { if (isa<CXXOperatorCallExpr>(this)) return cast<CXXOperatorCallExpr>(this)->getLocStart(); @@ -1367,7 +1367,7 @@ SourceLocation CallExpr::getLocStart() const { begin = getArg(0)->getLocStart(); return begin; } -SourceLocation CallExpr::getLocEnd() const { +SourceLocation CallExpr::getEndLoc() const { if (isa<CXXOperatorCallExpr>(this)) return cast<CXXOperatorCallExpr>(this)->getLocEnd(); @@ -1529,7 +1529,7 @@ MemberExpr *MemberExpr::Create( return E; } -SourceLocation MemberExpr::getLocStart() const { +SourceLocation MemberExpr::getBeginLoc() const { if (isImplicitAccess()) { if (hasQualifier()) return getQualifierLoc().getBeginLoc(); @@ -1543,7 +1543,7 @@ SourceLocation MemberExpr::getLocStart() const { return BaseStartLoc; return MemberLoc; } -SourceLocation MemberExpr::getLocEnd() const { +SourceLocation MemberExpr::getEndLoc() const { SourceLocation EndLoc = getMemberNameInfo().getEndLoc(); if (hasExplicitTemplateArgs()) EndLoc = getRAngleLoc(); @@ -2039,7 +2039,7 @@ bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions &LangOpts) const return Lit && Lit->getValue() == 0; } -SourceLocation InitListExpr::getLocStart() const { +SourceLocation InitListExpr::getBeginLoc() const { if (InitListExpr *SyntacticForm = getSyntacticForm()) return SyntacticForm->getLocStart(); SourceLocation Beg = LBraceLoc; @@ -2057,7 +2057,7 @@ SourceLocation InitListExpr::getLocStart() const { return Beg; } -SourceLocation InitListExpr::getLocEnd() const { +SourceLocation InitListExpr::getEndLoc() const { if (InitListExpr *SyntacticForm = getSyntacticForm()) return SyntacticForm->getLocEnd(); SourceLocation End = RBraceLoc; @@ -3870,7 +3870,7 @@ SourceRange DesignatedInitExpr::getDesignatorsSourceRange() const { DIE->getDesignator(size()-1)->getLocEnd()); } -SourceLocation DesignatedInitExpr::getLocStart() const { +SourceLocation DesignatedInitExpr::getBeginLoc() const { SourceLocation StartLoc; auto *DIE = const_cast<DesignatedInitExpr *>(this); Designator &First = *DIE->getDesignator(0); @@ -3885,7 +3885,7 @@ SourceLocation DesignatedInitExpr::getLocStart() const { return StartLoc; } -SourceLocation DesignatedInitExpr::getLocEnd() const { +SourceLocation DesignatedInitExpr::getEndLoc() const { return getInit()->getLocEnd(); } @@ -3944,11 +3944,11 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C, BaseAndUpdaterExprs[1] = ILE; } -SourceLocation DesignatedInitUpdateExpr::getLocStart() const { +SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const { return getBase()->getLocStart(); } -SourceLocation DesignatedInitUpdateExpr::getLocEnd() const { +SourceLocation DesignatedInitUpdateExpr::getEndLoc() const { return getBase()->getLocEnd(); } diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 93d68ec8e0..cc4c631553 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -89,7 +89,7 @@ QualType CXXUuidofExpr::getTypeOperand(ASTContext &Context) const { } // CXXScalarValueInitExpr -SourceLocation CXXScalarValueInitExpr::getLocStart() const { +SourceLocation CXXScalarValueInitExpr::getBeginLoc() const { return TypeInfo ? TypeInfo->getTypeLoc().getBeginLoc() : RParenLoc; } @@ -250,7 +250,7 @@ QualType CXXPseudoDestructorExpr::getDestroyedType() const { return QualType(); } -SourceLocation CXXPseudoDestructorExpr::getLocEnd() const { +SourceLocation CXXPseudoDestructorExpr::getEndLoc() const { SourceLocation End = DestroyedType.getLocation(); if (TypeSourceInfo *TInfo = DestroyedType.getTypeSourceInfo()) End = TInfo->getTypeLoc().getLocalSourceRange().getEnd(); @@ -450,13 +450,13 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &C, return E; } -SourceLocation CXXConstructExpr::getLocStart() const { +SourceLocation CXXConstructExpr::getBeginLoc() const { if (isa<CXXTemporaryObjectExpr>(this)) return cast<CXXTemporaryObjectExpr>(this)->getLocStart(); return Loc; } -SourceLocation CXXConstructExpr::getLocEnd() const { +SourceLocation CXXConstructExpr::getEndLoc() const { if (isa<CXXTemporaryObjectExpr>(this)) return cast<CXXTemporaryObjectExpr>(this)->getLocEnd(); @@ -707,11 +707,11 @@ CXXFunctionalCastExpr::CreateEmpty(const ASTContext &C, unsigned PathSize) { return new (Buffer) CXXFunctionalCastExpr(EmptyShell(), PathSize); } -SourceLocation CXXFunctionalCastExpr::getLocStart() const { +SourceLocation CXXFunctionalCastExpr::getBeginLoc() const { return getTypeInfoAsWritten()->getTypeLoc().getLocStart(); } -SourceLocation CXXFunctionalCastExpr::getLocEnd() const { +SourceLocation CXXFunctionalCastExpr::getEndLoc() const { return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getLocEnd(); } @@ -792,11 +792,11 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(const ASTContext &C, CXXConstructExpr::CK_Complete, ParenOrBraceRange), Type(TSI) {} -SourceLocation CXXTemporaryObjectExpr::getLocStart() const { +SourceLocation CXXTemporaryObjectExpr::getBeginLoc() const { return Type->getTypeLoc().getBeginLoc(); } -SourceLocation CXXTemporaryObjectExpr::getLocEnd() const { +SourceLocation CXXTemporaryObjectExpr::getEndLoc() const { SourceLocation Loc = getParenOrBraceRange().getEnd(); if (Loc.isInvalid() && getNumArgs()) Loc = getArg(getNumArgs()-1)->getLocEnd(); @@ -1120,7 +1120,7 @@ CXXUnresolvedConstructExpr::CreateEmpty(const ASTContext &C, unsigned NumArgs) { return new (Mem) CXXUnresolvedConstructExpr(Empty, NumArgs); } -SourceLocation CXXUnresolvedConstructExpr::getLocStart() const { +SourceLocation CXXUnresolvedConstructExpr::getBeginLoc() const { return Type->getTypeLoc().getBeginLoc(); } diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index a041006c90..64a7a19614 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -275,8 +275,8 @@ SourceRange Stmt::getSourceRange() const { llvm_unreachable("unknown statement kind!"); } -SourceLocation Stmt::getLocStart() const { -// llvm::errs() << "getLocStart() for " << getStmtClassName() << "\n"; +SourceLocation Stmt::getBeginLoc() const { + // llvm::errs() << "getBeginLoc() for " << getStmtClassName() << "\n"; switch (getStmtClass()) { case Stmt::NoStmtClass: llvm_unreachable("statement without class"); #define ABSTRACT_STMT(type) @@ -288,7 +288,7 @@ SourceLocation Stmt::getLocStart() const { llvm_unreachable("unknown statement kind"); } -SourceLocation Stmt::getLocEnd() const { +SourceLocation Stmt::getEndLoc() const { switch (getStmtClass()) { case Stmt::NoStmtClass: llvm_unreachable("statement without class"); #define ABSTRACT_STMT(type) diff --git a/lib/AST/StmtObjC.cpp b/lib/AST/StmtObjC.cpp index eea03f64c2..cc4b2308a0 100644 --- a/lib/AST/StmtObjC.cpp +++ b/lib/AST/StmtObjC.cpp @@ -64,7 +64,7 @@ ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(const ASTContext &Context, return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally); } -SourceLocation ObjCAtTryStmt::getLocEnd() const { +SourceLocation ObjCAtTryStmt::getEndLoc() const { if (HasFinally) return getFinallyStmt()->getLocEnd(); if (NumCatchStmts) diff --git a/lib/Analysis/CloneDetection.cpp b/lib/Analysis/CloneDetection.cpp index 8912b3b767..c0b9b5c082 100644 --- a/lib/Analysis/CloneDetection.cpp +++ b/lib/Analysis/CloneDetection.cpp @@ -77,7 +77,7 @@ ASTContext &StmtSequence::getASTContext() const { return D->getASTContext(); } -SourceLocation StmtSequence::getStartLoc() const { +SourceLocation StmtSequence::getBeginLoc() const { return front()->getLocStart(); } diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 2d84464635..389d29e467 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -67,7 +67,8 @@ public: void setStartLoc(SourceLocation Loc) { LocStart = Loc; } - SourceLocation getStartLoc() const { + SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); } + SourceLocation getBeginLoc() const { assert(LocStart && "Region has no start location"); return *LocStart; } diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 93dbeab5b0..718a5e1cce 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -6121,11 +6121,13 @@ class FormatStringLiteral { StartToken, StartTokenByteOffset); } - SourceLocation getLocStart() const LLVM_READONLY { + SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); } + SourceLocation getBeginLoc() const LLVM_READONLY { return FExpr->getLocStart().getLocWithOffset(Offset); } - SourceLocation getLocEnd() const LLVM_READONLY { return FExpr->getLocEnd(); } + SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); } + SourceLocation getEndLoc() const LLVM_READONLY { return FExpr->getLocEnd(); } }; } // namespace |