LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 50019 - AllowShortIfStatementsOnASingleLine don't work with else if constexpr statement
Summary: AllowShortIfStatementsOnASingleLine don't work with else if constexpr statement
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Marek Kurdej
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-18 10:17 PDT by Joel Falcou
Modified: 2021-05-03 09:13 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s): 8d93d7ffedebc5f18dee22ba954d38a1d2d0affa


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Falcou 2021-04-18 10:17:54 PDT
AllowShortIfStatementsOnASingleLine: Always
 doesn't behave properly with else, else if and else if constexpr clauses.

https://godbolt.org/z/oxYTcxere
Comment 1 Marek Kurdej 2021-04-18 11:24:20 PDT
Tentative fix: https://reviews.llvm.org/D100727.
Comment 2 Marek Kurdej 2021-05-03 09:13:18 PDT
Fixed in https://reviews.llvm.org/rG8d93d7ffedebc5f18dee22ba954d38a1d2d0affa. You'd need to use `AllowShortIfStatementsOnASingleLine: AllIfsAndElse` because `AllowShortIfStatementsOnASingleLine: Always` has kept the old behaviour not to break the backwards compatibility.