Skip to content

Commit a4d5141

Browse files
committed
[AST] NFC: Rename FunctionRefKind -> FunctionRefInfo
1 parent 3e73210 commit a4d5141

27 files changed

+270
-270
lines changed

include/swift/AST/Expr.h

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "swift/AST/DeclContext.h"
2727
#include "swift/AST/DeclNameLoc.h"
2828
#include "swift/AST/FreestandingMacroExpansion.h"
29-
#include "swift/AST/FunctionRefKind.h"
29+
#include "swift/AST/FunctionRefInfo.h"
3030
#include "swift/AST/ProtocolConformanceRef.h"
3131
#include "swift/AST/ThrownErrorDestination.h"
3232
#include "swift/AST/TypeAlignments.h"
@@ -195,14 +195,14 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
195195

196196
SWIFT_INLINE_BITFIELD(DeclRefExpr, Expr, 2+2+1+1,
197197
Semantics : 2, // an AccessSemantics
198-
FunctionRefKind : 2,
198+
FunctionRefInfo : 2,
199199
IsImplicitlyAsync : 1,
200200
IsImplicitlyThrows : 1
201201
);
202202

203203
SWIFT_INLINE_BITFIELD(UnresolvedDeclRefExpr, Expr, 2+2,
204204
DeclRefKind : 2,
205-
FunctionRefKind : 2
205+
FunctionRefInfo : 2
206206
);
207207

208208
SWIFT_INLINE_BITFIELD(MemberRefExpr, LookupExpr, 2,
@@ -226,7 +226,7 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
226226
);
227227

228228
SWIFT_INLINE_BITFIELD(UnresolvedDotExpr, Expr, 2,
229-
FunctionRefKind : 2
229+
FunctionRefInfo : 2
230230
);
231231

