[PATCH] D41487: [clang-format] Adds a FormatStyleSet

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 07:07:33 PST 2018


klimek added inline comments.


================
Comment at: lib/Format/Format.cpp:906-907
+  }
+  if (!LanguageFound)
+    return make_error_code(ParseError::Unsuitable);
+  *Style = *StyleSet.Get(Language);
----------------
Optional: I'd probably slightly re-structure the above to:
  if (!LanguageFound) {
    if (Styles.empty() || Styles[0].Language != FS::LK_None) {
      return make_error_code(PE::Unsuitable);
    }
    ...
  }


================
Comment at: lib/Format/Format.cpp:936
+void FormatStyle::FormatStyleSet::Add(FormatStyle Style) {
+  Style.StyleSet.Styles.reset();
+  if (!Styles)
----------------
Should we rather check that a style that's added doesn't have its own Styles map? (I'd say you're not allowed to add a Style that was gotten into another StyleSet).


Repository:
  rC Clang

https://reviews.llvm.org/D41487





More information about the cfe-commits mailing list