If an invalid architecture is set we currently return an empty string.
This will cause the offloading toolchain to continue to be built and
hit an assertion elsewhere due to the invalid architecture. This patch
fixes that so we now correctly exit.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM with few nits.
clang/lib/Driver/Driver.cpp | ||
---|---|---|
4194 | Nit. Optional is fine, but we could've just checked returned value for Arch.empty(). | |
4288 | Nit: do we need explicit StringRef() here? If implicit type conversion does not work, we could use Arch.equals("all"). |
clang/lib/Driver/Driver.cpp | ||
---|---|---|
4194 | Probably the better option. I originally used Optional for the implicit boolean conversion, but I don't think it'll make the code that much more complicated. | |
4288 | You're right, previously this used Arg-getValue() but then when it changed to llvm::split it got converted to a StringRef so this can be updated now. Thanks for pointing it out. |
Making suggested changes, Early exists is part of the LLVM style so it's definitely better.
Nit. Optional is fine, but we could've just checked returned value for Arch.empty().