From 9022240727e240a5c3a721d1b872d9041e0388fe Mon Sep 17 00:00:00 2001
From: Martin Probst <martin@probst.io>
Date: Sun, 18 Sep 2016 17:33:51 +0000
Subject: [PATCH] clang-format: [JS] Do not wrap taze annotation comments.

Summary:
`// taze: ... from ...` comments are used help tools where a
specific global symbol comes from.

Before:
    // taze: many, different, symbols from
    // 'some_long_location_here'

After:
    // taze: many, different, symbols from 'some_long_location_here'

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281857 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Format/Format.cpp             | 2 +-
 unittests/Format/FormatTestJS.cpp | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 388c35a7264..04bafacab9a 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -613,7 +613,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
     GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty;
     GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
     GoogleStyle.BreakBeforeTernaryOperators = false;
-    GoogleStyle.CommentPragmas = "@(export|requirecss|return|see|visibility) ";
+    GoogleStyle.CommentPragmas = "(taze:|@(export|requirecss|return|see|visibility)) ";
     GoogleStyle.MaxEmptyLinesToKeep = 3;
     GoogleStyle.NamespaceIndentation = FormatStyle::NI_All;
     GoogleStyle.SpacesInContainerLiterals = false;
diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp
index dd95462daf4..c19c054ec02 100644
--- a/unittests/Format/FormatTestJS.cpp
+++ b/unittests/Format/FormatTestJS.cpp
@@ -1444,5 +1444,11 @@ TEST_F(FormatTestJS, Conditional) {
                "}");
 }
 
+TEST_F(FormatTestJS, ImportComments) {
+  verifyFormat("import {x} from 'x';  // from some location",
+               getGoogleJSStyleWithColumns(25));
+  verifyFormat("// taze: x from 'location'", getGoogleJSStyleWithColumns(10));
+}
+
 } // end namespace tooling
 } // end namespace clang
-- 
GitLab