Skip to content

[refactoring] idea: convert a ternary operator into an if statement and vice-versa #34348

@hyp

Description

@hyp
Bugzilla Link 35000
Version trunk
OS All
CC @TH3CHARLie

Extended Description

This is a possible idea for a new refactoring action for clang-refactor & editors that support integration with Clang's refactoring engine.

This idea suggests adding a refactoring that can convert a ternary operator into an if statement and vice-versa. For example, this statement:

  int x = expression ? a : b;

Can become:

    int x;
    if (expression) {
        x = a;
    } else {
        x = b;
    }

and vice-versa.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions