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

Method loadFileInfoFromXml

lib/checkbufferoverrun.cpp:970–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

968}
969
970const Check::FileInfo * CheckBufferOverrun::loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement, const std::string& file0) const
971{
972 const std::string arrayIndex("array-index");
973 const std::string pointerArith("pointer-arith");
974
975 auto *fileInfo = new MyFileInfo(file0);
976 for (const tinyxml2::XMLElement *e = xmlElement->FirstChildElement(); e; e = e->NextSiblingElement()) {
977 const char* name = e->Name();
978 if (name == arrayIndex)
979 fileInfo->unsafeArrayIndex = CTU::loadUnsafeUsageListFromXml(e);
980 else if (name == pointerArith)
981 fileInfo->unsafePointerArith = CTU::loadUnsafeUsageListFromXml(e);
982 }
983
984 if (fileInfo->unsafeArrayIndex.empty() && fileInfo->unsafePointerArith.empty()) {
985 delete fileInfo;
986 return nullptr;
987 }
988
989 return fileInfo;
990}
991
992/** @brief Analyse all file infos for all TU */
993bool CheckBufferOverrun::analyseWholeProgram(const CTU::FileInfo &ctu, const std::list<const Check::FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger)

Callers

nothing calls this directly

Calls 4

FirstChildElementMethod · 0.80
NextSiblingElementMethod · 0.80
NameMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected