John, <div><br></div><div>That works perfectly.  Thank you so much for your help!<div><br></div><div>Sam<br><br><div class="gmail_quote">On Wed, Dec 29, 2010 at 4:20 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Dec 29, 2010, at 12:53 PM, Sam wrote:<br>
> Yes, I just don't know what to *do* with it ;-) In other words, I don't see a clear use of the SourceManager API once I have the SourceRange to extract the Expr's source-code.  I don't see any API calls that use SourceRange or beginning and ending SourceLocations for source-code extraction.<br>

<br>
</div>We should probably make some API for this.<br>
<br>
What you can do for now is something like the following:<br>
<br>
  SourceRange range = expr->getSourceRange();<br>
  if (range.getBegin().isMacroID() || range.getEnd().isMacroID()) {<br>
    // handle this case<br>
  } else if (!sourceManager.isFromSameFile(range.getBegin(), range.getEnd())) {<br>
    // handle this case<br>
  } else {<br>
    range.setEnd(preprocessor.getLocForEndOfToken(range.getEnd()));<br>
    const char *begin = sourceManager.getCharacterData(range.getBegin());<br>
    const char *end = sourceManager.getCharacterData(range.getEnd());<br>
    llvm::StringRef string(begin, end - begin);<br>
    // now you can do whatever you want<br>
  }<br>
<font color="#888888"><br>
John.</font></blockquote></div><br></div></div>