[PATCH] D130055: Clang extensions yolo, woot & kaboom
Jan Korous via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 19 10:42:03 PDT 2022
jkorous added a comment.
Hi Chris! This is a very interesting idea!
I do have couple thoughts - mostly that this could lead to something great and I would love it to apply to as many relevant cases as possible.
It looks like there is a possibility that a free function, static method or a method of another class (a `friend`?) should be `woot` for a specific pointer/reference parameter.
struct Foo {int a};
void init_Foo(Foo& f) { f.a = 42; }
In the same spirit as the above I think that `kaboom` should be applicable to functions in general.
BTW - if we generalize `woot` and `kaboom` - won't we get support for built-in types as a side-effect and won't that give us C support as a side-effect?
Last but not least - it would be really interesting to have the ability to check and diagnose improper use of these attributes.
One specific scenario that seems interesting to me is the ability to verify also absence of an attribute. (That could in-turn potentially unlock more aggressive analysis at call-sites.)
Example:
struct Bar {
int a, b;
Bar() : a(0) { } // <--- warning: constructor should be [[yolo]]
};
...and if we had that - would might potentially even collapse `woot` and !`yolo` together?
I can imagine that some parts of C++ would be tricky - e. g. templates so not sure how far could this idea be stretched.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130055/new/
https://reviews.llvm.org/D130055
More information about the cfe-commits
mailing list