1 //===--- ObjCPropertyAttributeOrderFixer.h ------------------------------*- C++
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
8 //===----------------------------------------------------------------------===//
11 /// This file declares ObjCPropertyAttributeOrderFixer, a TokenAnalyzer that
12 /// adjusts the order of attributes in an ObjC `@property(...)` declaration,
13 /// depending on the style.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_CLANG_LIB_FORMAT_OBJCPROPERTYATTRIBUTEORDERFIXER_H
18 #define LLVM_CLANG_LIB_FORMAT_OBJCPROPERTYATTRIBUTEORDERFIXER_H
20 #include "TokenAnalyzer.h"
25 class ObjCPropertyAttributeOrderFixer
: public TokenAnalyzer
{
26 llvm::StringMap
<unsigned> SortOrderMap
;
28 void analyzeObjCPropertyDecl(const SourceManager
&SourceMgr
,
29 const AdditionalKeywords
&Keywords
,
30 tooling::Replacements
&Fixes
,
31 const FormatToken
*Tok
);
33 void sortPropertyAttributes(const SourceManager
&SourceMgr
,
34 tooling::Replacements
&Fixes
,
35 const FormatToken
*BeginTok
,
36 const FormatToken
*EndTok
);
38 std::pair
<tooling::Replacements
, unsigned>
39 analyze(TokenAnnotator
&Annotator
,
40 SmallVectorImpl
<AnnotatedLine
*> &AnnotatedLines
,
41 FormatTokenLexer
&Tokens
) override
;
44 ObjCPropertyAttributeOrderFixer(const Environment
&Env
,
45 const FormatStyle
&Style
);
48 } // end namespace format
49 } // end namespace clang