zaks.anna added a comment.

Pierre,

Have you seen the post about API Notes?
http://llvm.cc/t/cfe-dev-clang-and-swift/331

I believe using API notes would be a better approach for adding annotations. By 
the time the static analyzer sees the AST, the annotations would already be 
there. The API Notes should already seamlessly work for nullability 
annotations. Does that work for you? (Do we still need some parts of this 
patch? I am not sure.)

A related topic is deciding what type of attributes should be used by the 
static analyzer checkers. Currently, there are 2 options, neither of which is 
ideal:

1. Extend clang with new attributes for static analyzes. This is not highly 
desirable because the clang attributes namespace will get polluted and compiler 
users might start using them. This approach is also not convenient for 
proprietary checkers.
2. Annotate attribute (AnnotateAttr) is used in some places; however, this 
attribute creeps into LLVMIR, which caused problems in the past.

The best approach would be to put all analyzer attributes behind "a fence" so 
that we could add/remove them without worrying that compiler(not analyzer) 
users depend on them. The attribute would not be CodeGened.

Here what it might look like:
analyzer_annotate(family, arg…)
family: id
arg:     [id=] value
value:  number | string | id

Is anyone interested in implementing this?


http://reviews.llvm.org/D13731



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

Reply via email to