Apply 'make format'

This commit is contained in:
github action 2022-11-20 15:26:23 +00:00
parent 47253450a4
commit a60e273c29
3 changed files with 10 additions and 10 deletions

View File

@ -214,8 +214,7 @@ class CMakeEmitter final {
<< hblockp->modp()->name() << " DIRECTORY " << hblockp->modp()->name() << " DIRECTORY "
<< v3Global.opt.makeDir() + "/" + prefix << " SOURCES "; << v3Global.opt.makeDir() + "/" + prefix << " SOURCES ";
for (const auto& childr : children) { for (const auto& childr : children) {
*of << " " *of << " " << v3Global.opt.makeDir() + "/" + childr->hierWrapper(true);
<< v3Global.opt.makeDir() + "/" + childr->hierWrapper(true);
} }
*of << " "; *of << " ";
const string vFile = hblockp->vFileIfNecessary(); const string vFile = hblockp->vFileIfNecessary();
@ -233,8 +232,7 @@ class CMakeEmitter final {
<< v3Global.rootp()->topModulep()->name() << " DIRECTORY " << v3Global.rootp()->topModulep()->name() << " DIRECTORY "
<< v3Global.opt.makeDir() << " SOURCES "; << v3Global.opt.makeDir() << " SOURCES ";
for (const auto& itr : *planp) { for (const auto& itr : *planp) {
*of << " " *of << " " << v3Global.opt.makeDir() + "/" + itr.second->hierWrapper(true);
<< v3Global.opt.makeDir() + "/" + itr.second->hierWrapper(true);
} }
*of << " " << cmake_list(v3Global.opt.vFiles()); *of << " " << cmake_list(v3Global.opt.vFiles());
*of << " VERILATOR_ARGS "; *of << " VERILATOR_ARGS ";

View File

@ -116,13 +116,14 @@ string VString::quoteStringLiteralForShell(const string& str) {
return result; return result;
} }
string VString::escapeStringForPath(const string &str) { string VString::escapeStringForPath(const string& str) {
if (str.find(R"(\\)") != string::npos) return str; // if it has been escaped already, don't do it again if (str.find(R"(\\)") != string::npos)
if (str.find('/') != string::npos) return str; // can be replaced by `__MINGW32__` or `_WIN32` return str; // if it has been escaped already, don't do it again
if (str.find('/') != string::npos) return str; // can be replaced by `__MINGW32__` or `_WIN32`
string result; string result;
const char space = ' '; // escape space like this `Program Files` const char space = ' '; // escape space like this `Program Files`
const char escape = '\\'; const char escape = '\\';
for (const char c: str) { for (const char c : str) {
if (c == space || c == escape) result.push_back(escape); if (c == space || c == escape) result.push_back(escape);
result.push_back(c); result.push_back(c);
} }

View File

@ -102,7 +102,8 @@ public:
// e.g. input abc's becomes "\"abc\'s\"" // e.g. input abc's becomes "\"abc\'s\""
static string escapeStringForPath(const string& str); static string escapeStringForPath(const string& str);
// Escape path in Windows // Escape path in Windows
// e.g. input `C:\Program Files\My Program\My Program.exe` becomes `C:\\Program\ Files\\My\ Program\\My\ Program.exe` // e.g. input `C:\Program Files\My Program\My Program.exe` becomes
// `C:\\Program\ Files\\My\ Program\\My\ Program.exe`
static string quoteStringLiteralForShell(const string& str); static string quoteStringLiteralForShell(const string& str);
// Replace any unprintable with space // Replace any unprintable with space
// This includes removing tabs, so column tracking is correct // This includes removing tabs, so column tracking is correct