aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Format/FormatTokenSource.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Format/FormatTokenSource.h')
-rw-r--r--contrib/llvm-project/clang/lib/Format/FormatTokenSource.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/contrib/llvm-project/clang/lib/Format/FormatTokenSource.h b/contrib/llvm-project/clang/lib/Format/FormatTokenSource.h
index 7819244eb7d1..8f00e5f4582c 100644
--- a/contrib/llvm-project/clang/lib/Format/FormatTokenSource.h
+++ b/contrib/llvm-project/clang/lib/Format/FormatTokenSource.h
@@ -15,10 +15,7 @@
#ifndef LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
#define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
-#include "FormatToken.h"
#include "UnwrappedLineParser.h"
-#include "llvm/ADT/DenseMap.h"
-#include <cstddef>
#define DEBUG_TYPE "format-token-source"
@@ -75,6 +72,15 @@ public:
// getNextToken() -> a1
// getNextToken() -> a2
virtual FormatToken *insertTokens(ArrayRef<FormatToken *> Tokens) = 0;
+
+ [[nodiscard]] FormatToken *getNextNonComment() {
+ FormatToken *Tok;
+ do {
+ Tok = getNextToken();
+ assert(Tok);
+ } while (Tok->is(tok::comment));
+ return Tok;
+ }
};
class IndexedTokenSource : public FormatTokenSource {
@@ -167,7 +173,7 @@ private:
return Next;
}
- void dbgToken(int Position, llvm::StringRef Indent = "") {
+ void dbgToken(int Position, StringRef Indent = "") {
FormatToken *Tok = Tokens[Position];
llvm::dbgs() << Indent << "[" << Position
<< "] Token: " << Tok->Tok.getName() << " / " << Tok->TokenText