MCPcopy Create free account
hub / github.com/KDE/kdevelop / visitFunctionCall

Method visitFunctionCall

plugins/qmakemanager/qmakefilevisitor.cpp:73–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void QMakeFileVisitor::visitFunctionCall(QMake::FunctionCallAST* node)
74{
75 if (node->identifier->value == QLatin1String("include") || node->identifier->value == QLatin1String("!include")) {
76 if (node->args.isEmpty())
77 return;
78 QStringList arguments = getValueList(node->args);
79
80 ifDebug(qCDebug(KDEV_QMAKE) << "found include" << node->identifier->value << arguments;)
81 QString argument = arguments.join(QString()).trimmed();
82 if (!argument.isEmpty() && QFileInfo(argument).isRelative()) {
83 argument = QFileInfo(m_baseFile->absoluteDir() + QLatin1Char('/') + argument).canonicalFilePath();
84 }
85 if (argument.isEmpty()) {
86 qCWarning(KDEV_QMAKE) << "empty include file detected in line" << node->startLine;
87 if (node->identifier->value.startsWith(QLatin1Char('!'))) {
88 visitNode(node->body);
89 }
90 return;
91 }
92 ifDebug(qCDebug(KDEV_QMAKE) << "Reading Include file:" << argument;)
93 QMakeIncludeFile includefile(argument, m_baseFile, m_variableValues);
94 bool read = includefile.read();
95 ifDebug(qCDebug(KDEV_QMAKE) << "successfully read:" << read;) if (read)
96 {
97 // TODO: optimize by using variableMap and iterator, don't compare values
98 const auto vars = includefile.variables();
99 for (const auto& var : vars) {
100 if (m_variableValues.value(var) != includefile.variableValues(var)) {
101 m_variableValues[var] = includefile.variableValues(var);
102 }
103 }
104 if (!node->identifier->value.startsWith(QLatin1Char('!'))) {
105 visitNode(node->body);
106 }
107 }
108 else if (node->identifier->value.startsWith(QLatin1Char('!'))) { visitNode(node->body); }
109 } else if (node->body && (node->identifier->value == QLatin1String("defineReplace")
110 || node->identifier->value
111 == QLatin1String("defineTest"))) { // TODO: differentiate between replace and test functions?
112 QStringList args = getValueList(node->args);
113 if (!args.isEmpty()) {
114 m_userMacros[args.first()] = node->body;
115 } // TODO: else return error
116 } else if (node->identifier->value == QLatin1String("return")) {
117 m_lastReturn = getValueList(node->args);
118 } else { // TODO: only visit when test function returned true?
119 qCWarning(KDEV_QMAKE) << "unhandled function call" << node->identifier->value;
120 visitNode(node->body);
121 }
122}
123
124void QMakeFileVisitor::visitAssignment(QMake::AssignmentAST* node)
125{

Callers

nothing calls this directly

Calls 10

joinMethod · 0.80
absoluteDirMethod · 0.80
variableValuesMethod · 0.80
QStringClass · 0.50
QFileInfoClass · 0.50
isEmptyMethod · 0.45
readMethod · 0.45
variablesMethod · 0.45
valueMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected