This makes the code cleaner and adds some coverage for invalid flags being passed as -z <unknown flag>. Almost an NFC change but just wanted to confirm.
No regressions in ELF test suite and test runs just fine:
=> ninja check-lld-elf [0/1] Running lit suite /q/src/llvm-taint-8.0/tools/lld/test/ELF Testing Time: 9.32s Expected Passes : 1054 Unsupported Tests : 332
Thank you for the patch. But honestly I wouldn't do this personally because the former code only depends on the usual equality check while the new code uses SmallDenseSet which is undeniably (slightly) more complicated than the comparison. From the perspective of code readability, I don't think there's too much difference, it's perhaps a matter of taste. So I think I prefer code that is simple, which is perhaps too simple that it sometimes even looks a bit stupid.
Well, I do like the general idea. I would go with a sorted static array and a binary search though. This is not really time critical, but the array version would be smaller in terms of code without involving run-time allocations.