14 namespace lexer_utils {
18 const auto &SourceManager = Context.getSourceManager();
20 Token.setKind(tok::unknown);
21 Location = Location.getLocWithOffset(-1);
23 SourceManager.getLocForStartOfFile(SourceManager.getFileID(Location));
24 while (Location != StartOfFile) {
25 Location = Lexer::GetBeginningOfToken(Location, SourceManager,
26 Context.getLangOpts());
27 if (!Lexer::getRawToken(Location, Token, SourceManager,
28 Context.getLangOpts()) &&
29 !Token.is(tok::comment)) {
32 Location = Location.getLocWithOffset(-1);
Token getPreviousNonCommentToken(const ASTContext &Context, SourceLocation Location)
ClangTidyContext & Context