Skip to content

Commit

Permalink
Clang tidy uninitialized.Branch (project-chip#17647)
Browse files Browse the repository at this point in the history
* Clang tidy uninitialized.Branch

* Do not link Optional.h as the destructor code seems to be too tricky for the linter
  • Loading branch information
andy31415 authored Apr 25, 2022
1 parent d9ad275 commit c292484
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Checks: >
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.NullDereference,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-core.uninitialized.Branch,
-clang-analyzer-optin.performance,
-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
-clang-analyzer-deadcode.DeadStores,
Expand Down
2 changes: 1 addition & 1 deletion src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, b
(attributeCluster != nullptr) ? &reader : GetAttributeAccessOverride(aPath.mEndpointId, aPath.mClusterId);
if (attributeOverride)
{
bool triedEncode;
bool triedEncode = false;
ReturnErrorOnFailure(ReadViaAccessInterface(aSubjectDescriptor.fabricIndex, aIsFabricFiltered, aPath, aAttributeReports,
apEncoderState, attributeOverride, &triedEncode));
ReturnErrorCodeIf(triedEncode, CHIP_NO_ERROR);
Expand Down
1 change: 1 addition & 0 deletions src/lib/core/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Optional

~Optional()
{
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch): mData is set when mHasValue
if (mHasValue)
{
mValue.mData.~T();
Expand Down

0 comments on commit c292484

Please sign in to comment.