File indexing completed on 2024-04-28 05:38:34

0001 /*
0002     SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB a KDAB Group company info@kdab.com
0003     SPDX-FileContributor: Shivam Kunwar <shivam.kunwar@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef CLAZY_UNUSED_RESULT_CHECK_H
0009 #define CLAZY_UNUSED_RESULT_CHECK_H
0010 
0011 #include "checkbase.h"
0012 
0013 #include <string>
0014 
0015 class Caller;
0016 class ClazyContext;
0017 
0018 namespace clang
0019 {
0020 namespace ast_matchers
0021 {
0022 class MatchFinder;
0023 } // namespace ast_matchers
0024 class Stmt;
0025 class VarDecl;
0026 class CXXRecordDecl;
0027 class QualType;
0028 } // namespace clang
0029 
0030 class UnusedResultCheck : public CheckBase
0031 {
0032 public:
0033     explicit UnusedResultCheck(const std::string &name, ClazyContext *context);
0034     ~UnusedResultCheck() override;
0035     void VisitStmt(clang::Stmt *stmt) override;
0036     void registerASTMatchers(clang::ast_matchers::MatchFinder &) override;
0037 
0038 private:
0039     std::unique_ptr<ClazyAstMatcherCallback> m_astMatcherCallBack; // TODO: add std::propagate_const
0040 };
0041 
0042 #endif