pytorch
1c0617bb - Fix clang-tidy for native CPU ops (#57037)

Commit
3 years ago
Fix clang-tidy for native CPU ops (#57037) Summary: Attempts to call clang-tidy on any source file in `aten/src/ATen/cpu/native` would fail with series of ``` /Users/nshulga/git/pytorch-worktree/aten/src/ATen/native/cpu/Activation.cpp:637:1: warning: variable 'REGISTER_DISPATCH' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables] /Users/nshulga/git/pytorch-worktree/aten/src/ATen/native/cpu/Activation.cpp:638:1: error: C++ requires a type specifier for all declarations [clang-diagnostic-error] REGISTER_DISPATCH(log_sigmoid_backward_cpu_stub, &log_sigmoid_backward_cpu_kernel); ``` because those macros are only defined for cpu-arch specific compilation of above mentioned files. Fix this by introducing `map_filename` function that will map source file to its copy in `build` folder, run clang-tidy over the copy and than map it back Find it while working on https://github.com/pytorch/pytorch/pull/56892 Pull Request resolved: https://github.com/pytorch/pytorch/pull/57037 Reviewed By: walterddr Differential Revision: D28033760 Pulled By: malfet fbshipit-source-id: b67cd007000574ecc165ab4b285c0c102cbceadd
Author
Parents
Loading