[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / packages / Python / lldbsuite / test / lldbplatform.py
blob365c752758d8c28aa7e41bc300638535d1b219c4
1 """ This module represents an abstraction of an lldb target / host platform. """
3 from __future__ import absolute_import
5 # System modules
6 import itertools
8 # Third-party modules
9 import six
11 # LLDB modules
12 import lldb
14 windows, linux, macosx, darwin, ios, tvos, watchos, bridgeos, darwin_all, darwin_embedded, freebsd, netbsd, bsd_all, android = range(
15 14)
17 __name_lookup = {
18 windows: ["windows"],
19 linux: ["linux"],
20 macosx: ["macosx"],
21 darwin: ["darwin"],
22 ios: ["ios"],
23 tvos: ["tvos"],
24 watchos: ["watchos"],
25 bridgeos: ["bridgeos"],
26 darwin_all: ["macosx", "darwin", "ios", "tvos", "watchos", "bridgeos"],
27 darwin_embedded: ["ios", "tvos", "watchos", "bridgeos"],
28 freebsd: ["freebsd"],
29 netbsd: ["netbsd"],
30 bsd_all: ["freebsd", "netbsd"],
31 android: ["android"]
35 def translate(values):
37 if isinstance(values, six.integer_types):
38 # This is a value from the platform enumeration, translate it.
39 return __name_lookup[values]
40 elif isinstance(values, six.string_types):
41 # This is a raw string, return it.
42 return [values]
43 elif hasattr(values, "__iter__"):
44 # This is an iterable, convert each item.
45 result = [translate(x) for x in values]
46 result = list(itertools.chain(*result))
47 return result
48 return values