Closed HerrCai0907 closed 6 months ago
@llvm/issue-subscribers-clang-tidy
Author: Congcong Cai (HerrCai0907)
I began working on this check request. I expect to have a pull request ready by Wednesday, possibly sooner if I don't face any unforeseen issues.
Any other resources I could reference would be greatly appreciated.
I think this check should be regardless this is const reference, reference or rvalue reference.
S&& f(S &&a) { return std::move(a); }
S const & a = f(S{}); // object referenced by 'a' has destructed after this statement
check should detect functions that return reference to argument.
Please note: we are not allowed to implement AUTOSAR rules:
https://discourse.llvm.org/t/clang-tidy-rfc-add-autosar-c-14-clang-tidy-module/59223 https://reviews.llvm.org/D112730
Implementing this functionality without using AUTOSAR as a reference would be fine, though. Is there a similar e.g. C++ Core Guideline that could be used instead?
Please note: we are not allowed to implement AUTOSAR rules:
https://discourse.llvm.org/t/clang-tidy-rfc-add-autosar-c-14-clang-tidy-module/59223
https://reviews.llvm.org/D112730
Implementing this functionality without using AUTOSAR as a reference would be fine, though. Is there a similar e.g. C++ Core Guideline that could be used instead?
Could we avoid legacy issues if we don't mention any autosar related things?
Could we avoid legacy issues if we don't mention any autosar related things?
Sure, if we can avoid any mention to AUTOSAR and not copy anything from that document (rule text, rationale, code examples) then I think it should be good.
example