[PATCH] D41456: [clang-tidy] readability-else-after-return: also diagnose noreturn function calls.
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 23 08:18:07 PDT 2018
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.
The problem with this proposed functionality is that it's not always obvious at the call site whether a function is noreturn. exit() may be an easy case, but there may be much less obvious names and whether the function is noreturn may depend on compile-time configuration or be instantiation-dependent in template code (https://godbolt.org/g/fNtpCy):
template<typename T>
struct X {
void f();
};
template<>
struct X<int> {
[[noreturn]] void f();
};
template<typename T>
void f(int x) {
if (x) {
X<T>().f();
} else { // Should the check complain here?
//...
}
}
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41456
More information about the cfe-commits
mailing list