[PATCH] D13549: Added new options to ClangFormat VSIX package.

Marek Kurdej via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 00:53:20 PDT 2015


curdeius added a comment.

Hi Zachary, just to answer your comments. I have done it on purpose not to use enum, because clang-format style can be actually a JSON string, e.g. `{BasedOnStyle: "LLVM", IndentWidth: 4}`, so it wouldn't translate into an enum (to my knowledge at least). Besides, I would like to have the possibility **not** to add a new enum value if there is a new style in clang-format.
Please correct me if I'm wrong about enums.


================
Comment at: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs:115
@@ +114,3 @@
+                // Check if string contains quotes. On Windows, file names cannot contain quotes.
+                // We do not accept them however to avoid hard-to-debug problems.
+                // A quote in user input would end the parameter quote and so break the command invocation.
----------------
zturner wrote:
> Wouldn't it be better to just return `false` from `CanConvertFrom` if the filename contains quotes?  Then you can assert in this function that it does not contain quotes?
Well, in `CanConvertFrom`, the `sourceType` parameter is a `Type` and not the value given by the user, so no, we cannot do this.


http://reviews.llvm.org/D13549





More information about the cfe-commits mailing list