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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 07:06:18 PST 2017


klimek added inline comments.


================
Comment at: lib/Format/Format.cpp:893
   for (int i = Styles.size() - 1; i >= 0; --i) {
-    if (Styles[i].Language == Language ||
-        Styles[i].Language == FormatStyle::LK_None) {
+    if (!LanguageFound && (Styles[i].Language == Language ||
+                           Styles[i].Language == FormatStyle::LK_None)) {
----------------
LanguageFound can't be true here.


================
Comment at: lib/Format/Format.cpp:903-907
+  for (int i = Styles.size() - 1; i >= 0; --i) {
+    if (Styles[i].Language != FormatStyle::LK_None) {
+      Style->AddLanguageStyle(Styles[i]);
     }
   }
----------------
This seems a bit backwards. I'd have expected us to build up a Style structure after parsing above, and then just copy that into the result in the end.


Repository:
  rC Clang

https://reviews.llvm.org/D41487





More information about the cfe-commits mailing list