[llvm] [llvm-exegesis][NFC] Refactor all `ValidationEvent` info in a single … (PR #82256)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 14:36:43 PST 2024


================
@@ -0,0 +1,53 @@
+
+#include "ValidationEvent.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace exegesis {
+
+namespace {
+
+struct ValidationEventInfo {
+  const char *const Name;
+  const char *const Description;
+};
+
+// Information about validation events, indexed by `ValidationEvent` enum
+// value.
+static constexpr ValidationEventInfo ValidationEventInfos[NumValidationEvents] =
----------------
boomanaiden154 wrote:

Would it be possible to use a `static_assert` to ensure that the length of this array is the same as the enum to prevent someone missing the implementation of a validation counter here? I think it would be tricky with a standard array, but with a `std::array`, I think we should have access to a `constexpr` `size()` method.

https://github.com/llvm/llvm-project/pull/82256


More information about the llvm-commits mailing list