142 changes: 96 additions & 46 deletions clang/include/clang/AST/Expr.h

Large diffs are not rendered by default.

135 changes: 88 additions & 47 deletions clang/include/clang/AST/ExprCXX.h

Large diffs are not rendered by default.

48 changes: 32 additions & 16 deletions clang/include/clang/AST/ExprObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class ObjCStringLiteral : public Expr {
SourceLocation getAtLoc() const { return AtLoc; }
void setAtLoc(SourceLocation L) { AtLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return String->getLocEnd(); }

// Iterators
Expand All @@ -94,7 +95,8 @@ class ObjCBoolLiteralExpr : public Expr {
bool getValue() const { return Value; }
void setValue(bool V) { Value = V; }

SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }

SourceLocation getLocation() const { return Loc; }
Expand Down Expand Up @@ -141,7 +143,8 @@ class ObjCBoxedExpr : public Expr {

SourceLocation getAtLoc() const { return Range.getBegin(); }

SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }

SourceRange getSourceRange() const LLVM_READONLY {
Expand Down Expand Up @@ -194,7 +197,8 @@ class ObjCArrayLiteral final
static ObjCArrayLiteral *CreateEmpty(const ASTContext &C,
unsigned NumElements);

SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }

Expand Down Expand Up @@ -359,7 +363,8 @@ class ObjCDictionaryLiteral final
return DictWithObjectsMethod;
}

SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }

Expand Down Expand Up @@ -412,7 +417,8 @@ class ObjCEncodeExpr : public Expr {
EncodedType = EncType;
}

SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }

