[PATCH] D70469: [attributes] [analyzer] Add handle related attributes

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 16:59:59 PST 2019


xazax.hun marked an inline comment as done.
xazax.hun added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7287
+  case ParsedAttr::AT_AcquireHandle:
+    handleSimpleAttribute<AcquireHandleAttr>(S, D, AL);
+    break;
----------------
NoQ wrote:
> xazax.hun wrote:
> > NoQ wrote:
> > > The next obvious step here would be to type-check the declaration to make sure that it's actually a handle (and emit a warning if it isn't).
> > Yeah, I do agree, but I think this depends on the role of the attribute. Adding a type check would make this more restrictive in a sense other users who want to write for example a Posix API checker and want to reuse this attribute might not be able to do so without touching the type-check code. Which may or may not be good. I do not have any strong feelings about either of the directions. 
> So you envision this working on completely arbitrary types? Fair!
> 
> Maybe check that when `AcquireHandleAttr` is on a parameter, it's actually an out-parameter?
Hmm, I think this makes a lot of sense! So basically, I would exclude primitive, non-pointer types that are taken by value. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70469





More information about the cfe-commits mailing list