| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2016 Sergio Martins <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <clang/AST/Type.h> |
| 8 |
|
| 9 |
#include <string> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
namespace clang |
| 13 |
{ |
| 14 |
class CXXMethodDecl; |
| 15 |
class CXXRecordDecl; |
| 16 |
class ClassTemplateSpecializationDecl; |
| 17 |
class Decl; |
| 18 |
class LangOptions; |
| 19 |
} |
| 20 |
|
| 21 |
namespace clazy |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Returns a list of QualTypes for the template arguments. |
| 25 |
* For example: |
| 26 |
* If the method was foo<int, Bar, char*>(), it would return {int, Bar, Char*} |
| 27 |
*/ |
| 28 |
std::vector<clang::QualType> getTemplateArgumentsTypes(clang::CXXMethodDecl *); |
| 29 |
|
| 30 |
/** |
| 31 |
* Returns a list of QualTypes for the template arguments. |
| 32 |
* For example: |
| 33 |
* If the class was QList<int>(), it would return {int} |
| 34 |
*/ |
| 35 |
std::vector<clang::QualType> getTemplateArgumentsTypes(clang::CXXRecordDecl *); |
| 36 |
|
| 37 |
clang::ClassTemplateSpecializationDecl *templateDecl(clang::Decl *decl); |
| 38 |
|
| 39 |
/** |
| 40 |
* Returns a string with the type name of the argument at the specified index. |
| 41 |
* If recordOnly is true, then it will only return a name if the argument is a class or struct. |
| 42 |
* |
| 43 |
* Example: For QList<Foo>, getTemplateArgumentTypeStr(decl, 0) would return "Foo" |
| 44 |
*/ |
| 45 |
std::string getTemplateArgumentTypeStr(clang::ClassTemplateSpecializationDecl *, unsigned int index, const clang::LangOptions &lo, bool recordOnly = false); |
| 46 |
|
| 47 |
clang::QualType getTemplateArgumentType(clang::ClassTemplateSpecializationDecl *, unsigned int index); |
| 48 |
|
| 49 |
} |