зеркало из https://github.com/microsoft/clang-1.git
[AST] Define a few more key getLocStart() implementations.
- This cuts the # of getSourceRange calls by 60% on OGF/NSBezierPath-OAExtensions.m. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
90e25a8b2c
Коммит
8fbc6d23d6
|
@ -633,6 +633,9 @@ public:
|
||||||
SourceLocation getOuterLocStart() const;
|
SourceLocation getOuterLocStart() const;
|
||||||
|
|
||||||
virtual SourceRange getSourceRange() const;
|
virtual SourceRange getSourceRange() const;
|
||||||
|
SourceLocation getLocStart() const {
|
||||||
|
return getOuterLocStart();
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Retrieve the nested-name-specifier that qualifies the name of this
|
/// \brief Retrieve the nested-name-specifier that qualifies the name of this
|
||||||
/// declaration, if it was present in the source.
|
/// declaration, if it was present in the source.
|
||||||
|
|
|
@ -2127,6 +2127,8 @@ public:
|
||||||
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
|
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
|
||||||
|
|
||||||
SourceRange getSourceRange() const;
|
SourceRange getSourceRange() const;
|
||||||
|
SourceLocation getLocStart() const;
|
||||||
|
SourceLocation getLocEnd() const;
|
||||||
|
|
||||||
static bool classof(const Stmt *T) {
|
static bool classof(const Stmt *T) {
|
||||||
return T->getStmtClass() >= firstCallExprConstant &&
|
return T->getStmtClass() >= firstCallExprConstant &&
|
||||||
|
|
|
@ -905,6 +905,24 @@ SourceRange CallExpr::getSourceRange() const {
|
||||||
end = getArg(getNumArgs() - 1)->getLocEnd();
|
end = getArg(getNumArgs() - 1)->getLocEnd();
|
||||||
return SourceRange(begin, end);
|
return SourceRange(begin, end);
|
||||||
}
|
}
|
||||||
|
SourceLocation CallExpr::getLocStart() const {
|
||||||
|
if (isa<CXXOperatorCallExpr>(this))
|
||||||
|
return cast<CXXOperatorCallExpr>(this)->getSourceRange().getBegin();
|
||||||
|
|
||||||
|
SourceLocation begin = getCallee()->getLocStart();
|
||||||
|
if (begin.isInvalid() && getNumArgs() > 0)
|
||||||
|
begin = getArg(0)->getLocStart();
|
||||||
|
return begin;
|
||||||
|
}
|
||||||
|
SourceLocation CallExpr::getLocEnd() const {
|
||||||
|
if (isa<CXXOperatorCallExpr>(this))
|
||||||
|
return cast<CXXOperatorCallExpr>(this)->getSourceRange().getEnd();
|
||||||
|
|
||||||
|
SourceLocation end = getRParenLoc();
|
||||||
|
if (end.isInvalid() && getNumArgs() > 0)
|
||||||
|
end = getArg(getNumArgs() - 1)->getLocEnd();
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
OffsetOfExpr *OffsetOfExpr::Create(ASTContext &C, QualType type,
|
OffsetOfExpr *OffsetOfExpr::Create(ASTContext &C, QualType type,
|
||||||
SourceLocation OperatorLoc,
|
SourceLocation OperatorLoc,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче