Skip to content

Commit 83f065d

Browse files
committed
[RISCV] static_assert SupportedProfiles and SupportedExperimentalProfiles are sorted
Just as we do for the arrays of extension names.
1 parent 81d20d8 commit 83f065d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ struct RISCVSupportedExtension {
3939
struct RISCVProfile {
4040
StringLiteral Name;
4141
StringLiteral MArch;
42+
43+
bool operator<(const RISCVProfile &RHS) const {
44+
return StringRef(Name) < StringRef(RHS.Name);
45+
}
4246
};
4347

4448
} // end anonymous namespace
@@ -61,6 +65,10 @@ static void verifyTables() {
6165
"Extensions are not sorted by name");
6266
assert(llvm::is_sorted(SupportedExperimentalExtensions) &&
6367
"Experimental extensions are not sorted by name");
68+
assert(llvm::is_sorted(SupportedProfiles) &&
69+
"Profiles are not sorted by name");
70+
assert(llvm::is_sorted(SupportedExperimentalProfiles) &&
71+
"Experimental profiles are not sorted by name");
6472
TableChecked.store(true, std::memory_order_relaxed);
6573
}
6674
#endif

0 commit comments

Comments
 (0)