Skip to content

Commit a592a78

Browse files
compnerdjrose-apple
authored andcommitted
Sema: Use PointerEmbeddedInt instead of Fixnum (#3009)
PointerEmbeddedInt is provided by stock LLVM and serves the same purpose. This updates the coersion function to use that rather than the swift specific Fixnum. Furthermore, this type has been removed in the future in favour of the PointerEmbeddedInt type, which makes this change something which will be needed when rebasing to a newer LLVM release.
1 parent 41c51d1 commit a592a78

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lib/Sema/CSApply.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "swift/Basic/StringExtras.h"
2424
#include "llvm/ADT/APFloat.h"
2525
#include "llvm/ADT/APInt.h"
26-
#include "llvm/ADT/Fixnum.h"
2726
#include "llvm/ADT/SmallString.h"
2827
#include "llvm/Support/SaveAndRestore.h"
2928

@@ -1137,10 +1136,12 @@ namespace {
11371136
/// \param locator Locator used to describe where in this expression we are.
11381137
///
11391138
/// \returns the coerced expression, which will have type \c ToType.
1140-
Expr *coerceCallArguments(Expr *arg, Type paramType,
1141-
llvm::PointerUnion<ApplyExpr *, llvm::Fixnum<2>>
1142-
applyOrLevel,
1143-
ConstraintLocatorBuilder locator);
1139+
using LevelTy = llvm::PointerEmbeddedInt<unsigned, 2>;
1140+
1141+
Expr *
1142+
coerceCallArguments(Expr *arg, Type paramType,
1143+
llvm::PointerUnion<ApplyExpr *, LevelTy> applyOrLevel,
1144+
ConstraintLocatorBuilder locator);
11441145

11451146
/// \brief Coerce the given object argument (e.g., for the base of a
11461147
/// member expression) to the given type.
@@ -1209,9 +1210,9 @@ namespace {
12091210
}
12101211

12111212
// Coerce the index argument.
1212-
index = coerceCallArguments(index, indexTy, /*level=*/llvm::Fixnum<2>(1),
1213-
locator.withPathElement(
1214-
ConstraintLocator::SubscriptIndex));
1213+
index = coerceCallArguments(
1214+
index, indexTy, LevelTy(1),
1215+
locator.withPathElement(ConstraintLocator::SubscriptIndex));
12151216
if (!index)
12161217
return nullptr;
12171218

@@ -4563,7 +4564,7 @@ static bool isReferenceToMetatypeMember(Expr *expr) {
45634564

45644565
Expr *ExprRewriter::coerceCallArguments(
45654566
Expr *arg, Type paramType,
4566-
llvm::PointerUnion<ApplyExpr *, llvm::Fixnum<2>> applyOrLevel,
4567+
llvm::PointerUnion<ApplyExpr *, LevelTy> applyOrLevel,
45674568
ConstraintLocatorBuilder locator) {
45684569

45694570
bool allParamsMatch = arg->getType()->isEqual(paramType);
@@ -4574,9 +4575,9 @@ Expr *ExprRewriter::coerceCallArguments(
45744575

45754576
// Determine the level,
45764577
unsigned level = 0;
4577-
if (applyOrLevel.is<llvm::Fixnum<2>>()) {
4578+
if (applyOrLevel.is<LevelTy>()) {
45784579
// Level specified by caller.
4579-
level = applyOrLevel.get<llvm::Fixnum<2>>();
4580+
level = applyOrLevel.get<LevelTy>();
45804581
} else if (callee) {
45814582
// Determine the level based on the application itself.
45824583
auto apply = applyOrLevel.get<ApplyExpr *>();

0 commit comments

Comments
 (0)