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:
Jordan Rose
2019-08-19 13:06:53 -07:00
committed by GitHub
parent e9bcca8166
commit 94d1e5efe6
11 changed files with 26 additions and 21 deletions

View File

@@ -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)) {