| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_USINGINSERTER_H |
| 10 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_USINGINSERTER_H |
| 11 |
|
| 12 |
#include "clang/AST/Decl.h" |
| 13 |
#include "clang/AST/Stmt.h" |
| 14 |
#include "clang/Basic/Diagnostic.h" |
| 15 |
#include "clang/Basic/SourceManager.h" |
| 16 |
#include <optional> |
| 17 |
#include <set> |
| 18 |
|
| 19 |
namespace clang::tidy::utils { |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
class UsingInserter { |
| 25 |
public: |
| 26 |
UsingInserter(const SourceManager &SourceMgr); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
std::optional<FixItHint> |
| 31 |
createUsingDeclaration(ASTContext &Context, const Stmt &Statement, |
| 32 |
llvm::StringRef QualifiedName); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
llvm::StringRef getShortName(ASTContext &Context, const Stmt &Statement, |
| 37 |
llvm::StringRef QualifiedName); |
| 38 |
|
| 39 |
private: |
| 40 |
typedef std::pair<const FunctionDecl *, std::string> NameInFunction; |
| 41 |
const SourceManager &SourceMgr; |
| 42 |
std::set<NameInFunction> AddedUsing; |
| 43 |
}; |
| 44 |
|
| 45 |
} |
| 46 |
#endif |