From ecbca9f5fb7d7613d2b94982c4825eb0d33d6842 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 5 Feb 2022 19:04:23 +0100 Subject: Vendor import of llvm-project main llvmorg-14-init-18294-gdb01b123d012, the last commit before the upstream release/14.x branch was created. --- clang/lib/Format/SortJavaScriptImports.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/Format/SortJavaScriptImports.cpp') diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp index e4107525a7ff..71326163f45a 100644 --- a/clang/lib/Format/SortJavaScriptImports.cpp +++ b/clang/lib/Format/SortJavaScriptImports.cpp @@ -133,7 +133,10 @@ class JavaScriptImportSorter : public TokenAnalyzer { 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 analyze(TokenAnnotator &Annotator, @@ -232,7 +235,6 @@ private: 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; } } @@ -510,7 +512,6 @@ private: while (Current->is(tok::identifier)) { nextToken(); if (Current->is(tok::semi)) { - nextToken(); return true; } if (!Current->is(tok::period)) -- cgit v1.2.3