<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 3:15 PM, Adrian Prantl via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">aprantl created this revision.<br>
aprantl added reviewers: dexonsmith, echristo, dblaikie.<br>
aprantl added a subscriber: llvm-commits.<br>
aprantl set the repository for this revision to rL LLVM.<br>
<br>
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].<br>
<br>
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.<br></blockquote><div><br></div><div>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. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
[1] <a href="https://web.archive.org/web/20140725222822/http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073801.html" rel="noreferrer" target="_blank">https://web.archive.org/web/20140725222822/http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/073801.html</a><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D14161" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14161</a><br>
<br>
Files:<br>
  include/llvm/IR/DIBuilder.h<br>
  include/llvm/IR/DebugInfoMetadata.h<br>
  lib/AsmParser/LLParser.cpp<br>
  lib/Bitcode/Reader/BitcodeReader.cpp<br>
  lib/Bitcode/Writer/BitcodeWriter.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
  lib/CodeGen/CGDebugInfo.cpp<br>
  lib/IR/AsmWriter.cpp<br>
  lib/IR/DIBuilder.cpp<br>
  lib/IR/DebugInfoMetadata.cpp<br>
  lib/IR/LLVMContextImpl.h<br>
  test/Assembler/dinamespace.ll<br>
  test/CodeGenCXX/debug-info-namespace.cpp<br>
  test/DebugInfo/Generic/namespace.ll<br>
  test/DebugInfo/X86/dwarf-public-names.ll<br>
  test/Modules/ExtDebugInfo.cpp<br></blockquote><div><br></div><div>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 ^)<br><br>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 :)<br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  unittests/IR/MetadataTest.cpp<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>