[llvm-branch-commits] [llvm] [BOLT] Gadget scanner: refactor issue reporting (PR #135662)
Anatoly Trosinenko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 29 07:19:47 PDT 2025
================
@@ -720,16 +713,30 @@ SrcSafetyAnalysis::create(BinaryFunction &BF,
RegsToTrackInstsFor);
}
-static std::shared_ptr<Report>
+static BriefReport<MCPhysReg> make_generic_report(MCInstReference Location,
+ StringRef Text) {
+ auto Report = std::make_shared<GenericDiagnostic>(Location, Text);
+ return BriefReport<MCPhysReg>(Report, std::nullopt);
+}
+
+template <typename T>
+static BriefReport<T> make_report(const GadgetKind &Kind,
+ MCInstReference Location,
----------------
atrosinenko wrote:
> If the first function is called `make_generic_report`, would it be more consistent to call the second function `make_gadget_report`?
This definitely makes sense.
> I'm guessing you might have thought about this and come to the conclusion that having two `make_report` functions is better?
Not sure two separate functions are absolutely necessary, but I would like to get rid of template parameters when calling the function when possible (similar to calling `std::make_pair` vs. instantiating `std::pair` directly). Maybe is would be reasonable to add an explicit type parameter to `make_generic_report` instead of assuming `MCPhysReg`, but added a brief explanation instead for now...
https://github.com/llvm/llvm-project/pull/135662
More information about the llvm-branch-commits
mailing list