From 0d807ccc3906faf9e86055fb9b408101ce4ab985 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Thu, 9 Oct 2014 20:43:04 +0000 Subject: [PATCH] Add ApplePropertyString dump helper to Dwarf.{h|cpp}. Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5688 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219442 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Dwarf.h | 5 +++++ lib/Support/Dwarf.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/llvm/Support/Dwarf.h b/include/llvm/Support/Dwarf.h index c38a3474dee..7da5d9c2544 100644 --- a/include/llvm/Support/Dwarf.h +++ b/include/llvm/Support/Dwarf.h @@ -882,6 +882,11 @@ const char *MacinfoString(unsigned Encoding); /// encodings. const char *CallFrameString(unsigned Encoding); +/// ApplePropertyString - Return the string for the specified Apple +/// property bit. This function is meant to return the symbolic name +/// for 1 bit of the DW_AT_APPLE_property attribute, not for the whole attribute. +const char *ApplePropertyString(unsigned); + // Constants for the DWARF5 Accelerator Table Proposal enum AcceleratorTable { // Data layout descriptors. diff --git a/lib/Support/Dwarf.cpp b/lib/Support/Dwarf.cpp index 1a8f4a1ec2e..9c80fb0d3b3 100644 --- a/lib/Support/Dwarf.cpp +++ b/lib/Support/Dwarf.cpp @@ -750,6 +750,39 @@ const char *llvm::dwarf::CallFrameString(unsigned Encoding) { return nullptr; } +/// ApplePropertyString - Return the string for the specified Apple +/// property bit. This function is meant to return the symbolic name +/// for 1 bit of the DW_AT_APPLE_property attribute, not for the whole attribute. +const char *llvm::dwarf::ApplePropertyString(unsigned Prop) { + switch (Prop) { + case DW_APPLE_PROPERTY_readonly: + return "DW_APPLE_PROPERTY_readonly"; + case DW_APPLE_PROPERTY_getter: + return "DW_APPLE_PROPERTY_getter"; + case DW_APPLE_PROPERTY_assign: + return "DW_APPLE_PROPERTY_assign"; + case DW_APPLE_PROPERTY_readwrite: + return "DW_APPLE_PROPERTY_readwrite"; + case DW_APPLE_PROPERTY_retain: + return "DW_APPLE_PROPERTY_retain"; + case DW_APPLE_PROPERTY_copy: + return "DW_APPLE_PROPERTY_copy"; + case DW_APPLE_PROPERTY_nonatomic: + return "DW_APPLE_PROPERTY_nonatomic"; + case DW_APPLE_PROPERTY_setter: + return "DW_APPLE_PROPERTY_setter"; + case DW_APPLE_PROPERTY_atomic: + return "DW_APPLE_PROPERTY_atomic"; + case DW_APPLE_PROPERTY_weak: + return "DW_APPLE_PROPERTY_weak"; + case DW_APPLE_PROPERTY_strong: + return "DW_APPLE_PROPERTY_strong"; + case DW_APPLE_PROPERTY_unsafe_unretained: + return "DW_APPLE_PROPERTY_unsafe_unretained"; + } + return nullptr; +} + const char *llvm::dwarf::AtomTypeString(unsigned AT) { switch (AT) { case dwarf::DW_ATOM_null: -- 2.34.1