aboutsummaryrefslogtreecommitdiff
path: root/src/common/mac/arch_utilities.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/mac/arch_utilities.h')
-rw-r--r--src/common/mac/arch_utilities.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/common/mac/arch_utilities.h b/src/common/mac/arch_utilities.h
index d267c43b..3b036738 100644
--- a/src/common/mac/arch_utilities.h
+++ b/src/common/mac/arch_utilities.h
@@ -31,16 +31,26 @@
#ifndef COMMON_MAC_ARCH_UTILITIES_H__
#define COMMON_MAC_ARCH_UTILITIES_H__
-#include <mach-o/arch.h>
+#include <mach/machine.h>
-namespace google_breakpad {
+#include <optional>
-// Custom implementation of |NXGetArchInfoFromName| and
-// |NXGetArchInfoFromCpuType| that handle newer CPU on older OSes.
-const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name);
-const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type,
- cpu_subtype_t cpu_subtype);
+static constexpr const char* kUnknownArchName = "<Unknown architecture>";
-} // namespace google_breakpad
+struct ArchInfo {
+ cpu_type_t cputype;
+ cpu_subtype_t cpusubtype;
+};
+
+// Returns architecture info if `arch_name` corresponds to a valid, known
+// architecture, and std::nullopt otherwise.
+std::optional<ArchInfo> GetArchInfoFromName(const char* arch_name);
+
+// Returns the name of the architecture specified by `cpu_type` and
+// `cpu_subtype`, or `kUnknownArchName` if it's unknown or invalid.
+const char* GetNameFromCPUType(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype);
+
+// Returns the architecture of the machine this code is running on.
+ArchInfo GetLocalArchInfo();
#endif // COMMON_MAC_ARCH_UTILITIES_H__