Skip to content

Commit 931d06d

Browse files
authored
Merge pull request #15325 from slavapestov/so-much-dead-code
AST: Remove unused inferDefaultArgumentKind() function
2 parents f53009a + d68ee9f commit 931d06d

File tree

2 files changed

+0
-57
lines changed

2 files changed

+0
-57
lines changed

include/swift/AST/DefaultArgumentKind.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ enum { NumDefaultArgumentKindBits = 4 };
5959
/// an empty string if it has none.
6060
llvm::StringRef getDefaultArgumentSpelling(DefaultArgumentKind kind);
6161

62-
/// Infer a default argument kind from an expression, if the
63-
/// expression is the canonical way to spell that default argument.
64-
DefaultArgumentKind inferDefaultArgumentKind(Expr *expr);
65-
6662
} // end namespace swift
6763

6864
#endif // LLVM_SWIFT_DEFAULTARGUMENTKIND_H

lib/AST/DefaultArgumentKind.cpp

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -37,56 +37,3 @@ StringRef swift::getDefaultArgumentSpelling(DefaultArgumentKind kind) {
3737

3838
llvm_unreachable("Unhandled DefaultArgumentKind in switch.");
3939
}
40-
41-
DefaultArgumentKind swift::inferDefaultArgumentKind(Expr *expr) {
42-
if (auto call = dyn_cast<CallExpr>(expr)) {
43-
if (auto ctorRefCall = dyn_cast<ConstructorRefCallExpr>(call->getFn())) {
44-
if (auto ctorRef = dyn_cast<DeclRefExpr>(ctorRefCall->getFn())) {
45-
if (auto ctor = dyn_cast<ConstructorDecl>(ctorRef->getDecl())) {
46-
auto ctorArg = call->getArg()->getSemanticsProvidingExpr();
47-
48-
// #file, #line, #column, #function, #dsohandle.
49-
if (auto magic = dyn_cast<MagicIdentifierLiteralExpr>(ctorArg)) {
50-
switch (magic->getKind()) {
51-
case MagicIdentifierLiteralExpr::File:
52-
return DefaultArgumentKind::File;
53-
case MagicIdentifierLiteralExpr::Line:
54-
return DefaultArgumentKind::Line;
55-
case MagicIdentifierLiteralExpr::Column:
56-
return DefaultArgumentKind::Column;
57-
case MagicIdentifierLiteralExpr::Function:
58-
return DefaultArgumentKind::Function;
59-
case MagicIdentifierLiteralExpr::DSOHandle:
60-
return DefaultArgumentKind::DSOHandle;
61-
}
62-
}
63-
64-
// nil.
65-
if (ctor->getFullName().getArgumentNames().size() == 1 &&
66-
ctor->getFullName().getArgumentNames()[0]
67-
== ctor->getASTContext().Id_nilLiteral)
68-
return DefaultArgumentKind::NilLiteral;
69-
}
70-
}
71-
}
72-
}
73-
74-
// Empty array literals, [].
75-
if (auto arrayExpr = dyn_cast<ArrayExpr>(expr)) {
76-
if (arrayExpr->getElements().empty())
77-
return DefaultArgumentKind::EmptyArray;
78-
79-
return DefaultArgumentKind::None;
80-
}
81-
82-
// Empty dictionary literals, [:].
83-
if (auto dictionaryExpr = dyn_cast<DictionaryExpr>(expr)) {
84-
if (dictionaryExpr->getElements().empty())
85-
return DefaultArgumentKind::EmptyDictionary;
86-
87-
return DefaultArgumentKind::None;
88-
}
89-
90-
return DefaultArgumentKind::None;
91-
}
92-

0 commit comments

Comments
 (0)