HomePhabricator

[APINotes] Don't apply API notes to non-definitions of structs. (#69)

Authored by jordan_rose on Mar 24 2017, 5:17 PM.

Description

[APINotes] Don't apply API notes to non-definitions of structs. (#69)

There are two reasons for this:

  • It doesn't really seem appropriate for forward-declared structs to pick up attributes.
  • In a proper definition struct X { ... }, the first struct X counts as a declaration, which means the API note attributes can get added ahead of time. Later on, when we try to add them /again/, they'll replace the attribute added at the first point rather than whatever the user wrote in source after the close brace. This also applies if there are any forward declarations before the definition.

There is a downside: API notes now can't affect tag types that are
/never/ defined (for example, structs that are forward-declared for
use in pointers). Any annotations one might want to apply to such
a type must be written in source.

rdar://problem/29981732

apple-llvm-split-commit: 911df2f93842d956d2848d8c10366b742cc4eef2
apple-llvm-split-dir: clang/

Details

Committed
GitHub <noreply@github.com>Mar 24 2017, 5:17 PM
Parents
rG8b18b71370f2: Propagating prior merge from 'llvm.org/master'.
Branches
Unknown
Tags
Unknown