The mappings we were using had a small number of keys, so a vector is
probably better. This allows us to remove the last usage of std::map in
our codebase.
I also used removeSimulator to simplify the code a bit further.
Paths
| Differential D105786
[lld-macho][nfc] Avoid using std::map for PlatformKinds ClosedPublic Authored by int3 on Jul 11 2021, 1:51 PM.
Details
Summary The mappings we were using had a small number of keys, so a vector is I also used removeSimulator to simplify the code a bit further.
Diff Detail
Event TimelineComment Actions switch statements are too verbose? In the removeSimulator case, I would expect it to be shorter and more readable. And why is removeSimulatornot somewhere in llvm Binaryformat? Comment Actions
I prefer to keep to the same code pattern as the other two PlatformKind mappings.
That file doesn't seem to have a whole lot of helper functions, just struct definitions. This revision is now accepted and ready to land.Jul 11 2021, 2:44 PM Closed by commit rGf6e84a84f95e: [lld-macho][nfc] Avoid using std::map for PlatformKinds (authored by int3). · Explain WhyJul 11 2021, 3:25 PM This revision was automatically updated to reflect the committed changes. int3 marked an inline comment as done.
Revision Contents
Diff 357819 lld/MachO/Driver.h
lld/MachO/Driver.cpp
lld/MachO/InputFiles.h
lld/MachO/InputFiles.cpp
lld/MachO/Writer.cpp
|
I agree that a switch seems like the obvious fit here, but *shrug*