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

0001 /*
0002     SPDX-FileCopyrightText: 2018 Sergio Martins <smartins@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef CLAZY_FULLY_QUALIFIED_MOC_TYPES_H
0008 #define CLAZY_FULLY_QUALIFIED_MOC_TYPES_H
0009 
0010 #include "checkbase.h"
0011 
0012 #include <clang/Basic/SourceLocation.h>
0013 
0014 #include <string>
0015 #include <vector>
0016 
0017 class ClazyContext;
0018 namespace clang
0019 {
0020 class CXXMethodDecl;
0021 class CXXRecordDecl;
0022 class Decl;
0023 class MacroInfo;
0024 class Token;
0025 } // namespace clang
0026 
0027 /**
0028  * See README-fully-qualified-moc-types.md for more info.
0029  */
0030 class FullyQualifiedMocTypes : public CheckBase
0031 {
0032 public:
0033     explicit FullyQualifiedMocTypes(const std::string &name, ClazyContext *context);
0034     void VisitDecl(clang::Decl *) override;
0035 
0036 private:
0037     bool isGadget(clang::CXXRecordDecl *record) const;
0038     bool handleQ_PROPERTY(clang::CXXMethodDecl *);
0039     void VisitMacroExpands(const clang::Token &MacroNameTok, const clang::SourceRange &range, const clang::MacroInfo *minfo = nullptr) override;
0040     void registerQ_GADGET(clang::SourceLocation);
0041     bool typeIsFullyQualified(clang::QualType t, std::string &qualifiedTypeName, std::string &typeName) const;
0042 
0043     std::vector<clang::SourceLocation> m_qgadgetMacroLocations;
0044 };
0045 #endif