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_QHASH_SIGNATURE
0009 #define CLAZY_QT6_QHASH_SIGNATURE
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  * Replaces qhash signature uint with size_t.
0032  *
0033  * Run only in Qt 6 code.
0034  */
0035 class Qt6QHashSignature : public CheckBase
0036 {
0037 public:
0038     explicit Qt6QHashSignature(const std::string &name, ClazyContext *context);
0039     void VisitDecl(clang::Decl *decl) override;
0040     void VisitStmt(clang::Stmt *stmt) override;
0041 
0042 private:
0043     std::vector<clang::FixItHint> fixitReplace(clang::FunctionDecl *funcDecl, bool changeReturnType, bool changeParamType);
0044 };
0045 
0046 #endif