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

Authored by nathawes on Thu, May 18, 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
nathawes created this revision.Thu, May 18, 7:16 PM
nathawes updated this revision to Diff 99519.Thu, May 18, 8:34 PM
nathawes edited the summary of this revision. (Show Details)

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

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

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

nathawes updated this revision to Diff 99622.Fri, May 19, 1:45 PM
akyrtzi accepted this revision.Fri, May 19, 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.Fri, May 19, 9:25 PM
akyrtzi closed this revision.Fri, May 19, 9:26 PM