ABI Checker: use lower-cased decl keywords to be consistent with source. NFC

This commit is contained in:
Xi Ge
2020-09-11 23:30:26 -07:00
parent 7dcb0ea31a
commit 950eb74e67
7 changed files with 42 additions and 19 deletions

View File

@@ -39,7 +39,7 @@ operator<<(raw_ostream &Out, const NodeAnnotation Value) {
llvm_unreachable("Undefined SDK node kind.");
}
StringRef swift::ide::api::getDeclKindStr(const DeclKind Value) {
static StringRef getDeclKindStrRaw(const DeclKind Value) {
switch (Value) {
#define DECL(X, PARENT) case DeclKind::X: return #X;
#include "swift/AST/DeclNodes.def"
@@ -47,9 +47,22 @@ StringRef swift::ide::api::getDeclKindStr(const DeclKind Value) {
llvm_unreachable("Unhandled DeclKind in switch.");
}
raw_ostream &swift::ide::api::operator<<(raw_ostream &Out,
const DeclKind Value) {
return Out << getDeclKindStr(Value);
StringRef swift::ide::api::getDeclKindStr(const DeclKind Value, bool lower) {
if (lower) {
switch (Value) {
#define DECL(X, PARENT) case DeclKind::X: { \
static std::string lowered = StringRef(#X).lower(); \
return lowered; \
}
#include "swift/AST/DeclNodes.def"
}
} else {
return getDeclKindStrRaw(Value);
}
}
raw_ostream &swift::ide::api::operator<<(raw_ostream &Out, const DeclKind Value) {
return Out << getDeclKindStrRaw(Value);
}
Optional<SDKNodeKind> swift::ide::api::parseSDKNodeKind(StringRef Content) {