[PATCH] D90133: clang-format: Allow fallback-style to take formatting arguments
Joel Grunbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 00:33:30 PDT 2020
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90133.300586.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201026/1e4e9c1c/attachment.bin>
More information about the cfe-commits
mailing list