-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AST] Dump decl attributes #77937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AST] Dump decl attributes #77937
Conversation
@swift-ci Please smoke test |
76ae112
to
7caeaca
Compare
Previously only some random decl attributes were included in the dump with the source spelling (e.g. @objc), or some affected how the decl is dumped. But the full attribute list has not been dumped. Dumping attributes are useful for debugging attribute handling.
7caeaca
to
507e816
Compare
@swift-ci Please smoke test |
// RUN: sed -E 's#0x[0-9a-fA-F]+##g' %t/astgen.ast.raw > %t/astgen.ast | ||
|
||
// RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SwiftParser/ASTGen has better recovery so AST might be different in invalid cases. It's not worth to emit the same AST.
Specifically, e.g. C++ parser discards the whole attribute for @_silgen_name("whatever", extra)
because of the extra
argument. But ASTGen recovers it.
printFoot(); \ | ||
} | ||
|
||
TRIVIAL_ATTR_PRINTER(Actor, actor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use SIMPLE_DECL_ATTR
here? LLVM has convertToSnakeFromCamelCase
FWIW which could be used to convert the class name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, I didn't know convertToSnakeFromCamelCase
. ... it seems to convert ObjCMembers
to obj_c_members
? which makes sense, but since we use objc_
, I'd go without it for now. Unfortunate.
Previously only some random decl attributes were included in the dump with the source spelling (e.g.
@objc
), or some affected how the decl is dumped. But the full attribute list has not been dumped. Dumping attributes are useful for debugging attribute handling.