diff options
| author | Paul Hoad <mydeveloperday@gmail.com> | 2019-03-02 09:08:51 +0000 |
|---|---|---|
| committer | Paul Hoad <mydeveloperday@gmail.com> | 2019-03-02 09:08:51 +0000 |
| commit | 9b468c0b1e3f6b2df84e0891263488bd61456eec (patch) | |
| tree | 4ad73b978a876cd8e7b332b6b8288788a435d46e /clang/lib/Format | |
| parent | 23b1dfe675cb026e746d85d648b2ecdf07067eb7 (diff) | |
| download | bcm5719-llvm-9b468c0b1e3f6b2df84e0891263488bd61456eec.tar.gz bcm5719-llvm-9b468c0b1e3f6b2df84e0891263488bd61456eec.zip | |
[clang-format] clang-format off/on not respected when using C Style comments
Summary:
If the clang-format on/off is in a /* comment */ then the sorting of headers is not ignored
PR40901 - https://bugs.llvm.org/show_bug.cgi?id=40901
Reviewers: djasper, klimek, JonasToth, krasimir, alexfh
Reviewed By: alexfh
Subscribers: alexfh, cfe-commits, llvm-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D58819
llvm-svn: 355266
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index a5023ec3019..a56fed9dee1 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1786,9 +1786,10 @@ tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, Code.substr(Prev, (Pos != StringRef::npos ? Pos : Code.size()) - Prev); StringRef Trimmed = Line.trim(); - if (Trimmed == "// clang-format off") + if (Trimmed == "// clang-format off" || Trimmed == "/* clang-format off */") FormattingOff = true; - else if (Trimmed == "// clang-format on") + else if (Trimmed == "// clang-format on" || + Trimmed == "/* clang-format on */") FormattingOff = false; const bool EmptyLineSkipped = |

