Chizi123 updated this revision to Diff 300586.
Chizi123 added a comment.

Accidentally added patch to commit


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

https://reviews.llvm.org/D90133

Files:
  clang/lib/Format/Format.cpp


Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2844,8 +2844,15 @@
   FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
 
   FormatStyle FallbackStyle = getNoStyle();
-  if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle))
-    return make_string_error("Invalid fallback style \"" + FallbackStyleName);
+  if (FallbackStyleName.startswith("{")) {
+    if (std::error_code ec = parseConfiguration(
+            FallbackStyleName, &FallbackStyle, AllowUnknownOptions))
+      return make_string_error("Error parsing -fallback-style: " +
+                               ec.message());
+  } else if (!getPredefinedStyle(FallbackStyleName, Style.Language,
+                                 &FallbackStyle)) {
+    return make_string_error("Invalid fallback style \"" + FallbackStyleName + 
"\"");
+  }
 
   if (StyleName.startswith("{")) {
     // Parse YAML/JSON style from the command line.


Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2844,8 +2844,15 @@
   FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
 
   FormatStyle FallbackStyle = getNoStyle();
-  if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle))
-    return make_string_error("Invalid fallback style \"" + FallbackStyleName);
+  if (FallbackStyleName.startswith("{")) {
+    if (std::error_code ec = parseConfiguration(
+            FallbackStyleName, &FallbackStyle, AllowUnknownOptions))
+      return make_string_error("Error parsing -fallback-style: " +
+                               ec.message());
+  } else if (!getPredefinedStyle(FallbackStyleName, Style.Language,
+                                 &FallbackStyle)) {
+    return make_string_error("Invalid fallback style \"" + FallbackStyleName + "\"");
+  }
 
   if (StyleName.startswith("{")) {
     // Parse YAML/JSON style from the command line.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to