[PATCH] D56294: [ObjectYAML] [COFF] Support multiple symbols with the same name

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 13:52:55 PST 2019


ruiu added inline comments.


================
Comment at: tools/obj2yaml/coff2yaml.cpp:208
       }
-      Rel.SymbolName = *SymbolNameOrErr;
+      if (SymbolUnique[*SymbolNameOrErr])
+        Rel.SymbolName = *SymbolNameOrErr;
----------------
mstorsjo wrote:
> ruiu wrote:
> > Doesn't this insert a new key if `*SymbolNameOrErr` does not exist in the map? I don't think that affects correctness of the program, but that's probably a waste of time and memory. I'd use `count` instead.
> Yes, but every symbol will exist in the map already. We're not interested in whether the key exists in the map or not (it will always exist), but whether the map entry actually is set to true or false.
Ah OK, then this is fine. I'd still use `count` to not surprise careless readers like me though. :)


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

https://reviews.llvm.org/D56294





More information about the llvm-commits mailing list