diff options
author | Martin Probst <martin@probst.io> | 2017-05-09 12:45:48 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2017-05-09 12:45:48 +0000 |
commit | 2083f31b88c5c47243af904640afea194b7d424c (patch) | |
tree | 472a9e032152ae24991f8dbf5abac5b725312ae9 /clang/lib/Format/Format.cpp | |
parent | 7aedf33a241da0c5bffc4d5a9e723bf8291993e5 (diff) | |
download | bcm5719-llvm-2083f31b88c5c47243af904640afea194b7d424c.tar.gz bcm5719-llvm-2083f31b88c5c47243af904640afea194b7d424c.zip |
clang-format: [JS] keep triple slash directives intact.
Summary:
TypeScript uses triple slash directives of the form:
/// <reference path="..."/>
For various non-source instructions that should not be wrapped.
Reference:
https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D32997
llvm-svn: 302523
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index e961e5536ef..c8677e80517 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -637,9 +637,10 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; GoogleStyle.BreakBeforeTernaryOperators = false; - // taze:, @tag followed by { for a lot of JSDoc tags, and @see, which is - // commonly followed by overlong URLs. - GoogleStyle.CommentPragmas = "(taze:|(@[A-Za-z_0-9-]+[ \\t]*{)|@see)"; + // taze:, triple slash directives (`/// <...`), @tag followed by { for a lot + // of JSDoc tags, and @see, which is commonly followed by overlong URLs. + GoogleStyle.CommentPragmas = + "(taze:|^/[ \t]*<|(@[A-Za-z_0-9-]+[ \\t]*{)|@see)"; GoogleStyle.MaxEmptyLinesToKeep = 3; GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; GoogleStyle.SpacesInContainerLiterals = false; |