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_FWD_FIXES_H 0009 #define CLAZY_QT6_FWD_FIXES_H 0010 0011 #include "checkbase.h" 0012 0013 #include <string> 0014 0015 class ClazyContext; 0016 0017 namespace clang 0018 { 0019 class Stmt; 0020 class FixItHint; 0021 } 0022 0023 /** 0024 * Replaces forward declaration with #include <QtCore/qcontainerfwd.h>. 0025 * 0026 * Run only in Qt 6 code. 0027 */ 0028 class Qt6FwdFixes : public CheckBase 0029 { 0030 public: 0031 explicit Qt6FwdFixes(const std::string &name, ClazyContext *context); 0032 void VisitDecl(clang::Decl *decl) override; 0033 void VisitInclusionDirective(clang::SourceLocation HashLoc, 0034 const clang::Token &IncludeTok, 0035 clang::StringRef FileName, 0036 bool IsAngled, 0037 clang::CharSourceRange FilenameRange, 0038 clazy::OptionalFileEntryRef File, 0039 clang::StringRef SearchPath, 0040 clang::StringRef RelativePath, 0041 const clang::Module *Imported, 0042 clang::SrcMgr::CharacteristicKind FileType) override; 0043 bool m_including_qcontainerfwd = false; 0044 std::set<clang::StringRef> m_qcontainerfwd_included_in_files; 0045 std::string m_currentFile; 0046 }; 0047 0048 #endif