HomePhabricator

[libclang] Restore old clang_Cursor_isAnonymous behaviour

Description

[libclang] Restore old clang_Cursor_isAnonymous behaviour

D54996 Changed the behaviour of clang_Cursor_isAnonymous, but there is no alternative available to get the old behaviour in some cases, which is essential for determining if a record is syntactically accessible, e.g.

struct {

int x;
int y;

} foo;

struct {

struct {
  int x;
  int y;
};

} bar;

void fun(struct { int x; int y; } *param);
The only 'anonymous' struct here is the one nested in bar, since there is
no way to reference the struct itself, only the fields within. Though the
anonymity applies to the instance itself, not the type.

To avoid confusion, I have added a new function called clang_Cursor_isAnonymousRecordDecl
which has the old behaviour of clang_Cursor_isAnonymous (and updated the doc
for the latter as well, which was seemingly forgotten).

Patch by Jorn Vernee.

Differential Revision: https://reviews.llvm.org/D61232

Details

Committed
yvvanApr 29 2019, 6:44 AM
Differential Revision
D61232: [libclang] Restore old clang_Cursor_isAnonymous behaviour
Parents
rL359447: FileCheck [2/12]: Stricter parsing of -D option
Branches
Unknown
Tags
Unknown