clang-format: [JS] fix uninitialized memory.

SortJavaScriptImports attempts to set its currently parsed token to an
invalid token when it reaches the end of the line. However in doing so,
it used a `FormatToken`, which contains a `Token Tok`. `Token` does not
have a constructor, so its fields start out as uninitialized memory.

`Token::startToken()` initializes all fields. Calling it in
`JavaScriptImportSorter`'s constructor thus fixes the problem.

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

GitOrigin-RevId: c26729251588cb6e9e20c3edf67d14ac9b549f9b
diff --git a/lib/Format/SortJavaScriptImports.cpp b/lib/Format/SortJavaScriptImports.cpp
index 5d1ad9a..7132616 100644
--- a/lib/Format/SortJavaScriptImports.cpp
+++ b/lib/Format/SortJavaScriptImports.cpp
@@ -133,7 +133,10 @@
 public:
   JavaScriptImportSorter(const Environment &Env, const FormatStyle &Style)
       : TokenAnalyzer(Env, Style),
-        FileContents(Env.getSourceManager().getBufferData(Env.getFileID())) {}
+        FileContents(Env.getSourceManager().getBufferData(Env.getFileID())) {
+    // FormatToken.Tok starts out in an uninitialized state.
+    invalidToken.Tok.startToken();
+  }
 
   std::pair<tooling::Replacements, unsigned>
   analyze(TokenAnnotator &Annotator,
@@ -232,7 +235,6 @@
     if (!Current || Current == LineEnd->Next) {
       // Set the current token to an invalid token, so that further parsing on
       // this line fails.
-      invalidToken.Tok.setKind(tok::unknown);
       Current = &invalidToken;
     }
   }