[PATCH] D39749: Allow yaml2obj to order implicit sections for ELF

Dave Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 13:35:14 PST 2017


kastiglione added inline comments.


================
Comment at: tools/yaml2obj/yaml2elf.cpp:78
+  /// \returns unsigned max if name is not present in the map
+  unsigned lookup(StringRef Name) const {
+    StringMap<int>::const_iterator I = Map.find(Name);
----------------
jakehehrlich wrote:
> I think you should use an Optional here instead of returning a maximal value. Also can you implement one of the lookup functions in terms of the other to dedup code?
I deduped, and instead of returning an optional, I added an assert. The intended semantics of this function is it's called only for inputs known to exist. The result should never be a none value. Thoughts?


https://reviews.llvm.org/D39749





More information about the llvm-commits mailing list