aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2025-05-28 12:26:39 -0700
committerGitHub <noreply@github.com>2025-05-28 12:26:39 -0700
commitb7bb2567032f2264715234bcd8ddf55414d99b5d (patch)
tree6270e407f0c4adf10761f9fdaaedff1e9f9cda26 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parente653dc9ca00819dc7767dbde4422e96ddc296d03 (diff)
downloadllvm-b7bb2567032f2264715234bcd8ddf55414d99b5d.zip
llvm-b7bb2567032f2264715234bcd8ddf55414d99b5d.tar.gz
llvm-b7bb2567032f2264715234bcd8ddf55414d99b5d.tar.bz2
Warn on misuse of DiagnosticInfo classes that hold Twines (#137397)
This annotates the `Twine` passed to the constructors of the various DiagnosticInfo subclasses with `[[clang::lifetimebound]]`, which causes us to warn when we would try to print the twine after it had already been destructed. We also update `DiagnosticInfoUnsupported` to hold a `const Twine &` like all of the other DiagnosticInfo classes, since this warning allows us to clean up all of the places where it was being used incorrectly.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index e1bdc7e..b8c632d1 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -709,7 +709,7 @@ class LoweringDiagnosticInfo : public DiagnosticInfo {
const Twine &Msg;
public:
- LoweringDiagnosticInfo(const Twine &DiagMsg,
+ LoweringDiagnosticInfo(const Twine &DiagMsg LLVM_LIFETIME_BOUND,
DiagnosticSeverity Severity = DS_Error)
: DiagnosticInfo(DK_Lowering, Severity), Msg(DiagMsg) {}
void print(DiagnosticPrinter &DP) const override { DP << Msg; }