@@ -50,27 +50,23 @@ static const StringRef SupportedConditionalCompilationEndianness[] = {
50
50
" big"
51
51
};
52
52
53
+ template <typename Type, size_t N>
54
+ bool contains (const Type (&Array)[N], const Type &V) {
55
+ return std::find (std::begin (Array), std::end (Array), V) != std::end (Array);
56
+ }
57
+
53
58
bool LangOptions::isPlatformConditionOSSupported (StringRef OSName) {
54
- auto foundIt = std::find (std::begin (SupportedConditionalCompilationOSs),
55
- std::end (SupportedConditionalCompilationOSs),
56
- OSName);
57
- return foundIt != std::end (SupportedConditionalCompilationOSs);
59
+ return contains (SupportedConditionalCompilationOSs, OSName);
58
60
}
59
61
60
62
bool
61
63
LangOptions::isPlatformConditionArchSupported (StringRef ArchName) {
62
- auto foundIt = std::find (std::begin (SupportedConditionalCompilationArches),
63
- std::end (SupportedConditionalCompilationArches),
64
- ArchName);
65
- return foundIt != std::end (SupportedConditionalCompilationArches);
64
+ return contains (SupportedConditionalCompilationArches, ArchName);
66
65
}
67
66
68
67
bool
69
68
LangOptions::isPlatformConditionEndiannessSupported (StringRef Endianness) {
70
- auto foundIt = std::find (std::begin (SupportedConditionalCompilationEndianness),
71
- std::end (SupportedConditionalCompilationEndianness),
72
- Endianness);
73
- return foundIt != std::end (SupportedConditionalCompilationEndianness);
69
+ return contains (SupportedConditionalCompilationEndianness, Endianness);
74
70
}
75
71
76
72
StringRef
0 commit comments