CLI: add -isystem include paths when running Clang

This commit is contained in:
Daniel Marjamäki 2020-02-02 16:35:42 +01:00
parent 894497e704
commit a9f55f4985
2 changed files with 9 additions and 5 deletions

View File

@ -251,7 +251,8 @@ const char * CppCheck::extraVersion()
unsigned int CppCheck::check(const std::string &path)
{
if (mSettings.clang) {
mErrorLogger.reportOut(std::string("Checking ") + path + "...");
if (!mSettings.quiet)
mErrorLogger.reportOut(std::string("Checking ") + path + "...");
const std::string clang = Path::isCPP(path) ? "clang++" : "clang";
const std::string temp = mSettings.buildDir + (Path::isCPP(path) ? "/__temp__.cpp" : "/__temp__.c");
@ -364,8 +365,10 @@ unsigned int CppCheck::check(const ImportProject::FileSettings &fs)
temp.mSettings.userUndefs = fs.undefs;
if (fs.platformType != Settings::Unspecified)
temp.mSettings.platform(fs.platformType);
if (mSettings.clang)
if (mSettings.clang) {
temp.mSettings.includePaths.insert(temp.mSettings.includePaths.end(), fs.systemIncludePaths.cbegin(), fs.systemIncludePaths.cend());
temp.check(Path::simplifyPath(fs.filename));
}
std::ifstream fin(fs.filename);
return temp.checkFile(Path::simplifyPath(fs.filename), fs.cfg, fin);
}

View File

@ -255,9 +255,10 @@ void ImportProject::FileSettings::parseCommand(const std::string &command)
defs += ';';
} else if (F=='U')
undefs.insert(fval);
else if (F=='I')
includePaths.push_back(fval);
else if (F=='s' && fval.compare(0,2,"td") == 0) {
else if (F=='I') {
if (std::find(includePaths.begin(), includePaths.end(), fval) == includePaths.end())
includePaths.push_back(fval);
} else if (F=='s' && fval.compare(0,2,"td") == 0) {
++pos;
const std::string stdval = readUntil(command, &pos, " ");
standard = stdval;