]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] treat forwardDeclare as an import/export statement.
authorDaniel Jasper <djasper@google.com>
Mon, 22 Feb 2016 15:06:53 +0000 (15:06 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 22 Feb 2016 15:06:53 +0000 (15:06 +0000)
Patch by Martin Probst. Thank you.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261528 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.cpp

index d5d7146aaa41b0b061c19b9255c631efea36bc9c..591ac5c4719cb57079624014de83f6aa9ac8d5e0 100644 (file)
@@ -786,7 +786,8 @@ private:
            Tok.Next->Next && (Tok.Next->Next->TokenText == "module" ||
                               Tok.Next->Next->TokenText == "provide" ||
                               Tok.Next->Next->TokenText == "require" ||
-                              Tok.Next->Next->TokenText == "setTestOnly") &&
+                              Tok.Next->Next->TokenText == "setTestOnly" ||
+                              Tok.Next->Next->TokenText == "forwardDeclare") &&
            Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren);
   }
 
index e08c876a5c676365a7b210c945cbc8281ee9afc8..255f11e0ef3ed3017a20259c49e61724af798033 100644 (file)
@@ -277,6 +277,8 @@ TEST_F(FormatTestJS, GoogModules) {
                getGoogleJSStyleWithColumns(40));
   verifyFormat("goog.setTestOnly('this.is.really.absurdly.long');",
                getGoogleJSStyleWithColumns(40));
+  verifyFormat("goog.forwardDeclare('this.is.really.absurdly.long');",
+               getGoogleJSStyleWithColumns(40));
 
   // These should be wrapped normally.
   verifyFormat(