aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DiagnosticInfo.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2022-03-18 00:04:22 +0000
committerPaul Kirth <paulkirth@google.com>2022-03-18 00:04:22 +0000
commit6cf560d69a222bff4af4e1d092437fd77f0f981c (patch)
tree1294c0be71860eb829e4f5ad9d5a3bcbbbcf6edd /llvm/lib/IR/DiagnosticInfo.cpp
parent10866a1df4a82cdc54187330c509a2d46235455d (diff)
downloadllvm-6cf560d69a222bff4af4e1d092437fd77f0f981c.zip
llvm-6cf560d69a222bff4af4e1d092437fd77f0f981c.tar.gz
llvm-6cf560d69a222bff4af4e1d092437fd77f0f981c.tar.bz2
Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics""
I mistakenly reverted my commit, so I'm relanding it. This reverts commit 10866a1df4a82cdc54187330c509a2d46235455d.
Diffstat (limited to 'llvm/lib/IR/DiagnosticInfo.cpp')
-rw-r--r--llvm/lib/IR/DiagnosticInfo.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index f46f0fd..50fe682 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -393,6 +393,17 @@ std::string DiagnosticInfoOptimizationBase::getMsg() const {
return OS.str();
}
+DiagnosticInfoMisExpect::DiagnosticInfoMisExpect(const Instruction *Inst,
+ Twine &Msg)
+ : DiagnosticInfoWithLocationBase(DK_MisExpect, DS_Warning,
+ *Inst->getParent()->getParent(),
+ Inst->getDebugLoc()),
+ Msg(Msg) {}
+
+void DiagnosticInfoMisExpect::print(DiagnosticPrinter &DP) const {
+ DP << getLocationStr() << ": " << getMsg();
+}
+
void OptimizationRemarkAnalysisFPCommute::anchor() {}
void OptimizationRemarkAnalysisAliasing::anchor() {}