Commit Graph

12 Commits

Author SHA1 Message Date
Becca Royal-Gordon
e22b6d6ee4 Handle subscripts in formDeclNameRef()
In particular, we were unconditionally dropping argument labels on accessors; now we only do that for property accessors, not subscript accessors.

Doing this unconditionally causes ClangImporter failures when a method parameter is called “subscript” (really!), so this behavior is enabled only by the caller’s request.
2021-03-24 14:55:06 -07:00
Becca Royal-Gordon
8d0040fa2b Improve access note error handling
The LLVM rebranch added an “AllowUnknownKeys” setting to llvm::yaml::Input, which lets us rip out a lot of marginal code and encourages a broader rework of access note error diagnosis:

• Access note warnings and errors are now diagnosed as they’re found during YAML parsing
• They now have proper SourceLocs inside the .accessnotes file
• They’re now tested using -verify-additional-file instead of FileCheck
• A lot of gross duct tape is now gone
2021-02-10 00:29:34 -08:00
Becca Royal-Gordon
d8c34638ec Update access note serialization for LLVM rebranch 2021-02-09 19:00:54 -08:00
Becca Royal-Gordon
01fa74510e [NFC] Clean up access note code
• Rename properties for greater consistency with the YAML file
• Rename AccessNotes -> AccessNotesFile
• Add doc comments
• Miscellaneous comment/style improvements.
2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
bf13139495 Allow unknown keys in access notes
LLVM’s YAML support wants to show a hard error if an unknown string appears in an access note. Instead, emit a remark but load the parts of the access note we do understand to allow for future expansion of access notes.
2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
899d1a47e5 [NFC] Centralize ObjCSelector helper 2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
e42294737f Handle access note I/O and parse errors 2021-02-09 14:17:35 -08:00
Becca Royal-Gordon
af55bbcede [NFC] Correct copyright years 2021-02-09 14:17:34 -08:00
Becca Royal-Gordon
feca4e6391 Let access notes apply to accessors
`Name: ‘getter:Context.property()’` now applies an access note to a getter of Context.property, and `Name: ‘setter:Context.property(_:)’` applies one to its setter. Additionally, access notes without `getter:` or `setter:` now cannot apply to accessors.
2021-02-09 14:17:34 -08:00
Becca Royal-Gordon
9ca2fbdb74 Clarify behavior of access note with ObjCName only
An access note with an ObjCName property but no ObjC property now implicitly sets ObjC to true. ObjC: false with an ObjCName is still illegal.
2021-02-09 14:17:34 -08:00
Becca Royal-Gordon
bde58ed167 Flatten access note format
Rather than nesting notes for members inside a note for the type, access note files now contain a flat list of notes with parent names embedded in the `Name` property.

Fixes rdar://71872830.

fixup spacing in access notes
2021-02-09 14:17:34 -08:00
Becca Royal-Gordon
ccf244b89b Add ability to load access notes 2021-02-09 14:17:33 -08:00