[PATCH] D28081: Make GetStyle return Expected<FormatStyle> instead of FormatStyle
Antonio Maiorano via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 1 10:26:28 PST 2017
amaiorano added inline comments.
================
Comment at: lib/Format/Format.cpp:1900
- if (!getPredefinedStyle(FallbackStyle, Style.Language, &Style)) {
- llvm::errs() << "Invalid fallback style \"" << FallbackStyle
- << "\" using LLVM style\n";
- return Style;
- }
+ FormatStyle FallbackStyle = getNoStyle();
+ if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle))
----------------
amaiorano wrote:
> Going over my diff, I realize that I didn't revert this local FormatStyle instance to make use of the top-level declared "FormatStyle Style" local variable. I will revert this one too.
I wrote the above comment before realizing there was a bug when fallback style is "none". As I explained in my long comment, we may actually want to keep this as a separate variable to fix the bug and ensure fallback style is only ever returned when no config is found, which is exactly what my change currently does.
https://reviews.llvm.org/D28081
More information about the cfe-commits
mailing list