File indexing completed on 2024-04-28 05:38:33
0001 /* 0002 SPDX-FileCopyrightText: 2020 The Qt Company Ltd. 0003 SPDX-FileCopyrightText: 2020 Lucie Gerard <lucie.gerard@qt.io> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef CLAZY_QT6_DEPRECATEDAPI_FIXES 0009 #define CLAZY_QT6_DEPRECATEDAPI_FIXES 0010 0011 #include "checkbase.h" 0012 0013 #include <string> 0014 #include <vector> 0015 0016 class ClazyContext; 0017 0018 namespace clang 0019 { 0020 class Stmt; 0021 class FixItHint; 0022 class CXXConstructExpr; 0023 class CXXOperatorCallExpr; 0024 class Expr; 0025 class CXXMemberCallExpr; 0026 0027 class CXXFunctionalCastExpr; 0028 } 0029 0030 /** 0031 * Idenfify deprecated API and replace them when possible 0032 * 0033 * Run only with Qt 5. 0034 */ 0035 class Qt6DeprecatedAPIFixes : public CheckBase 0036 { 0037 public: 0038 explicit Qt6DeprecatedAPIFixes(const std::string &name, ClazyContext *context); 0039 void VisitStmt(clang::Stmt *stmt) override; 0040 void VisitDecl(clang::Decl *decl) override; 0041 void VisitMacroExpands(const clang::Token &MacroNameTok, const clang::SourceRange &range, const clang::MacroInfo *) override; 0042 0043 private: 0044 std::vector<clang::SourceLocation> m_listingMacroExpand; 0045 void fixForDeprecatedOperator(clang::Stmt *stmt, const std::string &className); 0046 std::string buildReplacementforQDir(clang::DeclRefExpr *decl_operator, bool isPointer, std::string replacement, const std::string &replacement_var2); 0047 std::string buildReplacementForQVariant(clang::DeclRefExpr *decl_operator, const std::string &replacement, const std::string &replacement_var2); 0048 }; 0049 0050 #endif