[clang] Add a flag to preserve the old macro behaviour. (PR #174895)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 7 17:04:32 PST 2026


================
@@ -345,7 +351,10 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
   if (Loc.isInvalid())
     return;
 
-  CurLoc = CGM.getContext().getSourceManager().getFileLoc(Loc);
+  if (DebugInfoMacroExpansionLoc)
+    CurLoc = CGM.getContext().getSourceManager().getExpansionLoc(Loc);
+  else
+    CurLoc = CGM.getContext().getSourceManager().getFileLoc(Loc);
----------------
dwblaikie wrote:

Wrap this up in a helper and use it in all the places that need it?

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


More information about the cfe-commits mailing list