10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CHANGE_NAMESPACE_CHANGENAMESPACE_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CHANGE_NAMESPACE_CHANGENAMESPACE_H 13 #include "clang/ASTMatchers/ASTMatchFinder.h" 14 #include "clang/Format/Format.h" 15 #include "clang/Tooling/Core/Replacement.h" 16 #include "llvm/Support/Regex.h" 20 namespace change_namespace {
52 llvm::StringRef OldNs, llvm::StringRef NewNs, llvm::StringRef FilePattern,
53 llvm::ArrayRef<std::string> WhiteListedSymbolPatterns,
54 std::map<std::string, tooling::Replacements> *FileToReplacements,
55 llvm::StringRef FallbackStyle =
"LLVM");
59 void run(
const ast_matchers::MatchFinder::MatchResult &
Result)
override;
66 void moveOldNamespace(
const ast_matchers::MatchFinder::MatchResult &Result,
67 const NamespaceDecl *NsDecl);
69 void moveClassForwardDeclaration(
70 const ast_matchers::MatchFinder::MatchResult &Result,
71 const NamedDecl *FwdDecl);
73 void replaceQualifiedSymbolInDeclContext(
74 const ast_matchers::MatchFinder::MatchResult &Result,
75 const DeclContext *DeclContext, SourceLocation Start, SourceLocation End,
76 const NamedDecl *FromDecl);
78 void fixTypeLoc(
const ast_matchers::MatchFinder::MatchResult &Result,
79 SourceLocation Start, SourceLocation End, TypeLoc Type);
81 void fixUsingShadowDecl(
const ast_matchers::MatchFinder::MatchResult &Result,
82 const UsingDecl *UsingDeclaration);
84 void fixDeclRefExpr(
const ast_matchers::MatchFinder::MatchResult &Result,
85 const DeclContext *UseContext,
const NamedDecl *From,
86 const DeclRefExpr *Ref);
89 struct MoveNamespace {
97 unsigned InsertionOffset;
100 SourceManager *SourceMgr;
104 struct InsertForwardDeclaration {
107 unsigned InsertionOffset;
109 std::string ForwardDeclText;
112 std::string FallbackStyle;
120 std::map<std::string, tooling::Replacements> &FileToReplacements;
123 std::string OldNamespace;
126 std::string NewNamespace;
131 std::string DiffOldNamespace;
136 std::string DiffNewNamespace;
138 std::string FilePattern;
139 llvm::Regex FilePatternRE;
145 std::map<std::string, std::vector<MoveNamespace>> MoveNamespaces;
151 std::map<std::string, std::vector<InsertForwardDeclaration>> InsertFwdDecls;
154 llvm::SmallPtrSet<const UsingDecl *, 8> UsingDecls;
157 llvm::SmallPtrSet<const UsingDirectiveDecl *, 8> UsingNamespaceDecls;
160 llvm::SmallPtrSet<const NamespaceAliasDecl *, 8> NamespaceAliasDecls;
163 llvm::SmallVector<TypeLoc, 8> BaseCtorInitializerTypeLocs;
167 llvm::SmallPtrSet<const clang::DeclRefExpr*, 16> ProcessedFuncRefs;
170 std::vector<llvm::Regex> WhiteListedSymbolRegexes;
176 #endif // LLVM_CLANG_TOOLS_EXTRA_CHANGE_NAMESPACE_CHANGENAMESPACE_H
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//