File indexing completed on 2024-03-24 05:41:41
0001 /* 0002 SPDX-FileCopyrightText: 2016 Sergio Martins <smartins@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include <clang/AST/Type.h> 0008 0009 #include <string> 0010 #include <vector> 0011 0012 namespace clang 0013 { 0014 class CXXMethodDecl; 0015 class CXXRecordDecl; 0016 class ClassTemplateSpecializationDecl; 0017 class Decl; 0018 class LangOptions; 0019 } 0020 0021 namespace clazy 0022 { 0023 /** 0024 * Returns a list of QualTypes for the template arguments. 0025 * For example: 0026 * If the method was foo<int, Bar, char*>(), it would return {int, Bar, Char*} 0027 */ 0028 std::vector<clang::QualType> getTemplateArgumentsTypes(clang::CXXMethodDecl *); 0029 0030 /** 0031 * Returns a list of QualTypes for the template arguments. 0032 * For example: 0033 * If the class was QList<int>(), it would return {int} 0034 */ 0035 std::vector<clang::QualType> getTemplateArgumentsTypes(clang::CXXRecordDecl *); 0036 0037 clang::ClassTemplateSpecializationDecl *templateDecl(clang::Decl *decl); 0038 0039 /** 0040 * Returns a string with the type name of the argument at the specified index. 0041 * If recordOnly is true, then it will only return a name if the argument is a class or struct. 0042 * 0043 * Example: For QList<Foo>, getTemplateArgumentTypeStr(decl, 0) would return "Foo" 0044 */ 0045 std::string getTemplateArgumentTypeStr(clang::ClassTemplateSpecializationDecl *, unsigned int index, const clang::LangOptions &lo, bool recordOnly = false); 0046 0047 clang::QualType getTemplateArgumentType(clang::ClassTemplateSpecializationDecl *, unsigned int index); 0048 0049 }