[lldb] Simplify specifying of platform supported architectures
authorPavel Labath <pavel@labath.sk>
Wed, 10 Nov 2021 16:44:37 +0000 (17:44 +0100)
committerPavel Labath <pavel@labath.sk>
Tue, 16 Nov 2021 10:43:48 +0000 (11:43 +0100)
commit669e57ebd1a7137aba7aab47d9d4dd67e1b0b9a0
tree643ef6d3878aafbd4ffe3e1eead1f2dddc0f744f
parent33c0f93f6c10acff885fe11b9897943313cd5c26
[lldb] Simplify specifying of platform supported architectures

The GetSupportedArchitectureAtIndex pattern forces the use of
complicated patterns in both the implementations of the function and in
the various callers.

This patch creates a new method (GetSupportedArchitectures), which
returns a list (vector) of architectures. The
GetSupportedArchitectureAtIndex is kept in order to enable incremental
rollout. Base Platform class contains implementations of both of these
methods, using the other method as the source of truth. Platforms
without infinite stacks should implement at least one of them.

This patch also ports Linux, FreeBSD and NetBSD platforms to the new
API. A new helper function (CreateArchList) is added to simplify the
common task of creating a list of ArchSpecs with the same OS but
different architectures.

Differential Revision: https://reviews.llvm.org/D113608
lldb/include/lldb/Target/Platform.h
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/source/Target/Platform.cpp