[clang] [llvm] [Clang] Show inlining hints for __attribute__((warning/error)) (PR #174892)
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 8 13:06:20 PST 2026
================
@@ -2253,6 +2253,14 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
Opts.getDebugInfo() == llvm::codegenoptions::NoDebugInfo)
Opts.setDebugInfo(llvm::codegenoptions::LocTrackingOnly);
+ // Debug mode for inlining chain diagnostics requires at least
+ // -gline-directives-only to track inlining locations via DILocation.
+ if (Opts.getInliningChain() == CodeGenOptions::Inlining_Debug &&
+ Opts.getDebugInfo() < llvm::codegenoptions::DebugDirectivesOnly) {
+ Diags.Report(diag::warn_fe_inlining_debug_requires_g);
+ Opts.setInliningChain(CodeGenOptions::Inlining_Heuristic);
+ }
----------------
nickdesaulniers wrote:
> it can get a bit noisy when there are multiple diagnostics.
I'm ok with that. If your code emits multiple instances of _any_ diagnostic that additionally has a note attached, clang generally doesn't dedup the notes IIRC, so that's in line with the status quo.
https://github.com/llvm/llvm-project/pull/174892
More information about the llvm-commits
mailing list