mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Avoid reserved names in C++ code: "__Consuming" (#26720)
Double-underscored names are reserved for the C++ "implementation" (language and standard library). Even though "__Consuming" isn't likely to be part of the C++ standard any time soon, we should follow the rules. Note that the API digester will continue to use the string "__Consuming" for now, even though the underscores aren't really significant, to avoid invalidating existing dumps. No functionality change.
This commit is contained in:
@@ -1330,15 +1330,20 @@ SDKNodeInitInfo::SDKNodeInitInfo(SDKContext &Ctx, ValueDecl *VD)
|
||||
}
|
||||
}
|
||||
|
||||
#define CASE(BASE, KIND, KEY) case BASE::KIND: KEY = #KIND; break;
|
||||
if (auto *FD = dyn_cast<FuncDecl>(VD)) {
|
||||
switch(FD->getSelfAccessKind()) {
|
||||
CASE(SelfAccessKind, Mutating, FuncSelfKind)
|
||||
CASE(SelfAccessKind, __Consuming, FuncSelfKind)
|
||||
CASE(SelfAccessKind, NonMutating, FuncSelfKind)
|
||||
case SelfAccessKind::Mutating:
|
||||
FuncSelfKind = "Mutating";
|
||||
break;
|
||||
case SelfAccessKind::Consuming:
|
||||
// FIXME: Stay consistent with earlier digests that had underscores here.
|
||||
FuncSelfKind = "__Consuming";
|
||||
break;
|
||||
case SelfAccessKind::NonMutating:
|
||||
FuncSelfKind = "NonMutating";
|
||||
break;
|
||||
}
|
||||
}
|
||||
#undef CASE
|
||||
|
||||
// Get enum raw type name if this is an enum.
|
||||
if (auto *ED = dyn_cast<EnumDecl>(VD)) {
|
||||
|
||||
Reference in New Issue
Block a user