Skip to content

Commit 9908c74

Browse files
committed
Stopped using methods deprecated in recent Clang.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent f254951 commit 9908c74

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/CppParser/Parser.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static clang::SourceLocation GetDeclStartLocation(clang::CompilerInstance* C,
501501
const clang::Decl* D)
502502
{
503503
auto& SM = C->getSourceManager();
504-
auto startLoc = SM.getExpansionLoc(D->getLocStart());
504+
auto startLoc = SM.getExpansionLoc(D->getBeginLoc());
505505
auto startOffset = SM.getFileOffset(startLoc);
506506

507507
if (clang::dyn_cast_or_null<clang::TranslationUnitDecl>(D) || !startLoc.isValid())
@@ -519,7 +519,7 @@ static clang::SourceLocation GetDeclStartLocation(clang::CompilerInstance* C,
519519
if(!prevDecl || !IsExplicit(prevDecl))
520520
return lineBeginLoc;
521521

522-
auto prevDeclEndLoc = SM.getExpansionLoc(prevDecl->getLocEnd());
522+
auto prevDeclEndLoc = SM.getExpansionLoc(prevDecl->getEndLoc());
523523
auto prevDeclEndOffset = SM.getFileOffset(prevDeclEndLoc);
524524

525525
if(SM.getFileID(prevDeclEndLoc) != SM.getFileID(startLoc))
@@ -532,7 +532,7 @@ static clang::SourceLocation GetDeclStartLocation(clang::CompilerInstance* C,
532532
return lineBeginLoc;
533533

534534
// Declarations don't share same macro expansion
535-
if(SM.getExpansionLoc(prevDecl->getLocStart()) != startLoc)
535+
if(SM.getExpansionLoc(prevDecl->getBeginLoc()) != startLoc)
536536
return prevDeclEndLoc;
537537

538538
return GetDeclStartLocation(C, prevDecl);
@@ -891,7 +891,7 @@ static bool HasLayout(const clang::RecordDecl* Record)
891891

892892
bool Parser::IsSupported(const clang::NamedDecl* ND)
893893
{
894-
return !c->getSourceManager().isInSystemHeader(ND->getLocStart()) ||
894+
return !c->getSourceManager().isInSystemHeader(ND->getBeginLoc()) ||
895895
(llvm::isa<clang::RecordDecl>(ND) &&
896896
supportedStdTypes.find(ND->getName()) != supportedStdTypes.end());
897897
}
@@ -900,7 +900,7 @@ bool Parser::IsSupported(const clang::CXXMethodDecl* MD)
900900
{
901901
using namespace clang;
902902

903-
return !c->getSourceManager().isInSystemHeader(MD->getLocStart()) ||
903+
return !c->getSourceManager().isInSystemHeader(MD->getBeginLoc()) ||
904904
isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD) ||
905905
(MD->getDeclName().isIdentifier() && MD->getName() == "c_str" &&
906906
supportedStdTypes.find(MD->getParent()->getName()) !=
@@ -918,7 +918,7 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC)
918918
{
919919
auto headStartLoc = GetDeclStartLocation(c.get(), Record);
920920
auto headEndLoc = Record->getLocation(); // identifier location
921-
auto bodyEndLoc = Record->getLocEnd();
921+
auto bodyEndLoc = Record->getEndLoc();
922922

923923
auto headRange = clang::SourceRange(headStartLoc, headEndLoc);
924924
auto bodyRange = clang::SourceRange(headEndLoc, bodyEndLoc);
@@ -949,7 +949,7 @@ void Parser::WalkRecord(const clang::RecordDecl* Record, Class* RC)
949949
for (auto FD : Record->fields())
950950
WalkFieldCXX(FD, RC);
951951

952-
if (c->getSourceManager().isInSystemHeader(Record->getLocStart()))
952+
if (c->getSourceManager().isInSystemHeader(Record->getBeginLoc()))
953953
{
954954
if (supportedStdTypes.find(Record->getName()) != supportedStdTypes.end())
955955
{
@@ -2924,7 +2924,7 @@ void Parser::CompleteIfSpecializationType(const clang::QualType& QualType)
29242924

29252925
auto Diagnostics = c->getSema().getDiagnostics().getClient();
29262926
auto SemaDiagnostics = static_cast<::DiagnosticConsumer*>(Diagnostics);
2927-
c->getSema().InstantiateClassTemplateSpecialization(CTS->getLocStart(),
2927+
c->getSema().InstantiateClassTemplateSpecialization(CTS->getBeginLoc(),
29282928
CTS, TSK_ImplicitInstantiation, false);
29292929
}
29302930

@@ -3051,7 +3051,7 @@ void Parser::MarkValidity(Function* F)
30513051
if (!FD->getTemplateInstantiationPattern() ||
30523052
FD->getTemplateInstantiationPattern()->isLateTemplateParsed() ||
30533053
!FD->isExternallyVisible() ||
3054-
c->getSourceManager().isInSystemHeader(FD->getLocStart()))
3054+
c->getSourceManager().isInSystemHeader(FD->getBeginLoc()))
30553055
return;
30563056

30573057
auto Diagnostics = c->getSema().getDiagnostics().getClient();
@@ -3060,7 +3060,7 @@ void Parser::MarkValidity(Function* F)
30603060
auto TUScope = c->getSema().TUScope;
30613061
std::stack<Scope> Scopes = GetScopesFor(FD);
30623062
c->getSema().TUScope = &Scopes.top();
3063-
c->getSema().InstantiateFunctionDefinition(FD->getLocStart(), FD,
3063+
c->getSema().InstantiateFunctionDefinition(FD->getBeginLoc(), FD,
30643064
/*Recursive*/true);
30653065
c->getSema().TUScope = TUScope;
30663066
F->isInvalid = FD->isInvalidDecl();
@@ -3133,7 +3133,7 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
31333133
const auto& Body = GetFunctionBody(FD);
31343134
F->body = Body;
31353135

3136-
clang::SourceLocation ParamStartLoc = FD->getLocStart();
3136+
clang::SourceLocation ParamStartLoc = FD->getBeginLoc();
31373137
clang::SourceLocation ResultLoc;
31383138

31393139
auto FTSI = FD->getTypeSourceInfo();
@@ -3149,15 +3149,15 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
31493149
assert (!FTInfo.isNull());
31503150

31513151
ParamStartLoc = FTInfo.getLParenLoc();
3152-
ResultLoc = FTInfo.getReturnLoc().getLocStart();
3152+
ResultLoc = FTInfo.getReturnLoc().getBeginLoc();
31533153
}
31543154
}
31553155

3156-
clang::SourceLocation BeginLoc = FD->getLocStart();
3156+
clang::SourceLocation BeginLoc = FD->getBeginLoc();
31573157
if (ResultLoc.isValid())
31583158
BeginLoc = ResultLoc;
31593159

3160-
clang::SourceRange Range(BeginLoc, FD->getLocEnd());
3160+
clang::SourceRange Range(BeginLoc, FD->getEndLoc());
31613161

31623162
std::string Sig;
31633163
if (GetDeclText(Range, Sig))
@@ -3168,7 +3168,7 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
31683168
auto P = WalkParameter(VD, ParamStartLoc);
31693169
F->Parameters.push_back(P);
31703170

3171-
ParamStartLoc = VD->getLocEnd();
3171+
ParamStartLoc = VD->getEndLoc();
31723172
}
31733173

31743174
auto& CXXABI = codeGenTypes->getCXXABI();
@@ -3283,8 +3283,8 @@ void Parser::WalkAST()
32833283
auto TU = c->getASTContext().getTranslationUnitDecl();
32843284
for (auto D : TU->decls())
32853285
{
3286-
if (D->getLocStart().isValid() &&
3287-
!c->getSourceManager().isInSystemHeader(D->getLocStart()))
3286+
if (D->getBeginLoc().isValid() &&
3287+
!c->getSourceManager().isInSystemHeader(D->getBeginLoc()))
32883288
WalkDeclarationDef(D);
32893289
}
32903290
}
@@ -3654,8 +3654,8 @@ void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl)
36543654
auto IsDeclExplicit = IsExplicit(D);
36553655
if (IsDeclExplicit)
36563656
{
3657-
Decl->lineNumberStart = c->getSourceManager().getExpansionLineNumber(D->getLocStart());
3658-
Decl->lineNumberEnd = c->getSourceManager().getExpansionLineNumber(D->getLocEnd());
3657+
Decl->lineNumberStart = c->getSourceManager().getExpansionLineNumber(D->getBeginLoc());
3658+
Decl->lineNumberEnd = c->getSourceManager().getExpansionLineNumber(D->getEndLoc());
36593659
}
36603660
else
36613661
{
@@ -3676,7 +3676,7 @@ void Parser::HandleDeclaration(const clang::Decl* D, Declaration* Decl)
36763676
else if (IsDeclExplicit)
36773677
{
36783678
auto startLoc = GetDeclStartLocation(c.get(), D);
3679-
auto endLoc = D->getLocEnd();
3679+
auto endLoc = D->getEndLoc();
36803680
auto range = clang::SourceRange(startLoc, endLoc);
36813681

36823682
HandlePreprocessedEntities(Decl, range);
@@ -4445,7 +4445,7 @@ Declaration* Parser::GetDeclarationFromFriend(clang::NamedDecl* FriendDecl)
44454445
{
44464446
auto DecomposedLocStart = SM.getDecomposedLoc(it->getLocation());
44474447
int NewLineNumberStart = SM.getLineNumber(DecomposedLocStart.first, DecomposedLocStart.second);
4448-
auto DecomposedLocEnd = SM.getDecomposedLoc(it->getLocEnd());
4448+
auto DecomposedLocEnd = SM.getDecomposedLoc(it->getEndLoc());
44494449
int NewLineNumberEnd = SM.getLineNumber(DecomposedLocEnd.first, DecomposedLocEnd.second);
44504450
if (NewLineNumberStart < MinLineNumberStart)
44514451
{

0 commit comments

Comments
 (0)