[llvm] 52f739c - [ProfileData] Actually fix Clang -Wcovered-switch-default after D109398
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 8 00:15:59 PDT 2021
Author: Fangrui Song
Date: 2021-09-08T00:15:54-07:00
New Revision: 52f739c4ae02f0ac6f6cea866fcc7c78eed82e39
URL: https://github.com/llvm/llvm-project/commit/52f739c4ae02f0ac6f6cea866fcc7c78eed82e39
DIFF: https://github.com/llvm/llvm-project/commit/52f739c4ae02f0ac6f6cea866fcc7c78eed82e39.diff
LOG: [ProfileData] Actually fix Clang -Wcovered-switch-default after D109398
The Clang attribute `enum_extensibility(open)` (2017) is too new.
Just use a cast.
Added:
Modified:
llvm/include/llvm/ProfileData/SampleProf.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 26b4e54ffc3ad..2e26c5f676138 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -132,7 +132,7 @@ enum SecType {
};
static inline std::string getSecName(SecType Type) {
- switch (Type) {
+ switch ((int)Type) { // Avoid -Wcovered-switch-default
case SecInValid:
return "InvalidSection";
case SecProfSummary:
@@ -149,8 +149,9 @@ static inline std::string getSecName(SecType Type) {
return "CSNameTableSection";
case SecLBRProfile:
return "LBRProfileSection";
+ default:
+ return "UnknownSection";
}
- llvm_unreachable("");
}
// Entry type of section header table used by SampleProfileExtBinaryBaseReader
More information about the llvm-commits
mailing list