fixed removeDvmSpfDirectives

This commit is contained in:
ALEXks
2025-03-25 13:14:14 +03:00
parent 7eef52eb90
commit 381e3c5355

View File

@@ -442,9 +442,9 @@ static void replaceComment(string &dir, const char *firstChar)
} }
} }
void removeDvmSpfDirectives(SgFile* file, bool removeDvm, bool removeSpf, bool toComment) void removeDvmSpfDirectives(SgFile* file, bool removeDvm, bool removeSpf, bool toCommentDvm)
{ {
if (!removeDvm && !removeSpf && !toComment) if (!removeDvm && !removeSpf && !toCommentDvm)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__); printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
vector<SgStatement*> toDel; vector<SgStatement*> toDel;
@@ -470,7 +470,7 @@ void removeDvmSpfDirectives(SgFile* file, bool removeDvm, bool removeSpf, bool t
break; break;
const int var = st->variant(); const int var = st->variant();
if (isDVM_stat(st) && removeDvm || isSPF_stat(st) && removeSpf) if (isDVM_stat(st) && (removeDvm || toCommentDvm) || isSPF_stat(st) && removeSpf)
if (st->fileName() == currFile) if (st->fileName() == currFile)
toDel.push_back(st); toDel.push_back(st);
@@ -480,7 +480,7 @@ void removeDvmSpfDirectives(SgFile* file, bool removeDvm, bool removeSpf, bool t
} }
} }
if (toComment && removeDvm) if (toCommentDvm)
{ {
for (auto &elem : toDel) for (auto &elem : toDel)
{ {
@@ -500,7 +500,7 @@ void removeDvmSpfDirectives(SgFile* file, bool removeDvm, bool removeSpf, bool t
elem->deleteStmt(); elem->deleteStmt();
} }
} }
else else //removeSpf or removeDvm
{ {
for (auto &elem : toDel) for (auto &elem : toDel)
{ {