Home | History | Annotate | Line # | Download | only in Format
      1  1.1  joerg //===--- NamespaceEndCommentsFixer.h ----------------------------*- C++ -*-===//
      2  1.1  joerg //
      3  1.1  joerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
      4  1.1  joerg // See https://llvm.org/LICENSE.txt for license information.
      5  1.1  joerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
      6  1.1  joerg //
      7  1.1  joerg //===----------------------------------------------------------------------===//
      8  1.1  joerg ///
      9  1.1  joerg /// \file
     10  1.1  joerg /// This file declares NamespaceEndCommentsFixer, a TokenAnalyzer that
     11  1.1  joerg /// fixes namespace end comments.
     12  1.1  joerg ///
     13  1.1  joerg //===----------------------------------------------------------------------===//
     14  1.1  joerg 
     15  1.1  joerg #ifndef LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H
     16  1.1  joerg #define LLVM_CLANG_LIB_FORMAT_NAMESPACEENDCOMMENTSFIXER_H
     17  1.1  joerg 
     18  1.1  joerg #include "TokenAnalyzer.h"
     19  1.1  joerg 
     20  1.1  joerg namespace clang {
     21  1.1  joerg namespace format {
     22  1.1  joerg 
     23  1.1  joerg // Finds the namespace token corresponding to a closing namespace `}`, if that
     24  1.1  joerg // is to be formatted.
     25  1.1  joerg // If \p Line contains the closing `}` of a namespace, is affected and is not in
     26  1.1  joerg // a preprocessor directive, the result will be the matching namespace token.
     27  1.1  joerg // Otherwise returns null.
     28  1.1  joerg // \p AnnotatedLines is the sequence of lines from which \p Line is a member of.
     29  1.1  joerg const FormatToken *
     30  1.1  joerg getNamespaceToken(const AnnotatedLine *Line,
     31  1.1  joerg                   const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines);
     32  1.1  joerg 
     33  1.1  joerg class NamespaceEndCommentsFixer : public TokenAnalyzer {
     34  1.1  joerg public:
     35  1.1  joerg   NamespaceEndCommentsFixer(const Environment &Env, const FormatStyle &Style);
     36  1.1  joerg 
     37  1.1  joerg   std::pair<tooling::Replacements, unsigned>
     38  1.1  joerg   analyze(TokenAnnotator &Annotator,
     39  1.1  joerg           SmallVectorImpl<AnnotatedLine *> &AnnotatedLines,
     40  1.1  joerg           FormatTokenLexer &Tokens) override;
     41  1.1  joerg };
     42  1.1  joerg 
     43  1.1  joerg } // end namespace format
     44  1.1  joerg } // end namespace clang
     45  1.1  joerg 
     46  1.1  joerg #endif
     47