brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · d9ce85d Raw
52 lines · c
1//===--- ObjCPropertyAttributeOrderFixer.h ------------------------------*- C++2//-*-===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9///10/// \file11/// This file declares ObjCPropertyAttributeOrderFixer, a TokenAnalyzer that12/// adjusts the order of attributes in an ObjC `@property(...)` declaration,13/// depending on the style.14///15//===----------------------------------------------------------------------===//16 17#ifndef LLVM_CLANG_LIB_FORMAT_OBJCPROPERTYATTRIBUTEORDERFIXER_H18#define LLVM_CLANG_LIB_FORMAT_OBJCPROPERTYATTRIBUTEORDERFIXER_H19 20#include "TokenAnalyzer.h"21 22namespace clang {23namespace format {24 25class ObjCPropertyAttributeOrderFixer : public TokenAnalyzer {26  llvm::StringMap<unsigned> SortOrderMap;27 28  void analyzeObjCPropertyDecl(const SourceManager &SourceMgr,29                               const AdditionalKeywords &Keywords,30                               tooling::Replacements &Fixes,31                               const FormatToken *Tok);32 33  void sortPropertyAttributes(const SourceManager &SourceMgr,34                              tooling::Replacements &Fixes,35                              const FormatToken *BeginTok,36                              const FormatToken *EndTok);37 38  std::pair<tooling::Replacements, unsigned>39  analyze(TokenAnnotator &Annotator,40          SmallVectorImpl<AnnotatedLine *> &AnnotatedLines,41          FormatTokenLexer &Tokens) override;42 43public:44  ObjCPropertyAttributeOrderFixer(const Environment &Env,45                                  const FormatStyle &Style);46};47 48} // end namespace format49} // end namespace clang50 51#endif52