| 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-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
/// |
| 10 |
/// \file |
| 11 |
/// This file declares ObjCPropertyAttributeOrderFixer, a TokenAnalyzer that |
| 12 |
/// 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_H |
| 18 |
#define LLVM_CLANG_LIB_FORMAT_OBJCPROPERTYATTRIBUTEORDERFIXER_H |
| 19 |
|
| 20 |
#include "TokenAnalyzer.h" |
| 21 |
|
| 22 |
namespace clang { |
| 23 |
namespace format { |
| 24 |
|
| 25 |
class 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 |
|
| 43 |
public: |
| 44 |
ObjCPropertyAttributeOrderFixer(const Environment &Env, |
| 45 |
const FormatStyle &Style); |
| 46 |
}; |
| 47 |
|
| 48 |
} // end namespace format |
| 49 |
} // end namespace clang |
| 50 |
|
| 51 |
#endif |