[PATCH] Anonymous namespaces are missing import DW_TAG_imported_module.

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Mar 3 14:09:08 PST 2015

The language says things in an anonymous namespace are automatically imported into the containing scope. The question is whether the compiler expects the debugger to know that a-priori.
The compiler can let the debugger off the hook by emitting an explicit import. Source fidelity requires that the import be marked artificial, because it's implicit in the source, rather than explicit; one of those "as if" things.
Or, the compiler can require the debugger to know more about how the language works, and not emit the explicit import.
Either way is legal DWARF, and has no source-fidelity issues, but the former doesn't leave one particular language detail up to the debugger to get right.

From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of David Blaikie
Sent: Tuesday, March 03, 2015 9:44 AM
To: reviews+D7895+public+7827be49c0b04087 at reviews.llvm.org
Cc: llvm-commits at cs.uiuc.edu; Romanova, Katya
Subject: Re: [PATCH] Anonymous namespaces are missing import DW_TAG_imported_module.

On Fri, Feb 27, 2015 at 5:28 PM, Paul Robinson <Paul_Robinson at playstation.sony.com<mailto:Paul_Robinson at playstation.sony.com>> wrote:
It's an arguable gray area in the compiler/debugger contract.  How much
does the compiler _require_ the debugger to know?  (Which is different
from how much the debugger knows for the purpose of improving the user's
debugging experience.)

I don't quite see the grey here - I thought the line of reasoning you've provided in the past was fairly simple: source fidelity. The source doesn't have a using directive in it, so I don't know why we'd expect to see one in the debug info.

This change reduces that requirement, with very low size cost (which we
are pretty sensitive to).  A debugger that auto-imports anonymous
namespaces will see the import and recognize that it has already imported
 that scope, so the cost there is also very low.

Not seeing a whole lot of down-side here.

Mostly just principles & a desire not to add cruft in source or output.

Not sure if other people have any opinion on this, I'm happy to defer.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150303/7874570f/attachment.html>

More information about the llvm-commits mailing list