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

Function createDUI

lib/preprocessor.cpp:818–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818static simplecpp::DUI createDUI(const Settings &mSettings, const std::string &cfgStr, Standards::Language lang)
819{
820 // TODO: make it possible to specify platform-dependent sizes
821 simplecpp::DUI dui;
822
823 splitcfg(mSettings.userDefines, dui.defines, "1");
824 if (!cfgStr.empty())
825 splitcfg(cfgStr, dui.defines, "");
826
827 for (const std::string &def : mSettings.library.defines()) {
828 const std::string::size_type pos = def.find_first_of(" (");
829 if (pos == std::string::npos) {
830 dui.defines.push_back(def);
831 continue;
832 }
833 std::string s = def;
834 if (s[pos] == ' ') {
835 s[pos] = '=';
836 } else {
837 s[s.find(')')+1] = '=';
838 }
839 dui.defines.push_back(std::move(s));
840 }
841
842 dui.undefined = mSettings.userUndefs; // -U
843 dui.includePaths = mSettings.includePaths; // -I
844 dui.includes = mSettings.userIncludes; // --include
845 if (lang == Standards::Language::CPP) {
846 dui.std = mSettings.standards.stdValueCPP;
847 if (dui.std.empty()) {
848 dui.std = mSettings.standards.getCPP();
849 }
850 splitcfg(mSettings.platform.getLimitsDefines(Standards::getCPP(dui.std)), dui.defines, "");
851 }
852 else if (lang == Standards::Language::C) {
853 dui.std = mSettings.standards.stdValueC;
854 if (dui.std.empty()) {
855 dui.std = mSettings.standards.getC();
856 }
857 splitcfg(mSettings.platform.getLimitsDefines(Standards::getC(dui.std)), dui.defines, "");
858 }
859 dui.clearIncludeCache = mSettings.clearIncludeCache;
860 return dui;
861}
862
863const simplecpp::Output* Preprocessor::handleErrors(const simplecpp::OutputList& outputList)
864{

Callers 2

loadFilesMethod · 0.85
preprocessMethod · 0.85

Calls 8

splitcfgFunction · 0.85
definesMethod · 0.80
getLimitsDefinesMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
findMethod · 0.45
getCPPMethod · 0.45
getCMethod · 0.45

Tested by

no test coverage detected