[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:260 +``escape`` placed on a function parameter of a pointer type is used to indicate +that the pointer can escape the function. This means that a reference to the object +the pointer points to that is d

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. > The attribute will first be used by the Swift compiler in a new implicit > bridging diagnostic, but may have other non-Swift use-cases for diagnostics. This means there's no use of this attribute within Clang which suggests to me that this attribute belongs in t

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-29 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko accepted this revision. vsavchenko added a comment. This revision is now accepted and ready to land. Awesome, I have nothing to add at this point! Let's still wait for @aaron.ballman to check it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.o

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-29 Thread Josh Learn via Phabricator via cfe-commits
guitard0g added a comment. @vsavchenko > I see that the "applies to pointer arguments only" warning is not tested for > `noescape`, but I still find it to be a good practice to write a test with a > bunch of cases with attributes applied in wrong places. Updated with some tests for this! > Ad

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-29 Thread Josh Learn via Phabricator via cfe-commits
guitard0g updated this revision to Diff 362849. guitard0g marked an inline comment as done. guitard0g added a comment. Add tests for diagnostics of incorrect usage. Diagnose when escape and noescape are used on the same parameter. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-29 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added a comment. Great job! It looks good, but I have a couple of minor tweaks. I see that the "applies to pointer arguments only" warning is not tested for `noescape`, but I still find it to be a good practice to write a test with a bunch of cases with attributes applied in wrong p

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-28 Thread Josh Learn via Phabricator via cfe-commits
guitard0g marked an inline comment as done. guitard0g added inline comments. Comment at: clang/include/clang/Basic/Attr.td:1952 +def Escape : Attr { + let Spellings = [Clang<"escape">]; NoQ wrote: > Shouldn't both this attribute and the one above be `Inheritab

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-28 Thread Josh Learn via Phabricator via cfe-commits
guitard0g updated this revision to Diff 362643. guitard0g added a comment. Herald added a subscriber: jdoerfert. Change Escape/NoEscape to use InheritableAttr and update an attribute test to fix test failure. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llv

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-28 Thread Josh Learn via Phabricator via cfe-commits
guitard0g added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:260 +``escape`` placed on a function parameter of a pointer type is used to indicate +that the pointer can escape the function. This means that a reference to the object +the pointer points to tha

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > may have other non-Swift use-cases for diagnostics. I'm looking forward to taking advantage of this attribute in the static analyzer's `StackAddrEscapeChecker`! Comment at: clang/include/clang/Basic/Attr.td:1952 +def Escape : Attr { + let Spellings =

[PATCH] D107026: [Clang] Add support for attribute 'escape'

2021-07-28 Thread Josh Learn via Phabricator via cfe-commits
guitard0g created this revision. guitard0g added reviewers: aaron.ballman, NoQ, vsavchenko. guitard0g requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. The 'escape' attribute indicates that the annotated pointer parameter may escape the scope