diff options
author | Sergio Martins <smartins@kde.org> | 2017-09-21 22:44:19 +0100 |
---|---|---|
committer | Sergio Martins <smartins@kde.org> | 2017-09-21 22:44:19 +0100 |
commit | ebbb801b92170c4d5651805be3141e4cfd01e689 (patch) | |
tree | 3d63ec197d856474955dc6f1972844cb9b3960a4 /src/QtUtils.cpp | |
parent | 200b2ecb4acbd8701905d0b571c6bc3ba9687da7 (diff) | |
parent | b843957a8dd3fc24ecdaae0289d976a08a0e6958 (diff) |
Merge branch '1.2' into master
Diffstat (limited to 'src/QtUtils.cpp')
-rw-r--r-- | src/QtUtils.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/QtUtils.cpp b/src/QtUtils.cpp index eb267bf4..cc889c86 100644 --- a/src/QtUtils.cpp +++ b/src/QtUtils.cpp @@ -323,3 +323,28 @@ CXXMethodDecl *QtUtils::pmfFromUnary(UnaryOperator *uo) return nullptr; } + +bool QtUtils::recordHasCtorWithParam(clang::CXXRecordDecl *record, const std::string ¶mType, bool &ok, int &numCtors) +{ + ok = true; + numCtors = 0; + if (!record || !record->hasDefinition() || + record->getDefinition() != record) { // Means fwd decl + ok = false; + return false; + } + + for (auto ctor : record->ctors()) { + if (ctor->isCopyOrMoveConstructor()) + continue; + numCtors++; + for (auto param : ctor->parameters()) { + QualType qt = TypeUtils::pointeeQualType(param->getType()); + if (!qt.isConstQualified() && TypeUtils::derivesFrom(qt, paramType)) { + return true; + } + } + } + + return false; +} |