MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / loadFromXml

Method loadFromXml

lib/ctu.cpp:198–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198bool CTU::FileInfo::FunctionCall::loadFromXml(const tinyxml2::XMLElement *xmlElement)
199{
200 if (!loadBaseFromXml(xmlElement))
201 return false;
202 bool error=false;
203 callArgumentExpression = readAttrString(xmlElement, ATTR_CALL_ARGEXPR, &error);
204 callValueType = static_cast<ValueFlow::Value::ValueType>(readAttrInt(xmlElement, ATTR_CALL_ARGVALUETYPE, &error));
205 callArgValue.value = readAttrInt(xmlElement, ATTR_CALL_ARGVALUE, &error);
206 const auto ufr = readAttrInt(xmlElement, ATTR_CALL_UNKNOWN_FUNCTION_RETURN, &error);
207 // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) - TODO: fix this - #13726
208 callArgValue.unknownFunctionReturn = static_cast<ValueFlow::Value::UnknownFunctionReturn>(ufr>=0 && ufr <=0xff ? ufr : 0xff);
209 const char *w = xmlElement->Attribute(ATTR_WARNING);
210 warning = w && std::strcmp(w, "true") == 0;
211 for (const tinyxml2::XMLElement *e2 = xmlElement->FirstChildElement(); !error && e2; e2 = e2->NextSiblingElement()) {
212 if (std::strcmp(e2->Name(), "path") != 0)
213 continue;
214 std::string file = readAttrString(e2, ATTR_LOC_FILENAME, &error);
215 std::string info = readAttrString(e2, ATTR_INFO, &error);
216 const int line = readAttrInt(e2, ATTR_LOC_LINENR, &error);
217 const int column = readAttrInt(e2, ATTR_LOC_COLUMN, &error);
218 ErrorMessage::FileLocation loc(file, std::move(info), line, column);
219 callValuePath.emplace_back(std::move(loc));
220 }
221 return !error;
222}
223
224bool CTU::FileInfo::NestedCall::loadFromXml(const tinyxml2::XMLElement *xmlElement)
225{

Callers 1

analyseWholeProgramMethod · 0.45

Calls 7

readAttrStringFunction · 0.85
readAttrIntFunction · 0.85
AttributeMethod · 0.80
FirstChildElementMethod · 0.80
NextSiblingElementMethod · 0.80
NameMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected