Skip to content

Commit

Permalink
[clang] Use llvm::to_underlying (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Dec 10, 2023
1 parent bf91252 commit 2ec95c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator_range.h"
Expand Down Expand Up @@ -7514,7 +7515,7 @@ inline const Type *Type::getPointeeOrArrayElementType() const {
/// spaces into a diagnostic with <<.
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
LangAS AS) {
PD.AddTaggedVal(static_cast<std::underlying_type_t<LangAS>>(AS),
PD.AddTaggedVal(llvm::to_underlying(AS),
DiagnosticsEngine::ArgumentKind::ak_addrspace);
return PD;
}
Expand Down
11 changes: 5 additions & 6 deletions clang/lib/CodeGen/CGCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "clang/AST/CanonicalType.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/Type.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/IR/Value.h"

namespace llvm {
Expand Down Expand Up @@ -406,15 +407,13 @@ enum class FnInfoOpts {
};

inline FnInfoOpts operator|(FnInfoOpts A, FnInfoOpts B) {
return static_cast<FnInfoOpts>(
static_cast<std::underlying_type_t<FnInfoOpts>>(A) |
static_cast<std::underlying_type_t<FnInfoOpts>>(B));
return static_cast<FnInfoOpts>(llvm::to_underlying(A) |
llvm::to_underlying(B));
}

inline FnInfoOpts operator&(FnInfoOpts A, FnInfoOpts B) {
return static_cast<FnInfoOpts>(
static_cast<std::underlying_type_t<FnInfoOpts>>(A) &
static_cast<std::underlying_type_t<FnInfoOpts>>(B));
return static_cast<FnInfoOpts>(llvm::to_underlying(A) &
llvm::to_underlying(B));
}

inline FnInfoOpts operator|=(FnInfoOpts A, FnInfoOpts B) {
Expand Down

0 comments on commit 2ec95c1

Please sign in to comment.