#include "ReorderFieldsAction.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Refactoring.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include <string>
namespace clang {
namespace reorder_fields {
usingnamespaceclang::ast_matchers;
SmallSetVector;
static const RecordDecl *findDefinition(StringRef RecordName,
ASTContext &Context) { … }
static SmallVector<unsigned, 4>
getNewFieldsOrder(const RecordDecl *Definition,
ArrayRef<std::string> DesiredFieldsOrder) { … }
static void
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
std::map<std::string, tooling::Replacements> &Replacements) { … }
static SmallSetVector<FieldDecl *, 1>
findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer,
ASTContext &Context) { … }
static bool reorderFieldsInDefinition(
const RecordDecl *Definition, ArrayRef<unsigned> NewFieldsOrder,
const ASTContext &Context,
std::map<std::string, tooling::Replacements> &Replacements) { … }
static void reorderFieldsInConstructor(
const CXXConstructorDecl *CtorDecl, ArrayRef<unsigned> NewFieldsOrder,
ASTContext &Context,
std::map<std::string, tooling::Replacements> &Replacements) { … }
static bool reorderFieldsInInitListExpr(
const InitListExpr *InitListEx, ArrayRef<unsigned> NewFieldsOrder,
const ASTContext &Context,
std::map<std::string, tooling::Replacements> &Replacements) { … }
namespace {
class ReorderingConsumer : public ASTConsumer { … };
}
std::unique_ptr<ASTConsumer> ReorderFieldsAction::newASTConsumer() { … }
}
}