Because Clang-tidy 19 has more powerful clang-analyzer checks to detect subtle bugs. New checks such as misc-use-internal-linkage can help identify potential static variables or functions, thus reducing binary sizes.
Some new checks are disabled temporarily for later enabling. Additional warnings have been fixed or suppressed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/148648
Approved by: https://github.com/Skylion007
PR #108479 was reverted because
```
In file included from xplat/caffe2/c10/util/Exception.h:5:
In file included from xplat/caffe2/c10/util/StringUtil.h:6:
xplat/caffe2/c10/util/string_view.h:576:31: error: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated]
basic_string_view<CharT>::npos;
```
Now this is fixed and Wdeprecated generated no warnings on my host.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108622
Approved by: https://github.com/Skylion007
ostream output and `std::hash` currently fall-back to `std::string` to
ensure correctness, which means an extra allocation. If available, we
should prefer `std::string_view` or `std::experimental::string_view`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76975
Approved by: https://github.com/swolchok
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71196
`caffe2` headers contain code that can elicit warnings when built with strict compiler flags. Rather than force downstream/consuming code to weaken their compiler flags, suppress those warnings in the header using `#pragma clang diagnostic` suppressions.
Test Plan: CI Pass
Reviewed By: malfet
Differential Revision: D33536233
fbshipit-source-id: 74404e7a5edaf244f79f7a0addd991a84442a31f
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64670
Bounds checking is not required for `std::string_view`, and the checking hoses performance for the following performance prototype diff.
ghstack-source-id: 138037531
Test Plan: CI
Reviewed By: ezyang, bhosmer
Differential Revision: D30747515
fbshipit-source-id: 1f4374415a82dfdccce76ea2c6885c13cb93d369
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56830
Opt into formatting on GitHub and format everything. This is a trial run before turning on formatting for more and eventually all of the codebase.
Test Plan: CI
Reviewed By: zertosh
Differential Revision: D27979080
fbshipit-source-id: a80f0c48691c08ae8ca0af06377b87e6a2351151
Summary:
__builtin_memcmp is not a constexpr for character arrays for NVCC-11.3 compiler.
Attempts to compile this code results in the following error:
```
/opt/conda/lib/python3.6/site-packages/torch/include/c10/util/string_view.h(585): note: constexpr memory comparison is only supported for top-level integer or array-of-integer objects
/opt/conda/lib/python3.6/site-packages/torch/include/c10/util/string_view.h(340): note: called from:
/opt/conda/lib/python3.6/site-packages/torch/include/c10/util/string_view.h(369): note: called from:
```
Fixes #{issue number}
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57322
Reviewed By: janeyx99
Differential Revision: D28119125
Pulled By: malfet
fbshipit-source-id: e5ff6ac7bb42022e86c9974919e055cf82c2ea83
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30916
These macros said "make it constexpr if we're in C++14". Since we're now always C++14, we can just say "constexpr" isntead.
ghstack-source-id: 96369584
Test Plan: waitforsandcastle
Differential Revision: D18869635
fbshipit-source-id: f41751e4e26fad6214ec3a98db2d961315fd73ff
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30915
Since we now have C++14, we don't need these c10::guts helpers anymore
ghstack-source-id: 95777609
Test Plan: waitforsandcastle
Differential Revision: D18869639
fbshipit-source-id: 97716f932297c64c6e814410ac47b444c33d4e2e
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26618
Implement a mechanism to get type names at compile time
In a future diff, I'm planning to introduce this to caffe2::TypeMeta and a few other places.
ghstack-source-id: 95337871
Test Plan: unit tests
Differential Revision: D17519253
fbshipit-source-id: e14017f962fd181d147accb3f53fa8d6ee42a3f8
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26616
Implement C++17 std::string_view for C++11.
This is useful for compile time type name retrievaly which I'm going to stack on top of this.
It is also useful to replace `const std::string&` with throughout our codebase.
ghstack-source-id: 92100314
Test Plan: unit tests
Differential Revision: D17518992
fbshipit-source-id: 48e31c677d51b0041f4b37e89a92bd176d4a0b08