}
- ASTNode STPMgr::CreateBVConst(string*& strval, int base, int bit_width)
+ ASTNode STPMgr::CreateBVConst(string& strval, int base, int bit_width)
{
if (bit_width <= 0)
if (2 == base)
{
e = CONSTANTBV::BitVector_from_Bin(bv,
- (unsigned char*) strval->c_str());
+ (unsigned char*) strval.c_str());
}
else if (10 == base)
{
e = CONSTANTBV::BitVector_from_Dec(bv,
- (unsigned char*) strval->c_str());
+ (unsigned char*) strval.c_str());
}
else if (16 == base)
{
e = CONSTANTBV::BitVector_from_Hex(bv,
- (unsigned char*) strval->c_str());
+ (unsigned char*) strval.c_str());
}
else
{
ASTNode CreateZeroConst(unsigned int width);
ASTNode CreateBVConst(CBV bv, unsigned width);
ASTNode CreateBVConst(const char *strval, int base);
- ASTNode CreateBVConst(string*& strval, int base, int bit_width);
+ ASTNode CreateBVConst(string& strval, int base, int bit_width);
ASTNode CreateBVConst(unsigned int width, unsigned long long int bvconst);
/****************************************************************
}
Expr vc_bvConstExprFromDecStr(VC vc,
- const size_t width,
+ int width,
const char* decimalInput )
{
bmstar b = (bmstar)(((stpstar)vc)->bm);
-
- string *param = new string(decimalInput);
- // funny type to get it to compile. fix later when I
- // understand what this does.
- node n = b->CreateBVConst((string*&)param, (int)10,(int)width);
+ string str(decimalInput);
+ node n = b->CreateBVConst(str, 10, width);
BVTypeCheck(n);
nodestar output = new node(n);
- delete param;
return output;
}
Type vc_bvType(VC vc, int no_bits);
Type vc_bv32Type(VC vc);
- Expr vc_bvConstExprFromDecStr(VC vc, const size_t width, const char* decimalInput );
+ Expr vc_bvConstExprFromDecStr(VC vc, int width, const char* decimalInput );
Expr vc_bvConstExprFromStr(VC vc, const char* binary_repr);
Expr vc_bvConstExprFromInt(VC vc, int n_bits, unsigned int value);
Expr vc_bvConstExprFromLL(VC vc, int n_bits, unsigned long long value);
}
| NUMERAL_TOK BIN_BASED_NUMBER
{
- std::string* vals = new std::string($2);
+ std::string vals($2);
$$ = new ASTNode(parserInterface->CreateBVConst(vals, 2, $1));
- free($2); delete vals;
+ free($2);
}
| NUMERAL_TOK DEC_BASED_NUMBER
{
- std::string* vals = new std::string($2);
+ std::string vals($2);
$$ = new ASTNode(parserInterface->CreateBVConst(vals, 10, $1));
- free($2); delete vals;
+ free($2);
}
| NUMERAL_TOK HEX_BASED_NUMBER
{
- std::string* vals = new std::string($2);
+ std::string vals($2);
$$ = new ASTNode(parserInterface->CreateBVConst(vals, 16, $1));
- free($2); delete vals;
+ free($2);
}
| Expr '[' Expr ']'
{
return bm.CreateOneConst(width);
}
- ASTNode CreateBVConst(string*& strval, int base, int bit_width)
+ ASTNode CreateBVConst(string& strval, int base, int bit_width)
{
return bm.CreateBVConst(strval, base, bit_width);
}
an_term:
BVCONST_TOK
{
- $$ = new ASTNode(parserInterface->CreateBVConst($1, 10, 32));
+ $$ = new ASTNode(parserInterface->CreateBVConst(*$1, 10, 32));
delete $1;
}
| BVCONST_TOK LBRACKET_TOK NUMERAL_TOK RBRACKET_TOK
{
- $$ = new ASTNode(parserInterface->CreateBVConst($1,10,$3));
+ $$ = new ASTNode(parserInterface->CreateBVConst(*$1,10,$3));
delete $1;
}
| an_nonbvconst_term
}
| UNDERSCORE_TOK BVCONST_DECIMAL_TOK NUMERAL_TOK
{
- $$ = new ASTNode(parserInterface->CreateBVConst($2, 10, $3));
+ $$ = new ASTNode(parserInterface->CreateBVConst(*$2, 10, $3));
$$->SetValueWidth($3);
delete $2;
}
| BVCONST_HEXIDECIMAL_TOK
{
unsigned width = $1->length()*4;
- $$ = new ASTNode(parserInterface->CreateBVConst($1, 16, width));
+ $$ = new ASTNode(parserInterface->CreateBVConst(*$1, 16, width));
$$->SetValueWidth(width);
delete $1;
}
| BVCONST_BINARY_TOK
{
unsigned width = $1->length();
- $$ = new ASTNode(parserInterface->CreateBVConst($1, 2, width));
+ $$ = new ASTNode(parserInterface->CreateBVConst(*$1, 2, width));
$$->SetValueWidth(width);
delete $1;
}