140 changes: 94 additions & 46 deletions clang/include/clang/AST/Expr.h

Large diffs are not rendered by default.

134 changes: 90 additions & 44 deletions clang/include/clang/AST/ExprCXX.h

Large diffs are not rendered by default.

50 changes: 34 additions & 16 deletions clang/include/clang/AST/ExprObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class ObjCStringLiteral : public Expr {

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

// Iterators
child_range children() { return child_range(&String, &String+1); }
Expand Down Expand Up @@ -97,7 +98,8 @@ class ObjCBoolLiteralExpr : public Expr {

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

SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
Expand Down Expand Up @@ -145,7 +147,8 @@ class ObjCBoxedExpr : public Expr {

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

SourceRange getSourceRange() const LLVM_READONLY {
return Range;
Expand Down Expand Up @@ -199,7 +202,8 @@ class ObjCArrayLiteral final

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

/// Retrieve elements of array of literals.
Expand Down Expand Up @@ -365,7 +369,8 @@ class ObjCDictionaryLiteral final

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

// Iterators
Expand Down Expand Up @@ -419,7 +424,8 @@ class ObjCEncodeExpr : public Expr {

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

// Iterators
child_range children() {
Expand Down Expand Up @@ -455,7 +461,8 @@ class ObjCSelectorExpr : public Expr {

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

/// getNumArgs - Return the number of actual arguments to this call.
unsigned getNumArgs() const { return SelName.getNumArgs(); }
Expand Down Expand Up @@ -505,7 +512,8 @@ class ObjCProtocolExpr : public Expr {

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

// Iterators
child_range children() {
Expand Down Expand Up @@ -568,7 +576,8 @@ class ObjCIvarRefExpr : public Expr {
SourceLocation getBeginLoc() const LLVM_READONLY {
return isFreeIvar() ? Loc : getBase()->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }

SourceLocation getOpLoc() const { return OpLoc; }
void setOpLoc(SourceLocation L) { OpLoc = L; }
Expand Down Expand Up @@ -756,7 +765,8 @@ class ObjCPropertyRefExpr : public Expr {
return isObjectReceiver() ? getBase()->getLocStart() :getReceiverLocation();
}

SourceLocation getLocEnd() const LLVM_READONLY { return IdLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return IdLoc; }

// Iterators
child_range children() {
Expand Down Expand Up @@ -853,7 +863,8 @@ class ObjCSubscriptRefExpr : public Expr {
return SubExprs[BASE]->getLocStart();
}

SourceLocation getLocEnd() const LLVM_READONLY { return RBracket; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return RBracket; }

Expr *getBaseExpr() const { return cast<Expr>(SubExprs[BASE]); }
void setBaseExpr(Stmt *S) { SubExprs[BASE] = S; }
Expand Down Expand Up @@ -1408,7 +1419,8 @@ class ObjCMessageExpr final

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

// Iterators
child_range children();
Expand Down Expand Up @@ -1493,7 +1505,8 @@ class ObjCIsaExpr : public Expr {
return getBase()->getLocEnd();
}

SourceLocation getLocEnd() const LLVM_READONLY { return IsaMemberLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return IsaMemberLoc; }

SourceLocation getExprLoc() const LLVM_READONLY { return IsaMemberLoc; }

Expand Down Expand Up @@ -1566,7 +1579,10 @@ class ObjCIndirectCopyRestoreExpr : public Expr {
SourceLocation getBeginLoc() const LLVM_READONLY {
return Operand->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return Operand->getLocEnd();}
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return Operand->getLocEnd();
}

SourceLocation getExprLoc() const LLVM_READONLY {
return getSubExpr()->getExprLoc();
Expand Down Expand Up @@ -1628,7 +1644,8 @@ class ObjCBridgedCastExpr final
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getSubExpr()->getLocEnd();
}

Expand Down Expand Up @@ -1668,7 +1685,8 @@ class ObjCAvailabilityCheckExpr : public Expr {

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

/// This may be '*', in which case this should fold to true.
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 @@ -105,7 +105,8 @@ class OMPArraySectionExpr : public Expr {
SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }

SourceLocation getColonLoc() const { return ColonLoc; }
void setColonLoc(SourceLocation L) { ColonLoc = L; }
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 @@ -68,7 +68,8 @@ class OMPClause {
SourceLocation getBeginLoc() const { return StartLoc; }

/// Returns the ending location of the clause.
SourceLocation getLocEnd() const { return EndLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const { return EndLoc; }

/// Sets the starting location of the clause.
void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
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 @@ -103,7 +103,8 @@ class RawComment {
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }

const char *getBriefText(const ASTContext &Context) const {
if (BriefTextValid)
Expand Down
76 changes: 52 additions & 24 deletions clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ class alignas(void *) Stmt {
SourceRange getSourceRange() const LLVM_READONLY;
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY;
SourceLocation getLocEnd() const LLVM_READONLY;
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY;

// global temp stats (until we have a per-module visitor)
static void addStmtClass(const StmtClass s);
Expand Down Expand Up @@ -599,7 +600,8 @@ class NullStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == NullStmtClass;
Expand Down Expand Up @@ -700,7 +702,8 @@ class CompoundStmt final : public Stmt,

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

SourceLocation getLBracLoc() const { return LBraceLoc; }
SourceLocation getRBracLoc() const { return RBraceLoc; }
Expand Down Expand Up @@ -750,7 +753,8 @@ class SwitchCase : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == CaseStmtClass ||
Expand Down Expand Up @@ -805,7 +809,8 @@ class CaseStmt : public SwitchCase {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
// Handle deeply nested case statements with iteration instead of recursion.
const CaseStmt *CS = this;
while (const auto *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
Expand Down Expand Up @@ -846,7 +851,10 @@ class DefaultStmt : public SwitchCase {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == DefaultStmtClass;
Expand All @@ -856,7 +864,7 @@ class DefaultStmt : public SwitchCase {
child_range children() { return child_range(&SubStmt, &SubStmt+1); }
};

inline SourceLocation SwitchCase::getLocEnd() const {
inline SourceLocation SwitchCase::getEndLoc() const {
if (const auto *CS = dyn_cast<CaseStmt>(this))
return CS->getLocEnd();
return cast<DefaultStmt>(this)->getLocEnd();
Expand Down Expand Up @@ -891,7 +899,10 @@ class LabelStmt : public Stmt {

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

child_range children() { return child_range(&SubStmt, &SubStmt+1); }

Expand Down Expand Up @@ -947,7 +958,10 @@ class AttributedStmt final

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

child_range children() { return child_range(&SubStmt, &SubStmt + 1); }

Expand Down Expand Up @@ -1017,7 +1031,8 @@ class IfStmt : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return IfLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
if (SubExprs[ELSE])
return SubExprs[ELSE]->getLocEnd();
else
Expand Down Expand Up @@ -1113,7 +1128,8 @@ class SwitchStmt : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return SwitchLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
}

Expand Down Expand Up @@ -1170,7 +1186,8 @@ class WhileStmt : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return WhileLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}

Expand Down Expand Up @@ -1220,7 +1237,8 @@ class DoStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == DoStmtClass;
Expand Down Expand Up @@ -1292,7 +1310,8 @@ class ForStmt : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}

Expand Down Expand Up @@ -1329,7 +1348,8 @@ class GotoStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == GotoStmtClass;
Expand Down Expand Up @@ -1375,7 +1395,8 @@ class IndirectGotoStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == IndirectGotoStmtClass;
Expand All @@ -1400,7 +1421,8 @@ class ContinueStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == ContinueStmtClass;
Expand Down Expand Up @@ -1430,7 +1452,8 @@ class BreakStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == BreakStmtClass;
Expand Down Expand Up @@ -1483,7 +1506,8 @@ class ReturnStmt : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return RetLoc; }

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return RetExpr ? RetExpr->getLocEnd() : RetLoc;
}

Expand Down Expand Up @@ -1540,7 +1564,8 @@ class AsmStmt : public Stmt {

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

//===--- Asm String Analysis ---===//

Expand Down Expand Up @@ -1823,7 +1848,8 @@ class GCCAsmStmt : public AsmStmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == GCCAsmStmtClass;
Expand Down Expand Up @@ -1922,7 +1948,7 @@ class MSAsmStmt : public AsmStmt {
public:
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }

static bool classof(const Stmt *T) {
return T->getStmtClass() == MSAsmStmtClass;
Expand Down Expand Up @@ -2074,7 +2100,8 @@ class SEHLeaveStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == SEHLeaveStmtClass;
Expand Down Expand Up @@ -2292,7 +2319,8 @@ class CapturedStmt : public Stmt {
return getCapturedStmt()->getLocStart();
}

SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getCapturedStmt()->getLocEnd();
}

Expand Down
17 changes: 12 additions & 5 deletions clang/include/clang/AST/StmtCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class CXXCatchStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return CatchLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return HandlerBlock->getLocEnd();
}

Expand Down Expand Up @@ -198,7 +199,8 @@ class CXXForRangeStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}

Expand Down Expand Up @@ -285,7 +287,10 @@ class MSDependentExistsStmt : public Stmt {

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

child_range children() {
return child_range(&SubStmt, &SubStmt+1);
Expand Down Expand Up @@ -408,7 +413,8 @@ class CoroutineBodyStmt final
return getBody() ? getBody()->getLocStart()
: getPromiseDecl()->getLocStart();
}
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getBody() ? getBody()->getLocEnd() : getPromiseDecl()->getLocEnd();
}

Expand Down Expand Up @@ -471,7 +477,8 @@ class CoreturnStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getOperand() ? getOperand()->getLocEnd() : getLocStart();
}

Expand Down
23 changes: 16 additions & 7 deletions clang/include/clang/AST/StmtObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class ObjCForCollectionStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}

Expand Down Expand Up @@ -107,7 +108,8 @@ class ObjCAtCatchStmt : public Stmt {

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

bool hasEllipsis() const { return getCatchParamDecl() == nullptr; }

Expand Down Expand Up @@ -137,7 +139,8 @@ class ObjCAtFinallyStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtFinallyLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return AtFinallyStmt->getLocEnd();
}

Expand Down Expand Up @@ -243,7 +246,8 @@ class ObjCAtTryStmt : public Stmt {

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

static bool classof(const Stmt *T) {
return T->getStmtClass() == ObjCAtTryStmtClass;
Expand Down Expand Up @@ -301,7 +305,8 @@ class ObjCAtSynchronizedStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtSynchronizedLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return getSynchBody()->getLocEnd();
}

Expand Down Expand Up @@ -336,7 +341,8 @@ class ObjCAtThrowStmt : public Stmt {

SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return AtThrowLoc; }
SourceLocation getLocEnd() const LLVM_READONLY {
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY {
return Throw ? Throw->getLocEnd() : AtThrowLoc;
}

Expand Down Expand Up @@ -365,7 +371,10 @@ class ObjCAutoreleasePoolStmt : public Stmt {

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

SourceLocation getAtLoc() const { return AtLoc; }
void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
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 @@ -168,7 +168,8 @@ class OMPExecutableDirective : public Stmt {
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const { return StartLoc; }
/// Returns ending location of directive.
SourceLocation getLocEnd() const { return EndLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const { return EndLoc; }

/// Set starting location of directive kind.
///
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 @@ -507,7 +507,8 @@ class DeclSpec {
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }

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

/// A set of tokens that has been cached for later parsing.
Expand Down Expand Up @@ -1874,7 +1876,8 @@ class Declarator {
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }

void SetSourceRange(SourceRange R) { Range = R; }
/// SetRangeBegin - Set the start of the source range to Loc, unless it's
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
return this;
}

SourceLocation ObjCMethodDecl::getLocEnd() const {
SourceLocation ObjCMethodDecl::getEndLoc() const {
if (Stmt *Body = getBody())
return Body->getLocEnd();
return DeclEndLoc;
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 @@ -452,7 +452,7 @@ SourceLocation DeclRefExpr::getBeginLoc() const {
return getQualifierLoc().getBeginLoc();
return getNameInfo().getLocStart();
}
SourceLocation DeclRefExpr::getLocEnd() const {
SourceLocation DeclRefExpr::getEndLoc() const {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getNameInfo().getLocEnd();
Expand Down Expand Up @@ -1367,7 +1367,7 @@ SourceLocation CallExpr::getBeginLoc() const {
begin = getArg(0)->getLocStart();
return begin;
}
SourceLocation CallExpr::getLocEnd() const {
SourceLocation CallExpr::getEndLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocEnd();

Expand Down Expand Up @@ -1543,7 +1543,7 @@ SourceLocation MemberExpr::getBeginLoc() const {
return BaseStartLoc;
return MemberLoc;
}
SourceLocation MemberExpr::getLocEnd() const {
SourceLocation MemberExpr::getEndLoc() const {
SourceLocation EndLoc = getMemberNameInfo().getEndLoc();
if (hasExplicitTemplateArgs())
EndLoc = getRAngleLoc();
Expand Down Expand Up @@ -2057,7 +2057,7 @@ SourceLocation InitListExpr::getBeginLoc() const {
return Beg;
}

SourceLocation InitListExpr::getLocEnd() const {
SourceLocation InitListExpr::getEndLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocEnd();
SourceLocation End = RBraceLoc;
Expand Down Expand Up @@ -3885,7 +3885,7 @@ SourceLocation DesignatedInitExpr::getBeginLoc() const {
return StartLoc;
}

SourceLocation DesignatedInitExpr::getLocEnd() const {
SourceLocation DesignatedInitExpr::getEndLoc() const {
return getInit()->getLocEnd();
}

Expand Down Expand Up @@ -3948,7 +3948,7 @@ SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const {
return getBase()->getLocStart();
}

SourceLocation DesignatedInitUpdateExpr::getLocEnd() const {
SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
return getBase()->getLocEnd();
}

Expand Down
8 changes: 4 additions & 4 deletions clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -456,7 +456,7 @@ SourceLocation CXXConstructExpr::getBeginLoc() const {
return Loc;
}

SourceLocation CXXConstructExpr::getLocEnd() const {
SourceLocation CXXConstructExpr::getEndLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocEnd();

Expand Down Expand Up @@ -711,7 +711,7 @@ SourceLocation CXXFunctionalCastExpr::getBeginLoc() const {
return getTypeInfoAsWritten()->getTypeLoc().getLocStart();
}

SourceLocation CXXFunctionalCastExpr::getLocEnd() const {
SourceLocation CXXFunctionalCastExpr::getEndLoc() const {
return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getLocEnd();
}

Expand Down Expand Up @@ -796,7 +796,7 @@ 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();
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/Stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ SourceLocation Stmt::getBeginLoc() 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)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/StmtObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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 @@ -6126,7 +6126,8 @@ class FormatStringLiteral {
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
Expand Down