[PATCH] Added an option to specify fallback style.
Alexander Kornienko
alexfh at google.com
Mon Dec 2 07:16:24 PST 2013
================
Comment at: include/clang/Format/Format.h:411
@@ -409,1 +410,3 @@
+FormatStyle getStyle(StringRef StyleName, StringRef FileName,
+ StringRef FallbackStyle);
----------------
Daniel Jasper wrote:
> This will break
>
> clang/tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp.
>
> and possibly others? So either fix all instances or add a default value.
I've fixed the usage in this file (see the patch below), I'll commit it right after this patch. I haven't found any other usages of getStyle.
Index: tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
===================================================================
--- tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (revision 196097)
+++ tools/extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (working copy)
@@ -217,7 +217,7 @@
// Determine a formatting style from options.
format::FormatStyle FormatStyle;
if (DoFormat)
- FormatStyle = format::getStyle(FormatStyleOpt, FormatStyleConfig);
+ FormatStyle = format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
TUReplacements TUs;
TUReplacementFiles TURFiles;
================
Comment at: lib/Format/Format.cpp:1736
@@ -1733,3 +1735,3 @@
}
llvm::errs() << "Can't find usable .clang-format, using " << FallbackStyle
<< " style\n";
----------------
Daniel Jasper wrote:
> Having any output in this case breaks the current emacs integration. I have not found an easy way to work around this (i.e. to send stderr or stdout to different buffers).
>
> I think, if -fallback-style is present, we should silently fall back to it.
I think, you've solved this in your r190691, so anything on stderr shouldn't be a problem.
http://llvm-reviews.chandlerc.com/D2292
More information about the cfe-commits
mailing list