[cfe-dev] One more weird location saved in AST

Sergejs Belajevs sergejs.belajevs at gmail.com
Wed Aug 8 05:48:56 PDT 2012


Hi,

I'm working on source-to-source transformation tool using clang and
observe a weird behaviour on such code:

struct Str
{
  Str(const char*);
};

Str foo()
{
  return "";
}

For the return statement, location of getRetValue() expression points
to the beginning of return and not to the beginning of string literal
"". This means that if I'll use rewriter to replace the string to
something else, I will replace also the return statement, and that is
not cool. Is this a bug or am I missing something?


Thanks,
Sergejs



More information about the cfe-dev mailing list