clang-tools 20.0.0git
|
Classes | |
class | ReorderFieldsAction |
Functions | |
static const RecordDecl * | findDefinition (StringRef RecordName, ASTContext &Context) |
Finds the definition of a record by name. | |
static SmallVector< unsigned, 4 > | getNewFieldsOrder (const RecordDecl *Definition, ArrayRef< std::string > DesiredFieldsOrder) |
Calculates the new order of fields. | |
static void | addReplacement (SourceRange Old, SourceRange New, const ASTContext &Context, std::map< std::string, tooling::Replacements > &Replacements) |
Replaces one range of source code by another. | |
static SmallSetVector< FieldDecl *, 1 > | findMembersUsedInInitExpr (const CXXCtorInitializer *Initializer, ASTContext &Context) |
Find all member fields used in the given init-list initializer expr that belong to the same record. | |
static SourceRange | getFullFieldSourceRange (const FieldDecl &Field, const ASTContext &Context) |
Returns the full source range for the field declaration up to (not including) the trailing semicolumn, including potential macro invocations, e.g. | |
static bool | reorderFieldsInDefinition (const RecordDecl *Definition, ArrayRef< unsigned > NewFieldsOrder, const ASTContext &Context, std::map< std::string, tooling::Replacements > &Replacements) |
Reorders fields in the definition of a struct/class. | |
static void | reorderFieldsInConstructor (const CXXConstructorDecl *CtorDecl, ArrayRef< unsigned > NewFieldsOrder, ASTContext &Context, std::map< std::string, tooling::Replacements > &Replacements) |
Reorders initializers in a C++ struct/class constructor. | |
static bool | reorderFieldsInInitListExpr (const InitListExpr *InitListEx, ArrayRef< unsigned > NewFieldsOrder, const ASTContext &Context, std::map< std::string, tooling::Replacements > &Replacements) |
Reorders initializers in the brace initialization of an aggregate. | |
|
static |
Replaces one range of source code by another.
Definition at line 84 of file ReorderFieldsAction.cpp.
Referenced by reorderFieldsInConstructor(), reorderFieldsInDefinition(), and reorderFieldsInInitListExpr().
|
static |
Finds the definition of a record by name.
Definition at line 36 of file ReorderFieldsAction.cpp.
References Results.
|
static |
Find all member fields used in the given init-list initializer expr that belong to the same record.
Definition at line 100 of file ReorderFieldsAction.cpp.
References Results.
Referenced by reorderFieldsInConstructor().
|
static |
Returns the full source range for the field declaration up to (not including) the trailing semicolumn, including potential macro invocations, e.g.
int a GUARDED_BY(mu);
.
Definition at line 122 of file ReorderFieldsAction.cpp.
Referenced by reorderFieldsInDefinition().
|
static |
Calculates the new order of fields.
Definition at line 57 of file ReorderFieldsAction.cpp.
|
static |
Reorders initializers in a C++ struct/class constructor.
A constructor can have initializers for an arbitrary subset of the class's fields. Thus, we need to ensure that we reorder just the initializers that are present.
Definition at line 183 of file ReorderFieldsAction.cpp.
References addReplacement(), findMembersUsedInInitExpr(), and ID.
|
static |
Reorders fields in the definition of a struct/class.
At the moment reordering of fields with different accesses (public/protected/private) is not supported.
Definition at line 146 of file ReorderFieldsAction.cpp.
References addReplacement(), Field, and getFullFieldSourceRange().
|
static |
Reorders initializers in the brace initialization of an aggregate.
At the moment partial initialization is not supported.
Definition at line 246 of file ReorderFieldsAction.cpp.
References addReplacement().