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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 16:37:14 PDT 2015


> On 2015-Oct-28, at 15:15, Adrian Prantl <aprantl at apple.com> 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.
> 
> [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
>  unittests/IR/MetadataTest.cpp
> 
> <D14161.38690.patch>

I notice you missed updating LangRef.

I haven't had a chance to look in detail at the rest of the IR changes.  I'll
try to look in the next few days.


More information about the llvm-commits mailing list