summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-12 05:08:18 +0000
committerDaniel Jasper <djasper@google.com>2015-06-12 05:08:18 +0000
commit216c9cdb1d159e22588b18fa5156218a5e051ba2 (patch)
tree5414c21b868b5cfb8049cd4fb2aeacdcaf29cd42 /clang
parent4c0bf7034c7383acb10e0d162feeb2ae58d14d5b (diff)
downloadbcm5719-llvm-216c9cdb1d159e22588b18fa5156218a5e051ba2.tar.gz
bcm5719-llvm-216c9cdb1d159e22588b18fa5156218a5e051ba2.zip
clang-format: [JS] Support "export enum" declarations.
llvm-svn: 239595
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp3
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp5
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 2762979b6bd..7d9e5e98cfc 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1725,7 +1725,8 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() {
return;
}
- if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, Keywords.kw_var))
+ if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, tok::kw_enum,
+ Keywords.kw_var))
return; // Fall through to parsing the corresponding structure.
if (FormatTok->is(tok::l_brace)) {
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 888d73d48ee..31386b448ac 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -747,6 +747,11 @@ TEST_F(FormatTestJS, Modules) {
" a: 1,\n"
" b: 2\n"
"};");
+ verifyFormat("export enum Foo {\n"
+ " BAR,\n"
+ " // adsdasd\n"
+ " BAZ\n"
+ "}");
}
TEST_F(FormatTestJS, TemplateStrings) {
OpenPOWER on IntegriCloud