Skip to content

[clang-tidy] New check: bugprone-ifelse-braces #162140

@capitan-davide

Description

@capitan-davide

A simple check that warns, and potentially fixes, the use of unmatched compound statements (i.e., braces) following an if/else statements. For example:

void f(bool Flag) {
  if (Flag)
    doSomething();
  else {
    // we need to do something else here!
    doSomethingElse();
  }
}

This example will trigger a warning since the if branch do not uses braces, while the else branch does. Vice-versa also applies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions