llvm.org GIT mirror llvm / b902acb
Allow diagnostic handlers to check for optimization remarks. Summary: When optimization remarks are enabled via the driver flag -Rpass, we should allow the FE diagnostic handler to check if the given pass name needs a diagnostic. We were unconditionally checking the pattern defined in opt's -pass-remarks flag. This was causing the FE to not emit any diagnostics. Reviewers: qcolombet CC: llvm-commits Differential Revision: http://reviews.llvm.org/D3362 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206400 91177308-0d34-0410-b5e6-96231b3b80d8 Diego Novillo 6 years ago
1 changed file(s) with 11 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
129129 pImpl->DiagnosticHandler(DI, pImpl->DiagnosticContext);
130130 return;
131131 }
132
133 // Optimization remarks are selective. They need to check whether
134 // the regexp pattern, passed via -pass-remarks, matches the name
135 // of the pass that is emitting the diagnostic. If there is no match,
136 // ignore the diagnostic and return.
137 if (DI.getKind() == llvm::DK_OptimizationRemark &&
138 !pImpl->optimizationRemarksEnabledFor(
139 cast(DI).getPassName()))
140 return;
141
132142 // Otherwise, print the message with a prefix based on the severity.
133143 std::string MsgStorage;
134144 raw_string_ostream Stream(MsgStorage);
159169 const Function &Fn,
160170 const DebugLoc &DLoc,
161171 const Twine &Msg) {
162 if (pImpl->optimizationRemarksEnabledFor(PassName))
163 diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
172 diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
164173 }
165174
166175 //===----------------------------------------------------------------------===//