Skip to content

Commit 0af574a

Browse files
author
Greg Parker
committed
[AST] Rename DefaultArgumentKind::Nil to NilLiteral.
This avoids a conflict with #define Nil in objc/objc.h.
1 parent cb5249b commit 0af574a

File tree

10 files changed

+14
-14
lines changed

10 files changed

+14
-14
lines changed

include/swift/AST/DefaultArgumentKind.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum class DefaultArgumentKind : unsigned {
4545
/// The #dsohandle default argument, which is expanded at the call site.
4646
DSOHandle,
4747
/// The "nil" literal.
48-
Nil,
48+
NilLiteral,
4949
/// An empty array literal.
5050
EmptyArray,
5151
/// An empty dictionary literal.

include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ enum class DefaultArgumentKind : uint8_t {
316316
Function,
317317
Inherited,
318318
DSOHandle,
319-
Nil,
319+
NilLiteral,
320320
EmptyArray,
321321
EmptyDictionary,
322322
};

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static StringRef getDefaultArgumentKindString(DefaultArgumentKind value) {
282282
case DefaultArgumentKind::Function: return "#function";
283283
case DefaultArgumentKind::Inherited: return "inherited";
284284
case DefaultArgumentKind::Line: return "#line";
285-
case DefaultArgumentKind::Nil: return "nil";
285+
case DefaultArgumentKind::NilLiteral: return "nil";
286286
case DefaultArgumentKind::EmptyArray: return "[]";
287287
case DefaultArgumentKind::EmptyDictionary: return "[:]";
288288
case DefaultArgumentKind::Normal: return "normal";

lib/AST/DefaultArgumentKind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StringRef swift::getDefaultArgumentSpelling(DefaultArgumentKind kind) {
3030
case DefaultArgumentKind::Column: return "#column";
3131
case DefaultArgumentKind::Function: return "#function";
3232
case DefaultArgumentKind::DSOHandle: return "#dsohandle";
33-
case DefaultArgumentKind::Nil: return "nil";
33+
case DefaultArgumentKind::NilLiteral: return "nil";
3434
case DefaultArgumentKind::EmptyArray: return "[]";
3535
case DefaultArgumentKind::EmptyDictionary: return "[:]";
3636
}
@@ -65,7 +65,7 @@ DefaultArgumentKind swift::inferDefaultArgumentKind(Expr *expr) {
6565
if (ctor->getFullName().getArgumentNames().size() == 1 &&
6666
ctor->getFullName().getArgumentNames()[0]
6767
== ctor->getASTContext().Id_nilLiteral)
68-
return DefaultArgumentKind::Nil;
68+
return DefaultArgumentKind::NilLiteral;
6969
}
7070
}
7171
}

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,15 +1745,15 @@ DefaultArgumentKind ClangImporter::Implementation::inferDefaultArgument(
17451745
// Nullable trailing closure parameters default to 'nil'.
17461746
if (isLastParameter &&
17471747
(type->isFunctionPointerType() || type->isBlockPointerType()))
1748-
return DefaultArgumentKind::Nil;
1748+
return DefaultArgumentKind::NilLiteral;
17491749

17501750
// NSZone parameters default to 'nil'.
17511751
if (auto ptrType = type->getAs<clang::PointerType>()) {
17521752
if (auto recType
17531753
= ptrType->getPointeeType()->getAs<clang::RecordType>()) {
17541754
if (recType->isStructureOrClassType() &&
17551755
recType->getDecl()->getName() == "_NSZone")
1756-
return DefaultArgumentKind::Nil;
1756+
return DefaultArgumentKind::NilLiteral;
17571757
}
17581758
}
17591759
}
@@ -1786,7 +1786,7 @@ DefaultArgumentKind ClangImporter::Implementation::inferDefaultArgument(
17861786

17871787
auto emptyDictionaryKind = DefaultArgumentKind::EmptyDictionary;
17881788
if (clangOptionality == OTK_Optional)
1789-
emptyDictionaryKind = DefaultArgumentKind::Nil;
1789+
emptyDictionaryKind = DefaultArgumentKind::NilLiteral;
17901790

17911791
bool sawInfo = false;
17921792
for (auto word : reversed(camel_case::getWords(searchStr))) {

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
22132213

22142214
case DefaultArgumentKind::Normal:
22152215
case DefaultArgumentKind::Inherited:
2216-
case DefaultArgumentKind::Nil:
2216+
case DefaultArgumentKind::NilLiteral:
22172217
case DefaultArgumentKind::EmptyArray:
22182218
case DefaultArgumentKind::EmptyDictionary:
22192219
return !includeDefaultArgs;

lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ void SILGenModule::emitDefaultArgGenerator(SILDeclRef constant, Expr *arg,
932932
case DefaultArgumentKind::Line:
933933
case DefaultArgumentKind::Function:
934934
case DefaultArgumentKind::DSOHandle:
935-
case DefaultArgumentKind::Nil:
935+
case DefaultArgumentKind::NilLiteral:
936936
case DefaultArgumentKind::EmptyArray:
937937
case DefaultArgumentKind::EmptyDictionary:
938938
return;

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4555,7 +4555,7 @@ getCallerDefaultArg(ConstraintSystem &cs, DeclContext *dc,
45554555
/*implicit=*/true);
45564556
break;
45574557

4558-
case DefaultArgumentKind::Nil:
4558+
case DefaultArgumentKind::NilLiteral:
45594559
init = new (tc.Context) NilLiteralExpr(loc, /*Implicit=*/true);
45604560
break;
45614561

lib/Serialization/Deserialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ getActualDefaultArgKind(uint8_t raw) {
226226
return swift::DefaultArgumentKind::Function;
227227
case serialization::DefaultArgumentKind::DSOHandle:
228228
return swift::DefaultArgumentKind::DSOHandle;
229-
case serialization::DefaultArgumentKind::Nil:
230-
return swift::DefaultArgumentKind::Nil;
229+
case serialization::DefaultArgumentKind::NilLiteral:
230+
return swift::DefaultArgumentKind::NilLiteral;
231231
case serialization::DefaultArgumentKind::EmptyArray:
232232
return swift::DefaultArgumentKind::EmptyArray;
233233
case serialization::DefaultArgumentKind::EmptyDictionary:

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ static uint8_t getRawStableDefaultArgumentKind(swift::DefaultArgumentKind kind)
964964
CASE(Line)
965965
CASE(Function)
966966
CASE(DSOHandle)
967-
CASE(Nil)
967+
CASE(NilLiteral)
968968
CASE(EmptyArray)
969969
CASE(EmptyDictionary)
970970
#undef CASE

0 commit comments

Comments
 (0)