Skip to content

Commit

Permalink
Replace uses of replaceInString method with IEGenLib's better version #…
Browse files Browse the repository at this point in the history
  • Loading branch information
riftEmber committed Sep 8, 2021
1 parent 51ca219 commit 54197d3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
9 changes: 0 additions & 9 deletions include/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ class Utils {
//! Get the source code of a statement as a string
static std::string stmtToString(clang::Stmt *stmt);

//! Get a copy of the given string with all instances of the substring to
//! find replaced as specified
//! \param[in] input String to perform substitutions on (will not be
//! modified)
//! \param[in] toFind String to find (and replace) within input
//! \param[in] replaceWith String to use as replacement
static std::string replaceInString(std::string input, const std::string &toFind,
const std::string &replaceWith);

//! Retrieve "all" array accesses, from left to right, contained in an
//! expression.
//! Recurses into BinaryOperators.
Expand Down
3 changes: 2 additions & 1 deletion src/StmtContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Driver.hpp"
#include "ExecSchedule.hpp"
#include "Utils.hpp"
#include "iegenlib.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/OperationKinds.h"
Expand Down Expand Up @@ -261,7 +262,7 @@ std::string StmtContext::exprToStringWithSafeArrays(Expr *expr) {
DataAccessHandler::buildDataAccess(access, true, accessComponents);
std::string accessStr = DataAccessHandler::makeStringForArrayAccess(
&accessComponents.back().second, accessComponents);
initialStr = Utils::replaceInString(
initialStr = iegenlib::replaceInString(
initialStr, Utils::stmtToString(access), accessStr);
}
return initialStr;
Expand Down
11 changes: 0 additions & 11 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ std::string Utils::stmtToString(clang::Stmt *stmt) {
.str();
}

std::string Utils::replaceInString(std::string input, const std::string &toFind,
const std::string &replaceWith) {
size_t pos = input.find(toFind);
if (pos == std::string::npos) {
return input;
} else {
return replaceInString(input.replace(pos, toFind.length(), replaceWith),
toFind, replaceWith);
}
}

void Utils::getExprArrayAccesses(
Expr *expr, std::vector<ArraySubscriptExpr *> &currentList) {
Expr *usableExpr = expr->IgnoreParenImpCasts();
Expand Down

0 comments on commit 54197d3

Please sign in to comment.