Hi Jakob, How is `FieldName`, which is a std::string, being passed as the third argument to SetValue on line 1848 of TGParser.cpp, which is declared as being an Init*? The nearly identical (FIXME) codepath in ParseDeclaration immediately puts the string into a StringInit, which makes sense, but how on earth is the std::string being passed in? This is really freaking me out. -- Sean Silva
Jakob Stoklund Olesen
2013-Jan-31 06:00 UTC
[LLVMdev] std::string suffices for Init* argument?
On Jan 30, 2013, at 9:37 PM, Sean Silva <silvas at purdue.edu> wrote:> How is `FieldName`, which is a std::string, being passed as the third > argument to SetValue on line 1848 of TGParser.cpp, which is declared > as being an Init*? The nearly identical (FIXME) codepath in > ParseDeclaration immediately puts the string into a StringInit, which > makes sense, but how on earth is the std::string being passed in? This > is really freaking me out.See TGParser.h: bool SetValue(Record *TheRec, SMLoc Loc, Init *ValName, const std::vector<unsigned> &BitList, Init *V); bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName, const std::vector<unsigned> &BitList, Init *V) { return SetValue(TheRec, Loc, StringInit::get(ValName), BitList, V); } ;-) /jakob