-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang analyzer]consume llvm::Error
#120597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
`llvm::Error` must be consumed, otherwise it will cause trap during destructor
|
@llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang Author: Congcong Cai (HerrCai0907) Changes
Full diff: https://github.com/llvm/llvm-project/pull/120597.diff 1 Files Affected:
diff --git a/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp
index 71268af22e2424..e8cf367b833467 100644
--- a/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp
@@ -81,7 +81,7 @@ class TextDiagnostics : public PathDiagnosticConsumer {
if (llvm::Error Err = Repls.add(Repl)) {
llvm::errs() << "Error applying replacement " << Repl.toString()
- << ": " << Err << "\n";
+ << ": " << llvm::toString(std::move(Err)) << "\n";
}
}
};
|
|
How did you notice this? If its from a real case then we could add a regression test for this too. |
|
I want to use error in other place and follow this style to print error, but get a trap since Error isn't consumed. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/10726 Here is the relevant piece of the build log for the reference |
llvm::Errormust be consumed, otherwise it will cause trap during destructor