Skip to content

Commit 09395ba

Browse files
committed
[NFC] Inline TypeChecker::getInt8Type and TypeChecker::getUInt8Type
1 parent f02a0f0 commit 09395ba

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,9 +2426,9 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
24262426
static bool isStringCompatiblePointerBaseType(ASTContext &ctx,
24272427
Type baseType) {
24282428
// Allow strings to be passed to pointer-to-byte or pointer-to-void types.
2429-
if (baseType->isEqual(TypeChecker::getInt8Type(ctx)))
2429+
if (baseType->isEqual(ctx.getInt8Decl()->getDeclaredInterfaceType()))
24302430
return true;
2431-
if (baseType->isEqual(TypeChecker::getUInt8Type(ctx)))
2431+
if (baseType->isEqual(ctx.getUInt8Decl()->getDeclaredInterfaceType()))
24322432
return true;
24332433
if (baseType->isEqual(ctx.TheEmptyTupleType))
24342434
return true;
@@ -9213,11 +9213,11 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
92139213
auto &ctx = getASTContext();
92149214
auto int8Con = Constraint::create(*this, ConstraintKind::Bind,
92159215
baseType2,
9216-
TypeChecker::getInt8Type(ctx),
9216+
ctx.getInt8Decl()->getDeclaredInterfaceType(),
92179217
getConstraintLocator(locator));
92189218
auto uint8Con = Constraint::create(*this, ConstraintKind::Bind,
92199219
baseType2,
9220-
TypeChecker::getUInt8Type(ctx),
9220+
ctx.getUInt8Decl()->getDeclaredInterfaceType(),
92219221
getConstraintLocator(locator));
92229222
auto voidCon = Constraint::create(*this, ConstraintKind::Bind,
92239223
baseType2, ctx.TheEmptyTupleType,

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,21 +386,7 @@ Type TypeChecker::getStringType(ASTContext &Context) {
386386

387387
return Type();
388388
}
389-
390-
return Type();
391-
}
392-
393-
Type TypeChecker::getInt8Type(ASTContext &Context) {
394-
if (auto typeDecl = Context.getInt8Decl())
395-
return typeDecl->getDeclaredInterfaceType();
396-
397-
return Type();
398-
}
399-
400-
Type TypeChecker::getUInt8Type(ASTContext &Context) {
401-
if (auto typeDecl = Context.getUInt8Decl())
402-
return typeDecl->getDeclaredInterfaceType();
403-
389+
llvm::report_fatal_error("Broken Standard library: Cannot resolve String");
404390
return Type();
405391
}
406392

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,6 @@ Type getArraySliceType(SourceLoc loc, Type elementType);
348348
Type getOptionalType(SourceLoc loc, Type elementType);
349349
Type getStringType(ASTContext &ctx);
350350
Type getSubstringType(ASTContext &ctx);
351-
Type getInt8Type(ASTContext &ctx);
352-
Type getUInt8Type(ASTContext &ctx);
353351

354352
/// Bind an UnresolvedDeclRefExpr by performing name lookup and
355353
/// returning the resultant expression. Context is the DeclContext used

0 commit comments

Comments
 (0)