[llvm] [TableGen] Fix MacOS failure in Option Emitter. (PR #108225)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 06:47:21 PDT 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/108225
Handle the case of same pointer used as both inputs to the `CompareOptionRecords`, to avoid emitting errors for equivalent options.
>From 0115d5c951232838ce3aad48d9be41d4d8eea1c1 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Wed, 11 Sep 2024 06:43:59 -0700
Subject: [PATCH] [TableGen] Fix MacOS failure in Option Emitter.
Handle the case of same pointer used as both inputs to the
`CompareOptionRecords`, to avoid emitting errors for equivalent
options.
---
llvm/utils/TableGen/Common/OptEmitter.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/utils/TableGen/Common/OptEmitter.cpp b/llvm/utils/TableGen/Common/OptEmitter.cpp
index 1c91ec5b3dbc44..75e32c36d4f726 100644
--- a/llvm/utils/TableGen/Common/OptEmitter.cpp
+++ b/llvm/utils/TableGen/Common/OptEmitter.cpp
@@ -41,6 +41,8 @@ static int StrCmpOptionName(const char *A, const char *B) {
// Returns true if A is ordered before B.
bool CompareOptionRecords(const Record *A, const Record *B) {
+ if (A == B)
+ return false;
// Sentinel options precede all others and are only ordered by precedence.
bool ASent = A->getValueAsDef("Kind")->getValueAsBit("Sentinel");
bool BSent = B->getValueAsDef("Kind")->getValueAsBit("Sentinel");
More information about the llvm-commits
mailing list