[cfe-dev] interface name SourceLocation?
Chris Lattner
clattner at apple.com
Fri Apr 11 10:34:35 PDT 2008
On Apr 11, 2008, at 10:29 AM, Emerson Murphy-Hill wrote:
> Thanks Steve, this worked. Although I had to use a slightly
> different endBuf, because the Lexer was complaining:
>
> const char *endBuf = SM->getBufferData(LocStart.getFileID()).second;
>
Be careful with this, this will explode violently if LocStart is a
macro instantiation. Before calling "getFileID()" generally you want
to call "isMacroID()". If you have a macro ID, you need to decide how
your refactoring will handle it. It seems pretty reasonable to just
throw up your hands and say "can't do it", but you don't want to
abort :)
An example would be something like:
#define X @interface foo
X : bar { ...
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080411/a9d35193/attachment.html>
More information about the cfe-dev
mailing list