GUI: save dumpfiles in buildDir if possible
This commit is contained in:
parent
0e40a4cc39
commit
5fa7a4edc4
|
@ -107,7 +107,7 @@ void CheckThread::run()
|
||||||
|
|
||||||
void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileSettings *fileSettings, const QString &fileName)
|
void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileSettings *fileSettings, const QString &fileName)
|
||||||
{
|
{
|
||||||
bool hasdump = false;
|
QString dumpFile;
|
||||||
|
|
||||||
foreach (const QString addon, mAddons) {
|
foreach (const QString addon, mAddons) {
|
||||||
if (addon == "clang") {
|
if (addon == "clang") {
|
||||||
|
@ -139,22 +139,25 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!hasdump) {
|
if (dumpFile.isEmpty()) {
|
||||||
// TODO: Generate dump file in buildDir.
|
|
||||||
// Otherwise a mutex might be needed
|
|
||||||
const std::string buildDir = mCppcheck.settings().buildDir;
|
const std::string buildDir = mCppcheck.settings().buildDir;
|
||||||
mCppcheck.settings().buildDir.clear();
|
mCppcheck.settings().buildDir.clear();
|
||||||
mCppcheck.settings().dump = true;
|
mCppcheck.settings().dump = true;
|
||||||
|
if (!buildDir.empty()) {
|
||||||
|
mCppcheck.settings().dumpFile = AnalyzerInformation::getAnalyzerInfoFile(buildDir, fileName.toStdString(), fileSettings ? fileSettings->cfg : std::string()) + ".dump";
|
||||||
|
dumpFile = QString::fromStdString(mCppcheck.settings().dumpFile);
|
||||||
|
} else {
|
||||||
|
dumpFile = fileName + ".dump";
|
||||||
|
}
|
||||||
if (fileSettings)
|
if (fileSettings)
|
||||||
mCppcheck.check(*fileSettings);
|
mCppcheck.check(*fileSettings);
|
||||||
else
|
else
|
||||||
mCppcheck.check(fileName.toStdString());
|
mCppcheck.check(fileName.toStdString());
|
||||||
mCppcheck.settings().dump = false;
|
mCppcheck.settings().dump = false;
|
||||||
|
mCppcheck.settings().dumpFile.clear();
|
||||||
mCppcheck.settings().buildDir = buildDir;
|
mCppcheck.settings().buildDir = buildDir;
|
||||||
hasdump = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString dumpFile = fileName + ".dump";
|
|
||||||
QString cmd = "python " + a + ' ' + dumpFile;
|
QString cmd = "python " + a + ' ' + dumpFile;
|
||||||
qDebug() << cmd;
|
qDebug() << cmd;
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
|
@ -179,7 +179,7 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
|
||||||
// write dump file xml prolog
|
// write dump file xml prolog
|
||||||
std::ofstream fdump;
|
std::ofstream fdump;
|
||||||
if (_settings.dump) {
|
if (_settings.dump) {
|
||||||
const std::string dumpfile(filename + ".dump");
|
const std::string dumpfile(_settings.dumpFile.empty() ? (filename + ".dump") : _settings.dumpFile);
|
||||||
fdump.open(dumpfile.c_str());
|
fdump.open(dumpfile.c_str());
|
||||||
if (fdump.is_open()) {
|
if (fdump.is_open()) {
|
||||||
fdump << "<?xml version=\"1.0\"?>" << std::endl;
|
fdump << "<?xml version=\"1.0\"?>" << std::endl;
|
||||||
|
|
|
@ -84,6 +84,7 @@ public:
|
||||||
|
|
||||||
/** @brief Is --dump given? */
|
/** @brief Is --dump given? */
|
||||||
bool dump;
|
bool dump;
|
||||||
|
std::string dumpFile;
|
||||||
|
|
||||||
/** @brief Is --exception-handling given */
|
/** @brief Is --exception-handling given */
|
||||||
bool exceptionHandling;
|
bool exceptionHandling;
|
||||||
|
|
Loading…
Reference in New Issue