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

Daniil Kovalev llvmlistbot at llvm.org
Fri Mar 8 03:19:49 PST 2024


================
@@ -296,7 +296,20 @@ DIStringType *DIBuilder::createStringType(StringRef Name,
 
 DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
   return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
-                            0, 0, std::nullopt, DINode::FlagZero);
+                            0, 0, std::nullopt, std::nullopt, DINode::FlagZero);
+}
+
+DIDerivedType *DIBuilder::createPtrAuthQualifiedType(
+    DIType *FromTy, unsigned Key, bool IsAddressDiscriminated,
+    unsigned ExtraDiscriminator, bool IsaPointer,
+    bool AuthenticatesNullValues) {
+  return DIDerivedType::get(VMContext, dwarf::DW_TAG_LLVM_ptrauth_type, "",
+                            nullptr, 0, nullptr, FromTy, 0, 0, 0, std::nullopt,
+                            std::optional<DIDerivedType::PtrAuthData>(
+                                std::in_place, Key, IsAddressDiscriminated,
----------------
kovdan01 wrote:

According to https://llvm.org/docs/CodingStandards.html#c-standard-versions, we can rely on C++17, so use `std::in_place` for in-place initialization of `std::optional` (see (6) https://en.cppreference.com/w/cpp/utility/optional/optional). Please let me know if we for some reason can't rely on this C++17 feature here.

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


More information about the Mlir-commits mailing list