From f2b5df7391124f25fa723ae6bcb9809140f96192 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Mon, 13 Jun 2016 14:56:28 -0700 Subject: [PATCH] Sema: Use PointerEmbeddedInt instead of Fixnum 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. --- lib/Sema/CSApply.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 5e16e5a016669..644a885c3ce49 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -23,7 +23,6 @@ #include "swift/Basic/StringExtras.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" -#include "llvm/ADT/Fixnum.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/SaveAndRestore.h" @@ -1119,10 +1118,12 @@ namespace { /// \param locator Locator used to describe where in this expression we are. /// /// \returns the coerced expression, which will have type \c ToType. - Expr *coerceCallArguments(Expr *arg, Type paramType, - llvm::PointerUnion> - applyOrLevel, - ConstraintLocatorBuilder locator); + using LevelTy = llvm::PointerEmbeddedInt; + + Expr * + coerceCallArguments(Expr *arg, Type paramType, + llvm::PointerUnion applyOrLevel, + ConstraintLocatorBuilder locator); /// \brief Coerce the given object argument (e.g., for the base of a /// member expression) to the given type. @@ -1191,9 +1192,9 @@ namespace { } // Coerce the index argument. - index = coerceCallArguments(index, indexTy, /*level=*/llvm::Fixnum<2>(1), - locator.withPathElement( - ConstraintLocator::SubscriptIndex)); + index = coerceCallArguments( + index, indexTy, LevelTy(1), + locator.withPathElement(ConstraintLocator::SubscriptIndex)); if (!index) return nullptr; @@ -4545,7 +4546,7 @@ static bool isReferenceToMetatypeMember(Expr *expr) { Expr *ExprRewriter::coerceCallArguments( Expr *arg, Type paramType, - llvm::PointerUnion> applyOrLevel, + llvm::PointerUnion applyOrLevel, ConstraintLocatorBuilder locator) { bool allParamsMatch = arg->getType()->isEqual(paramType); @@ -4556,9 +4557,9 @@ Expr *ExprRewriter::coerceCallArguments( // Determine the level, unsigned level = 0; - if (applyOrLevel.is>()) { + if (applyOrLevel.is()) { // Level specified by caller. - level = applyOrLevel.get>(); + level = applyOrLevel.get(); } else if (callee) { // Determine the level based on the application itself. auto apply = applyOrLevel.get();