I made the wrong assumption that execution would continue after an error Diag which led to unneeded complex code.
This patch aligns with the better implementation of ToolChain::GetRuntimeLibType.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Driver/ToolChain.cpp | ||
---|---|---|
553–559 ↗ | (On Diff #74818) | I believe you can use StringSwitch here |
Thanks for working on this. Your code is much cleaner ;-).
lib/Driver/ToolChain.cpp | ||
---|---|---|
553 ↗ | (On Diff #74818) | I think you are changing the meaning of this comment. The original sounded like a request not to use this type anywhere else. Your version only explains where it's used (right now). |
Update comments to express that platform should only be used in tests
lib/Driver/ToolChain.cpp | ||
---|---|---|
553–559 ↗ | (On Diff #74818) | I'm uncertain how to apply it while also preserving the Diag for an invalid argument: I would probably need an additional CST_Unknown which I don't like more... |
lib/Driver/ToolChain.cpp | ||
---|---|---|
553–559 ↗ | (On Diff #74818) | I think you can try something like this: llvm::Optional<ToolChain::CXXStdlibType> Res = StringSwitch<ToolChain::CXXStdlibType, llvm::NoneType>(LibName).Case("libc++", ToolChain::CST_Libcxx).Case("libstdc++", ToolChain::CST_Libstdcxx).Case("platform", GetDefaultCXXStdlibType()).Default(llvm::None); if (Res) return Res.getValue(); |
lib/Driver/ToolChain.cpp | ||
---|---|---|
553–559 ↗ | (On Diff #74818) | Does that really improve readability? StringSwitch is currently never used in ToolChain.cpp and the cascade with ifs is one line shorter in this case... |
Can I commit this as-is for now and we can think about StringSwitch in the driver later on?