MCPcopy Create free account
hub / github.com/KDAB/codebrowser / lookUpCandidates

Function lookUpCandidates

generator/qtsupport.cpp:37–64  ·  view source on GitHub ↗

* Lookup candidates function of name \a methodName within the QObject derivative \a objClass * its bases, or its private implementation */

Source from the content-addressed store, hash-verified

35 * its bases, or its private implementation
36 */
37static llvm::SmallVector<clang::CXXMethodDecl *, 10> lookUpCandidates(const clang::CXXRecordDecl* objClass,
38 llvm::StringRef methodName)
39{
40 llvm::SmallVector<clang::CXXMethodDecl *, 10> candidates;
41 clang::CXXMethodDecl *d_func = nullptr;
42 auto classIt = objClass;
43 while (classIt) {
44 if (!classIt->getDefinition())
45 break;
46
47 for (auto mi = classIt->method_begin(); mi != classIt->method_end(); ++mi) {
48 if ((*mi)->getName() == methodName)
49 candidates.push_back(*mi);
50 if (!d_func && (*mi)->getName() == "d_func" && !getResultType(*mi).isNull())
51 d_func = *mi;
52 }
53
54 // Look in the first base (because the QObject need to be the first base class)
55 classIt = classIt->getNumBases() == 0 ? nullptr :
56 classIt->bases_begin()->getType()->getAsCXXRecordDecl();
57
58 if (d_func && !classIt && candidates.empty()) {
59 classIt = getResultType(d_func)->getPointeeCXXRecordDecl();
60 d_func = nullptr;
61 }
62 }
63 return candidates;
64}
65
66/**
67 * \a obj is an expression to a type of an QObject (or pointer to) that is the sender or the receiver

Callers 2

handleSignalOrSlotMethod · 0.85
handleInvokeMethodMethod · 0.85

Calls 1

getResultTypeFunction · 0.85

Tested by

no test coverage detected