Commit a95a42e6 authored by rmrf's avatar rmrf
Browse files

TODO: Utility needs to reworked

parent fe23440a
......@@ -2,39 +2,28 @@
using namespace scpar;
void
Utility::tabit (raw_ostream & os, int tabn
)
{
for (int i = 0; i < tabn; i++)
{
void Utility::tabit (raw_ostream &os, int tabn) {
for (int i = 0; i < tabn; i++) {
os << " ";
}
}
string Utility::strip (string s, string sub)
{
string Utility::strip (string s, string sub) {
// sub has "struct "
size_t
pos = s.find (sub);
size_t pos = s.find (sub);
if (pos == string::npos)
{
if (pos == string::npos) {
return s;
}
return s.erase (pos, sub.length ());
return s.erase (pos, sub.length());
}
template < typename vec > vec Utility::removeDuplicate (vec vecInput)
{
for (unsigned int i = 0; i < vecInput.size (); i++)
{
for (unsigned int j = 0; j < vecInput.size (); j++)
{
if (i != j && vecInput.at (i) == vecInput.at (j))
{
vecInput.erase (vecInput.begin () + j);
template < typename vec > vec Utility::removeDuplicate(vec vecInput) {
for (unsigned int i = 0; i < vecInput.size (); i++) {
for (unsigned int j = 0; j < vecInput.size (); j++) {
if (i != j && vecInput.at(i) == vecInput.at (j)) {
vecInput.erase (vecInput.begin() + j);
}
}
}
......@@ -42,12 +31,9 @@ template < typename vec > vec Utility::removeDuplicate (vec vecInput)
}
template < typename vec, typename element >
bool Utility::isElementPresent (vec vecInput, element elemInput)
{
for (unsigned int i = 0; i < vecInput.size (); i++)
{
if (elemInput == vecInput.at (i))
{
bool Utility::isElementPresent (vec vecInput, element elemInput) {
for (unsigned int i = 0; i < vecInput.size (); i++) {
if (elemInput == vecInput.at (i)) {
return true;
}
}
......@@ -55,11 +41,9 @@ template < typename vec, typename element >
}
template < typename expressionArg >
string getArgumentName (expressionArg * exp)
{
if (exp == NULL)
{
return string ("NULL");
string getArgumentName (expressionArg * exp) {
if (exp == NULL) {
return string("NULL");
clang::LangOptions LangOpts;
LangOpts.CPlusPlus = true;
......@@ -75,8 +59,6 @@ template < typename expressionArg >
}
}
Utility::Utility ()
{
Utility::Utility() {
}
......@@ -19,15 +19,13 @@
#include "clang/Basic/SourceManager.h"
#include "clang/AST/PrettyPrinter.h"
#include <string>
namespace scpar {
using namespace clang;
using namespace std;
class Utility {
public:
Utility (){
}
Utility();
/*
void tabit (llvm::raw_ostream &, int tabn);
string strip (string, string);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment