Displaying 1 result from an estimated 1 matches for "decl_source_loc".
2009 Nov 13
1
[LLVMdev] dodgy use of c_str()
>From llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp:
void DebugInfo::EmitGlobalVariable(GlobalVariable *GV, tree decl) {
// Gather location information.
expanded_location Loc = expand_location(DECL_SOURCE_LOCATION(decl));
DIType TyD = getOrCreateType(TREE_TYPE(decl));
const char *DispName = GV->getNameStr().c_str();
Isn't this use of c_str() dodgy, because the temporary string returned
by Gv->getNameStr() will be destroyed at the end of the expression, so
it's no longer valid to use t...