|
20 | 20 | #include "clang/Basic/DiagnosticIDs.h"
|
21 | 21 | #include "clang/Basic/LLVM.h"
|
22 | 22 | #include "clang/Basic/SourceLocation.h"
|
| 23 | +#include "llvm/ADT/STLForwardCompat.h" |
23 | 24 | #include "llvm/ADT/SmallVector.h"
|
24 | 25 | #include "llvm/Support/Casting.h"
|
25 | 26 | #include "llvm/Support/ErrorHandling.h"
|
@@ -167,15 +168,13 @@ static const std::array<const StringRef, 4> Msgs = {{
|
167 | 168 | // Criteria is a bitset, thus a few helpers are needed.
|
168 | 169 | CognitiveComplexity::Criteria operator|(CognitiveComplexity::Criteria LHS,
|
169 | 170 | CognitiveComplexity::Criteria RHS) {
|
170 |
| - return static_cast<CognitiveComplexity::Criteria>( |
171 |
| - static_cast<std::underlying_type_t<CognitiveComplexity::Criteria>>(LHS) | |
172 |
| - static_cast<std::underlying_type_t<CognitiveComplexity::Criteria>>(RHS)); |
| 171 | + return static_cast<CognitiveComplexity::Criteria>(llvm::to_underlying(LHS) | |
| 172 | + llvm::to_underlying(RHS)); |
173 | 173 | }
|
174 | 174 | CognitiveComplexity::Criteria operator&(CognitiveComplexity::Criteria LHS,
|
175 | 175 | CognitiveComplexity::Criteria RHS) {
|
176 |
| - return static_cast<CognitiveComplexity::Criteria>( |
177 |
| - static_cast<std::underlying_type_t<CognitiveComplexity::Criteria>>(LHS) & |
178 |
| - static_cast<std::underlying_type_t<CognitiveComplexity::Criteria>>(RHS)); |
| 176 | + return static_cast<CognitiveComplexity::Criteria>(llvm::to_underlying(LHS) & |
| 177 | + llvm::to_underlying(RHS)); |
179 | 178 | }
|
180 | 179 | CognitiveComplexity::Criteria &operator|=(CognitiveComplexity::Criteria &LHS,
|
181 | 180 | CognitiveComplexity::Criteria RHS) {
|
|
0 commit comments