@@ -676,7 +676,6 @@ class alignas(1 << DeclAlignInBits) Decl {
676
676
677
677
Decl (const Decl&) = delete ;
678
678
void operator =(const Decl&) = delete ;
679
- SourceLoc getLocFromSource () const ;
680
679
681
680
protected:
682
681
@@ -1583,7 +1582,7 @@ enum class ImportKind : uint8_t {
1583
1582
class ImportDecl final : public Decl,
1584
1583
private llvm::TrailingObjects<ImportDecl, std::pair<Identifier,SourceLoc>> {
1585
1584
friend TrailingObjects;
1586
- friend class Decl ;
1585
+
1587
1586
public:
1588
1587
typedef std::pair<Identifier, SourceLoc> AccessPathElement;
1589
1588
@@ -1655,7 +1654,7 @@ class ImportDecl final : public Decl,
1655
1654
}
1656
1655
1657
1656
SourceLoc getStartLoc () const { return ImportLoc; }
1658
- SourceLoc getLocFromSource () const { return getFullAccessPath ().front ().second ; }
1657
+ SourceLoc getLoc () const { return getFullAccessPath ().front ().second ; }
1659
1658
SourceRange getSourceRange () const {
1660
1659
return SourceRange (ImportLoc, getFullAccessPath ().back ().second );
1661
1660
}
@@ -1717,7 +1716,6 @@ class ExtensionDecl final : public GenericContext, public Decl,
1717
1716
std::pair<LazyMemberLoader *, uint64_t > takeConformanceLoaderSlow ();
1718
1717
1719
1718
friend class ExtendedNominalRequest ;
1720
- friend class Decl ;
1721
1719
public:
1722
1720
using Decl::getASTContext;
1723
1721
@@ -1730,7 +1728,7 @@ class ExtensionDecl final : public GenericContext, public Decl,
1730
1728
ClangNode clangNode = ClangNode());
1731
1729
1732
1730
SourceLoc getStartLoc () const { return ExtensionLoc; }
1733
- SourceLoc getLocFromSource () const { return ExtensionLoc; }
1731
+ SourceLoc getLoc () const { return ExtensionLoc; }
1734
1732
SourceRange getSourceRange () const {
1735
1733
return { ExtensionLoc, Braces.End };
1736
1734
}
@@ -2043,7 +2041,7 @@ class PatternBindingEntry {
2043
2041
class PatternBindingDecl final : public Decl,
2044
2042
private llvm::TrailingObjects<PatternBindingDecl, PatternBindingEntry> {
2045
2043
friend TrailingObjects;
2046
- friend class Decl ;
2044
+
2047
2045
SourceLoc StaticLoc; // /< Location of the 'static/class' keyword, if present.
2048
2046
SourceLoc VarLoc; // /< Location of the 'var' keyword.
2049
2047
@@ -2052,7 +2050,7 @@ class PatternBindingDecl final : public Decl,
2052
2050
PatternBindingDecl (SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
2053
2051
SourceLoc VarLoc, unsigned NumPatternEntries,
2054
2052
DeclContext *Parent);
2055
- SourceLoc getLocFromSource () const { return VarLoc; }
2053
+
2056
2054
public:
2057
2055
static PatternBindingDecl *create (ASTContext &Ctx, SourceLoc StaticLoc,
2058
2056
StaticSpellingKind StaticSpelling,
@@ -2082,6 +2080,7 @@ class PatternBindingDecl final : public Decl,
2082
2080
SourceLoc getStartLoc () const {
2083
2081
return StaticLoc.isValid () ? StaticLoc : VarLoc;
2084
2082
}
2083
+ SourceLoc getLoc () const { return VarLoc; }
2085
2084
SourceRange getSourceRange () const ;
2086
2085
2087
2086
unsigned getNumPatternEntries () const {
@@ -2217,8 +2216,7 @@ class PatternBindingDecl final : public Decl,
2217
2216
// / global variables.
2218
2217
class TopLevelCodeDecl : public DeclContext , public Decl {
2219
2218
BraceStmt *Body;
2220
- SourceLoc getLocFromSource () const { return getStartLoc (); }
2221
- friend class Decl ;
2219
+
2222
2220
public:
2223
2221
TopLevelCodeDecl (DeclContext *Parent, BraceStmt *Body = nullptr )
2224
2222
: DeclContext(DeclContextKind::TopLevelCodeDecl, Parent),
@@ -2229,6 +2227,7 @@ class TopLevelCodeDecl : public DeclContext, public Decl {
2229
2227
void setBody (BraceStmt *b) { Body = b; }
2230
2228
2231
2229
SourceLoc getStartLoc () const ;
2230
+ SourceLoc getLoc () const { return getStartLoc (); }
2232
2231
SourceRange getSourceRange () const ;
2233
2232
2234
2233
static bool classof (const Decl *D) {
@@ -2267,8 +2266,6 @@ class IfConfigDecl : public Decl {
2267
2266
// / The array is ASTContext allocated.
2268
2267
ArrayRef<IfConfigClause> Clauses;
2269
2268
SourceLoc EndLoc;
2270
- SourceLoc getLocFromSource () const { return Clauses[0 ].Loc ; }
2271
- friend class Decl ;
2272
2269
public:
2273
2270
2274
2271
IfConfigDecl (DeclContext *Parent, ArrayRef<IfConfigClause> Clauses,
@@ -2294,6 +2291,7 @@ class IfConfigDecl : public Decl {
2294
2291
}
2295
2292
2296
2293
SourceLoc getEndLoc () const { return EndLoc; }
2294
+ SourceLoc getLoc () const { return Clauses[0 ].Loc ; }
2297
2295
2298
2296
bool hadMissingEnd () const { return Bits.IfConfigDecl .HadMissingEnd ; }
2299
2297
@@ -2310,8 +2308,7 @@ class PoundDiagnosticDecl : public Decl {
2310
2308
SourceLoc StartLoc;
2311
2309
SourceLoc EndLoc;
2312
2310
StringLiteralExpr *Message;
2313
- SourceLoc getLocFromSource () const { return StartLoc; }
2314
- friend class Decl ;
2311
+
2315
2312
public:
2316
2313
PoundDiagnosticDecl (DeclContext *Parent, bool IsError, SourceLoc StartLoc,
2317
2314
SourceLoc EndLoc, StringLiteralExpr *Message)
@@ -2340,6 +2337,7 @@ class PoundDiagnosticDecl : public Decl {
2340
2337
}
2341
2338
2342
2339
SourceLoc getEndLoc () const { return EndLoc; };
2340
+ SourceLoc getLoc () const { return StartLoc; }
2343
2341
2344
2342
SourceRange getSourceRange () const {
2345
2343
return SourceRange (StartLoc, EndLoc);
@@ -2402,8 +2400,7 @@ class ValueDecl : public Decl {
2402
2400
friend class IsFinalRequest ;
2403
2401
friend class IsDynamicRequest ;
2404
2402
friend class IsImplicitlyUnwrappedOptionalRequest ;
2405
- friend class Decl ;
2406
- SourceLoc getLocFromSource () const { return NameLoc; }
2403
+
2407
2404
protected:
2408
2405
ValueDecl (DeclKind K,
2409
2406
llvm::PointerUnion<DeclContext *, ASTContext *> context,
@@ -2476,6 +2473,7 @@ class ValueDecl : public Decl {
2476
2473
bool canInferObjCFromRequirement (ValueDecl *requirement);
2477
2474
2478
2475
SourceLoc getNameLoc () const { return NameLoc; }
2476
+ SourceLoc getLoc () const { return NameLoc; }
2479
2477
2480
2478
bool isUsableFromInline () const ;
2481
2479
@@ -6283,7 +6281,6 @@ AbstractStorageDecl::AccessorRecord::getAccessor(AccessorKind kind) const {
6283
6281
class EnumCaseDecl final : public Decl,
6284
6282
private llvm::TrailingObjects<EnumCaseDecl, EnumElementDecl *> {
6285
6283
friend TrailingObjects;
6286
- friend class Decl ;
6287
6284
SourceLoc CaseLoc;
6288
6285
6289
6286
EnumCaseDecl (SourceLoc CaseLoc,
@@ -6296,7 +6293,6 @@ class EnumCaseDecl final : public Decl,
6296
6293
std::uninitialized_copy (Elements.begin (), Elements.end (),
6297
6294
getTrailingObjects<EnumElementDecl *>());
6298
6295
}
6299
- SourceLoc getLocFromSource () const { return CaseLoc; }
6300
6296
6301
6297
public:
6302
6298
static EnumCaseDecl *create (SourceLoc CaseLoc,
@@ -6308,6 +6304,11 @@ class EnumCaseDecl final : public Decl,
6308
6304
return {getTrailingObjects<EnumElementDecl *>(),
6309
6305
Bits.EnumCaseDecl .NumElements };
6310
6306
}
6307
+
6308
+ SourceLoc getLoc () const {
6309
+ return CaseLoc;
6310
+ }
6311
+
6311
6312
SourceRange getSourceRange () const ;
6312
6313
6313
6314
static bool classof (const Decl *D) {
@@ -6720,8 +6721,7 @@ class PrecedenceGroupDecl : public Decl {
6720
6721
SourceLoc higherThanLoc, ArrayRef<Relation> higherThan,
6721
6722
SourceLoc lowerThanLoc, ArrayRef<Relation> lowerThan,
6722
6723
SourceLoc rbraceLoc);
6723
- friend class Decl ;
6724
- SourceLoc getLocFromSource () const { return NameLoc; }
6724
+
6725
6725
public:
6726
6726
static PrecedenceGroupDecl *create (DeclContext *dc,
6727
6727
SourceLoc precedenceGroupLoc,
@@ -6741,6 +6741,7 @@ class PrecedenceGroupDecl : public Decl {
6741
6741
SourceLoc rbraceLoc);
6742
6742
6743
6743
6744
+ SourceLoc getLoc () const { return NameLoc; }
6744
6745
SourceRange getSourceRange () const {
6745
6746
return { PrecedenceGroupLoc, RBraceLoc };
6746
6747
}
@@ -6859,8 +6860,7 @@ class OperatorDecl : public Decl {
6859
6860
ArrayRef<Identifier> Identifiers;
6860
6861
ArrayRef<SourceLoc> IdentifierLocs;
6861
6862
ArrayRef<NominalTypeDecl *> DesignatedNominalTypes;
6862
- SourceLoc getLocFromSource () const { return NameLoc; }
6863
- friend class Decl ;
6863
+
6864
6864
public:
6865
6865
OperatorDecl (DeclKind kind, DeclContext *DC, SourceLoc OperatorLoc,
6866
6866
Identifier Name, SourceLoc NameLoc,
@@ -6875,6 +6875,7 @@ class OperatorDecl : public Decl {
6875
6875
: Decl(kind, DC), OperatorLoc(OperatorLoc), NameLoc(NameLoc), name(Name),
6876
6876
DesignatedNominalTypes(DesignatedNominalTypes) {}
6877
6877
6878
+ SourceLoc getLoc () const { return NameLoc; }
6878
6879
6879
6880
SourceLoc getOperatorLoc () const { return OperatorLoc; }
6880
6881
SourceLoc getNameLoc () const { return NameLoc; }
@@ -7037,10 +7038,6 @@ class MissingMemberDecl : public Decl {
7037
7038
&& " not enough bits" );
7038
7039
setImplicit ();
7039
7040
}
7040
- friend class Decl ;
7041
- SourceLoc getLocFromSource () const {
7042
- return SourceLoc ();
7043
- }
7044
7041
public:
7045
7042
static MissingMemberDecl *
7046
7043
create (ASTContext &ctx, DeclContext *DC, DeclName name,
@@ -7065,6 +7062,10 @@ class MissingMemberDecl : public Decl {
7065
7062
return Bits.MissingMemberDecl .NumberOfFieldOffsetVectorEntries ;
7066
7063
}
7067
7064
7065
+ SourceLoc getLoc () const {
7066
+ return SourceLoc ();
7067
+ }
7068
+
7068
7069
SourceRange getSourceRange () const {
7069
7070
return SourceRange ();
7070
7071
}
0 commit comments