Skip to content

Commit 70b1f66

Browse files
authored
removed redundant Path::fromNativeSeparators() calls (#6509)
`Path::simplifyPath()` includes the operation
1 parent 44174cc commit 70b1f66

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

Diff for: cli/cmdlineparser.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
897897

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

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

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

Diff for: lib/analyzerinfo.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ void AnalyzerInformation::writeFilesTxt(const std::string &buildDir, const std::
5353
std::ofstream fout(filesTxt);
5454
for (const std::string &f : sourcefiles) {
5555
const std::string afile = getFilename(f);
56-
fout << afile << ".a" << (++fileCount[afile]) << "::" << Path::simplifyPath(Path::fromNativeSeparators(f)) << '\n';
56+
fout << afile << ".a" << (++fileCount[afile]) << "::" << Path::simplifyPath(f) << '\n';
5757
if (!userDefines.empty())
58-
fout << afile << ".a" << (++fileCount[afile]) << ":" << userDefines << ":" << Path::simplifyPath(Path::fromNativeSeparators(f)) << '\n';
58+
fout << afile << ".a" << (++fileCount[afile]) << ":" << userDefines << ":" << Path::simplifyPath(f) << '\n';
5959
}
6060

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

Diff for: lib/errorlogger.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,7 @@ std::string ErrorMessage::FileLocation::getOrigFile(bool convert) const
731731

732732
void ErrorMessage::FileLocation::setfile(std::string file)
733733
{
734-
mFileName = Path::fromNativeSeparators(std::move(file));
735-
mFileName = Path::simplifyPath(std::move(mFileName));
734+
mFileName = Path::simplifyPath(std::move(file));
736735
}
737736

738737
std::string ErrorMessage::FileLocation::stringify() const

Diff for: lib/importproject.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static bool simplifyPathWithVariables(std::string &s, std::map<std::string, std:
138138
}
139139
if (s.find("$(") != std::string::npos)
140140
return false;
141-
s = Path::simplifyPath(Path::fromNativeSeparators(std::move(s)));
141+
s = Path::simplifyPath(std::move(s));
142142
return true;
143143
}
144144

0 commit comments

Comments
 (0)