Skip to content

Commit e15eb47

Browse files
committed
Inline TypeChecker::getExceptionType
1 parent 80ee233 commit e15eb47

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

lib/Sema/CSGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ namespace {
22982298
// Okay, now it should be safe to coerce the pattern.
22992299
// Pull the top-level pattern back out.
23002300
pattern = clause->getErrorPattern();
2301-
Type exnType = CS.TC.getExceptionType(CS.DC, clause->getCatchLoc());
2301+
Type exnType = CS.getASTContext().getErrorDecl()->getDeclaredType();
23022302
if (!exnType)
23032303
return false;
23042304
if (CS.TC.coercePatternToType(pattern,

lib/Sema/TypeCheckStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
621621
// Coerce the operand to the exception type.
622622
auto E = TS->getSubExpr();
623623

624-
Type exnType = TC.getExceptionType(DC, TS->getThrowLoc());
624+
Type exnType = getASTContext().getErrorDecl()->getDeclaredType();
625625
if (!exnType) return TS;
626626

627627
TC.typeCheckExpression(E, DC, TypeLoc::withoutLoc(exnType), CTP_ThrowStmt);

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,6 @@ Type TypeChecker::getUInt8Type(DeclContext *dc) {
410410
return Type();
411411
}
412412

413-
/// Find the standard type of exceptions.
414-
///
415-
/// We call this the "exception type" to try to avoid confusion with
416-
/// the AST's ErrorType node.
417-
Type TypeChecker::getExceptionType(DeclContext *dc, SourceLoc loc) {
418-
return Context.getErrorDecl()->getDeclaredType();
419-
}
420-
421413
Type
422414
TypeChecker::getDynamicBridgedThroughObjCClass(DeclContext *dc,
423415
Type dynamicType,

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,6 @@ class TypeChecker final {
742742
Type getUInt8Type(DeclContext *dc);
743743
Type getNSObjectType(DeclContext *dc);
744744
Type getObjCSelectorType(DeclContext *dc);
745-
Type getExceptionType(DeclContext *dc, SourceLoc loc);
746745

747746
/// Try to resolve an IdentTypeRepr, returning either the referenced
748747
/// Type or an ErrorType in case of error.

0 commit comments

Comments
 (0)