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 = [Clang<"escape">];
----------------
Shouldn't both this attribute and the one above be `InheritableAttr`?

Comments in this file say:
```
/// An inheritable attribute is inherited by later redeclarations.
```
Which is arguably exactly what we want? Like, it should be sufficient to put 
the attribute into the header, there's no need to duplicate it in the 
implementation?


================
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 derived from the parameter value may survive
----------------
Are you sure you want "can escape" instead of "will escape"? In the former case 
it's impossible to implement the warning without false positives ("well, it 
says it may escape, but I know for sure that if I pass these other arguments 
then it won't escape"). In the latter case, of course, a lot of places where 
the value escapes conditionally won't be able to wear the attribute. Do I 
understand correctly that you want to proceed with the more aggressive 
diagnostic?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107026/new/

https://reviews.llvm.org/D107026

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to