diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index b14184afe5840..b3ae66e6e769d 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -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" @@ -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>(AS), + PD.AddTaggedVal(llvm::to_underlying(AS), DiagnosticsEngine::ArgumentKind::ak_addrspace); return PD; } diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index aee86a3242fd3..1c0d15dc932ad 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -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 { @@ -406,15 +407,13 @@ enum class FnInfoOpts { }; inline FnInfoOpts operator|(FnInfoOpts A, FnInfoOpts B) { - return static_cast( - static_cast>(A) | - static_cast>(B)); + return static_cast(llvm::to_underlying(A) | + llvm::to_underlying(B)); } inline FnInfoOpts operator&(FnInfoOpts A, FnInfoOpts B) { - return static_cast( - static_cast>(A) & - static_cast>(B)); + return static_cast(llvm::to_underlying(A) & + llvm::to_underlying(B)); } inline FnInfoOpts operator|=(FnInfoOpts A, FnInfoOpts B) {