Skip to content

Commit

Permalink
llvm-slicer-crit: fix matching multiple criteria given with -c
Browse files Browse the repository at this point in the history
See #324.
  • Loading branch information
mchalupa committed Dec 13, 2022
1 parent 010addc commit e03e5de
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions tools/llvm-slicer-crit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,28 +1168,24 @@ getSlicingCriteriaValues(llvm::Module &M, const std::string &slicingCriteria,
bool criteria_are_next_instr) {
std::string criteria = slicingCriteria;
if (legacySlicingCriteria != "") {
if (slicingCriteria != "")
criteria += ";";
auto legacyCriteriaParts = splitList(legacySlicingCriteria, ',');
for (auto &legacyCriterion : legacyCriteriaParts) {
if (criteria != "")
criteria += ";";

auto parts = splitList(legacySlicingCriteria, ':');
if (parts.size() == 2) {
if (legacySecondaryCriteria != "") {
criteria += ";" + parts[0] + "#" + parts[1] + "|" +
legacySecondaryCriteria + "()";
} else {
auto parts = splitList(legacyCriterion, ':');
if (parts.size() == 2) {
criteria += parts[0] + "#" + parts[1];
} else if (parts.size() == 1) {
criteria += legacyCriterion + "()";
} else {
llvm::errs()
<< "Unsupported criteria: " << legacyCriterion << "\n";
return {};
}
} else if (parts.size() == 1) {
if (legacySecondaryCriteria != "") {
criteria += ";" + legacySlicingCriteria + "()|" +
legacySecondaryCriteria + "()";
} else {
criteria += legacySlicingCriteria + "()";
criteria += "|" + legacySecondaryCriteria + "()";
}
} else {
llvm::errs() << "Unsupported criteria: " << legacySlicingCriteria
<< "\n";
return {};
}
}

Expand Down

0 comments on commit e03e5de

Please sign in to comment.