Port getLocStart -> getBeginLoc
Reviewers: teemperor!
Subscribers: jholewinski, whisperity, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D50350
llvm-svn: 339385
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index 36382e1..7b71794 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -265,8 +265,8 @@
// Measure the old text.
int Size = Rewrite.getRangeSize(SrcRange);
if (Size == -1) {
- Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag)
- << Old->getSourceRange();
+ Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag)
+ << Old->getSourceRange();
return;
}
// Get the new text.
@@ -282,8 +282,8 @@
}
if (SilenceRewriteMacroWarning)
return;
- Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag)
- << Old->getSourceRange();
+ Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag)
+ << Old->getSourceRange();
}
void InsertText(SourceLocation Loc, StringRef Str,
@@ -748,11 +748,11 @@
if (ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>((*DI))) {
if (!IFace->isThisDeclarationADefinition()) {
SmallVector<Decl *, 8> DG;
- SourceLocation StartLoc = IFace->getLocStart();
+ SourceLocation StartLoc = IFace->getBeginLoc();
do {
if (isa<ObjCInterfaceDecl>(*DI) &&
!cast<ObjCInterfaceDecl>(*DI)->isThisDeclarationADefinition() &&
- StartLoc == (*DI)->getLocStart())
+ StartLoc == (*DI)->getBeginLoc())
DG.push_back(*DI);
else
break;
@@ -773,11 +773,11 @@
if (ObjCProtocolDecl *Proto = dyn_cast<ObjCProtocolDecl>((*DI))) {
if (!Proto->isThisDeclarationADefinition()) {
SmallVector<Decl *, 8> DG;
- SourceLocation StartLoc = Proto->getLocStart();
+ SourceLocation StartLoc = Proto->getBeginLoc();
do {
if (isa<ObjCProtocolDecl>(*DI) &&
!cast<ObjCProtocolDecl>(*DI)->isThisDeclarationADefinition() &&
- StartLoc == (*DI)->getLocStart())
+ StartLoc == (*DI)->getBeginLoc())
DG.push_back(*DI);
else
break;
@@ -923,16 +923,15 @@
static bool objcSetPropertyDefined = false;
SourceLocation startGetterSetterLoc;
- if (PID->getLocStart().isValid()) {
- SourceLocation startLoc = PID->getLocStart();
+ if (PID->getBeginLoc().isValid()) {
+ SourceLocation startLoc = PID->getBeginLoc();
InsertText(startLoc, "// ");
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @synthesize location");
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "@synthesize: can't find ';'");
startGetterSetterLoc = startLoc.getLocWithOffset(semiBuf-startBuf+1);
- }
- else
+ } else
startGetterSetterLoc = IMD ? IMD->getLocEnd() : CID->getLocEnd();
if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
@@ -1061,7 +1060,7 @@
void RewriteModernObjC::RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
const std::string &typedefString) {
- SourceLocation startLoc = ClassDecl->getLocStart();
+ SourceLocation startLoc = ClassDecl->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
const char *semiPtr = strchr(startBuf, ';');
// Replace the @class with typedefs corresponding to the classes.
@@ -1109,7 +1108,7 @@
// nothing to rewrite.
if (Method->isImplicit())
return;
- SourceLocation LocStart = Method->getLocStart();
+ SourceLocation LocStart = Method->getBeginLoc();
SourceLocation LocEnd = Method->getLocEnd();
if (SM->getExpansionLineNumber(LocEnd) >
@@ -1129,7 +1128,7 @@
}
void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
- SourceLocation LocStart = CatDecl->getLocStart();
+ SourceLocation LocStart = CatDecl->getBeginLoc();
// FIXME: handle category headers that are declared across multiple lines.
if (CatDecl->getIvarRBraceLoc().isValid()) {
@@ -1154,7 +1153,7 @@
}
void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
- SourceLocation LocStart = PDecl->getLocStart();
+ SourceLocation LocStart = PDecl->getBeginLoc();
assert(PDecl->isThisDeclarationADefinition());
// FIXME: handle protocol headers that are declared across multiple lines.
@@ -1189,7 +1188,7 @@
}
void RewriteModernObjC::RewriteForwardProtocolDecl(DeclGroupRef D) {
- SourceLocation LocStart = (*D.begin())->getLocStart();
+ SourceLocation LocStart = (*D.begin())->getBeginLoc();
if (LocStart.isInvalid())
llvm_unreachable("Invalid SourceLocation");
// FIXME: handle forward protocol that are declared across multiple lines.
@@ -1198,7 +1197,7 @@
void
RewriteModernObjC::RewriteForwardProtocolDecl(const SmallVectorImpl<Decl *> &DG) {
- SourceLocation LocStart = DG[0]->getLocStart();
+ SourceLocation LocStart = DG[0]->getBeginLoc();
if (LocStart.isInvalid())
llvm_unreachable("Invalid SourceLocation");
// FIXME: handle forward protocol that are declared across multiple lines.
@@ -1338,21 +1337,21 @@
if (IMD) {
if (IMD->getIvarRBraceLoc().isValid()) {
- ReplaceText(IMD->getLocStart(), 1, "/** ");
+ ReplaceText(IMD->getBeginLoc(), 1, "/** ");
ReplaceText(IMD->getIvarRBraceLoc(), 1, "**/ ");
}
else {
- InsertText(IMD->getLocStart(), "// ");
+ InsertText(IMD->getBeginLoc(), "// ");
}
}
else
- InsertText(CID->getLocStart(), "// ");
+ InsertText(CID->getBeginLoc(), "// ");
for (auto *OMD : IMD ? IMD->instance_methods() : CID->instance_methods()) {
std::string ResultStr;
RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr);
- SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();
+ SourceLocation LocStart = OMD->getBeginLoc();
+ SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc();
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
@@ -1362,8 +1361,8 @@
for (auto *OMD : IMD ? IMD->class_methods() : CID->class_methods()) {
std::string ResultStr;
RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr);
- SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();
+ SourceLocation LocStart = OMD->getBeginLoc();
+ SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc();
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
@@ -1608,7 +1607,7 @@
// replace break with goto __break_label
std::string buf;
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
buf = "goto __break_label_";
buf += utostr(ObjCBcLabelNo.back());
ReplaceText(startLoc, strlen("break"), buf);
@@ -1638,7 +1637,7 @@
// replace continue with goto __continue_label
std::string buf;
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
buf = "goto __continue_label_";
buf += utostr(ObjCBcLabelNo.back());
ReplaceText(startLoc, strlen("continue"), buf);
@@ -1686,7 +1685,7 @@
assert(!ObjCBcLabelNo.empty() &&
"ObjCForCollectionStmt - Label No stack empty");
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
StringRef elementName;
std::string elementTypeAsString;
@@ -1860,7 +1859,7 @@
///
Stmt *RewriteModernObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @synchronized location");
@@ -1883,12 +1882,12 @@
// We can't use S->getSynchExpr()->getLocEnd() to find the end location, since
// the sync expression is typically a message expression that's already
// been rewritten! (which implies the SourceLocation's are invalid).
- SourceLocation RParenExprLoc = S->getSynchBody()->getLocStart();
+ SourceLocation RParenExprLoc = S->getSynchBody()->getBeginLoc();
const char *RParenExprLocBuf = SM->getCharacterData(RParenExprLoc);
while (*RParenExprLocBuf != ')') RParenExprLocBuf--;
RParenExprLoc = startLoc.getLocWithOffset(RParenExprLocBuf-startBuf);
- SourceLocation LBranceLoc = S->getSynchBody()->getLocStart();
+ SourceLocation LBranceLoc = S->getSynchBody()->getBeginLoc();
const char *LBraceLocBuf = SM->getCharacterData(LBranceLoc);
assert (*LBraceLocBuf == '{');
ReplaceText(RParenExprLoc, (LBraceLocBuf - SM->getCharacterData(RParenExprLoc) + 1), buf);
@@ -1915,7 +1914,7 @@
WarnAboutReturnGotoStmts(SubStmt);
if (isa<ReturnStmt>(S) || isa<GotoStmt>(S)) {
- Diags.Report(Context->getFullLoc(S->getLocStart()),
+ Diags.Report(Context->getFullLoc(S->getBeginLoc()),
TryFinallyContainsReturnDiag);
}
}
@@ -1923,7 +1922,7 @@
Stmt *RewriteModernObjC::RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
SourceLocation startLoc = S->getAtLoc();
ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */");
- ReplaceText(S->getSubStmt()->getLocStart(), 1,
+ ReplaceText(S->getSubStmt()->getBeginLoc(), 1,
"{ __AtAutoreleasePool __autoreleasepool; ");
return nullptr;
@@ -1944,7 +1943,7 @@
}
}
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @try location");
@@ -1958,7 +1957,7 @@
ObjCAtCatchStmt *Catch = S->getCatchStmt(I);
VarDecl *catchDecl = Catch->getCatchParamDecl();
- startLoc = Catch->getLocStart();
+ startLoc = Catch->getBeginLoc();
bool AtRemoved = false;
if (catchDecl) {
QualType t = catchDecl->getType();
@@ -1967,7 +1966,7 @@
ObjCInterfaceDecl *IDecl = Ptr->getObjectType()->getInterface();
if (IDecl) {
std::string Result;
- ConvertSourceLocationToLineDirective(Catch->getLocStart(), Result);
+ ConvertSourceLocationToLineDirective(Catch->getBeginLoc(), Result);
startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @catch location");
@@ -1988,7 +1987,7 @@
Result += "_"; Result += catchDecl->getNameAsString();
Result += "; ";
- SourceLocation lBraceLoc = Catch->getCatchBody()->getLocStart();
+ SourceLocation lBraceLoc = Catch->getCatchBody()->getBeginLoc();
ReplaceText(lBraceLoc, 1, Result);
AtRemoved = true;
}
@@ -2001,7 +2000,7 @@
}
if (finalStmt) {
buf.clear();
- SourceLocation FinallyLoc = finalStmt->getLocStart();
+ SourceLocation FinallyLoc = finalStmt->getBeginLoc();
if (noCatch) {
ConvertSourceLocationToLineDirective(FinallyLoc, buf);
@@ -2013,10 +2012,10 @@
buf += "catch (id e) {_rethrow = e;}\n";
}
- SourceLocation startFinalLoc = finalStmt->getLocStart();
+ SourceLocation startFinalLoc = finalStmt->getBeginLoc();
ReplaceText(startFinalLoc, 8, buf);
Stmt *body = finalStmt->getFinallyBody();
- SourceLocation startFinalBodyLoc = body->getLocStart();
+ SourceLocation startFinalBodyLoc = body->getBeginLoc();
buf.clear();
Write_RethrowObject(buf);
ReplaceText(startFinalBodyLoc, 1, buf);
@@ -2035,7 +2034,7 @@
// been rewritten! (which implies the SourceLocation's are invalid).
Stmt *RewriteModernObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) {
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @throw location");
@@ -2170,7 +2169,7 @@
Loc = ECE->getLParenLoc();
EndLoc = ECE->getRParenLoc();
} else {
- Loc = E->getLocStart();
+ Loc = E->getBeginLoc();
EndLoc = E->getLocEnd();
}
// This will defend against trying to rewrite synthesized expressions.
@@ -2296,7 +2295,7 @@
if (const CStyleCastExpr *ECE = dyn_cast<CStyleCastExpr>(E))
startLoc = ECE->getLParenLoc();
else
- startLoc = E->getLocStart();
+ startLoc = E->getBeginLoc();
startLoc = SM->getExpansionLoc(startLoc);
const char *endBuf = SM->getCharacterData(startLoc);
ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString);
@@ -2625,7 +2624,7 @@
SynthGetClassFunctionDecl();
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
- SourceLocation StartLoc = Exp->getLocStart();
+ SourceLocation StartLoc = Exp->getBeginLoc();
SourceLocation EndLoc = Exp->getLocEnd();
// Synthesize a call to objc_msgSend().
@@ -2709,7 +2708,7 @@
SynthGetClassFunctionDecl();
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
- SourceLocation StartLoc = Exp->getLocStart();
+ SourceLocation StartLoc = Exp->getBeginLoc();
SourceLocation EndLoc = Exp->getLocEnd();
// Build the expression: __NSContainer_literal(int, ...).arr
@@ -2832,7 +2831,7 @@
SynthGetClassFunctionDecl();
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
- SourceLocation StartLoc = Exp->getLocStart();
+ SourceLocation StartLoc = Exp->getBeginLoc();
SourceLocation EndLoc = Exp->getLocEnd();
// Build the expression: __NSContainer_literal(int, ...).arr
@@ -3070,7 +3069,7 @@
LineString += "\"";
else LineString += "\"\n";
- Location = D->getLocStart();
+ Location = D->getBeginLoc();
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
if (FD->isExternC() && !FD->isMain()) {
const DeclContext *DC = FD->getDeclContext();
@@ -3169,7 +3168,7 @@
FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef);
else {
assert(CurMethodDef && "SynthMsgSendStretCallExpr - CurMethodDef is null");
- FunLocStart = CurMethodDef->getLocStart();
+ FunLocStart = CurMethodDef->getBeginLoc();
}
InsertText(FunLocStart, str);
@@ -3563,8 +3562,8 @@
}
Stmt *RewriteModernObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) {
- Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(),
- Exp->getLocEnd());
+ Stmt *ReplacingStmt =
+ SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd());
// Now do the actual rewrite.
ReplaceStmt(Exp, ReplacingStmt);
@@ -3896,7 +3895,7 @@
IVD; IVD = IVD->getNextIvar())
IVars.push_back(IVD);
- SourceLocation LocStart = CDecl->getLocStart();
+ SourceLocation LocStart = CDecl->getBeginLoc();
SourceLocation LocEnd = CDecl->getEndOfDefinitionLoc();
const char *startBuf = SM->getCharacterData(LocStart);
@@ -4461,9 +4460,9 @@
}
void RewriteModernObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) {
- //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
- //SourceLocation FunLocStart = MD->getLocStart();
- SourceLocation FunLocStart = MD->getLocStart();
+ // fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
+ // SourceLocation FunLocStart = MD->getBeginLoc();
+ SourceLocation FunLocStart = MD->getBeginLoc();
std::string FuncName;
BuildUniqueMethodName(FuncName, MD);
SynthesizeBlockLiterals(FunLocStart, FuncName);
@@ -4778,7 +4777,7 @@
std::string Str = "(";
Str += TypeString;
Str += ")";
- InsertText(IC->getSubExpr()->getLocStart(), Str);
+ InsertText(IC->getSubExpr()->getBeginLoc(), Str);
}
void RewriteModernObjC::RewriteBlockPointerFunctionArgs(FunctionDecl *FD) {
@@ -5069,7 +5068,7 @@
FunLocStart = getFunctionSourceLocation(*this, CurFunctionDef);
else {
assert(CurMethodDef && "RewriteByRefVar - CurMethodDef is null");
- FunLocStart = CurMethodDef->getLocStart();
+ FunLocStart = CurMethodDef->getBeginLoc();
}
InsertText(FunLocStart, ByrefType);
@@ -5156,7 +5155,7 @@
if (const CStyleCastExpr *ECE = dyn_cast<CStyleCastExpr>(E))
startLoc = ECE->getLParenLoc();
else
- startLoc = E->getLocStart();
+ startLoc = E->getBeginLoc();
startLoc = SM->getExpansionLoc(startLoc);
endBuf = SM->getCharacterData(startLoc);
ReplaceText(DeclLoc, endBuf-startBuf, ByrefType);
@@ -5537,7 +5536,7 @@
if (ObjCMessageExpr *MessExpr = dyn_cast<ObjCMessageExpr>(S)) {
#if 0
// Before we rewrite it, put the original message expression in a comment.
- SourceLocation startLoc = MessExpr->getLocStart();
+ SourceLocation startLoc = MessExpr->getBeginLoc();
SourceLocation endLoc = MessExpr->getLocEnd();
const char *startBuf = SM->getCharacterData(startLoc);
@@ -5676,7 +5675,7 @@
const std::string &Str = Buf.str();
printf("CAST = %s\n", &Str[0]);
- InsertText(ICE->getSubExpr()->getLocStart(), Str);
+ InsertText(ICE->getSubExpr()->getBeginLoc(), Str);
delete S;
return Replacement;
}
diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
index 6229351..7049520 100644
--- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -216,8 +216,8 @@
// Measure the old text.
int Size = Rewrite.getRangeSize(SrcRange);
if (Size == -1) {
- Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag)
- << Old->getSourceRange();
+ Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag)
+ << Old->getSourceRange();
return;
}
// Get the new text.
@@ -233,8 +233,8 @@
}
if (SilenceRewriteMacroWarning)
return;
- Diags.Report(Context->getFullLoc(Old->getLocStart()), RewriteFailedDiag)
- << Old->getSourceRange();
+ Diags.Report(Context->getFullLoc(Old->getBeginLoc()), RewriteFailedDiag)
+ << Old->getSourceRange();
}
void InsertText(SourceLocation Loc, StringRef Str,
@@ -680,11 +680,11 @@
if (ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>((*DI))) {
if (!IFace->isThisDeclarationADefinition()) {
SmallVector<Decl *, 8> DG;
- SourceLocation StartLoc = IFace->getLocStart();
+ SourceLocation StartLoc = IFace->getBeginLoc();
do {
if (isa<ObjCInterfaceDecl>(*DI) &&
!cast<ObjCInterfaceDecl>(*DI)->isThisDeclarationADefinition() &&
- StartLoc == (*DI)->getLocStart())
+ StartLoc == (*DI)->getBeginLoc())
DG.push_back(*DI);
else
break;
@@ -699,11 +699,11 @@
if (ObjCProtocolDecl *Proto = dyn_cast<ObjCProtocolDecl>((*DI))) {
if (!Proto->isThisDeclarationADefinition()) {
SmallVector<Decl *, 8> DG;
- SourceLocation StartLoc = Proto->getLocStart();
+ SourceLocation StartLoc = Proto->getBeginLoc();
do {
if (isa<ObjCProtocolDecl>(*DI) &&
!cast<ObjCProtocolDecl>(*DI)->isThisDeclarationADefinition() &&
- StartLoc == (*DI)->getLocStart())
+ StartLoc == (*DI)->getBeginLoc())
DG.push_back(*DI);
else
break;
@@ -769,7 +769,7 @@
ObjCCategoryImplDecl *CID) {
static bool objcGetPropertyDefined = false;
static bool objcSetPropertyDefined = false;
- SourceLocation startLoc = PID->getLocStart();
+ SourceLocation startLoc = PID->getBeginLoc();
InsertText(startLoc, "// ");
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @synthesize location");
@@ -901,11 +901,11 @@
void RewriteObjC::RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
const std::string &typedefString) {
- SourceLocation startLoc = ClassDecl->getLocStart();
- const char *startBuf = SM->getCharacterData(startLoc);
- const char *semiPtr = strchr(startBuf, ';');
- // Replace the @class with typedefs corresponding to the classes.
- ReplaceText(startLoc, semiPtr-startBuf+1, typedefString);
+ SourceLocation startLoc = ClassDecl->getBeginLoc();
+ const char *startBuf = SM->getCharacterData(startLoc);
+ const char *semiPtr = strchr(startBuf, ';');
+ // Replace the @class with typedefs corresponding to the classes.
+ ReplaceText(startLoc, semiPtr - startBuf + 1, typedefString);
}
void RewriteObjC::RewriteForwardClassDecl(DeclGroupRef D) {
@@ -945,7 +945,7 @@
// nothing to rewrite.
if (Method->isImplicit())
return;
- SourceLocation LocStart = Method->getLocStart();
+ SourceLocation LocStart = Method->getBeginLoc();
SourceLocation LocEnd = Method->getLocEnd();
if (SM->getExpansionLineNumber(LocEnd) >
@@ -965,7 +965,7 @@
}
void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
- SourceLocation LocStart = CatDecl->getLocStart();
+ SourceLocation LocStart = CatDecl->getBeginLoc();
// FIXME: handle category headers that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
@@ -983,7 +983,7 @@
}
void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
- SourceLocation LocStart = PDecl->getLocStart();
+ SourceLocation LocStart = PDecl->getBeginLoc();
assert(PDecl->isThisDeclarationADefinition());
// FIXME: handle protocol headers that are declared across multiple lines.
@@ -1018,7 +1018,7 @@
}
void RewriteObjC::RewriteForwardProtocolDecl(DeclGroupRef D) {
- SourceLocation LocStart = (*D.begin())->getLocStart();
+ SourceLocation LocStart = (*D.begin())->getBeginLoc();
if (LocStart.isInvalid())
llvm_unreachable("Invalid SourceLocation");
// FIXME: handle forward protocol that are declared across multiple lines.
@@ -1027,7 +1027,7 @@
void
RewriteObjC::RewriteForwardProtocolDecl(const SmallVectorImpl<Decl *> &DG) {
- SourceLocation LocStart = DG[0]->getLocStart();
+ SourceLocation LocStart = DG[0]->getBeginLoc();
if (LocStart.isInvalid())
llvm_unreachable("Invalid SourceLocation");
// FIXME: handle forward protocol that are declared across multiple lines.
@@ -1165,13 +1165,13 @@
ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID);
ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID);
- InsertText(IMD ? IMD->getLocStart() : CID->getLocStart(), "// ");
+ InsertText(IMD ? IMD->getBeginLoc() : CID->getBeginLoc(), "// ");
for (auto *OMD : IMD ? IMD->instance_methods() : CID->instance_methods()) {
std::string ResultStr;
RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr);
- SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();
+ SourceLocation LocStart = OMD->getBeginLoc();
+ SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc();
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
@@ -1181,8 +1181,8 @@
for (auto *OMD : IMD ? IMD->class_methods() : CID->class_methods()) {
std::string ResultStr;
RewriteObjCMethodDecl(OMD->getClassInterface(), OMD, ResultStr);
- SourceLocation LocStart = OMD->getLocStart();
- SourceLocation LocEnd = OMD->getCompoundBody()->getLocStart();
+ SourceLocation LocStart = OMD->getBeginLoc();
+ SourceLocation LocEnd = OMD->getCompoundBody()->getBeginLoc();
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
@@ -1412,7 +1412,7 @@
// replace break with goto __break_label
std::string buf;
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
buf = "goto __break_label_";
buf += utostr(ObjCBcLabelNo.back());
ReplaceText(startLoc, strlen("break"), buf);
@@ -1429,7 +1429,7 @@
// replace continue with goto __continue_label
std::string buf;
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
buf = "goto __continue_label_";
buf += utostr(ObjCBcLabelNo.back());
ReplaceText(startLoc, strlen("continue"), buf);
@@ -1477,7 +1477,7 @@
assert(!ObjCBcLabelNo.empty() &&
"ObjCForCollectionStmt - Label No stack empty");
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
StringRef elementName;
std::string elementTypeAsString;
@@ -1641,7 +1641,7 @@
///
Stmt *RewriteObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @synchronized location");
@@ -1654,7 +1654,7 @@
// We can't use S->getSynchExpr()->getLocEnd() to find the end location, since
// the sync expression is typically a message expression that's already
// been rewritten! (which implies the SourceLocation's are invalid).
- SourceLocation endLoc = S->getSynchBody()->getLocStart();
+ SourceLocation endLoc = S->getSynchBody()->getBeginLoc();
const char *endBuf = SM->getCharacterData(endLoc);
while (*endBuf != ')') endBuf--;
SourceLocation rparenLoc = startLoc.getLocWithOffset(endBuf-startBuf);
@@ -1719,7 +1719,7 @@
WarnAboutReturnGotoStmts(SubStmt);
if (isa<ReturnStmt>(S) || isa<GotoStmt>(S)) {
- Diags.Report(Context->getFullLoc(S->getLocStart()),
+ Diags.Report(Context->getFullLoc(S->getBeginLoc()),
TryFinallyContainsReturnDiag);
}
}
@@ -1742,7 +1742,7 @@
RewriteTryReturnStmts(SubStmt);
}
if (isa<ReturnStmt>(S)) {
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "RewriteTryReturnStmts: can't find ';'");
@@ -1763,7 +1763,7 @@
RewriteSyncReturnStmts(SubStmt, syncExitBuf);
}
if (isa<ReturnStmt>(S)) {
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
const char *semiBuf = strchr(startBuf, ';');
@@ -1782,7 +1782,7 @@
Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @try location");
@@ -1829,7 +1829,7 @@
buf = "if ("; // we are generating code for the first catch clause
else
buf = "else if (";
- startLoc = Catch->getLocStart();
+ startLoc = Catch->getBeginLoc();
startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @catch location");
@@ -1839,7 +1839,7 @@
if (Catch->hasEllipsis()) {
// Now rewrite the body...
lastCatchBody = Catch->getCatchBody();
- SourceLocation bodyLoc = lastCatchBody->getLocStart();
+ SourceLocation bodyLoc = lastCatchBody->getBeginLoc();
const char *bodyBuf = SM->getCharacterData(bodyLoc);
assert(*SM->getCharacterData(Catch->getRParenLoc()) == ')' &&
"bogus @catch paren location");
@@ -1866,7 +1866,7 @@
// Now rewrite the body...
lastCatchBody = Catch->getCatchBody();
SourceLocation rParenLoc = Catch->getRParenLoc();
- SourceLocation bodyLoc = lastCatchBody->getLocStart();
+ SourceLocation bodyLoc = lastCatchBody->getBeginLoc();
const char *bodyBuf = SM->getCharacterData(bodyLoc);
const char *rParenBuf = SM->getCharacterData(rParenLoc);
assert((*rParenBuf == ')') && "bogus @catch paren location");
@@ -1900,14 +1900,14 @@
lastCurlyLoc = lastCatchBody->getLocEnd();
}
if (ObjCAtFinallyStmt *finalStmt = S->getFinallyStmt()) {
- startLoc = finalStmt->getLocStart();
+ startLoc = finalStmt->getBeginLoc();
startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @finally start");
ReplaceText(startLoc, 8, "/* @finally */");
Stmt *body = finalStmt->getFinallyBody();
- SourceLocation startLoc = body->getLocStart();
+ SourceLocation startLoc = body->getBeginLoc();
SourceLocation endLoc = body->getLocEnd();
assert(*SM->getCharacterData(startLoc) == '{' &&
"bogus @finally body location");
@@ -1950,7 +1950,7 @@
// been rewritten! (which implies the SourceLocation's are invalid).
Stmt *RewriteObjC::RewriteObjCThrowStmt(ObjCAtThrowStmt *S) {
// Get the start location and compute the semi location.
- SourceLocation startLoc = S->getLocStart();
+ SourceLocation startLoc = S->getBeginLoc();
const char *startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @throw location");
@@ -2082,7 +2082,7 @@
Loc = ECE->getLParenLoc();
EndLoc = ECE->getRParenLoc();
} else {
- Loc = E->getLocStart();
+ Loc = E->getBeginLoc();
EndLoc = E->getLocEnd();
}
// This will defend against trying to rewrite synthesized expressions.
@@ -2204,7 +2204,7 @@
if (const CStyleCastExpr *ECE = dyn_cast<CStyleCastExpr>(E))
startLoc = ECE->getLParenLoc();
else
- startLoc = E->getLocStart();
+ startLoc = E->getBeginLoc();
startLoc = SM->getExpansionLoc(startLoc);
const char *endBuf = SM->getCharacterData(startLoc);
ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString);
@@ -3008,8 +3008,8 @@
}
Stmt *RewriteObjC::RewriteMessageExpr(ObjCMessageExpr *Exp) {
- Stmt *ReplacingStmt = SynthMessageExpr(Exp, Exp->getLocStart(),
- Exp->getLocEnd());
+ Stmt *ReplacingStmt =
+ SynthMessageExpr(Exp, Exp->getBeginLoc(), Exp->getLocEnd());
// Now do the actual rewrite.
ReplaceStmt(Exp, ReplacingStmt);
@@ -3093,7 +3093,7 @@
return;
ObjCInterfaceDecl *RCDecl = CDecl->getSuperClass();
int NumIvars = CDecl->ivar_size();
- SourceLocation LocStart = CDecl->getLocStart();
+ SourceLocation LocStart = CDecl->getBeginLoc();
SourceLocation LocEnd = CDecl->getEndOfDefinitionLoc();
const char *startBuf = SM->getCharacterData(LocStart);
@@ -3635,9 +3635,9 @@
}
void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) {
- //fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
- //SourceLocation FunLocStart = MD->getLocStart();
- SourceLocation FunLocStart = MD->getLocStart();
+ // fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
+ // SourceLocation FunLocStart = MD->getBeginLoc();
+ SourceLocation FunLocStart = MD->getBeginLoc();
std::string FuncName;
BuildUniqueMethodName(FuncName, MD);
SynthesizeBlockLiterals(FunLocStart, FuncName);
@@ -4212,7 +4212,7 @@
FunLocStart = CurFunctionDef->getTypeSpecStartLoc();
else {
assert(CurMethodDef && "RewriteByRefVar - CurMethodDef is null");
- FunLocStart = CurMethodDef->getLocStart();
+ FunLocStart = CurMethodDef->getBeginLoc();
}
InsertText(FunLocStart, ByrefType);
if (Ty.isObjCGCWeak()) {
@@ -4274,7 +4274,7 @@
if (const CStyleCastExpr *ECE = dyn_cast<CStyleCastExpr>(E))
startLoc = ECE->getLParenLoc();
else
- startLoc = E->getLocStart();
+ startLoc = E->getBeginLoc();
startLoc = SM->getExpansionLoc(startLoc);
endBuf = SM->getCharacterData(startLoc);
ByrefType += " " + Name;
@@ -4632,7 +4632,7 @@
if (ObjCMessageExpr *MessExpr = dyn_cast<ObjCMessageExpr>(S)) {
#if 0
// Before we rewrite it, put the original message expression in a comment.
- SourceLocation startLoc = MessExpr->getLocStart();
+ SourceLocation startLoc = MessExpr->getBeginLoc();
SourceLocation endLoc = MessExpr->getLocEnd();
const char *startBuf = SM->getCharacterData(startLoc);
@@ -4760,7 +4760,7 @@
const std::string &Str = Buf.str();
printf("CAST = %s\n", &Str[0]);
- InsertText(ICE->getSubExpr()->getLocStart(), Str);
+ InsertText(ICE->getSubExpr()->getBeginLoc(), Str);
delete S;
return Replacement;
}
@@ -5873,8 +5873,8 @@
CK_BitCast,
IV->getBase());
// Don't forget the parens to enforce the proper binding.
- ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
- IV->getBase()->getLocEnd(), castExpr);
+ ParenExpr *PE = new (Context) ParenExpr(
+ IV->getBase()->getBeginLoc(), IV->getBase()->getLocEnd(), castExpr);
// Cannot delete IV->getBase(), since PE points to it.
// Replace the old base with the cast. This is important when doing
// embedded rewrites. For example, [newInv->_container addObject:0].