[llvm] 502280e - [Verifier] Pass raw_ostream as pointer instead of reference
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 01:58:04 PDT 2023
Author: Benjamin Kramer
Date: 2023-08-01T10:44:28+02:00
New Revision: 502280ed3561e76443ac58e634d3d6468224dd48
URL: https://github.com/llvm/llvm-project/commit/502280ed3561e76443ac58e634d3d6468224dd48
DIFF: https://github.com/llvm/llvm-project/commit/502280ed3561e76443ac58e634d3d6468224dd48.diff
LOG: [Verifier] Pass raw_ostream as pointer instead of reference
This can be nullptr and ubsan found a couple of cases in LLVM's unit
tests.
Added:
Modified:
llvm/include/llvm/ADT/GenericConvergenceVerifier.h
llvm/lib/IR/Verifier.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/GenericConvergenceVerifier.h b/llvm/include/llvm/ADT/GenericConvergenceVerifier.h
index 213d77593c9968..ae5e9e85856390 100644
--- a/llvm/include/llvm/ADT/GenericConvergenceVerifier.h
+++ b/llvm/include/llvm/ADT/GenericConvergenceVerifier.h
@@ -30,11 +30,11 @@ template <typename ContextT> class GenericConvergenceVerifier {
using CycleInfoT = GenericCycleInfo<ContextT>;
using CycleT = typename CycleInfoT::CycleT;
- void initialize(raw_ostream &OS,
+ void initialize(raw_ostream *OS,
function_ref<void(const Twine &Message)> FailureCB,
const FunctionT &F) {
clear();
- this->OS = &OS;
+ this->OS = OS;
this->FailureCB = FailureCB;
Context = ContextT(&F);
}
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index e03e6a117a243d..2374aeb8c1d666 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -408,7 +408,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
auto FailureCB = [this](const Twine &Message) {
this->CheckFailed(Message);
};
- CV.initialize(*OS, FailureCB, F);
+ CV.initialize(OS, FailureCB, F);
Broken = false;
// FIXME: We strip const here because the inst visitor strips const.
More information about the llvm-commits
mailing list