This is an archive of the discontinued LLVM Phabricator instance.

Fix forward declarations interfering with USR generation of external source symbols
ClosedPublic

Authored by nathawes on May 18 2017, 7:16 PM.

Details

Reviewers
akyrtzi
Summary

ObjC interfaces marked with an ExternalSourceSymbolAttr have the name of the external module they were defined in included in their USR. During USR generation we were looking for this attribute only on the canonical decl. In the case of ObjC interfaces and Tag decls however, the canonical declaration is simply the first one, which may be a forward declaration, rather than the definition that has the the attribute. This patch changes the logic to look for the attribute on the definitions for these cases.

Diff Detail

Repository
rL LLVM

Event Timeline

nathawes created this revision.May 18 2017, 7:16 PM
nathawes updated this revision to Diff 99519.May 18 2017, 8:34 PM
nathawes edited the summary of this revision. (Show Details)
akyrtzi edited edge metadata.May 18 2017, 9:06 PM

I recommend to add a Decl::getExternalSourceSymbolAttr() to reuse this and avoid code duplication.

nathawes updated this revision to Diff 99595.May 19 2017, 11:02 AM
nathawes planned changes to this revision.May 19 2017, 12:54 PM

Ah sorry, missed the "Decl::" part of your recommendation. I'll move it.

nathawes updated this revision to Diff 99622.May 19 2017, 1:45 PM
akyrtzi accepted this revision.May 19 2017, 9:25 PM

Also used the new Decl:: function in a place in libclang/CIndex.cpp and committed in r303484

This revision is now accepted and ready to land.May 19 2017, 9:25 PM
akyrtzi closed this revision.May 19 2017, 9:26 PM