@@ -1834,8 +1834,6 @@ namespace {
1834
1834
Expr *forceBridgeFromObjectiveC (Expr *object, Type valueType) {
1835
1835
return bridgeFromObjectiveC (object, valueType, false );
1836
1836
}
1837
-
1838
- TypeAliasDecl *MaxFloatTypeDecl = nullptr ;
1839
1837
1840
1838
public:
1841
1839
ExprRewriter (ConstraintSystem &cs, const Solution &solution,
@@ -2002,25 +2000,18 @@ namespace {
2002
2000
type = defaultType;
2003
2001
}
2004
2002
2005
- // Find the maximum-sized builtin float type.
2006
- // FIXME: Cache name lookup.
2007
- if (!MaxFloatTypeDecl) {
2008
- SmallVector<ValueDecl *, 1 > lookupResults;
2009
- tc.getStdlibModule (dc)->lookupValue (/* AccessPath=*/ {},
2010
- tc.Context .Id_MaxBuiltinFloatType ,
2011
- NLKind::QualifiedLookup,
2012
- lookupResults);
2013
- if (lookupResults.size () == 1 )
2014
- MaxFloatTypeDecl = dyn_cast<TypeAliasDecl>(lookupResults.front ());
2015
- }
2016
- if (!MaxFloatTypeDecl ||
2017
- !MaxFloatTypeDecl->hasInterfaceType () ||
2018
- !MaxFloatTypeDecl->getDeclaredInterfaceType ()->is <BuiltinFloatType>()) {
2003
+ // Get the _MaxBuiltinFloatType decl, or look for it if it's not cached.
2004
+ auto maxFloatTypeDecl = tc.Context .get_MaxBuiltinFloatTypeDecl ();
2005
+
2006
+ if (!maxFloatTypeDecl ||
2007
+ !maxFloatTypeDecl->hasInterfaceType () ||
2008
+ !maxFloatTypeDecl->getDeclaredInterfaceType ()->is <BuiltinFloatType>()) {
2019
2009
tc.diagnose (expr->getLoc (), diag::no_MaxBuiltinFloatType_found);
2020
2010
return nullptr ;
2021
2011
}
2022
- tc.validateDecl (MaxFloatTypeDecl);
2023
- auto maxType = MaxFloatTypeDecl->getUnderlyingTypeLoc ().getType ();
2012
+
2013
+ tc.validateDecl (maxFloatTypeDecl);
2014
+ auto maxType = maxFloatTypeDecl->getUnderlyingTypeLoc ().getType ();
2024
2015
2025
2016
DeclName initName (tc.Context , DeclBaseName::createConstructor (),
2026
2017
{ tc.Context .Id_floatLiteral });
0 commit comments