Skip to content

Commit b0dd41b

Browse files
committed
[master-next] Use the new AST getBeginLoc API instead of getLocStart
The getLocStart API is deprecated and slated for removal from LLVM very soon. Switch to use getBeginLoc instead. I did not see any uses of the corresponding getLocEnd API.
1 parent 411fae3 commit b0dd41b

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
496496
bool Invalid;
497497
unsigned StartLocCol =
498498
ClangContext.getSourceManager().getSpellingColumnNumber(
499-
RC->getLocStart(), &Invalid);
499+
RC->getBeginLoc(), &Invalid);
500500
if (Invalid)
501501
StartLocCol = 0;
502502

lib/ClangImporter/ImportDecl.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,7 @@ namespace {
23662366
TypeAliasDecl *typealias = nullptr;
23672367
typealias = Impl.createDeclWithClangNode<TypeAliasDecl>(
23682368
Decl, AccessLevel::Public,
2369-
Impl.importSourceLoc(Decl->getLocStart()),
2369+
Impl.importSourceLoc(Decl->getBeginLoc()),
23702370
SourceLoc(), Name,
23712371
Impl.importSourceLoc(Decl->getLocation()),
23722372
/*genericparams*/nullptr, DC);
@@ -2385,7 +2385,7 @@ namespace {
23852385
TypeAliasDecl *typealias = nullptr;
23862386
typealias = Impl.createDeclWithClangNode<TypeAliasDecl>(
23872387
Decl, AccessLevel::Public,
2388-
Impl.importSourceLoc(Decl->getLocStart()),
2388+
Impl.importSourceLoc(Decl->getBeginLoc()),
23892389
SourceLoc(), Name,
23902390
Impl.importSourceLoc(Decl->getLocation()),
23912391
/*genericparams*/nullptr, DC);
@@ -2453,7 +2453,7 @@ namespace {
24532453
auto Loc = Impl.importSourceLoc(Decl->getLocation());
24542454
auto Result = Impl.createDeclWithClangNode<TypeAliasDecl>(Decl,
24552455
AccessLevel::Public,
2456-
Impl.importSourceLoc(Decl->getLocStart()),
2456+
Impl.importSourceLoc(Decl->getBeginLoc()),
24572457
SourceLoc(), Name,
24582458
Loc,
24592459
/*genericparams*/nullptr, DC);
@@ -2594,7 +2594,7 @@ namespace {
25942594
/// Basic information about the enum type we're building.
25952595
Identifier enumName = name;
25962596
DeclContext *enumDC = dc;
2597-
SourceLoc loc = Impl.importSourceLoc(decl->getLocStart());
2597+
SourceLoc loc = Impl.importSourceLoc(decl->getBeginLoc());
25982598

25992599
// If this is an error enum, form the error wrapper type,
26002600
// which is a struct containing an NSError instance.
@@ -3046,7 +3046,7 @@ namespace {
30463046
auto name = importedName.getDeclName().getBaseIdentifier();
30473047
auto result = Impl.createDeclWithClangNode<StructDecl>(decl,
30483048
AccessLevel::Public,
3049-
Impl.importSourceLoc(decl->getLocStart()),
3049+
Impl.importSourceLoc(decl->getBeginLoc()),
30503050
name,
30513051
Impl.importSourceLoc(decl->getLocation()),
30523052
None, nullptr, dc);
@@ -3370,7 +3370,7 @@ namespace {
33703370
/*IsStatic*/false,
33713371
VarDecl::Specifier::Var,
33723372
/*IsCaptureList*/false,
3373-
Impl.importSourceLoc(decl->getLocStart()),
3373+
Impl.importSourceLoc(decl->getBeginLoc()),
33743374
name, dc);
33753375
result->setInterfaceType(type);
33763376
result->setIsObjC(false);
@@ -4253,7 +4253,7 @@ namespace {
42534253
if (!dc)
42544254
return nullptr;
42554255

4256-
auto loc = Impl.importSourceLoc(decl->getLocStart());
4256+
auto loc = Impl.importSourceLoc(decl->getBeginLoc());
42574257
auto result = ExtensionDecl::create(
42584258
Impl.SwiftContext, loc,
42594259
TypeLoc::withoutLoc(objcClass->getDeclaredType()),
@@ -4390,7 +4390,7 @@ namespace {
43904390
// Create the protocol declaration and record it.
43914391
auto result = Impl.createDeclWithClangNode<ProtocolDecl>(
43924392
decl, AccessLevel::Public, dc,
4393-
Impl.importSourceLoc(decl->getLocStart()),
4393+
Impl.importSourceLoc(decl->getBeginLoc()),
43944394
Impl.importSourceLoc(decl->getLocation()), name, None,
43954395
/*TrailingWhere=*/nullptr);
43964396
result->computeType();
@@ -4539,7 +4539,7 @@ namespace {
45394539

45404540
// Create the class declaration and record it.
45414541
auto result = Impl.createDeclWithClangNode<ClassDecl>(
4542-
decl, access, Impl.importSourceLoc(decl->getLocStart()), name,
4542+
decl, access, Impl.importSourceLoc(decl->getBeginLoc()), name,
45434543
Impl.importSourceLoc(decl->getLocation()), None, nullptr, dc);
45444544

45454545
// Import generic arguments, if any.
@@ -4864,7 +4864,7 @@ namespace {
48644864
TypeAliasDecl *typealias = nullptr;
48654865
typealias = Impl.createDeclWithClangNode<TypeAliasDecl>(
48664866
decl, AccessLevel::Public,
4867-
Impl.importSourceLoc(decl->getLocStart()),
4867+
Impl.importSourceLoc(decl->getBeginLoc()),
48684868
SourceLoc(), name,
48694869
Impl.importSourceLoc(decl->getLocation()),
48704870
/*genericparams=*/nullptr, dc);
@@ -5097,7 +5097,7 @@ Decl *SwiftDeclConverter::importCompatibilityTypeAlias(
50975097

50985098
// Create the type alias.
50995099
auto alias = Impl.createDeclWithClangNode<TypeAliasDecl>(
5100-
decl, AccessLevel::Public, Impl.importSourceLoc(decl->getLocStart()),
5100+
decl, AccessLevel::Public, Impl.importSourceLoc(decl->getBeginLoc()),
51015101
SourceLoc(), compatibilityName.getDeclName().getBaseIdentifier(),
51025102
Impl.importSourceLoc(decl->getLocation()), /*generic params*/nullptr, dc);
51035103

lib/ClangImporter/ImportEnumInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void EnumInfo::classifyEnum(const clang::EnumDecl *decl,
108108
// FIXME: Stop using these once flag_enum and enum_extensibility
109109
// have been adopted everywhere, or at least relegate them to Swift 4 mode
110110
// only.
111-
auto loc = decl->getLocStart();
111+
auto loc = decl->getBeginLoc();
112112
if (loc.isMacroID()) {
113113
StringRef MacroName = pp.getImmediateMacroName(loc);
114114
if (MacroName == "CF_ENUM" || MacroName == "__CF_NAMED_ENUM" ||

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11881188
auto *Decl = StructTy->getDecl();
11891189
auto L = getDebugLoc(*this, Decl);
11901190
if (auto *ClangDecl = Decl->getClangDecl()) {
1191-
auto ClangSrcLoc = ClangDecl->getLocStart();
1191+
auto ClangSrcLoc = ClangDecl->getBeginLoc();
11921192
clang::SourceManager &ClangSM =
11931193
CI.getClangASTContext().getSourceManager();
11941194
L.Line = ClangSM.getPresumedLineNumber(ClangSrcLoc);
@@ -1213,7 +1213,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12131213
auto *Decl = ClassTy->getDecl();
12141214
auto L = getDebugLoc(*this, Decl);
12151215
if (auto *ClangDecl = Decl->getClangDecl()) {
1216-
auto ClangSrcLoc = ClangDecl->getLocStart();
1216+
auto ClangSrcLoc = ClangDecl->getBeginLoc();
12171217
clang::SourceManager &ClangSM =
12181218
CI.getClangASTContext().getSourceManager();
12191219
L.Line = ClangSM.getPresumedLineNumber(ClangSrcLoc);

0 commit comments

Comments
 (0)