Skip to content

Commit

Permalink
removed redundant Path::fromNativeSeparators() calls (#6509)
Browse files Browse the repository at this point in the history
`Path::simplifyPath()` includes the operation
  • Loading branch information
firewave authored Jun 11, 2024
1 parent 44174cc commit 70b1f66
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a

// Write results in file
else if (std::strncmp(argv[i], "--output-file=", 14) == 0)
mSettings.outputFile = Path::simplifyPath(Path::fromNativeSeparators(argv[i] + 14));
mSettings.outputFile = Path::simplifyPath(argv[i] + 14);

// Experimental: limit execution time for extended valueflow analysis. basic valueflow analysis
// is always executed.
Expand Down Expand Up @@ -933,7 +933,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a

// Write results in results.plist
else if (std::strncmp(argv[i], "--plist-output=", 15) == 0) {
mSettings.plistOutput = Path::simplifyPath(Path::fromNativeSeparators(argv[i] + 15));
mSettings.plistOutput = Path::simplifyPath(argv[i] + 15);
if (mSettings.plistOutput.empty())
mSettings.plistOutput = ".";

Expand Down
6 changes: 3 additions & 3 deletions lib/analyzerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ void AnalyzerInformation::writeFilesTxt(const std::string &buildDir, const std::
std::ofstream fout(filesTxt);
for (const std::string &f : sourcefiles) {
const std::string afile = getFilename(f);
fout << afile << ".a" << (++fileCount[afile]) << "::" << Path::simplifyPath(Path::fromNativeSeparators(f)) << '\n';
fout << afile << ".a" << (++fileCount[afile]) << "::" << Path::simplifyPath(f) << '\n';
if (!userDefines.empty())
fout << afile << ".a" << (++fileCount[afile]) << ":" << userDefines << ":" << Path::simplifyPath(Path::fromNativeSeparators(f)) << '\n';
fout << afile << ".a" << (++fileCount[afile]) << ":" << userDefines << ":" << Path::simplifyPath(f) << '\n';
}

for (const FileSettings &fs : fileSettings) {
const std::string afile = getFilename(fs.filename());
fout << afile << ".a" << (++fileCount[afile]) << ":" << fs.cfg << ":" << Path::simplifyPath(Path::fromNativeSeparators(fs.filename())) << std::endl;
fout << afile << ".a" << (++fileCount[afile]) << ":" << fs.cfg << ":" << Path::simplifyPath(fs.filename()) << std::endl;
}
}

Expand Down
3 changes: 1 addition & 2 deletions lib/errorlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,7 @@ std::string ErrorMessage::FileLocation::getOrigFile(bool convert) const

void ErrorMessage::FileLocation::setfile(std::string file)
{
mFileName = Path::fromNativeSeparators(std::move(file));
mFileName = Path::simplifyPath(std::move(mFileName));
mFileName = Path::simplifyPath(std::move(file));
}

std::string ErrorMessage::FileLocation::stringify() const
Expand Down
2 changes: 1 addition & 1 deletion lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static bool simplifyPathWithVariables(std::string &s, std::map<std::string, std:
}
if (s.find("$(") != std::string::npos)
return false;
s = Path::simplifyPath(Path::fromNativeSeparators(std::move(s)));
s = Path::simplifyPath(std::move(s));
return true;
}

Expand Down

0 comments on commit 70b1f66

Please sign in to comment.