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

0001 /*
0002     SPDX-FileCopyrightText: 2015 Klarälvdalens Datakonsult AB a KDAB Group company info@kdab.com
0003     SPDX-FileContributor: SĂ©rgio Martins <sergio.martins@kdab.com>
0004 
0005     SPDX-FileCopyrightText: 2015-2016 Sergio Martins <smartins@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef CLAZY_MISSING_TYPE_INFO_H
0011 #define CLAZY_MISSING_TYPE_INFO_H
0012 
0013 #include "checkbase.h"
0014 
0015 #include <set>
0016 #include <string>
0017 
0018 class ClazyContext;
0019 
0020 namespace clang
0021 {
0022 class ClassTemplateSpecializationDecl;
0023 class CXXRecordDecl;
0024 class Decl;
0025 class QualType;
0026 }
0027 
0028 /**
0029  * Suggests usage of Q_PRIMITIVE_TYPE or Q_MOVABLE_TYPE in cases where you're using QList<T> and sizeof(T) > sizeof(void*)
0030  * or using QVector<T>. Unless they already have a classification.
0031  *
0032  * See README-missing-type-info for more info.
0033  */
0034 class MissingTypeInfo : public CheckBase
0035 {
0036 public:
0037     MissingTypeInfo(const std::string &name, ClazyContext *context);
0038     void VisitDecl(clang::Decl *decl) override;
0039 
0040 private:
0041     void registerQTypeInfo(clang::ClassTemplateSpecializationDecl *decl);
0042     bool typeHasClassification(clang::QualType) const;
0043     std::set<std::string> m_typeInfos;
0044 };
0045 
0046 #endif