in src/AccessSpecifierManager.cpp [76:119]
void MacroExpands(const Token &MacroNameTok, const MacroDefinition &, SourceRange range, const MacroArgs *) override
{
IdentifierInfo *ii = MacroNameTok.getIdentifierInfo();
if (!ii) {
return;
}
auto name = ii->getName();
const bool isSlots = name == "slots" || name == "Q_SLOTS";
const bool isSignals = isSlots ? false : (name == "signals" || name == "Q_SIGNALS");
const bool isSlot = (isSlots || isSignals) ? false : name == "Q_SLOT";
const bool isSignal = (isSlots || isSignals || isSlot) ? false : name == "Q_SIGNAL";
const bool isInvokable = (isSlots || isSignals || isSlot || isSignal) ? false : name == "Q_INVOKABLE";
const bool isScriptable = (isSlot || isSignal || isInvokable) ? false : name == "Q_SCRIPTABLE";
if (!isSlots && !isSignals && !isSlot && !isSignal && !isInvokable && !isScriptable) {
return;
}
SourceLocation loc = range.getBegin();
if (loc.isMacroID()) {
return;
}
if (isSignals || isSlots) {
QtAccessSpecifierType qtAccessSpecifier = isSlots ? QtAccessSpecifier_Slot : QtAccessSpecifier_Signal;
m_qtAccessSpecifiers.push_back({loc, clang::AS_none, qtAccessSpecifier});
} else {
// Get the location of the method declaration, so we can compare directly when we visit methods
loc = Utils::locForNextToken(loc, m_ci.getSourceManager(), m_ci.getLangOpts());
if (loc.isInvalid()) {
return;
}
if (isSignal) {
m_individualSignals.push_back(loc.getRawEncoding());
} else if (isSlot) {
m_individualSlots.push_back(loc.getRawEncoding());
} else if (isInvokable) {
m_invokables.push_back(loc.getRawEncoding());
} else if (isScriptable) {
m_scriptables.push_back(loc.getRawEncoding());
}
}
}