This is an archive of the discontinued LLVM Phabricator instance.

Add #pragma clang attribute support for the external_source_symbol attribute
ClosedPublic

Authored by arphaman on Apr 18 2017, 9:39 AM.

Details

Summary

Right now the external_source_symbol attribute isn't supported by #pragma clang attribute for the following two reasons:

  • The Named attribute subject isn't supported by TableGen.
  • There was no way to specify a subject match rule for #pragma clang attribute that could operate on a set of attribute subjects (e.g. the ones that derive from NamedDecl).

This patch fixes the two issues and thus adds external_source_symbol support to #pragma clang attribute,

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Apr 18 2017, 9:39 AM
arphaman updated this revision to Diff 95593.Apr 18 2017, 9:42 AM

Avoid a vector copy by using a reference variable.

aaron.ballman added inline comments.Apr 19 2017, 5:34 AM
lib/Sema/SemaDeclAttr.cpp
5769 ↗(On Diff #95593)

Instead of duplicating this check in the if statement, why not hoist the current check above the if statement?

utils/TableGen/ClangAttrEmitter.cpp
1620 ↗(On Diff #95593)

ArrayRef automatically converts to a std::vector, so you should just be able to use Rules(Rules).

1625 ↗(On Diff #95593)

Any reason not to return this rule by const ref and make the function const?

1701 ↗(On Diff #95593)

Can use const auto * here

arphaman updated this revision to Diff 95754.Apr 19 2017, 8:17 AM
arphaman marked 4 inline comments as done.

Addressed Aaron's comments.

lib/Sema/SemaDeclAttr.cpp
5773 ↗(On Diff #95754)

I hoisted it after diagnoseLangOpts to keep some tests happy.

This revision is now accepted and ready to land.Apr 19 2017, 8:51 AM
This revision was automatically updated to reflect the committed changes.