Skip to content

[clang-tidy] bugprone-unchecked-optional-access ignores assert and assume #60417

Open
@Febbe

Description

@Febbe

The check does not consider implicit checks like __assume or assert which explicitly tell that this value should not be uninitialized.
For example, the following code snipped will rise a warning.

  for (std::optional<down_sampling::work::sample_down>&& job : jobv) {    //
    assert(job);
    job->do_something();
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyclang:dataflowClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions