moved `ImportProject` out of `Settings` and only store `fileSettings` (#5603)
`ImportProject` is not needed outside of the command-line parsing so we do not need it inside the `Settings` at all. We only use the `fileSettings` in the executors.
This commit is contained in:
parent
10654386db
commit
dd627a2b1d
|
@ -122,6 +122,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
bool def = false;
|
bool def = false;
|
||||||
bool maxconfigs = false;
|
bool maxconfigs = false;
|
||||||
|
|
||||||
|
ImportProject project;
|
||||||
|
|
||||||
mSettings.exename = Path::getCurrentExecutablePath(argv[0]);
|
mSettings.exename = Path::getCurrentExecutablePath(argv[0]);
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
|
@ -666,7 +668,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
|
|
||||||
// --project
|
// --project
|
||||||
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
|
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
|
||||||
if (mSettings.project.projectType != ImportProject::Type::NONE)
|
if (project.projectType != ImportProject::Type::NONE)
|
||||||
{
|
{
|
||||||
mLogger.printError("multiple --project options are not supported.");
|
mLogger.printError("multiple --project options are not supported.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -674,16 +676,16 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
|
|
||||||
mSettings.checkAllConfigurations = false; // Can be overridden with --max-configs or --force
|
mSettings.checkAllConfigurations = false; // Can be overridden with --max-configs or --force
|
||||||
std::string projectFile = argv[i]+10;
|
std::string projectFile = argv[i]+10;
|
||||||
ImportProject::Type projType = mSettings.project.import(projectFile, &mSettings);
|
ImportProject::Type projType = project.import(projectFile, &mSettings);
|
||||||
mSettings.project.projectType = projType;
|
project.projectType = projType;
|
||||||
if (projType == ImportProject::Type::CPPCHECK_GUI) {
|
if (projType == ImportProject::Type::CPPCHECK_GUI) {
|
||||||
for (const std::string &lib : mSettings.project.guiProject.libraries)
|
for (const std::string &lib : project.guiProject.libraries)
|
||||||
mSettings.libraries.emplace_back(lib);
|
mSettings.libraries.emplace_back(lib);
|
||||||
|
|
||||||
const auto& excludedPaths = mSettings.project.guiProject.excludedPaths;
|
const auto& excludedPaths = project.guiProject.excludedPaths;
|
||||||
std::copy(excludedPaths.cbegin(), excludedPaths.cend(), std::back_inserter(mIgnoredPaths));
|
std::copy(excludedPaths.cbegin(), excludedPaths.cend(), std::back_inserter(mIgnoredPaths));
|
||||||
|
|
||||||
std::string platform(mSettings.project.guiProject.platform);
|
std::string platform(project.guiProject.platform);
|
||||||
|
|
||||||
// keep existing platform from command-line intact
|
// keep existing platform from command-line intact
|
||||||
if (!platform.empty()) {
|
if (!platform.empty()) {
|
||||||
|
@ -700,14 +702,16 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mSettings.project.guiProject.projectFile.empty()) {
|
const auto& projectFileGui = project.guiProject.projectFile;
|
||||||
projectFile = mSettings.project.guiProject.projectFile;
|
if (!projectFileGui.empty()) {
|
||||||
projType = mSettings.project.import(mSettings.project.guiProject.projectFile, &mSettings);
|
// read underlying project
|
||||||
|
projectFile = projectFileGui;
|
||||||
|
projType = project.import(projectFileGui, &mSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (projType == ImportProject::Type::VS_SLN || projType == ImportProject::Type::VS_VCXPROJ) {
|
if (projType == ImportProject::Type::VS_SLN || projType == ImportProject::Type::VS_VCXPROJ) {
|
||||||
if (mSettings.project.guiProject.analyzeAllVsConfigs == "false")
|
if (project.guiProject.analyzeAllVsConfigs == "false")
|
||||||
mSettings.project.selectOneVsConfig(mSettings.platform.type);
|
project.selectOneVsConfig(mSettings.platform.type);
|
||||||
if (!CppCheckExecutor::tryLoadLibrary(mSettings.library, argv[0], "windows.cfg")) {
|
if (!CppCheckExecutor::tryLoadLibrary(mSettings.library, argv[0], "windows.cfg")) {
|
||||||
// This shouldn't happen normally.
|
// This shouldn't happen normally.
|
||||||
mLogger.printError("failed to load 'windows.cfg'. Your Cppcheck installation is broken. Please re-install.");
|
mLogger.printError("failed to load 'windows.cfg'. Your Cppcheck installation is broken. Please re-install.");
|
||||||
|
@ -731,8 +735,8 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
// --project-configuration
|
// --project-configuration
|
||||||
else if (std::strncmp(argv[i], "--project-configuration=", 24) == 0) {
|
else if (std::strncmp(argv[i], "--project-configuration=", 24) == 0) {
|
||||||
mVSConfig = argv[i] + 24;
|
mVSConfig = argv[i] + 24;
|
||||||
if (!mVSConfig.empty() && (mSettings.project.projectType == ImportProject::Type::VS_SLN || mSettings.project.projectType == ImportProject::Type::VS_VCXPROJ))
|
if (!mVSConfig.empty() && (project.projectType == ImportProject::Type::VS_SLN || project.projectType == ImportProject::Type::VS_VCXPROJ))
|
||||||
mSettings.project.ignoreOtherConfigs(mVSConfig);
|
project.ignoreOtherConfigs(mVSConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only print something when there are errors
|
// Only print something when there are errors
|
||||||
|
@ -1028,7 +1032,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
substituteTemplateFormatStatic(mSettings.templateFormat);
|
substituteTemplateFormatStatic(mSettings.templateFormat);
|
||||||
substituteTemplateLocationStatic(mSettings.templateLocation);
|
substituteTemplateLocationStatic(mSettings.templateLocation);
|
||||||
|
|
||||||
mSettings.project.ignorePaths(mIgnoredPaths);
|
project.ignorePaths(mIgnoredPaths);
|
||||||
|
|
||||||
if (mSettings.force || maxconfigs)
|
if (mSettings.force || maxconfigs)
|
||||||
mSettings.checkAllConfigurations = true;
|
mSettings.checkAllConfigurations = true;
|
||||||
|
@ -1053,19 +1057,22 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPathNames.empty() && mSettings.project.projectType != ImportProject::Type::NONE) {
|
if (!mPathNames.empty() && project.projectType != ImportProject::Type::NONE) {
|
||||||
mLogger.printError("--project cannot be used in conjunction with source files.");
|
mLogger.printError("--project cannot be used in conjunction with source files.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print error only if we have "real" command and expect files
|
// Print error only if we have "real" command and expect files
|
||||||
if (!mExitAfterPrint && mPathNames.empty() && mSettings.project.guiProject.pathNames.empty() && mSettings.project.fileSettings.empty()) {
|
if (!mExitAfterPrint && mPathNames.empty() && project.guiProject.pathNames.empty() && project.fileSettings.empty()) {
|
||||||
mLogger.printError("no C or C++ source files found.");
|
mLogger.printError("no C or C++ source files found.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mSettings.project.guiProject.pathNames.empty())
|
if (!project.guiProject.pathNames.empty())
|
||||||
mPathNames = mSettings.project.guiProject.pathNames;
|
mPathNames = project.guiProject.pathNames;
|
||||||
|
|
||||||
|
if (!project.fileSettings.empty())
|
||||||
|
mSettings.fileSettings = project.fileSettings;
|
||||||
|
|
||||||
// Use paths _pathnames if no base paths for relative path output are given
|
// Use paths _pathnames if no base paths for relative path output are given
|
||||||
if (mSettings.basePaths.empty() && mSettings.relativePaths)
|
if (mSettings.basePaths.empty() && mSettings.relativePaths)
|
||||||
|
|
|
@ -194,16 +194,16 @@ bool CppCheckExecutor::parseFromArgs(Settings &settings, int argc, const char* c
|
||||||
#else
|
#else
|
||||||
const bool caseSensitive = true;
|
const bool caseSensitive = true;
|
||||||
#endif
|
#endif
|
||||||
if (!settings.project.fileSettings.empty() && !settings.fileFilters.empty()) {
|
if (!settings.fileSettings.empty() && !settings.fileFilters.empty()) {
|
||||||
// filter only for the selected filenames from all project files
|
// filter only for the selected filenames from all project files
|
||||||
std::list<ImportProject::FileSettings> newList;
|
std::list<ImportProject::FileSettings> newList;
|
||||||
|
|
||||||
const std::list<ImportProject::FileSettings>& fileSettings = settings.project.fileSettings;
|
const std::list<ImportProject::FileSettings>& fileSettings = settings.fileSettings;
|
||||||
std::copy_if(fileSettings.cbegin(), fileSettings.cend(), std::back_inserter(newList), [&](const ImportProject::FileSettings& fs) {
|
std::copy_if(fileSettings.cbegin(), fileSettings.cend(), std::back_inserter(newList), [&](const ImportProject::FileSettings& fs) {
|
||||||
return matchglobs(settings.fileFilters, fs.filename);
|
return matchglobs(settings.fileFilters, fs.filename);
|
||||||
});
|
});
|
||||||
if (!newList.empty())
|
if (!newList.empty())
|
||||||
settings.project.fileSettings = newList;
|
settings.fileSettings = newList;
|
||||||
else {
|
else {
|
||||||
logger.printError("could not find any files matching the filter.");
|
logger.printError("could not find any files matching the filter.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -220,13 +220,13 @@ bool CppCheckExecutor::parseFromArgs(Settings &settings, int argc, const char* c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFiles.empty() && settings.project.fileSettings.empty()) {
|
if (mFiles.empty() && settings.fileSettings.empty()) {
|
||||||
logger.printError("could not find or open any of the paths given.");
|
logger.printError("could not find or open any of the paths given.");
|
||||||
if (!ignored.empty())
|
if (!ignored.empty())
|
||||||
logger.printMessage("Maybe all paths were ignored?");
|
logger.printMessage("Maybe all paths were ignored?");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!settings.fileFilters.empty() && settings.project.fileSettings.empty()) {
|
if (!settings.fileFilters.empty() && settings.fileSettings.empty()) {
|
||||||
std::map<std::string, std::size_t> newMap;
|
std::map<std::string, std::size_t> newMap;
|
||||||
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
||||||
if (matchglobs(settings.fileFilters, i->first)) {
|
if (matchglobs(settings.fileFilters, i->first)) {
|
||||||
|
@ -319,7 +319,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck)
|
||||||
std::list<std::string> fileNames;
|
std::list<std::string> fileNames;
|
||||||
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i)
|
||||||
fileNames.emplace_back(i->first);
|
fileNames.emplace_back(i->first);
|
||||||
AnalyzerInformation::writeFilesTxt(settings.buildDir, fileNames, settings.userDefines, settings.project.fileSettings);
|
AnalyzerInformation::writeFilesTxt(settings.buildDir, fileNames, settings.userDefines, settings.fileSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings.checkersReportFilename.empty())
|
if (!settings.checkersReportFilename.empty())
|
||||||
|
|
|
@ -237,11 +237,11 @@ unsigned int ProcessExecutor::check()
|
||||||
std::map<int, std::string> pipeFile;
|
std::map<int, std::string> pipeFile;
|
||||||
std::size_t processedsize = 0;
|
std::size_t processedsize = 0;
|
||||||
std::map<std::string, std::size_t>::const_iterator iFile = mFiles.cbegin();
|
std::map<std::string, std::size_t>::const_iterator iFile = mFiles.cbegin();
|
||||||
std::list<ImportProject::FileSettings>::const_iterator iFileSettings = mSettings.project.fileSettings.cbegin();
|
std::list<ImportProject::FileSettings>::const_iterator iFileSettings = mSettings.fileSettings.cbegin();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Start a new child
|
// Start a new child
|
||||||
const size_t nchildren = childFile.size();
|
const size_t nchildren = childFile.size();
|
||||||
if ((iFile != mFiles.cend() || iFileSettings != mSettings.project.fileSettings.cend()) && nchildren < mSettings.jobs && checkLoadAverage(nchildren)) {
|
if ((iFile != mFiles.cend() || iFileSettings != mSettings.fileSettings.cend()) && nchildren < mSettings.jobs && checkLoadAverage(nchildren)) {
|
||||||
int pipes[2];
|
int pipes[2];
|
||||||
if (pipe(pipes) == -1) {
|
if (pipe(pipes) == -1) {
|
||||||
std::cerr << "#### ThreadExecutor::check, pipe() failed: "<< std::strerror(errno) << std::endl;
|
std::cerr << "#### ThreadExecutor::check, pipe() failed: "<< std::strerror(errno) << std::endl;
|
||||||
|
@ -275,7 +275,7 @@ unsigned int ProcessExecutor::check()
|
||||||
fileChecker.settings() = mSettings;
|
fileChecker.settings() = mSettings;
|
||||||
unsigned int resultOfCheck = 0;
|
unsigned int resultOfCheck = 0;
|
||||||
|
|
||||||
if (iFileSettings != mSettings.project.fileSettings.end()) {
|
if (iFileSettings != mSettings.fileSettings.end()) {
|
||||||
resultOfCheck = fileChecker.check(*iFileSettings);
|
resultOfCheck = fileChecker.check(*iFileSettings);
|
||||||
if (fileChecker.settings().clangTidy)
|
if (fileChecker.settings().clangTidy)
|
||||||
fileChecker.analyseClangTidy(*iFileSettings);
|
fileChecker.analyseClangTidy(*iFileSettings);
|
||||||
|
@ -291,7 +291,7 @@ unsigned int ProcessExecutor::check()
|
||||||
|
|
||||||
close(pipes[1]);
|
close(pipes[1]);
|
||||||
rpipes.push_back(pipes[0]);
|
rpipes.push_back(pipes[0]);
|
||||||
if (iFileSettings != mSettings.project.fileSettings.end()) {
|
if (iFileSettings != mSettings.fileSettings.end()) {
|
||||||
childFile[pid] = iFileSettings->filename + ' ' + iFileSettings->cfg;
|
childFile[pid] = iFileSettings->filename + ' ' + iFileSettings->cfg;
|
||||||
pipeFile[pipes[0]] = iFileSettings->filename + ' ' + iFileSettings->cfg;
|
pipeFile[pipes[0]] = iFileSettings->filename + ' ' + iFileSettings->cfg;
|
||||||
++iFileSettings;
|
++iFileSettings;
|
||||||
|
@ -334,7 +334,7 @@ unsigned int ProcessExecutor::check()
|
||||||
fileCount++;
|
fileCount++;
|
||||||
processedsize += size;
|
processedsize += size;
|
||||||
if (!mSettings.quiet)
|
if (!mSettings.quiet)
|
||||||
Executor::reportStatus(fileCount, mFiles.size() + mSettings.project.fileSettings.size(), processedsize, totalfilesize);
|
Executor::reportStatus(fileCount, mFiles.size() + mSettings.fileSettings.size(), processedsize, totalfilesize);
|
||||||
|
|
||||||
close(*rp);
|
close(*rp);
|
||||||
rp = rpipes.erase(rp);
|
rp = rpipes.erase(rp);
|
||||||
|
@ -370,7 +370,7 @@ unsigned int ProcessExecutor::check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (iFile == mFiles.end() && iFileSettings == mSettings.project.fileSettings.end() && rpipes.empty() && childFile.empty()) {
|
if (iFile == mFiles.end() && iFileSettings == mSettings.fileSettings.end() && rpipes.empty() && childFile.empty()) {
|
||||||
// All done
|
// All done
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ unsigned int SingleExecutor::check()
|
||||||
unsigned int c = 0;
|
unsigned int c = 0;
|
||||||
// TODO: processes either mSettings.project.fileSettings or mFiles - process/thread implementations process both
|
// TODO: processes either mSettings.project.fileSettings or mFiles - process/thread implementations process both
|
||||||
// TODO: thread/process implementations process fileSettings first
|
// TODO: thread/process implementations process fileSettings first
|
||||||
if (mSettings.project.fileSettings.empty()) {
|
if (mSettings.fileSettings.empty()) {
|
||||||
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) {
|
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) {
|
||||||
if (!mSettings.library.markupFile(i->first)
|
if (!mSettings.library.markupFile(i->first)
|
||||||
|| !mSettings.library.processMarkupAfterCode(i->first)) {
|
|| !mSettings.library.processMarkupAfterCode(i->first)) {
|
||||||
|
@ -66,13 +66,13 @@ unsigned int SingleExecutor::check()
|
||||||
} else {
|
} else {
|
||||||
// filesettings
|
// filesettings
|
||||||
// check all files of the project
|
// check all files of the project
|
||||||
for (const ImportProject::FileSettings &fs : mSettings.project.fileSettings) {
|
for (const ImportProject::FileSettings &fs : mSettings.fileSettings) {
|
||||||
if (!mSettings.library.markupFile(fs.filename)
|
if (!mSettings.library.markupFile(fs.filename)
|
||||||
|| !mSettings.library.processMarkupAfterCode(fs.filename)) {
|
|| !mSettings.library.processMarkupAfterCode(fs.filename)) {
|
||||||
result += mCppcheck.check(fs);
|
result += mCppcheck.check(fs);
|
||||||
++c;
|
++c;
|
||||||
if (!mSettings.quiet)
|
if (!mSettings.quiet)
|
||||||
reportStatus(c, mSettings.project.fileSettings.size(), c, mSettings.project.fileSettings.size());
|
reportStatus(c, mSettings.fileSettings.size(), c, mSettings.fileSettings.size());
|
||||||
if (mSettings.clangTidy)
|
if (mSettings.clangTidy)
|
||||||
mCppcheck.analyseClangTidy(fs);
|
mCppcheck.analyseClangTidy(fs);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ unsigned int SingleExecutor::check()
|
||||||
// second loop to parse all markup files which may not work until all
|
// second loop to parse all markup files which may not work until all
|
||||||
// c/cpp files have been parsed and checked
|
// c/cpp files have been parsed and checked
|
||||||
// TODO: get rid of duplicated code
|
// TODO: get rid of duplicated code
|
||||||
if (mSettings.project.fileSettings.empty()) {
|
if (mSettings.fileSettings.empty()) {
|
||||||
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) {
|
for (std::map<std::string, std::size_t>::const_iterator i = mFiles.cbegin(); i != mFiles.cend(); ++i) {
|
||||||
if (mSettings.library.markupFile(i->first)
|
if (mSettings.library.markupFile(i->first)
|
||||||
&& mSettings.library.processMarkupAfterCode(i->first)) {
|
&& mSettings.library.processMarkupAfterCode(i->first)) {
|
||||||
|
@ -96,13 +96,13 @@ unsigned int SingleExecutor::check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (const ImportProject::FileSettings &fs : mSettings.project.fileSettings) {
|
for (const ImportProject::FileSettings &fs : mSettings.fileSettings) {
|
||||||
if (mSettings.library.markupFile(fs.filename)
|
if (mSettings.library.markupFile(fs.filename)
|
||||||
&& mSettings.library.processMarkupAfterCode(fs.filename)) {
|
&& mSettings.library.processMarkupAfterCode(fs.filename)) {
|
||||||
result += mCppcheck.check(fs);
|
result += mCppcheck.check(fs);
|
||||||
++c;
|
++c;
|
||||||
if (!mSettings.quiet)
|
if (!mSettings.quiet)
|
||||||
reportStatus(c, mSettings.project.fileSettings.size(), c, mSettings.project.fileSettings.size());
|
reportStatus(c, mSettings.fileSettings.size(), c, mSettings.fileSettings.size());
|
||||||
if (mSettings.clangTidy)
|
if (mSettings.clangTidy)
|
||||||
mCppcheck.analyseClangTidy(fs);
|
mCppcheck.analyseClangTidy(fs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ unsigned int ThreadExecutor::check()
|
||||||
std::vector<std::future<unsigned int>> threadFutures;
|
std::vector<std::future<unsigned int>> threadFutures;
|
||||||
threadFutures.reserve(mSettings.jobs);
|
threadFutures.reserve(mSettings.jobs);
|
||||||
|
|
||||||
ThreadData data(*this, mErrorLogger, mSettings, mFiles, mSettings.project.fileSettings, mExecuteCommand);
|
ThreadData data(*this, mErrorLogger, mSettings, mFiles, mSettings.fileSettings, mExecuteCommand);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mSettings.jobs; ++i) {
|
for (unsigned int i = 0; i < mSettings.jobs; ++i) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -600,7 +600,7 @@ void MainWindow::doAnalyzeFiles(const QStringList &files, const bool checkLibrar
|
||||||
std::transform(fileNames.cbegin(), fileNames.cend(), std::back_inserter(sourcefiles), [](const QString& s) {
|
std::transform(fileNames.cbegin(), fileNames.cend(), std::back_inserter(sourcefiles), [](const QString& s) {
|
||||||
return s.toStdString();
|
return s.toStdString();
|
||||||
});
|
});
|
||||||
AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, checkSettings.userDefines, checkSettings.project.fileSettings);
|
AnalyzerInformation::writeFilesTxt(checkSettings.buildDir, sourcefiles, checkSettings.userDefines, checkSettings.fileSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
mThread->setCheckFiles(true);
|
mThread->setCheckFiles(true);
|
||||||
|
|
|
@ -1797,7 +1797,7 @@ void CppCheck::removeCtuInfoFiles(const std::map<std::string, std::size_t> &file
|
||||||
const std::string &ctuInfoFileName = getCtuInfoFileName(dumpFileName);
|
const std::string &ctuInfoFileName = getCtuInfoFileName(dumpFileName);
|
||||||
std::remove(ctuInfoFileName.c_str());
|
std::remove(ctuInfoFileName.c_str());
|
||||||
}
|
}
|
||||||
for (const auto& fs: mSettings.project.fileSettings) {
|
for (const auto& fs: mSettings.fileSettings) {
|
||||||
const std::string &dumpFileName = getDumpFileName(mSettings, fs.filename);
|
const std::string &dumpFileName = getDumpFileName(mSettings, fs.filename);
|
||||||
const std::string &ctuInfoFileName = getCtuInfoFileName(dumpFileName);
|
const std::string &ctuInfoFileName = getCtuInfoFileName(dumpFileName);
|
||||||
std::remove(ctuInfoFileName.c_str());
|
std::remove(ctuInfoFileName.c_str());
|
||||||
|
|
|
@ -205,6 +205,8 @@ public:
|
||||||
/** @brief List of --file-filter for analyzing special files */
|
/** @brief List of --file-filter for analyzing special files */
|
||||||
std::vector<std::string> fileFilters;
|
std::vector<std::string> fileFilters;
|
||||||
|
|
||||||
|
std::list<ImportProject::FileSettings> fileSettings;
|
||||||
|
|
||||||
/** @brief Force checking the files with "too many" configurations (--force). */
|
/** @brief Force checking the files with "too many" configurations (--force). */
|
||||||
bool force{};
|
bool force{};
|
||||||
|
|
||||||
|
@ -267,8 +269,6 @@ public:
|
||||||
/** @brief Using -E for debugging purposes */
|
/** @brief Using -E for debugging purposes */
|
||||||
bool preprocessOnly{};
|
bool preprocessOnly{};
|
||||||
|
|
||||||
ImportProject project;
|
|
||||||
|
|
||||||
/** @brief Is --quiet given? */
|
/** @brief Is --quiet given? */
|
||||||
bool quiet{};
|
bool quiet{};
|
||||||
|
|
||||||
|
|
|
@ -2015,7 +2015,6 @@ private:
|
||||||
"</project>");
|
"</project>");
|
||||||
const char * const argv[] = {"cppcheck", "--project=project.cppcheck"};
|
const char * const argv[] = {"cppcheck", "--project=project.cppcheck"};
|
||||||
ASSERT(parser->parseFromArgs(2, argv));
|
ASSERT(parser->parseFromArgs(2, argv));
|
||||||
ASSERT_EQUALS(static_cast<int>(ImportProject::Type::CPPCHECK_GUI), static_cast<int>(settings->project.projectType));
|
|
||||||
ASSERT_EQUALS(1, parser->getPathNames().size());
|
ASSERT_EQUALS(1, parser->getPathNames().size());
|
||||||
auto it = parser->getPathNames().cbegin();
|
auto it = parser->getPathNames().cbegin();
|
||||||
ASSERT_EQUALS("dir", *it);
|
ASSERT_EQUALS("dir", *it);
|
||||||
|
|
|
@ -82,7 +82,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = std::move(f_s);
|
fs.filename = std::move(f_s);
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = f;
|
fs.filename = f;
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = std::move(f_s);
|
fs.filename = std::move(f_s);
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = f;
|
fs.filename = f;
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = std::move(f_s);
|
fs.filename = std::move(f_s);
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
if (useFS) {
|
if (useFS) {
|
||||||
ImportProject::FileSettings fs;
|
ImportProject::FileSettings fs;
|
||||||
fs.filename = f;
|
fs.filename = f;
|
||||||
s.project.fileSettings.emplace_back(std::move(fs));
|
s.fileSettings.emplace_back(std::move(fs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue