Skip to content

Commit fb437b0

Browse files
committed
Optimize another getBeginLoc
1 parent 16077ed commit fb437b0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,13 @@ class DeclRefExpr final
13441344

13451345
SourceLocation getLocation() const { return DeclRefExprBits.Loc; }
13461346
void setLocation(SourceLocation L) { DeclRefExprBits.Loc = L; }
1347-
SourceLocation getBeginLoc() const LLVM_READONLY;
1347+
1348+
SourceLocation getBeginLoc() const {
1349+
if (hasQualifier())
1350+
return getQualifierLoc().getBeginLoc();
1351+
return DeclRefExprBits.Loc;
1352+
}
1353+
13481354
SourceLocation getEndLoc() const LLVM_READONLY;
13491355

13501356
/// Determine whether this declaration reference was preceded by a

clang/lib/AST/Expr.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,6 @@ void DeclRefExpr::setDecl(ValueDecl *NewD) {
547547
setDependence(computeDependence(this, NewD->getASTContext()));
548548
}
549549

550-
SourceLocation DeclRefExpr::getBeginLoc() const {
551-
if (hasQualifier())
552-
return getQualifierLoc().getBeginLoc();
553-
return getNameInfo().getBeginLoc();
554-
}
555550
SourceLocation DeclRefExpr::getEndLoc() const {
556551
if (hasExplicitTemplateArgs())
557552
return getRAngleLoc();

0 commit comments

Comments
 (0)