diff options
author | Stephen Kelly <steveire@gmail.com> | 2018-08-09 20:05:03 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2018-08-09 20:05:03 +0000 |
commit | 724e9e52a43ec1e63d199c0f87f94acb68b198dd (patch) | |
tree | ceb76bdc12fd256dd947eb4c7e3ba0e1387ffc7b /clang/lib | |
parent | c53078a1e39dd40392913c18f2f5e1f26d582935 (diff) | |
download | bcm5719-llvm-724e9e52a43ec1e63d199c0f87f94acb68b198dd.tar.gz bcm5719-llvm-724e9e52a43ec1e63d199c0f87f94acb68b198dd.zip |
Add getBeginLoc API to replace getLocStart
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50346
llvm-svn: 339372
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 12 | ||||
-rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 10 | ||||
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 3 |
4 files changed, 15 insertions, 14 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 69adcbc0d55..b90953cc2d5 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -447,7 +447,7 @@ 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(); @@ -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(); @@ -1529,7 +1529,7 @@ MemberExpr *MemberExpr::Create( return E; } -SourceLocation MemberExpr::getLocStart() const { +SourceLocation MemberExpr::getBeginLoc() const { if (isImplicitAccess()) { if (hasQualifier()) return getQualifierLoc().getBeginLoc(); @@ -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; @@ -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); @@ -3944,7 +3944,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C, BaseAndUpdaterExprs[1] = ILE; } -SourceLocation DesignatedInitUpdateExpr::getLocStart() const { +SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const { return getBase()->getLocStart(); } diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 93d68ec8e0b..04619dfe704 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/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; } @@ -450,7 +450,7 @@ 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; @@ -707,7 +707,7 @@ 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(); } @@ -792,7 +792,7 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(const ASTContext &C, CXXConstructExpr::CK_Complete, ParenOrBraceRange), Type(TSI) {} -SourceLocation CXXTemporaryObjectExpr::getLocStart() const { +SourceLocation CXXTemporaryObjectExpr::getBeginLoc() const { return Type->getTypeLoc().getBeginLoc(); } @@ -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/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index a041006c905..b1f540d8795 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/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) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 2edc9ca0d7d..88e0a640ea9 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -6121,7 +6121,8 @@ 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); } |