// Iterators
Expand Down Expand Up @@ -447,7 +453,8 @@ class ObjCSelectorExpr : public Expr {
void setAtLoc(SourceLocation L) { AtLoc = L; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }

/// getNumArgs - Return the number of actual arguments to this call.
Expand Down Expand Up @@ -496,7 +503,8 @@ class ObjCProtocolExpr : public Expr {
void setAtLoc(SourceLocation L) { AtLoc = L; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }

// Iterators
Expand Down Expand Up @@ -556,7 +564,8 @@ class ObjCIvarRefExpr : public Expr {
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return isFreeIvar() ? Loc : getBase()->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
Expand Down Expand Up @@ -742,7 +751,8 @@ class ObjCPropertyRefExpr : public Expr {
/// Determine the type of the base, regardless of the kind of receiver.
QualType getReceiverType(const ASTContext &ctx) const;

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return isObjectReceiver() ? getBase()->getLocStart() :getReceiverLocation();
}

Expand Down Expand Up @@ -838,7 +848,8 @@ class ObjCSubscriptRefExpr : public Expr {
SourceLocation getRBracket() const { return RBracket; }
void setRBracket(SourceLocation RB) { RBracket = RB; }

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExprs[BASE]->getLocStart();
}

Expand Down Expand Up @@ -1395,7 +1406,8 @@ class ObjCMessageExpr final
RBracLoc = R.getEnd();
}

SourceLocation getLocStart() const LLVM_READONLY { return LBracLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return LBracLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RBracLoc; }

// Iterators
Expand Down Expand Up @@ -1472,7 +1484,8 @@ class ObjCIsaExpr : public Expr {
SourceLocation getOpLoc() const { return OpLoc; }
void setOpLoc(SourceLocation L) { OpLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}

Expand Down Expand Up @@ -1549,7 +1562,8 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
child_range children() { return child_range(&Operand, &Operand+1); }

// Source locations are determined by the subexpression.
SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return Operand->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return Operand->getLocEnd();}
Expand Down Expand Up @@ -1611,7 +1625,8 @@ class ObjCBridgedCastExpr final
/// The location of the bridge keyword.
SourceLocation getBridgeKeywordLoc() const { return BridgeKeywordLoc; }

SourceLocation getLocStart() const LLVM_READONLY { return LParenLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
return getSubExpr()->getLocEnd();
Expand Down Expand Up @@ -1651,7 +1666,8 @@ class ObjCAvailabilityCheckExpr : public Expr {
explicit ObjCAvailabilityCheckExpr(EmptyShell Shell)
: Expr(ObjCAvailabilityCheckExprClass, Shell) {}

SourceLocation getLocStart() const { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const { return AtLoc; }
SourceLocation getLocEnd() const { return RParen; }
SourceRange getSourceRange() const { return {AtLoc, RParen}; }

Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/ExprOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class OMPArraySectionExpr : public Expr {
/// Set length of the array section.
void setLength(Expr *E) { SubExprs[LENGTH] = E; }

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class OMPClause {

public:
/// Returns the starting location of the clause.
SourceLocation getLocStart() const { return StartLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const { return StartLoc; }

/// Returns the ending location of the clause.
SourceLocation getLocEnd() const { return EndLoc; }
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/RawCommentList.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class RawComment {
}

SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }

const char *getBriefText(const ASTContext &Context) const {
Expand Down
81 changes: 54 additions & 27 deletions clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ class alignas(void *) Stmt {
/// value objects created/interpreted by SourceManager. We assume AST
/// clients will have a pointer to the respective SourceManager.
SourceRange getSourceRange() const LLVM_READONLY;
SourceLocation getLocStart() const LLVM_READONLY;
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY;
SourceLocation getLocEnd() const LLVM_READONLY;

// global temp stats (until we have a per-module visitor)
Expand Down Expand Up @@ -527,7 +528,8 @@ class DeclStmt : public Stmt {
SourceLocation getEndLoc() const { return EndLoc; }
void setEndLoc(SourceLocation L) { EndLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return StartLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return StartLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -595,7 +597,8 @@ class NullStmt : public Stmt {

bool hasLeadingEmptyMacro() const { return HasLeadingEmptyMacro; }

SourceLocation getLocStart() const LLVM_READONLY { return SemiLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return SemiLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SemiLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -695,7 +698,8 @@ class CompoundStmt final : public Stmt,
return const_reverse_body_iterator(body_begin());
}

SourceLocation getLocStart() const LLVM_READONLY { return LBraceLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return LBraceLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RBraceLoc; }

SourceLocation getLBracLoc() const { return LBraceLoc; }
Expand Down Expand Up @@ -744,7 +748,8 @@ class SwitchCase : public Stmt {
return const_cast<SwitchCase*>(this)->getSubStmt();
}

SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocEnd() const LLVM_READONLY;

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -797,7 +802,8 @@ class CaseStmt : public SwitchCase {
void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); }
void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); }

SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
// Handle deeply nested case statements with iteration instead of recursion.
Expand Down Expand Up @@ -838,7 +844,8 @@ class DefaultStmt : public SwitchCase {
SourceLocation getColonLoc() const { return ColonLoc; }
void setColonLoc(SourceLocation L) { ColonLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -882,7 +889,8 @@ class LabelStmt : public Stmt {
void setIdentLoc(SourceLocation L) { IdentLoc = L; }
void setSubStmt(Stmt *SS) { SubStmt = SS; }

SourceLocation getLocStart() const LLVM_READONLY { return IdentLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return IdentLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}

child_range children() { return child_range(&SubStmt, &SubStmt+1); }
Expand Down Expand Up @@ -937,7 +945,8 @@ class AttributedStmt final
Stmt *getSubStmt() { return SubStmt; }
const Stmt *getSubStmt() const { return SubStmt; }

SourceLocation getLocStart() const LLVM_READONLY { return AttrLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AttrLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}

child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
Expand Down Expand Up @@ -1005,7 +1014,8 @@ class IfStmt : public Stmt {

bool isObjCAvailabilityCheck() const;

SourceLocation getLocStart() const LLVM_READONLY { return IfLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return IfLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
if (SubExprs[ELSE])
Expand Down Expand Up @@ -1100,7 +1110,8 @@ class SwitchStmt : public Stmt {
/// have been explicitly covered.
bool isAllEnumCasesCovered() const { return FirstCase.getInt(); }

SourceLocation getLocStart() const LLVM_READONLY { return SwitchLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return SwitchLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
Expand Down Expand Up @@ -1156,7 +1167,8 @@ class WhileStmt : public Stmt {
SourceLocation getWhileLoc() const { return WhileLoc; }
void setWhileLoc(SourceLocation L) { WhileLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return WhileLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return WhileLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
Expand Down Expand Up @@ -1206,7 +1218,8 @@ class DoStmt : public Stmt {
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return DoLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return DoLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1276,7 +1289,8 @@ class ForStmt : public Stmt {
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
Expand Down Expand Up @@ -1313,7 +1327,8 @@ class GotoStmt : public Stmt {
SourceLocation getLabelLoc() const { return LabelLoc; }
void setLabelLoc(SourceLocation L) { LabelLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return LabelLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1358,7 +1373,8 @@ class IndirectGotoStmt : public Stmt {
return const_cast<IndirectGotoStmt*>(this)->getConstantTarget();
}

SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return Target->getLocEnd(); }

static bool classof(const Stmt *T) {
Expand All @@ -1382,7 +1398,8 @@ class ContinueStmt : public Stmt {
SourceLocation getContinueLoc() const { return ContinueLoc; }
void setContinueLoc(SourceLocation L) { ContinueLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return ContinueLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ContinueLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return ContinueLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1411,7 +1428,8 @@ class BreakStmt : public Stmt {
SourceLocation getBreakLoc() const { return BreakLoc; }
void setBreakLoc(SourceLocation L) { BreakLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return BreakLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return BreakLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return BreakLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1462,7 +1480,8 @@ class ReturnStmt : public Stmt {
const VarDecl *getNRVOCandidate() const { return NRVOCandidate; }
void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; }

SourceLocation getLocStart() const LLVM_READONLY { return RetLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return RetLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
return RetExpr ? RetExpr->getLocEnd() : RetLoc;
Expand Down Expand Up @@ -1519,7 +1538,8 @@ class AsmStmt : public Stmt {
bool isVolatile() const { return IsVolatile; }
void setVolatile(bool V) { IsVolatile = V; }

SourceLocation getLocStart() const LLVM_READONLY { return {}; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return {}; }
SourceLocation getLocEnd() const LLVM_READONLY { return {}; }

//===--- Asm String Analysis ---===//
Expand Down Expand Up @@ -1801,7 +1821,8 @@ class GCCAsmStmt : public AsmStmt {
return Clobbers[i];
}

SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1899,7 +1920,8 @@ class MSAsmStmt : public AsmStmt {
ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);

public:
SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -1929,7 +1951,8 @@ class SEHExceptStmt : public Stmt {
Expr *FilterExpr,
Stmt *Block);

SourceLocation getLocStart() const LLVM_READONLY { return getExceptLoc(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return getExceptLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }

SourceLocation getExceptLoc() const { return Loc; }
Expand Down Expand Up @@ -1967,7 +1990,8 @@ class SEHFinallyStmt : public Stmt {
SourceLocation FinallyLoc,
Stmt *Block);

SourceLocation getLocStart() const LLVM_READONLY { return getFinallyLoc(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return getFinallyLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }

SourceLocation getFinallyLoc() const { return Loc; }
Expand Down Expand Up @@ -2006,7 +2030,8 @@ class SEHTryStmt : public Stmt {
SourceLocation TryLoc, Stmt *TryBlock,
Stmt *Handler);

SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }

SourceLocation getTryLoc() const { return TryLoc; }
Expand Down Expand Up @@ -2047,7 +2072,8 @@ class SEHLeaveStmt : public Stmt {
SourceLocation getLeaveLoc() const { return LeaveLoc; }
void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }

SourceLocation getLocStart() const LLVM_READONLY { return LeaveLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return LeaveLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return LeaveLoc; }

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -2261,7 +2287,8 @@ class CapturedStmt : public Stmt {
return capture_init_begin() + NumCaptures;
}

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getCapturedStmt()->getLocStart();
}

Expand Down
18 changes: 12 additions & 6 deletions clang/include/clang/AST/StmtCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class CXXCatchStmt : public Stmt {
CXXCatchStmt(EmptyShell Empty)
: Stmt(CXXCatchStmtClass), ExceptionDecl(nullptr), HandlerBlock(nullptr) {}

SourceLocation getLocStart() const LLVM_READONLY { return CatchLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return CatchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return HandlerBlock->getLocEnd();
}
Expand Down Expand Up @@ -86,7 +87,8 @@ class CXXTryStmt final : public Stmt,
static CXXTryStmt *Create(const ASTContext &C, EmptyShell Empty,
unsigned numHandlers);

SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }

SourceLocation getTryLoc() const { return TryLoc; }
Expand Down Expand Up @@ -194,7 +196,8 @@ class CXXForRangeStmt : public Stmt {
SourceLocation getColonLoc() const { return ColonLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }

SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
Expand Down Expand Up @@ -280,7 +283,8 @@ class MSDependentExistsStmt : public Stmt {
return reinterpret_cast<CompoundStmt *>(SubStmt);
}

SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}

child_range children() {
Expand Down Expand Up @@ -399,7 +403,8 @@ class CoroutineBodyStmt final
return {getStoredStmts() + SubStmt::FirstParamMove, NumParams};
}

SourceLocation getLocStart() const LLVM_READONLY {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBody() ? getBody()->getLocStart()
: getPromiseDecl()->getLocStart();
}
Expand Down Expand Up @@ -464,7 +469,8 @@ class CoreturnStmt : public Stmt {
bool isImplicit() const { return IsImplicit; }
void setIsImplicit(bool value = true) { IsImplicit = value; }

SourceLocation getLocStart() const LLVM_READONLY { return CoreturnLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return getOperand() ? getOperand()->getLocEnd() : getLocStart();
}
Expand Down
21 changes: 14 additions & 7 deletions clang/include/clang/AST/StmtObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class ObjCForCollectionStmt : public Stmt {
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }

SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
Expand Down Expand Up @@ -104,7 +105,8 @@ class ObjCAtCatchStmt : public Stmt {
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }

SourceLocation getLocStart() const LLVM_READONLY { return AtCatchLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtCatchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return Body->getLocEnd(); }

bool hasEllipsis() const { return getCatchParamDecl() == nullptr; }
Expand Down Expand Up @@ -133,7 +135,8 @@ class ObjCAtFinallyStmt : public Stmt {
Stmt *getFinallyBody() { return AtFinallyStmt; }
void setFinallyBody(Stmt *S) { AtFinallyStmt = S; }

SourceLocation getLocStart() const LLVM_READONLY { return AtFinallyLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtFinallyLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return AtFinallyStmt->getLocEnd();
}
Expand Down Expand Up @@ -238,7 +241,8 @@ class ObjCAtTryStmt : public Stmt {
getStmts()[1 + NumCatchStmts] = S;
}

SourceLocation getLocStart() const LLVM_READONLY { return AtTryLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtTryLoc; }
SourceLocation getLocEnd() const LLVM_READONLY;

static bool classof(const Stmt *T) {
Expand Down Expand Up @@ -295,7 +299,8 @@ class ObjCAtSynchronizedStmt : public Stmt {
}
void setSynchExpr(Stmt *S) { SubStmts[SYNC_EXPR] = S; }

SourceLocation getLocStart() const LLVM_READONLY { return AtSynchronizedLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtSynchronizedLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return getSynchBody()->getLocEnd();
}
Expand Down Expand Up @@ -329,7 +334,8 @@ class ObjCAtThrowStmt : public Stmt {
SourceLocation getThrowLoc() const LLVM_READONLY { return AtThrowLoc; }
void setThrowLoc(SourceLocation Loc) { AtThrowLoc = Loc; }

SourceLocation getLocStart() const LLVM_READONLY { return AtThrowLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtThrowLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
return Throw ? Throw->getLocEnd() : AtThrowLoc;
}
Expand Down Expand Up @@ -357,7 +363,8 @@ class ObjCAutoreleasePoolStmt : public Stmt {
Stmt *getSubStmt() { return SubStmt; }
void setSubStmt(Stmt *S) { SubStmt = S; }

SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}

SourceLocation getAtLoc() const { return AtLoc; }
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/AST/StmtOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class OMPExecutableDirective : public Stmt {
}

/// Returns starting location of directive kind.
SourceLocation getLocStart() const { return StartLoc; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const { return StartLoc; }
/// Returns ending location of directive.
SourceLocation getLocEnd() const { return EndLoc; }

Expand Down
9 changes: 6 additions & 3 deletions clang/include/clang/Sema/DeclSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ class DeclSpec {
const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; }

SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }

SourceLocation getTypeSpecWidthLoc() const { return TSWRange.getBegin(); }
Expand Down Expand Up @@ -1120,7 +1121,8 @@ class UnqualifiedId {
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(StartLocation, EndLocation);
}
SourceLocation getLocStart() const LLVM_READONLY { return StartLocation; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return StartLocation; }
SourceLocation getLocEnd() const LLVM_READONLY { return EndLocation; }
};

Expand Down Expand Up @@ -1870,7 +1872,8 @@ class Declarator {

/// Get the source range that spans this declarator.
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }

void SetSourceRange(SourceRange R) { Range = R; }
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -1529,7 +1529,7 @@ MemberExpr *MemberExpr::Create(
return E;
}

SourceLocation MemberExpr::getLocStart() const {
SourceLocation MemberExpr::getBeginLoc() const {
if (isImplicitAccess()) {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -3944,7 +3944,7 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
BaseAndUpdaterExprs[1] = ILE;
}

SourceLocation DesignatedInitUpdateExpr::getLocStart() const {
SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const {
return getBase()->getLocStart();
}

Expand Down
10 changes: 5 additions & 5 deletions clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/Stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down