search for: getvarnum

Displaying 3 results from an estimated 3 matches for "getvarnum".

2010 Apr 18
4
[LLVMdev] create two Twine object
I need to generate variables like status1, status2, status3, ...... request1, request2, request3, ...... this is my code, other unrelated detail are eliminated. static int varNum; static const char *getVarNum() { ++varNum; std::stringstream ss; ss << varNum; std::string *varname = new std::string(ss.str()); return varname->c_str(); } const char *VarNum = getVarNum(); Twine *x1 = new Twine(StringRef("status"), VarNum); // 1 Twine *x2 = new Twine(StringRef("request")...
2010 Apr 18
0
[LLVMdev] create two Twine object
...ap sounds wrong. I think all you need here is static int varNum; ++varNum; Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") + Twine(varNum), entry_inst); Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") + Twine(varNum), entry_inst); btw, your getVarNum() leaks. Eugene On Sun, Apr 18, 2010 at 5:55 AM, Yuanfang Chen <tabloid.adroit at gmail.com> wrote: > I need to generate variables like > status1, status2, status3, ...... > request1, request2, request3, ...... > this is my code, other unrelated detail are eliminated. > stati...
2010 Apr 18
1
[LLVMdev] create two Twine object
...> static int varNum; > > ++varNum; > Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") + > Twine(varNum), entry_inst); > Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") + > Twine(varNum), entry_inst); > > > btw, your getVarNum() leaks. > > Eugene > > On Sun, Apr 18, 2010 at 5:55 AM, Yuanfang Chen <tabloid.adroit at gmail.com> wrote: >> I need to generate variables like >> status1, status2, status3, ...... >> request1, request2, request3, ...... >> this is my code, other unrelated...