[all-commits] [llvm/llvm-project] 63a565: [clang-format] Remove spurious JSON binding when D...
Andrew Smith via All-commits
all-commits at lists.llvm.org
Wed Dec 15 15:09:47 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 63a565768e8fdbb3260a88f584aa2c11a58fea93
https://github.com/llvm/llvm-project/commit/63a565768e8fdbb3260a88f584aa2c11a58fea93
Author: Andrew Smith <aws at awsmith.us>
Date: 2021-12-15 (Wed, 15 Dec 2021)
Changed paths:
M clang/tools/clang-format/ClangFormat.cpp
M clang/unittests/Format/FormatTestJson.cpp
Log Message:
-----------
[clang-format] Remove spurious JSON binding when DisableFormat = true
Relevant issue: https://github.com/llvm/llvm-project/issues/52705
When the `DisableFormat` option of `clang-format` is set to `true` and a JSON file is formatted, the ephemeral variable binding that is added to the top-level object is not removed from the formatted file. For example, this JSON:
```
{
"key": "value"
}
```
Is reformatted to:
```
x = {
"key": "value"
}
```
Which is not valid JSON syntax. This fix avoids the addition of this binding when `DisableFormat` is set to `true`, ensuring that it cannot be left behind when formatting is disabled.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D115769
Fixes #52705
More information about the All-commits
mailing list