232232
SWIFT_INLINE_BITFIELD_FULL(SubscriptExpr, LookupExpr, 2,
@@ -236,11 +236,11 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
236236
SWIFT_INLINE_BITFIELD_EMPTY(DynamicSubscriptExpr, DynamicLookupExpr);
237237

238238
SWIFT_INLINE_BITFIELD_FULL(UnresolvedMemberExpr, Expr, 2,
239-
FunctionRefKind : 2
239+
FunctionRefInfo : 2
240240
);
241241

242242
SWIFT_INLINE_BITFIELD(OverloadSetRefExpr, Expr, 2,
243-
FunctionRefKind : 2
243+
FunctionRefInfo : 2
244244
);
245245

246246
SWIFT_INLINE_BITFIELD(BooleanLiteralExpr, LiteralExpr, 1,
@@ -1231,9 +1231,9 @@ class DeclRefExpr : public Expr {
12311231
: Expr(ExprKind::DeclRef, Implicit, Ty), D(D), Loc(Loc),
12321232
implicitActorHopTarget(ActorIsolation::forUnspecified()) {
12331233
Bits.DeclRefExpr.Semantics = (unsigned) semantics;
1234-
Bits.DeclRefExpr.FunctionRefKind =
1235-
static_cast<unsigned>(Loc.isCompound() ? FunctionRefKind::Compound
1236-
: FunctionRefKind::Unapplied);
1234+
Bits.DeclRefExpr.FunctionRefInfo =
1235+
static_cast<unsigned>(Loc.isCompound() ? FunctionRefInfo::Compound
1236+
: FunctionRefInfo::Unapplied);
12371237
Bits.DeclRefExpr.IsImplicitlyAsync = false;
12381238
Bits.DeclRefExpr.IsImplicitlyThrows = false;
12391239
}
@@ -1300,13 +1300,13 @@ class DeclRefExpr : public Expr {
13001300
DeclNameLoc getNameLoc() const { return Loc; }
13011301

13021302
/// Retrieve the kind of function reference.
1303-
FunctionRefKind getFunctionRefKind() const {
1304-
return static_cast<FunctionRefKind>(Bits.DeclRefExpr.FunctionRefKind);
1303+
FunctionRefInfo getFunctionRefInfo() const {
1304+
return static_cast<FunctionRefInfo>(Bits.DeclRefExpr.FunctionRefInfo);
13051305
}
13061306

13071307
/// Set the kind of function reference.
1308-
void setFunctionRefKind(FunctionRefKind refKind) {
1309-
Bits.DeclRefExpr.FunctionRefKind = static_cast<unsigned>(refKind);
1308+
void setFunctionRefInfo(FunctionRefInfo refKind) {
1309+
Bits.DeclRefExpr.FunctionRefInfo = static_cast<unsigned>(refKind);
13101310
}
13111311

13121312
static bool classof(const Expr *E) {
@@ -1506,10 +1506,10 @@ class OverloadSetRefExpr : public Expr {
15061506

15071507
protected:
15081508
OverloadSetRefExpr(ExprKind Kind, ArrayRef<ValueDecl*> decls,
1509-
FunctionRefKind functionRefKind, bool Implicit, Type Ty)
1509+
FunctionRefInfo functionRefInfo, bool Implicit, Type Ty)
15101510
: Expr(Kind, Implicit, Ty), Decls(decls) {
1511-
Bits.OverloadSetRefExpr.FunctionRefKind =
1512-
static_cast<unsigned>(functionRefKind);
1511+
Bits.OverloadSetRefExpr.FunctionRefInfo =
1512+
static_cast<unsigned>(functionRefInfo);
15131513
}
15141514

15151515
public:
@@ -1529,14 +1529,14 @@ class OverloadSetRefExpr : public Expr {
15291529
bool hasBaseObject() const;
15301530

15311531
/// Retrieve the kind of function reference.
1532-
FunctionRefKind getFunctionRefKind() const {
1533-
return static_cast<FunctionRefKind>(
1534-
Bits.OverloadSetRefExpr.FunctionRefKind);
1532+
FunctionRefInfo getFunctionRefInfo() const {
1533+
return static_cast<FunctionRefInfo>(
1534+
Bits.OverloadSetRefExpr.FunctionRefInfo);
15351535
}
15361536

15371537
/// Set the kind of function reference.
1538-
void setFunctionRefKind(FunctionRefKind refKind) {
1539-
Bits.OverloadSetRefExpr.FunctionRefKind = static_cast<unsigned>(refKind);
1538+
void setFunctionRefInfo(FunctionRefInfo refKind) {
1539+
Bits.OverloadSetRefExpr.FunctionRefInfo = static_cast<unsigned>(refKind);
15401540
}
15411541

15421542
static bool classof(const Expr *E) {
@@ -1552,9 +1552,9 @@ class OverloadedDeclRefExpr final : public OverloadSetRefExpr {
15521552

15531553
public:
15541554
OverloadedDeclRefExpr(ArrayRef<ValueDecl*> Decls, DeclNameLoc Loc,
1555-
FunctionRefKind functionRefKind,
1555+
FunctionRefInfo functionRefInfo,
15561556
bool Implicit, Type Ty = Type())
1557-
: OverloadSetRefExpr(ExprKind::OverloadedDeclRef, Decls, functionRefKind,
1557+
: OverloadSetRefExpr(ExprKind::OverloadedDeclRef, Decls, functionRefInfo,
15581558
Implicit, Ty),
15591559
Loc(Loc) {
15601560
}
@@ -1584,9 +1584,9 @@ class UnresolvedDeclRefExpr : public Expr {
15841584
: Expr(ExprKind::UnresolvedDeclRef, /*Implicit=*/loc.isInvalid()),
15851585
Name(name), Loc(loc) {
15861586
Bits.UnresolvedDeclRefExpr.DeclRefKind = static_cast<unsigned>(refKind);
1587-
Bits.UnresolvedDeclRefExpr.FunctionRefKind =
1588-
static_cast<unsigned>(Loc.isCompound() ? FunctionRefKind::Compound
1589-
: FunctionRefKind::Unapplied);
1587+
Bits.UnresolvedDeclRefExpr.FunctionRefInfo =
1588+
static_cast<unsigned>(Loc.isCompound() ? FunctionRefInfo::Compound
1589+
: FunctionRefInfo::Unapplied);
15901590
}
15911591

15921592
static UnresolvedDeclRefExpr *createImplicit(
@@ -1616,14 +1616,14 @@ class UnresolvedDeclRefExpr : public Expr {
16161616
}
16171617

16181618
/// Retrieve the kind of function reference.
1619-
FunctionRefKind getFunctionRefKind() const {
1620-
return static_cast<FunctionRefKind>(
1621-
Bits.UnresolvedDeclRefExpr.FunctionRefKind);
1619+
FunctionRefInfo getFunctionRefInfo() const {
1620+
return static_cast<FunctionRefInfo>(
1621+
Bits.UnresolvedDeclRefExpr.FunctionRefInfo);
16221622
}
16231623

16241624
/// Set the kind of function reference.
1625-
void setFunctionRefKind(FunctionRefKind refKind) {
1626-
Bits.UnresolvedDeclRefExpr.FunctionRefKind = static_cast<unsigned>(refKind);
1625+
void setFunctionRefInfo(FunctionRefInfo refKind) {
1626+
Bits.UnresolvedDeclRefExpr.FunctionRefInfo = static_cast<unsigned>(refKind);
16271627
}
16281628

16291629
DeclNameLoc getNameLoc() const { return Loc; }
@@ -1901,7 +1901,7 @@ class UnresolvedMemberExpr final
19011901
bool implicit)
19021902
: Expr(ExprKind::UnresolvedMember, implicit), DotLoc(dotLoc),
19031903
NameLoc(nameLoc), Name(name) {
1904-
// FIXME: Really, we should be setting this to `FunctionRefKind::Compound`
1904+
// FIXME: Really, we should be setting this to `FunctionRefInfo::Compound`
19051905
// if `NameLoc` is compound, but this would be a source break for cases like
19061906
// ```
19071907
// struct S {
@@ -1912,8 +1912,8 @@ class UnresolvedMemberExpr final
19121912
// ```
19131913
// Instead, we should store compound-ness as a separate bit from applied/
19141914
// unapplied.
1915-
Bits.UnresolvedMemberExpr.FunctionRefKind =
1916-
static_cast<unsigned>(FunctionRefKind::Unapplied);
1915+
Bits.UnresolvedMemberExpr.FunctionRefInfo =
1916+
static_cast<unsigned>(FunctionRefInfo::Unapplied);
19171917
}
19181918

19191919
DeclNameRef getName() const { return Name; }
@@ -1926,14 +1926,14 @@ class UnresolvedMemberExpr final
19261926
SourceLoc getEndLoc() const { return NameLoc.getSourceRange().End; }
19271927

19281928
/// Retrieve the kind of function reference.
1929-
FunctionRefKind getFunctionRefKind() const {
1930-
return static_cast<FunctionRefKind>(
1931-
Bits.UnresolvedMemberExpr.FunctionRefKind);
1929+
FunctionRefInfo getFunctionRefInfo() const {
1930+
return static_cast<FunctionRefInfo>(
1931+
Bits.UnresolvedMemberExpr.FunctionRefInfo);
19321932
}
19331933

19341934
/// Set the kind of function reference.
1935-
void setFunctionRefKind(FunctionRefKind refKind) {
1936-
Bits.UnresolvedMemberExpr.FunctionRefKind = static_cast<unsigned>(refKind);
1935+
void setFunctionRefInfo(FunctionRefInfo refKind) {
1936+
Bits.UnresolvedMemberExpr.FunctionRefInfo = static_cast<unsigned>(refKind);
19371937
}
19381938

19391939
static bool classof(const Expr *E) {
@@ -2627,9 +2627,9 @@ class UnresolvedDotExpr : public Expr {
26272627
: Expr(ExprKind::UnresolvedDot, Implicit), SubExpr(subexpr),
26282628
DotLoc(dotloc), NameLoc(nameloc), Name(name),
26292629
OuterAlternatives(outerAlternatives) {
2630-
Bits.UnresolvedDotExpr.FunctionRefKind =
2631-
static_cast<unsigned>(NameLoc.isCompound() ? FunctionRefKind::Compound
2632-
: FunctionRefKind::Unapplied);
2630+
Bits.UnresolvedDotExpr.FunctionRefInfo =
2631+
static_cast<unsigned>(NameLoc.isCompound() ? FunctionRefInfo::Compound
2632+
: FunctionRefInfo::Unapplied);
26332633
}
26342634

26352635
static UnresolvedDotExpr *createImplicit(
@@ -2692,13 +2692,13 @@ class UnresolvedDotExpr : public Expr {
26922692
}
26932693

26942694
/// Retrieve the kind of function reference.
2695-
FunctionRefKind getFunctionRefKind() const {
2696-
return static_cast<FunctionRefKind>(Bits.UnresolvedDotExpr.FunctionRefKind);
2695+
FunctionRefInfo getFunctionRefInfo() const {
2696+
return static_cast<FunctionRefInfo>(Bits.UnresolvedDotExpr.FunctionRefInfo);
26972697
}
26982698

26992699
/// Set the kind of function reference.
2700-
void setFunctionRefKind(FunctionRefKind refKind) {
2701-
Bits.UnresolvedDotExpr.FunctionRefKind = static_cast<unsigned>(refKind);
2700+
void setFunctionRefInfo(FunctionRefInfo refKind) {
2701+
Bits.UnresolvedDotExpr.FunctionRefInfo = static_cast<unsigned>(refKind);
27022702
}
27032703

27042704
static bool classof(const Expr *E) {

include/swift/AST/FunctionRefKind.h renamed to include/swift/AST/FunctionRefInfo.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- FunctionRefKind.h - Function reference kind ------------*- C++ -*-===//
1+
//===--- FunctionRefInfo.h - Function reference info ------------*- C++ -*-===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -10,12 +10,12 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
//
13-
// This file defines the FunctionRefKind enum, which is used to describe how
13+
// This file defines the FunctionRefInfo enum, which is used to describe how
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
#ifndef SWIFT_AST_FUNCTION_REF_KIND_H
18-
#define SWIFT_AST_FUNCTION_REF_KIND_H
17+
#ifndef SWIFT_AST_FUNCTION_REF_INFO_H
18+
#define SWIFT_AST_FUNCTION_REF_INFO_H
1919

2020
#include "llvm/ADT/StringRef.h"
2121

@@ -28,7 +28,7 @@ namespace swift {
2828
/// How a function is referenced comes down to how it was spelled in
2929
/// the source code, e.g., was it called in the source code and was it
3030
/// spelled as a compound name.
31-
enum class FunctionRefKind : unsigned {
31+
enum class FunctionRefInfo : unsigned {
3232
/// The function was referenced using a bare function name (e.g.,
3333
/// 'f') and not directly called.
3434
Unapplied,
@@ -45,8 +45,8 @@ enum class FunctionRefKind : unsigned {
4545

4646
/// Produce a string describing a function reference kind, for
4747
/// debugging purposes.
48-
llvm::StringRef getFunctionRefKindStr(FunctionRefKind refKind);
48+
llvm::StringRef getFunctionRefInfoStr(FunctionRefInfo refKind);
4949

5050
}
5151

52-
#endif // SWIFT_AST_FUNCTION_REF_KIND_H
52+
#endif // SWIFT_AST_FUNCTION_REF_INFO_H

include/swift/Sema/CSFix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3244,7 +3244,7 @@ class SpecifyBaseTypeForOptionalUnresolvedMember final : public ConstraintFix {
32443244

32453245
static SpecifyBaseTypeForOptionalUnresolvedMember *
32463246
attempt(ConstraintSystem &cs, ConstraintKind kind, Type baseTy,
3247-
DeclNameRef memberName, FunctionRefKind functionRefKind,
3247+
DeclNameRef memberName, FunctionRefInfo functionRefInfo,
32483248
MemberLookupResult result, ConstraintLocator *locator);
32493249

32503250
static bool classof(const ConstraintFix *fix) {

include/swift/Sema/Constraint.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define SWIFT_SEMA_CONSTRAINT_H
2020

2121
#include "swift/AST/ASTNode.h"
22-
#include "swift/AST/FunctionRefKind.h"
22+
#include "swift/AST/FunctionRefInfo.h"
2323
#include "swift/AST/Identifier.h"
2424
#include "swift/AST/Type.h"
2525
#include "swift/AST/TypeLoc.h"
@@ -384,7 +384,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
384384
unsigned NumTypeVariables : 11;
385385

386386
/// The kind of function reference, for member references.
387-
unsigned TheFunctionRefKind : 2;
387+
unsigned TheFunctionRefInfo : 2;
388388

389389
/// The trailing closure matching for an applicable function constraint,
390390
/// if any. 0 = None, 1 = Forward, 2 = Backward.
@@ -471,14 +471,14 @@ class Constraint final : public llvm::ilist_node<Constraint>,
471471

472472
/// Construct a new member constraint.
473473
Constraint(ConstraintKind kind, Type first, Type second, DeclNameRef member,
474-
DeclContext *useDC, FunctionRefKind functionRefKind,
474+
DeclContext *useDC, FunctionRefInfo functionRefInfo,
475475
ConstraintLocator *locator,
476476
SmallPtrSetImpl<TypeVariableType *> &typeVars);
477477

478478
/// Construct a new value witness constraint.
479479
Constraint(ConstraintKind kind, Type first, Type second,
480480
ValueDecl *requirement, DeclContext *useDC,
481-
FunctionRefKind functionRefKind, ConstraintLocator *locator,
481+
FunctionRefInfo functionRefInfo, ConstraintLocator *locator,
482482
SmallPtrSetImpl<TypeVariableType *> &typeVars);
483483

484484
/// Construct a new overload-binding constraint, which might have a fix.
@@ -534,21 +534,21 @@ class Constraint final : public llvm::ilist_node<Constraint>,
534534
/// alternatives.
535535
static Constraint *createMemberOrOuterDisjunction(
536536
ConstraintSystem &cs, ConstraintKind kind, Type first, Type second,
537-
DeclNameRef member, DeclContext *useDC, FunctionRefKind functionRefKind,
537+
DeclNameRef member, DeclContext *useDC, FunctionRefInfo functionRefInfo,
538538
ArrayRef<OverloadChoice> outerAlternatives, ConstraintLocator *locator);
539539

540540
/// Create a new member constraint.
541541
static Constraint *createMember(ConstraintSystem &cs, ConstraintKind kind,
542542
Type first, Type second, DeclNameRef member,
543543
DeclContext *useDC,
544-
FunctionRefKind functionRefKind,
544+
FunctionRefInfo functionRefInfo,
545545
ConstraintLocator *locator);
546546

547547
/// Create a new value witness constraint.
548548
static Constraint *createValueWitness(
549549
ConstraintSystem &cs, ConstraintKind kind, Type first, Type second,
550550
ValueDecl *requirement, DeclContext *useDC,
551-
FunctionRefKind functionRefKind, ConstraintLocator *locator);
551+
FunctionRefInfo functionRefInfo, ConstraintLocator *locator);
552552

553553
/// Create an overload-binding constraint, possibly with a fix.
554554
static Constraint *createBindOverload(ConstraintSystem &cs, Type type,
@@ -798,14 +798,14 @@ class Constraint final : public llvm::ilist_node<Constraint>,
798798
}
799799

800800
/// Determine the kind of function reference we have for a member reference.
801-
FunctionRefKind getFunctionRefKind() const {
801+
FunctionRefInfo getFunctionRefInfo() const {
802802
if (Kind == ConstraintKind::ValueMember ||
803803
Kind == ConstraintKind::UnresolvedValueMember ||
804804
Kind == ConstraintKind::ValueWitness)
805-
return static_cast<FunctionRefKind>(TheFunctionRefKind);
805+
return static_cast<FunctionRefInfo>(TheFunctionRefInfo);
806806

807807
// Conservative answer: drop all of the labels.
808-
return FunctionRefKind::Compound;
808+
return FunctionRefInfo::Compound;
809809
}
810810

811811
/// Retrieve the set of constraints in a disjunction.

0 commit comments

Comments
 (0)