Upgrade clang to 13 for clang-format, clang-tidy, and sanity (#28763)

pull/28774/head
Esun Kim 3 years ago committed by GitHub
parent 9317838084
commit 2057bfd182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .clang-tidy
  2. 6
      src/core/lib/promise/detail/basic_seq.h
  3. 4
      src/core/lib/promise/for_each.h
  4. 4
      src/core/lib/promise/observable.h
  5. 6
      templates/tools/dockerfile/grpc_clang_format/Dockerfile.template
  6. 10
      templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template
  7. 8
      templates/tools/dockerfile/test/sanity/Dockerfile.template
  8. 6
      tools/dockerfile/grpc_clang_format/Dockerfile
  9. 10
      tools/dockerfile/grpc_clang_tidy/Dockerfile
  10. 8
      tools/dockerfile/test/sanity/Dockerfile

@ -18,6 +18,8 @@
# Once those issues are clear, these checks can be enabled later. # Once those issues are clear, these checks can be enabled later.
# #
# - bugprone-branch-clone # - bugprone-branch-clone
# - bugprone-easily-swappable-parameters,
# - bugprone-implicit-widening-of-multiplication-result
# - bugprone-infinite-loop # - bugprone-infinite-loop
# - bugprone-narrowing-conversions # - bugprone-narrowing-conversions
# - bugprone-not-null-terminated-result # - bugprone-not-null-terminated-result
@ -42,6 +44,7 @@
# - modernize-use-equals-delete # - modernize-use-equals-delete
# - modernize-use-using # - modernize-use-using
# - performance-no-automatic-move # - performance-no-automatic-move
# - performance-no-int-to-ptr
# - performance-unnecessary-copy-initialization # - performance-unnecessary-copy-initialization
# - performance-unnecessary-value-param # - performance-unnecessary-value-param
# - readability-else-after-return # - readability-else-after-return
@ -53,6 +56,8 @@ Checks: '-*,
-abseil-no-namespace, -abseil-no-namespace,
bugprone-*, bugprone-*,
-bugprone-branch-clone, -bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-infinite-loop, -bugprone-infinite-loop,
-bugprone-narrowing-conversions, -bugprone-narrowing-conversions,
-bugprone-not-null-terminated-result, -bugprone-not-null-terminated-result,
@ -67,6 +72,7 @@ Checks: '-*,
-google-upgrade-googletest-case, -google-upgrade-googletest-case,
performance-*, performance-*,
-performance-no-automatic-move, -performance-no-automatic-move,
-performance-no-int-to-ptr,
-performance-unnecessary-copy-initialization, -performance-unnecessary-copy-initialization,
-performance-unnecessary-value-param, -performance-unnecessary-value-param,
clang-diagnostic-deprecated-register, clang-diagnostic-deprecated-register,

@ -162,9 +162,9 @@ absl::enable_if_t<I <= J, SeqState<Traits, I, Fs...>*> GetSeqState(
} }
template <template <typename> class Traits, char I, typename... Fs, typename T> template <template <typename> class Traits, char I, typename... Fs, typename T>
auto CallNext(SeqState<Traits, I, Fs...>* state, T&& arg) -> decltype( auto CallNext(SeqState<Traits, I, Fs...>* state, T&& arg)
SeqState<Traits, I, Fs...>::Types::PromiseResultTraits::CallFactory( -> decltype(SeqState<Traits, I, Fs...>::Types::PromiseResultTraits::
&state->next_factory, std::forward<T>(arg))) { CallFactory(&state->next_factory, std::forward<T>(arg))) {
return SeqState<Traits, I, Fs...>::Types::PromiseResultTraits::CallFactory( return SeqState<Traits, I, Fs...>::Types::PromiseResultTraits::CallFactory(
&state->next_factory, std::forward<T>(arg)); &state->next_factory, std::forward<T>(arg));
} }

