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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 15:15:07 PDT 2015


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14161.38690.patch
Type: text/x-patch
Size: 16229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151028/5e6f5c53/attachment.bin>


More information about the llvm-commits mailing list