[PATCH] D28081: Make GetStyle return Expected<FormatStyle> instead of FormatStyle

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 29 01:24:11 PST 2016

ioeric added inline comments.

Comment at: lib/Format/Format.cpp:1984
+    // If so, can't return this error here...
+    return make_string_error("Configuration file(s) do(es) not support " +
+                             getLanguageName(Language) + ": " +
amaiorano wrote:
> amaiorano wrote:
> > See the TODO comment above (which will be removed obviously). Is it an error if we find no suitable config for the input language? If that happens, should the fallback style be returned?
> @ioeric Do you have any thoughts on my question here? Say the user specified "-file" and a fallback style, and we find files but they are not suitable (for a different language), do we use the fallback style, since it's as if we found no config file. If so, then we wouldn't consider this an error, and therefore would not print nor return the message that we see here ("Configuration file(s) do(es) not support...").
> The fact that the original code output to errs() here leads me to believe that this should be considered an error condition, in which case I should keep my change - that is, return an error here and _not_ return the fallback style.
I don't have strong opinion here, but I am inclined to return an error.


More information about the cfe-commits mailing list