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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 10 10:37:16 PST 2019


aaron.ballman added a comment.

In D70469#1776523 <https://reviews.llvm.org/D70469#1776523>, @NoQ wrote:

> It still mildly worries me that the attributes aren't truly reusable, as the exact meaning of the attribute depends on the domain. In particular, every domain is expected to have different approaches to error handling, i.e. a function that creates or destroys a handle may fail to, respectively, create or destroy the handle, but instead indicate the failure in a domain-specific manner, eg. through magical return values or null handle or errno or whatever.
>
> @aaron.ballman, do you think this is a problem? Should we rather go for an attribute name that's obviously domain-specific (eg., `__attribute__((fuchsia_acquire_handle))`), or is it ok to re-use attributes without re-using their exact meaning?


That may be part of why I keep pushing back on this addition -- it seems like these are general purpose attributes that can be used to identify what a handle is and where a handle is obtained/released. Or these could be specific to a particular coding guideline's definition of a handle and associated semantics. If the goal is to only support a limited set of use cases, then I think something like `[[clang::fucschia_acquire_handle]]` makes more sense. If the goal is to provided general utilities for the static analyzer to reason about handles, then I think we want the more generalized names.


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

https://reviews.llvm.org/D70469





More information about the cfe-commits mailing list