comparison clang-tools-extra/clang-tidy/utils/FixItHintUtils.h @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents 79ff65ed7e25
children
comparison
equal deleted inserted replaced
237:c80f45b162ad 252:1f2b6ac9f198
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FIXITHINTUTILS_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FIXITHINTUTILS_H
11 11
12 #include "clang/AST/ASTContext.h" 12 #include "clang/AST/ASTContext.h"
13 #include "clang/AST/Decl.h" 13 #include "clang/AST/Decl.h"
14 #include "clang/Sema/DeclSpec.h" 14 #include "clang/Sema/DeclSpec.h"
15 #include <optional>
15 16
16 namespace clang { 17 namespace clang::tidy::utils::fixit {
17 namespace tidy {
18 namespace utils {
19 namespace fixit {
20 18
21 /// Creates fix to make ``VarDecl`` a reference by adding ``&``. 19 /// Creates fix to make ``VarDecl`` a reference by adding ``&``.
22 FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context); 20 FixItHint changeVarDeclToReference(const VarDecl &Var, ASTContext &Context);
23 21
24 /// This enum defines where the qualifier shall be preferably added. 22 /// This enum defines where the qualifier shall be preferably added.
39 /// `int * p = &i;` -> `int * const = &i` 37 /// `int * p = &i;` -> `int * const = &i`
40 }; 38 };
41 39
42 /// \brief Creates fix to qualify ``VarDecl`` with the specified \c Qualifier. 40 /// \brief Creates fix to qualify ``VarDecl`` with the specified \c Qualifier.
43 /// Requires that `Var` is isolated in written code like in `int foo = 42;`. 41 /// Requires that `Var` is isolated in written code like in `int foo = 42;`.
44 Optional<FixItHint> 42 std::optional<FixItHint>
45 addQualifierToVarDecl(const VarDecl &Var, const ASTContext &Context, 43 addQualifierToVarDecl(const VarDecl &Var, const ASTContext &Context,
46 DeclSpec::TQ Qualifier, 44 DeclSpec::TQ Qualifier,
47 QualifierTarget CT = QualifierTarget::Pointee, 45 QualifierTarget CT = QualifierTarget::Pointee,
48 QualifierPolicy CP = QualifierPolicy::Left); 46 QualifierPolicy CP = QualifierPolicy::Left);
49 } // namespace fixit 47
50 } // namespace utils 48 // \brief Format a pointer to an expression
51 } // namespace tidy 49 std::string formatDereference(const Expr &ExprNode, const ASTContext &Context);
52 } // namespace clang 50 } // namespace clang::tidy::utils::fixit
53 51
54 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FIXITHINTUTILS_H 52 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_FIXITHINTUTILS_H