[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.
This commit is contained in:
Chris Bracken
2022-05-28 17:23:03 -07:00
committed by GitHub
parent 415df244af
commit 41a7ac3505
2 changed files with 9 additions and 3 deletions

View File

@@ -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

View File

@@ -52,8 +52,7 @@ static std::string GLESShaderNameToShaderKeyName(const std::string& name,
}
ShaderLibraryGLES::ShaderLibraryGLES(
std::vector<std::shared_ptr<fml::Mapping>> shader_libraries)
: is_valid_(true) {
std::vector<std::shared_ptr<fml::Mapping>> 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|