brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · eba2423 Raw
47 lines · c
1//===--- NamespaceEndCommentsFixer.h ----------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// This file declares NamespaceEndCommentsFixer, a TokenAnalyzer that11/// fixes namespace end comments.12///13//===----------------------------------------------------------------------===//14 15#ifndef LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H16#define LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H17 18#include "TokenAnalyzer.h"19 20namespace clang {21namespace format {22 23// Finds the namespace token corresponding to a closing namespace `}`, if that24// is to be formatted.25// If \p Line contains the closing `}` of a namespace, is affected and is not in26// a preprocessor directive, the result will be the matching namespace token.27// Otherwise returns null.28// \p AnnotatedLines is the sequence of lines from which \p Line is a member of.29const FormatToken *30getNamespaceToken(const AnnotatedLine *Line,31                  const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines);32 33class NamespaceEndCommentsFixer : public TokenAnalyzer {34public:35  NamespaceEndCommentsFixer(const Environment &Env, const FormatStyle &Style);36 37  std::pair<tooling::Replacements, unsigned>38  analyze(TokenAnnotator &Annotator,39          SmallVectorImpl<AnnotatedLine *> &AnnotatedLines,40          FormatTokenLexer &Tokens) override;41};42 43} // end namespace format44} // end namespace clang45 46#endif47