@ -58,8 +58,8 @@ template <typename Reader, typename Action>
class ForEach { class ForEach {
private: private:
using ReaderNext = decltype(std::declval<Reader>().Next()); using ReaderNext = decltype(std::declval<Reader>().Next());
using ReaderResult = typename PollTraits<decltype( using ReaderResult = typename PollTraits<
std::declval<ReaderNext>()())>::Type::value_type; decltype(std::declval<ReaderNext>()())>::Type::value_type;
using ActionFactory = promise_detail::PromiseFactory<ReaderResult, Action>; using ActionFactory = promise_detail::PromiseFactory<ReaderResult, Action>;
using ActionPromise = typename ActionFactory::Promise; using ActionPromise = typename ActionFactory::Promise;

@ -172,8 +172,8 @@ class ObservableNext {
template <typename T, typename F> template <typename T, typename F>
class ObservableWatch final : private WatchCommitter { class ObservableWatch final : private WatchCommitter {
private: private:
using Promise = PromiseLike<decltype( using Promise = PromiseLike<decltype(std::declval<F>()(
std::declval<F>()(std::declval<T>(), std::declval<WatchCommitter*>()))>; std::declval<T>(), std::declval<WatchCommitter*>()))>;
using Result = typename Promise::Result; using Result = typename Promise::Result;
public: public:

@ -14,11 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
# Install clang-format
RUN apt-get update && apt-get install -y clang-format-11
ENV CLANG_FORMAT=clang-format-11
ADD clang_format_all_the_things.sh / ADD clang_format_all_the_things.sh /

@ -14,11 +14,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
# Install clang-tidy 11 # Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y clang-tidy-11 jq git RUN apt-get update && apt-get install -y python3 jq git && apt-get clean
ENV CLANG_TIDY=clang-tidy-11
# otherwise clang-tidy will report missing <gtest/gtest.h> header
RUN apt-get update && apt-get install -y libgtest-dev && apt-get clean
ADD clang_tidy_all_the_things.sh / ADD clang_tidy_all_the_things.sh /

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
<%include file="../../apt_get_basic.include"/> <%include file="../../apt_get_basic.include"/>
<%include file="../../cxx_deps.include"/> <%include file="../../cxx_deps.include"/>
@ -52,10 +52,8 @@
# Upgrade Python's YAML library # Upgrade Python's YAML library
RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user
# Install clang, clang-format, and clang-tidy # Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y clang clang-format-11 clang-tidy-11 jq RUN apt-get update && apt-get install -y jq git
ENV CLANG_FORMAT=clang-format-11
ENV CLANG_TIDY=clang-tidy-11
<%include file="../../bazel.include"/> <%include file="../../bazel.include"/>
<%include file="../../buildifier.include"/> <%include file="../../buildifier.include"/>

@ -12,11 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
# Install clang-format
RUN apt-get update && apt-get install -y clang-format-11
ENV CLANG_FORMAT=clang-format-11
ADD clang_format_all_the_things.sh / ADD clang_format_all_the_things.sh /

@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
# Install clang-tidy 11 # Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y clang-tidy-11 jq git RUN apt-get update && apt-get install -y python3 jq git && apt-get clean
ENV CLANG_TIDY=clang-tidy-11
# otherwise clang-tidy will report missing <gtest/gtest.h> header
RUN apt-get update && apt-get install -y libgtest-dev && apt-get clean
ADD clang_tidy_all_the_things.sh / ADD clang_tidy_all_the_things.sh /

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:11 FROM silkeh/clang:13
#================= #=================
# Basic C core dependencies # Basic C core dependencies
@ -98,10 +98,8 @@ RUN python3 -m pip install simplejson mako virtualenv==16.7.9 lxml six
# Upgrade Python's YAML library # Upgrade Python's YAML library
RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user
# Install clang, clang-format, and clang-tidy # Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y clang clang-format-11 clang-tidy-11 jq RUN apt-get update && apt-get install -y jq git
ENV CLANG_FORMAT=clang-format-11
ENV CLANG_TIDY=clang-tidy-11
#======================== #========================
# Bazel installation # Bazel installation

Loading…
Cancel
Save