This is an archive of the discontinued LLVM Phabricator instance.

Remove the line number from DINamespace and thus decl_line/decl_file from DW_TAG_namespace.
AbandonedPublic

Authored by aprantl on Oct 28 2015, 3:15 PM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

aprantl updated this revision to Diff 38690.Oct 28 2015, 3:15 PM
aprantl retitled this revision from to Remove the line number from DINamespace and thus decl_line/decl_file from DW_TAG_namespace..
aprantl updated this object.
aprantl added reviewers: dexonsmith, echristo, dblaikie.
aprantl set the repository for this revision to rL LLVM.
aprantl added a subscriber: llvm-commits.
aprantl abandoned this revision.Feb 8 2018, 4:21 PM

A change to this effect landed a year ago in r301706.