[PATCH] D14161: Remove the line number from DINamespace and thus decl_line/decl_file from DW_TAG_namespace.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 15:46:31 PDT 2015


On Wed, Oct 28, 2015 at 3:15 PM, Adrian Prantl via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> aprantl created this revision.
> aprantl added reviewers: dexonsmith, echristo, dblaikie.
> aprantl added a subscriber: llvm-commits.
> aprantl set the repository for this revision to rL LLVM.
>
> The file/line on DINamespace only serves one purpose and that is to
> prevent anonymous namespaces from different CUs from accidentally being
> uniqued. Since (C++) namespaces can be opened and closed in many different
> places, it makes no sense to put an arbitrary decl_file/decl_line on them
> and having it there prevents ODR type uniquing [example 1].
>
> This patch gets rid of the line number field in DINamespace. The file is
> still inherited from DIScope. CFE only attaches a DIFile when the namespace
> is anonymous. A more radical approach would be to drop the DIFile, too, and
> make anonymous namespaces distinct. I'll reserve this as the next
> incremental step.
>

I'd probably do it the other way around - make the anonymous namespaces
distinct, then drop the line/file, but you're writing the code, so that's
your call.


>
> [1]
> https://web.archive.org/web/20140725222822/http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073801.html
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D14161
>
> Files:
>   include/llvm/IR/DIBuilder.h
>   include/llvm/IR/DebugInfoMetadata.h
>   lib/AsmParser/LLParser.cpp
>   lib/Bitcode/Reader/BitcodeReader.cpp
>   lib/Bitcode/Writer/BitcodeWriter.cpp
>   lib/CodeGen/AsmPrinter/DwarfUnit.cpp
>   lib/CodeGen/AsmPrinter/DwarfUnit.h
>   lib/CodeGen/CGDebugInfo.cpp
>   lib/IR/AsmWriter.cpp
>   lib/IR/DIBuilder.cpp
>   lib/IR/DebugInfoMetadata.cpp
>   lib/IR/LLVMContextImpl.h
>   test/Assembler/dinamespace.ll
>   test/CodeGenCXX/debug-info-namespace.cpp
>   test/DebugInfo/Generic/namespace.ll
>   test/DebugInfo/X86/dwarf-public-names.ll
>   test/Modules/ExtDebugInfo.cpp
>

This patch seems like a weird hybrid - it's rooted in the llvm source tree,
but has changes to Clang as well (like this test case ^)

But I'm happy with you going forward with the changes post-commit review if
the (reasonably short term) end goal is to have no line or file on
namespaces, and anonymous namespaces be distinct nodes. Sounds dandy to me
:)

- Dave


>   unittests/IR/MetadataTest.cpp
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151028/d53da347/attachment.html>


More information about the llvm-commits mailing list