Path: blob/main/contrib/llvm-project/clang/lib/Format/NamespaceEndCommentsFixer.h
35233 views
//===--- NamespaceEndCommentsFixer.h ----------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file declares NamespaceEndCommentsFixer, a TokenAnalyzer that10/// fixes namespace end comments.11///12//===----------------------------------------------------------------------===//1314#ifndef LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H15#define LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H1617#include "TokenAnalyzer.h"1819namespace clang {20namespace format {2122// Finds the namespace token corresponding to a closing namespace `}`, if that23// is to be formatted.24// If \p Line contains the closing `}` of a namespace, is affected and is not in25// a preprocessor directive, the result will be the matching namespace token.26// Otherwise returns null.27// \p AnnotatedLines is the sequence of lines from which \p Line is a member of.28const FormatToken *29getNamespaceToken(const AnnotatedLine *Line,30const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines);3132class NamespaceEndCommentsFixer : public TokenAnalyzer {33public:34NamespaceEndCommentsFixer(const Environment &Env, const FormatStyle &Style);3536std::pair<tooling::Replacements, unsigned>37analyze(TokenAnnotator &Annotator,38SmallVectorImpl<AnnotatedLine *> &AnnotatedLines,39FormatTokenLexer &Tokens) override;40};4142} // end namespace format43} // end namespace clang4445#endif464748