[Mlir-commits] [llvm] [mlir] [Dwarf] Support `__ptrauth` qualifier in metadata nodes (PR #83862)

Daniil Kovalev llvmlistbot at llvm.org
Tue Mar 5 16:10:21 PST 2024


================
@@ -975,34 +975,29 @@ class DIDerivedType : public DIType {
 public:
   /// Pointer authentication (__ptrauth) metadata.
   struct PtrAuthData {
-    union {
-      struct {
-        unsigned Key : 4;
-        unsigned IsAddressDiscriminated : 1;
-        unsigned ExtraDiscriminator : 16;
-        unsigned IsaPointer : 1;
-        unsigned AuthenticatesNullValues : 1;
-      } Data;
-      unsigned RawData;
-    } Payload;
-
-    PtrAuthData(unsigned FromRawData) { Payload.RawData = FromRawData; }
+    unsigned RawData;
+
+    PtrAuthData(unsigned FromRawData) : RawData(FromRawData) {}
     PtrAuthData(unsigned Key, bool IsDiscr, unsigned Discriminator,
                 bool IsaPointer, bool AuthenticatesNullValues) {
       assert(Key < 16);
       assert(Discriminator <= 0xffff);
-      Payload.Data.Key = Key;
-      Payload.Data.IsAddressDiscriminated = IsDiscr;
-      Payload.Data.ExtraDiscriminator = Discriminator;
-      Payload.Data.IsaPointer = IsaPointer;
-      Payload.Data.AuthenticatesNullValues = AuthenticatesNullValues;
+      RawData = (Key << 0) | (IsDiscr ? (1 << 4) : 0) | (Discriminator << 5) |
----------------
kovdan01 wrote:

Fixed, thanks, see f765247a3d49b3b726a7442d8d31c1cbd4782154

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


More information about the Mlir-commits mailing list