MyDeveloperDay marked 8 inline comments as done.
MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/BraceInserter.cpp:21-56
+bool SupportsAnyAutomaticBraces(FormatStyle &Style, bool insertion) {
+  if (insertion) {
+    if (Style.AutomaticBraces.AfterIf == FormatStyle::BIS_Always)
+      return true;
+    if (Style.AutomaticBraces.AfterIf == FormatStyle::BIS_WrapLikely)
+      return true;
+    if (Style.AutomaticBraces.AfterFor == FormatStyle::BIS_Always)
----------------
HazardyKnusperkeks wrote:
> How about something like that?
I think for now

```
bool SupportsAnyAutomaticBraces(FormatStyle &Style, bool insertion) {
  if (   Style.AutomaticBraces.AfterIf == FormatStyle::BIS_Leave
      && Style.AutomaticBraces.AfterFor == FormatStyle::BIS_Leave
      && Style.AutomaticBraces.AfterWhile == FormatStyle::BIS_Leave
      && Style.AutomaticBraces.AfterDo == FormatStyle::BIS_Leave
      && Style.AutomaticBraces.AfterElse == FormatStyle::BIS_Leave)
      return false;

  if (!insertion){
    if (Style.AutomaticBraces.AfterIf != FormatStyle::BIS_Remove)
    && Style.AutomaticBraces.AfterFor != FormatStyle::BIS_Remove)
    && Style.AutomaticBraces.AfterWhile != FormatStyle::BIS_Remove)
    && Style.AutomaticBraces.AfterDo != FormatStyle::BIS_Remove)
    && Style.AutomaticBraces.AfterElse != FormatStyle::BIS_Remove)
      return false;
  }
  return true;
}
```

Should cover it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95168/new/

https://reviews.llvm.org/D95168

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to