[LiveDebugValues] Fix a warning
authorKazu Hirata <kazu@google.com>
Mon, 22 Aug 2022 17:57:16 +0000 (10:57 -0700)
committerKazu Hirata <kazu@google.com>
Mon, 22 Aug 2022 17:57:16 +0000 (10:57 -0700)
This patch fixes:

  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:330:5: error:
  anonymous types declared in an anonymous union are an extension
  [-Werror,-Wnested-anon-types]

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h

index f84bcae..373a382 100644 (file)
@@ -326,11 +326,13 @@ struct ResolvedDbgOp {
 /// DbgOp is a constant, meaning that for simple equality or const-ness checks
 /// it is not necessary to lookup this ID.
 struct DbgOpID {
+  struct IsConstIndexPair {
+    uint32_t IsConst : 1;
+    uint32_t Index : 31;
+  };
+
   union {
-    struct {
-      uint32_t IsConst : 1;
-      uint32_t Index : 31;
-    } ID;
+    struct IsConstIndexPair ID;
     uint32_t RawID;
   };