[PATCH] Config file support for clang-format, part 2.

Alexander Kornienko alexfh at google.com
Thu May 9 01:16:15 PDT 2013


I've tried, of course. And my message goes after YAML I/O's, but this way
it's still informative enough for diagnostic purposes. And I thought we can
come back to this once YAML I/O has better support for this.
On May 9, 2013 9:54 AM, "Kim Gräsman" <kim.grasman at gmail.com> wrote:

>
>   Looks good!
>
>   Did you try provoking a syntax error? Unless it's been short-circuited,
> I think the YAML parsing framework will print a diagnostic before your
> manual llvm::errs() output, but I don't have time to rebuild and check
> right now.
>
>
> ================
> Comment at: lib/Format/Format.cpp:56-64
> @@ -55,1 +55,11 @@
> +    } else {
> +      StringRef StylesArray[] = { "LLVM", "Google", "Chromium", "Mozilla"
> };
> +      ArrayRef<StringRef> Styles(StylesArray);
> +      for (size_t i = 0; i < Styles.size(); ++i) {
> +        StringRef StyleName(Styles[i]);
> +        if (Style == clang::format::getPredefinedStyle(StyleName)) {
> +          IO.mapOptional("# BasedOnStyle", StyleName);
> +          break;
> +        }
> +      }
>      }
> ----------------
> Maybe move this into clang::format::isPredefinedStyle(const FormatStyle&
> Style)?
>
> That way you don't have to re-define the predefined style names here too.
>
> ================
> Comment at: lib/Format/Format.cpp:61
> @@ +60,3 @@
> +        if (Style == clang::format::getPredefinedStyle(StyleName)) {
> +          IO.mapOptional("# BasedOnStyle", StyleName);
> +          break;
> ----------------
> IIRC, the YAML parser doesn't take "#" comments, only JavaScript-style
> "//", but I'm not 100% sure. Did you try roundtripping a dumped
> configuration?
>
>
> http://llvm-reviews.chandlerc.com/D758
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130509/609fce2e/attachment.html>


More information about the cfe-commits mailing list