This is an archive of the discontinued LLVM Phabricator instance.

Always emit DW_AT_declaration attribute when the variable isn't a definition.
ClosedPublic

Authored by friss on Sep 17 2014, 8:21 AM.

Details

Summary

This doesn't show up today as we don't emit decalration only variables. This
will be tested when the followup patches implementing import of forward
declared entities lands in clang.

Diff Detail

Repository
rL LLVM

Event Timeline

friss updated this revision to Diff 13787.Sep 17 2014, 8:21 AM
friss retitled this revision from to Always emit DW_AT_declaration attribute when the variable isn't a definition..
friss added reviewers: echristo, dblaikie, aprantl.
friss updated this object.
friss added a subscriber: Unknown Object (MLST).
echristo edited edge metadata.Sep 17 2014, 9:25 AM

This sounds like we'd want DIEs for global variable declarations or have I missed something?

friss added a comment.Sep 17 2014, 9:30 AM

It's not that we want declarations for all globals, but sometimes a declaration is all we have:

namespace ns {
extern int A;
}
using ns::A;
int foo(int Arg = A) { return Arg; }

In the above, if we want to emit the imported_declaration or the default argument, we want to have a declaration only DIE for the global.

echristo accepted this revision.Sep 17 2014, 9:55 AM
echristo edited edge metadata.

Ah right. OK with the testing coming in short order via the rest of it as we get patches :)

This revision is now accepted and ready to land.Sep 17 2014, 9:55 AM
friss closed this revision.Sep 18 2014, 2:48 AM
friss updated this revision to Diff 13824.

Closed by commit rL218041 (authored by @friss).

friss added a comment.Sep 18 2014, 4:32 AM

This commit seems to have broken the gdb test suite:

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/17377/steps/gdb-75-check/logs/stdio http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/17377/steps/gdb-75-check/logs/stdio

If someone with access to gdb test suite could help me figure it out, that would be great.

Fred

You can check out the testcases yourself from svn and take a look at the
differences in the 3 failing tests as far as debug info. They're short.

-eric