[PATCH] D101855: [lld-macho] Check simulator platforms to avoid issuing false positive errors.

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 15:20:05 PDT 2021


oontvoo marked an inline comment as not done.
oontvoo added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:144
+  // Mapping of platform to simulator and vice-versa.
+  static std::map<PlatformKind, PlatformKind> *platformMap = []() {
+    auto *ret = new std::map<PlatformKind, PlatformKind>();
----------------
int3 wrote:
> nit 1: for uniformity, can we use a DenseMap instead of a std::map? I know perf isn't important here but it would be nice to avoid std::map where possible
> 
> nit 2: I'm pretty sure we can initialize this via initializer lists rather than a lambda, i.e. something like
> 
> ```
> platformMap = {{PlatformKind::iOS, PlatformKind::iOSSimulator}, {PlatformKind::iOS, PlatformKind::iOSSimulator}, ...};
> ```
(actually not done)

Re: `DenseMap`, I couldn't use the DenseMap here because :

```
In file included from /Users/vyng/repo/llvm-project/llvm/include/llvm/ADT/DenseSet.h:16:
/Users/vyng/repo/llvm-project/llvm/include/llvm/ADT/DenseMap.h:456:22: error: no member named 'getEmptyKey' in 'llvm::DenseMapInfo<llvm::MachO::PlatformKind>'
    return KeyInfoT::getEmptyKey();

```

Didn't seem like it's worth changing the PlatformKind class ... thoughts? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101855/new/

https://reviews.llvm.org/D101855



More information about the llvm-commits mailing list