[clang] [llvm] [Clang] Show inlining hints for __attribute__((warning/error)) (PR #174892)

Justin Stitt via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 8 11:34:54 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);
+  }
----------------
JustinStitt wrote:

Ok done with [`e866945` (#174892)](https://github.com/llvm/llvm-project/pull/174892/commits/e866945f1c61774e745ec3a793629104ef473fee) although it can get a bit noisy when there are multiple diagnostics. Should I try to engineer some EmitOnce or does something like that already exist?

https://github.com/llvm/llvm-project/pull/174892


More information about the llvm-commits mailing list