mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Make PyTorch code-base clang-tidy compliant (#56892)
Summary: This is an automatic change generated by the following script: ``` #!/usr/bin/env python3 from subprocess import check_output, check_call import os def get_compiled_files_list(): import json with open("build/compile_commands.json") as f: data = json.load(f) files = [os.path.relpath(node['file']) for node in data] for idx, fname in enumerate(files): if fname.startswith('build/') and fname.endswith('.DEFAULT.cpp'): files[idx] = fname[len('build/'):-len('.DEFAULT.cpp')] return files def run_clang_tidy(fname): check_call(["python3", "tools/clang_tidy.py", "-c", "build", "-x", fname,"-s"]) changes = check_output(["git", "ls-files", "-m"]) if len(changes) == 0: return check_call(["git", "commit","--all", "-m", f"NOLINT stubs for {fname}"]) def main(): git_files = check_output(["git", "ls-files"]).decode("ascii").split("\n") compiled_files = get_compiled_files_list() for idx, fname in enumerate(git_files): if fname not in compiled_files: continue if fname.startswith("caffe2/contrib/aten/"): continue print(f"[{idx}/{len(git_files)}] Processing {fname}") run_clang_tidy(fname) if __name__ == "__main__": main() ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/56892 Reviewed By: H-Huang Differential Revision: D27991944 Pulled By: malfet fbshipit-source-id: 5415e1eb2c1b34319a4f03024bfaa087007d7179
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5a10ee71d6
commit
4cb534f92e
@ -11,6 +11,7 @@ namespace {
|
||||
|
||||
static inline void swapBytes16(void *ptr)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint16_t output;
|
||||
memcpy(&output, ptr, sizeof(uint16_t));
|
||||
#if defined(_MSC_VER) && !defined(_DEBUG)
|
||||
@ -27,6 +28,7 @@ static inline void swapBytes16(void *ptr)
|
||||
|
||||
static inline void swapBytes32(void *ptr)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint32_t output;
|
||||
memcpy(&output, ptr, sizeof(uint32_t));
|
||||
#if defined(_MSC_VER) && !defined(_DEBUG)
|
||||
@ -45,6 +47,7 @@ static inline void swapBytes32(void *ptr)
|
||||
|
||||
static inline void swapBytes64(void *ptr)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint64_t output;
|
||||
memcpy(&output, ptr, sizeof(uint64_t));
|
||||
#if defined(_MSC_VER)
|
||||
@ -67,6 +70,7 @@ static inline void swapBytes64(void *ptr)
|
||||
}
|
||||
|
||||
static inline uint16_t decodeUInt16LE(const uint8_t *data) {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint16_t output;
|
||||
memcpy(&output, data, sizeof(uint16_t));
|
||||
return output;
|
||||
@ -79,6 +83,7 @@ static inline uint16_t decodeUInt16BE(const uint8_t *data) {
|
||||
}
|
||||
|
||||
static inline uint32_t decodeUInt32LE(const uint8_t *data) {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint32_t output;
|
||||
memcpy(&output, data, sizeof(uint32_t));
|
||||
return output;
|
||||
@ -91,6 +96,7 @@ static inline uint32_t decodeUInt32BE(const uint8_t *data) {
|
||||
}
|
||||
|
||||
static inline uint64_t decodeUInt64LE(const uint8_t *data) {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
|
||||
uint64_t output;
|
||||
memcpy(&output, data, sizeof(uint64_t));
|
||||
return output;
|
||||
|
Reference in New Issue
Block a user