From 41a7ac350595ca8c5fc246e66d0955c9c1672704 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sat, 28 May 2022 17:23:03 -0700 Subject: [PATCH] [impeller] Revert ShaderLibraryGLES validity check (flutter/engine#33679) In https://github.com/flutter/engine/pull/33666, I landed a bulk lint cleanup that applied fixes to global constant naming using the `--fix` option to the linter script, but also caught a few straggling linter violations that hadn't been previously fixed. As part of this patch, the linter applied a change that moved ShaderLibraryGLES's is_valid_ initialisation from the ctor body to the initialiser list, always initialised to true. This is unsafe because prior to is_valid_ initialisation in the ctor body, there was a bailout if any of the shader_libraries wasn't valid. This eliminates the use of the `cppcoreguidelines-prefer-member-initializer` lint, which incorrectly flagged this code due to the following issue: https://github.com/llvm/llvm-project/issues/52837 This is a partial revert of https://github.com/flutter/engine/pull/33666. Reintroduction of this issue is prevented by the removal of the `cppcoreguidelines-prefer-member-initializer` lint in this patch. --- engine/src/flutter/impeller/.clang-tidy | 8 +++++++- .../impeller/renderer/backend/gles/shader_library_gles.cc | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/impeller/.clang-tidy b/engine/src/flutter/impeller/.clang-tidy index 28a352346a..35447af3e8 100644 --- a/engine/src/flutter/impeller/.clang-tidy +++ b/engine/src/flutter/impeller/.clang-tidy @@ -1,5 +1,11 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,google-*,readability-identifier-naming,-google-explicit-constructor,cppcoreguidelines-prefer-member-initializer,modernize-use-default-member-init' +Checks: 'clang-diagnostic-*,\ +clang-analyzer-*,\ +google-*,\ +readability-identifier-naming,\ +-google-explicit-constructor,\ +modernize-use-default-member-init' + WarningsAsErrors: '' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false diff --git a/engine/src/flutter/impeller/renderer/backend/gles/shader_library_gles.cc b/engine/src/flutter/impeller/renderer/backend/gles/shader_library_gles.cc index f782e16e88..8af6e62d98 100644 --- a/engine/src/flutter/impeller/renderer/backend/gles/shader_library_gles.cc +++ b/engine/src/flutter/impeller/renderer/backend/gles/shader_library_gles.cc @@ -52,8 +52,7 @@ static std::string GLESShaderNameToShaderKeyName(const std::string& name, } ShaderLibraryGLES::ShaderLibraryGLES( - std::vector> shader_libraries) - : is_valid_(true) { + std::vector> shader_libraries) { ShaderFunctionMap functions; UniqueID library_id; auto iterator = [&functions, &library_id](auto type, // @@ -82,6 +81,7 @@ ShaderLibraryGLES::ShaderLibraryGLES( } functions_ = functions; + is_valid_ = true; } // |ShaderLibrary|