StringSwitchify. No functionality change.

llvm-svn: 156916
This commit is contained in:
Benjamin Kramer 2012-05-16 12:44:25 +00:00
parent e51c8442dd
commit 96a44b61c3
1 changed files with 11 additions and 18 deletions

View File

@ -2489,26 +2489,19 @@ enum FormatAttrKind {
/// getFormatAttrKind - Map from format attribute names to supported format /// getFormatAttrKind - Map from format attribute names to supported format
/// types. /// types.
static FormatAttrKind getFormatAttrKind(StringRef Format) { static FormatAttrKind getFormatAttrKind(StringRef Format) {
// Check for formats that get handled specially. return llvm::StringSwitch<FormatAttrKind>(Format)
if (Format == "NSString") // Check for formats that get handled specially.
return NSStringFormat; .Case("NSString", NSStringFormat)
if (Format == "CFString") .Case("CFString", CFStringFormat)
return CFStringFormat; .Case("strftime", StrftimeFormat)
if (Format == "strftime")
return StrftimeFormat;
// Otherwise, check for supported formats. // Otherwise, check for supported formats.
if (Format == "scanf" || Format == "printf" || Format == "printf0" || .Cases("scanf", "printf", "printf0", "strfmon", SupportedFormat)
Format == "strfmon" || Format == "cmn_err" || Format == "vcmn_err" || .Cases("cmn_err", "vcmn_err", "zcmn_err", SupportedFormat)
Format == "zcmn_err" || .Case("kprintf", SupportedFormat) // OpenBSD.
Format == "kprintf") // OpenBSD.
return SupportedFormat;
if (Format == "gcc_diag" || Format == "gcc_cdiag" || .Cases("gcc_diag", "gcc_cdiag", "gcc_cxxdiag", "gcc_tdiag", IgnoredFormat)
Format == "gcc_cxxdiag" || Format == "gcc_tdiag") .Default(InvalidFormat);
return IgnoredFormat;
return InvalidFormat;
} }
/// Handle __attribute__((init_priority(priority))) attributes based on /// Handle __attribute__((init_priority(priority))) attributes based on