pImpl->DiagnosticHandler(DI, pImpl->DiagnosticContext);
return;
}
+
+ // Optimization remarks are selective. They need to check whether
+ // the regexp pattern, passed via -pass-remarks, matches the name
+ // of the pass that is emitting the diagnostic. If there is no match,
+ // ignore the diagnostic and return.
+ if (DI.getKind() == llvm::DK_OptimizationRemark &&
+ !pImpl->optimizationRemarksEnabledFor(
+ cast<DiagnosticInfoOptimizationRemark>(DI).getPassName()))
+ return;
+
// Otherwise, print the message with a prefix based on the severity.
std::string MsgStorage;
raw_string_ostream Stream(MsgStorage);
const Function &Fn,
const DebugLoc &DLoc,
const Twine &Msg) {
- if (pImpl->optimizationRemarksEnabledFor(PassName))
- diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
+ diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
}
//===----------------------------------------------------------------------===//