<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black;background:white">Hello, </span><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><br>
<span style="background:white">   I've written a lib tool which consumes via </span><br>
<span style="background:white">clang::tooling::CompilationDatabase::loadFromDirectory a codebase and </span><br>
<span style="background:white">performs code transformations through the idiom of assigning to some </span><br>
<span style="background:white">ast_matchers some child classes of MatchCallback which generate </span><br>
<span style="background:white">AtomicChanges which, through convertChangeToFileReplaces, become file </span><br>
<span style="background:white">replacements. </span><br>
<br>
<span style="background:white">   I've noticed that, for largish codebases, after a few hundred code </span><br>
<span style="background:white">transformations, the SourceLocation for matched nodes as reported by </span><br>
<span style="background:white">(node->sourceRange.begin()).printToString(*sourceManager) are radically </span><br>
<span style="background:white">different from the spellingLoc actually used by AtomicChange. In particular, </span><br>
<span style="background:white">the SourceLocation will be the correct location within the codebase, while </span><br>
<span style="background:white">the SpellingLoc will be within some included library header. </span><br>
<br>
<span style="background:white">    I've noticed a recent mailing list thread titled "Understanding Source </span><br>
<span style="background:white">Locatiosn" describing a similar problem fixed by using a different part of </span><br>
<span style="background:white">the API to load and construct the AST. Am I using the wrong part of the API? </span><br>
<span style="background:white">Is this phenomenon otherwise familiar to anyone? </span><br>
<span style="background:white">thanks in advance, </span><br>
<span style="background:white">Jon </span></span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>