Skip to content

Commit

Permalink
Minimize string temporal creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui committed Feb 2, 2024
1 parent a040507 commit 1feaeb4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/BuildConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,18 @@ BuildConfig::emitCompdb(const StringRef baseDir, std::ostream& os) const {

String
runMM(const String& sourceFile, const bool isTest = false) {
String command =
"cd " + getOutDir() + " && " + CXX + CXXFLAGS + DEFINES + INCLUDES;
String command = "cd ";
command += getOutDir();
command += " && ";
command += CXX;
command += CXXFLAGS;
command += DEFINES;
command += INCLUDES;
if (isTest) {
command += " -DPOAC_TEST";
}
command += " -MM " + sourceFile;
command += " -MM ";
command += sourceFile;
return getCmdOutput(command);
}

Expand Down Expand Up @@ -411,7 +417,8 @@ containsTestCode(const String& sourceFile) {
command += CXXFLAGS;
command += DEFINES;
command += INCLUDES;
command += " " + sourceFile;
command += ' ';
command += sourceFile;

const String src = getCmdOutput(command);

Expand Down

0 comments on commit 1feaeb4

Please sign in to comment.