Skip to content

Commit 2c5d7a8

Browse files
authored
[clang-format] Remove YAML hack to emit a BasedOnStyle comment (#89228)
When serializing a formatting style to YAML, we were emitting a comment `# BasedOnStyle: <style>` if the serialized formatting style matches one of the known styles. This is useful, but mis-uses the YAML API. An upcoming change to fix keys with special characters by quoting them breaks this, and will emit a non-comment **key** `'# BasedOnStyle': <style>` instead. (#88763) Thus, remove this hack. There doesn't seem to be a specific use for it, and it is not tested. If we want the comment back, we should add comment support to the YAML writer, and use that instead.
1 parent 2125080 commit 2c5d7a8

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

clang/lib/Format/Format.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ template <> struct MappingTraits<FormatStyle> {
807807
FormatStyle PredefinedStyle;
808808
if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) &&
809809
Style == PredefinedStyle) {
810-
IO.mapOptional("# BasedOnStyle", StyleName);
811810
BasedOnStyle = StyleName;
812811
break;
813812
}

0 commit comments

Comments
 (0)