-
Notifications
You must be signed in to change notification settings - Fork 95
[WIP]Memory Ownership Annotations #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…tandardize function declarations with explicit `void` parameters for consistency.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
==========================================
- Coverage 91.52% 91.47% -0.06%
==========================================
Files 236 236
Lines 29561 28818 -743
==========================================
- Hits 27057 26361 -696
+ Misses 2504 2457 -47 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pnoltes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR. I was not aware that this is possible and this looks like a good addition to make the code more readable and even more when using clang-tidy.
Should we also add clang-tidy to our CI?
For the usage of '(void)' for an explicit empty argument list, maybe this should also be added to our coding conventions documentation.
And ideally when to use 'CELIX_OWNERSHIP_RETURNS', '_TAKES' and ' _HOLDS' should also be documented.
Yes.
I am currently working on fixing the |
Description
This pull request focuses on improving code clarity and consistency. The changes include:
voidin parameter lists for consistency.CELIX_HAS_ATTRIBUTEmacro to check for attribute support.Usage
Enable the following clang-tidy checks to see its effects:
Both vscode and Clion IDE have good integrations with clang-tidy.
Limitations
ownership_returnscan only be used to mark functions returning their allocations through return values, i.e., output parameter is not supported, see [analyzer] Extend ownership_returns attribute to cover output parameters llvm/llvm-project#166122The first issue leads to lots of false-positives, which can fortunately be suppressed using
NOLINTmacros. I will try to fix both issues in the Clang upstream.