Fix clang-tidy bugprone* warnings (#148529)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/148529
Approved by: https://github.com/ezyang
This commit is contained in:
Yuanyuan Chen
2025-06-23 23:09:56 +00:00
committed by PyTorch MergeBot
parent 3f920f3d8f
commit 07bb097698
28 changed files with 74 additions and 79 deletions

View File

@ -280,6 +280,7 @@ static PyObject* THPModule_crashIfvptrUBSAN(PyObject* module, PyObject* noarg) {
virtual ~Baz() = default;
};
Baz x{};
// NOLINTNEXTLINE(bugprone-casting*)
auto y = static_cast<Foo*>(static_cast<void*>(&x));
auto rc = y->bar();
return THPUtils_packInt32(rc);
@ -2371,7 +2372,7 @@ Call this whenever a new thread is created in order to propagate values from
auto acc = at::getAccelerator(check.value_or(false));
if (acc.has_value()) {
bool is_available = at::globalContext()
.getAcceleratorHooksInterface(acc.value())
.getAcceleratorHooksInterface(acc)
.isAvailable();
if (!is_available) {