Bunch of fixed bugs in LLVM afte running misc-use-after-move analysis
Details
Diff Detail
- Build Status
Buildable 2115 Build 2115: arc lint + arc unit
Event Timeline
| lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp | ||
|---|---|---|
| 42 | Thanks. FYI, we're working on a proposal for annotating methods that reinitialize an object. | |
| lib/IRReader/IRReader.cpp | ||
|---|---|---|
| 39 | Typo: Should be "Identifier" | |
| 44 | This is a StringRef -- no need to move it (don't think it has a move constructor anyway as a move would not be cheaper than a copy). | |
| lib/Target/X86/X86ISelLowering.cpp | ||
| 27000 | Typo: Should be WidenedMask | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
| 63 | Inadvertently deleted empty line? | |
| lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp | ||
|---|---|---|
| 42 | Ok, I gonna leve comment here | |
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 27000 | btw, why it fires here? It is passed to canWidenShuffleElements by reference and documentation says that it assumes it is being reinitialized in this case. | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
|---|---|---|
| 53 | If it is an instrprof error, we'd like the chance to inspect it and display an additional hint, instead of simply printing out a string representation of the error. | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
|---|---|---|
| 53 | The check still does not seem idiomatic to me, it could be instead: E = handleErrors(std::move(E), [&](const InstrProfError &IPE) {
instrprof_error instrError = IPE.get();
StringRef Hint = "";
if (instrError == instrprof_error::unrecognized_format) {
// Hint for common error of forgetting -sample for sample profiles.
Hint = "Perhaps you forgot to use the -sample option?";
}
exitWithError(IPE.message(), Whence, Hint);
});
exitWithError(toString(std::move(E)), Whence);
` | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
|---|---|---|
| 53 | I *think* you can also write: handleAllErrors(std::move(E),
[&](const InstrProfError &IPE) {
instrprof_error instrError = IPE.get();
StringRef Hint = "";
if (instrError == instrprof_error::unrecognized_format) {
// Hint for common error of forgetting -sample for sample profiles.
Hint = "Perhaps you forgot to use the -sample option?";
}
exitWithError(IPE.message(), Whence, Hint);
},
[&](const Error &E) {
exitWithError(toString(E), Whence);
});
` | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
|---|---|---|
| 53 | oh ok I got it, we get rid of the second exitWithError call and use after move | |
| tools/llvm-profdata/llvm-profdata.cpp | ||
|---|---|---|
| 53 | ok, the code right now doesn't compile here, but I will fix it (toString takes E by value) | |
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 27000 | You're right, it shouldn't fire here. I'll take a look at what's going wrong here. | |
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 27000 | I was also surprised. Thanks Martin for taking care about it | |
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 27000 | have you checked this one Martin? | |
What's the status of this change in general? There seem to be a couple of comments that are still open?
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 27000 | Sorry, no -- I've been busy with other things. | |
| lib/Object/Error.cpp | ||
|---|---|---|
| 94 | We can just return Error::success() instead of Err. The reasoning is:
| |
False positive - extract() reinitializes.