For the new hotness attribute, the API will take the pass rather than
the pass name so we can no longer play the trick of AlwaysPrint being a
special pass name. This adds a getter to help the transition.
There is also a corresponding clang patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274100
91177308-0d34-0410-b5e6-
96231b3b80d8
/// The printed message must not end with '.' nor start with a severity
/// keyword.
virtual void print(DiagnosticPrinter &DP) const = 0;
-
- static const char *AlwaysPrint;
};
typedef std::function<void(const DiagnosticInfo &)> DiagnosticHandlerFunction;
/// \see DiagnosticInfoOptimizationBase::isEnabled.
bool isEnabled() const override;
+ static const char *AlwaysPrint;
+
+ bool shouldAlwaysPrint() const { return getPassName() == AlwaysPrint; }
+
protected:
DiagnosticInfoOptimizationRemarkAnalysis(enum DiagnosticKind Kind,
const char *PassName,
return ++PluginKindID;
}
-const char *DiagnosticInfo::AlwaysPrint = "";
+const char *DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint = "";
DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I,
const Twine &MsgStr,
}
bool DiagnosticInfoOptimizationRemarkAnalysis::isEnabled() const {
- return getPassName() == DiagnosticInfo::AlwaysPrint ||
+ return shouldAlwaysPrint() ||
(PassRemarksAnalysisOptLoc.Pattern &&
PassRemarksAnalysisOptLoc.Pattern->match(getPassName()));
}
// With Rpass-analysis report why. This is on by default if distribution
// was requested explicitly.
emitOptimizationRemarkAnalysis(
- Ctx, Forced ? DiagnosticInfo::AlwaysPrint : LDIST_NAME, *F,
- L->getStartLoc(), Twine("loop not distributed: ") + Message);
+ Ctx, Forced ? DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint
+ : LDIST_NAME,
+ *F, L->getStartLoc(), Twine("loop not distributed: ") + Message);
// Also issue a warning if distribution was requested explicitly but it
// failed.
return LV_NAME;
if (getForce() == LoopVectorizeHints::FK_Undefined && getWidth() == 0)
return LV_NAME;
- return DiagnosticInfo::AlwaysPrint;
+ return DiagnosticInfoOptimizationRemarkAnalysis::AlwaysPrint;
}
bool allowReordering() const {