(No testcase because it's difficult to force an error here.)
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This seems reasonable. We do something similar in other places (and unfortunately is very hard to test in isolation).
LGTM. Thanks.
lib/LTO/LTOCodeGenerator.cpp | ||
---|---|---|
261 ↗ | (On Diff #77103) | Can you get the + Filename on the same line as the initialization for ErrMsg? |
Just wondering: can't you get an error by providing an output path in a non-existing directory?
lib/LTO/LTOCodeGenerator.cpp | ||
---|---|---|
261 ↗ | (On Diff #77103) | I guess I could write std::string ErrMsg = Twine("could not write object file: ") + Filename;. Is that better? |
lib/LTO/LTOCodeGenerator.cpp | ||
---|---|---|
261 ↗ | (On Diff #77103) | I would rather leave it as is. |
If file creation fails, you hit a different error path. This is the error path you hit if the disk runs out of space or something like that.
lib/LTO/LTOCodeGenerator.cpp | ||
---|---|---|
261 ↗ | (On Diff #77103) | I'd write: std::string ErrMsg = "could not write object file: " + Filename.str(); (if it compiles) |
lib/LTO/LTOCodeGenerator.cpp | ||
---|---|---|
261 ↗ | (On Diff #77103) | Agree, if it compiles. But using the Twine is a little bit cumbersome here, at least to me. |