[llvm] ccc4fa1 - [TableGen] Fix MacOS failure in Option Emitter. (#108225)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 06:57:34 PDT 2024


Author: Rahul Joshi
Date: 2024-09-11T09:57:31-04:00
New Revision: ccc4fa18423f097a9f04d3198cacf094445ffd71

URL: https://github.com/llvm/llvm-project/commit/ccc4fa18423f097a9f04d3198cacf094445ffd71
DIFF: https://github.com/llvm/llvm-project/commit/ccc4fa18423f097a9f04d3198cacf094445ffd71.diff

LOG: [TableGen] Fix MacOS failure in Option Emitter. (#108225)

Handle the case of same pointer used as both inputs to the
`CompareOptionRecords`, to avoid emitting errors for equivalent options.

Follow-up to #107696.

Added: 
    

Modified: 
    llvm/utils/TableGen/Common/OptEmitter.cpp

Removed: 
    


################################################################################
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