[all-commits] [llvm/llvm-project] 9e7fdd: [yaml][clang-tidy] Fix multiline YAML serialization

Dmitry Polukhin via All-commits all-commits at lists.llvm.org
Thu Jul 9 02:42:36 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e7fddbd36f567217255c1df1cb816b79f0250af
      https://github.com/llvm/llvm-project/commit/9e7fddbd36f567217255c1df1cb816b79f0250af
  Author: Dmitry Polukhin <dmitry.polukhin at gmail.com>
  Date:   2020-07-09 (Thu, 09 Jul 2020)

  Changed paths:
    M clang/include/clang/Tooling/ReplacementsYaml.h
    M clang/unittests/Tooling/ReplacementsYamlTest.cpp
    M llvm/include/llvm/Support/YAMLTraits.h
    M llvm/lib/Support/YAMLTraits.cpp
    M llvm/test/Transforms/LowerMatrixIntrinsics/remarks-shared-subtrees.ll
    M llvm/unittests/Support/YAMLIOTest.cpp

  Log Message:
  -----------
  [yaml][clang-tidy] Fix multiline YAML serialization

Summary:
New line duplication logic introduced in https://reviews.llvm.org/D63482
has two issues: (1) there is no logic that removes duplicate newlines
when clang-apply-replacment reads YAML and (2) in general such logic
should be applied to all strings and should happen on string
serialization level instead in YAML parser.

This diff changes multiline strings quotation from single quote `'` to
double `"`. It solves problems with internal newlines because now they are
escaped. Also double quotation solves the problem with leading whitespace after
newline. In case of single quotation YAML parsers should remove leading
whitespace according to specification. In case of double quotation these
leading are internal space and they are preserved. There is no way to
instruct YAML parsers to preserve leading whitespaces after newline so
double quotation is the only viable option that solves all problems at
once.

Test Plan: check-all

Reviewers: gribozavr, mgehre, yvvan

Subscribers: xazax.hun, hiraditya, cfe-commits, llvm-commits

Tags: #clang-tools-extra, #clang, #llvm

Differential Revision: https://reviews.llvm.org/D80301




More information about the All-commits mailing list