<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Dear Shu,<br>
<br>
Please send questions like this to the cfe-dev mailing list. The
owners of the mailing list should only be contacted for
administrative questions (e.g., when you need help subscribing or
unsubscribing to/from the list).<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<br>
On 9/10/13 7:47 AM, Shu,Kaikai wrote:<br>
</div>
<blockquote
cite="mid:7E9B12E15629EA4887220C22524FE7A41054BB1E@TC-MAIL-MBS01.internal.baidu.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:\5B8B\4F53;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@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:"\@\5B8B\4F53";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Lucida Sans Unicode";
panose-1:2 11 6 2 3 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
h1
{mso-style-priority:9;
mso-style-link:"\6807\9898 1 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:24.0pt;
font-family:\5B8B\4F53;}
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;}
pre
{mso-style-priority:99;
mso-style-link:"HTML \9884\8BBE\683C\5F0F Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:\5B8B\4F53;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.1Char
{mso-style-name:"\6807\9898 1 Char";
mso-style-priority:9;
mso-style-link:"\6807\9898 1";
font-family:\5B8B\4F53;
font-weight:bold;}
span.HTMLChar
{mso-style-name:"HTML \9884\8BBE\683C\5F0F Char";
mso-style-priority:99;
mso-style-link:"HTML \9884\8BBE\683C\5F0F";
font-family:\5B8B\4F53;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"
style="mso-margin-bottom-alt:auto;text-align:left;background:white"
align="left">
<b><span style="font-size:24.0pt;font-family:"Lucida Sans
Unicode","sans-serif";color:black"
lang="EN-US">AST Matcher Reference<o:p></o:p></span></b></p>
<p class="MsoNormal"
style="mso-margin-bottom-alt:auto;text-align:left;background:white"
align="left">
<span lang="EN-US"><a moz-do-not-send="true"
href="http://clang.llvm.org/docs/LibASTMatchersReference.html">http://clang.llvm.org/docs/LibASTMatchersReference.html</a></span><b><span
style="font-size:24.0pt;font-family:"Lucida Sans
Unicode","sans-serif";color:black"
lang="EN-US"><o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">in this page, the
example fellows not work and when compile, error message is
: error: 'equalsBoundNode' was not declared in this scope<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I can’t get a way to
solve this, can someone give me some help? please<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<table class="MsoNormalTable" style="background:white"
border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:3.95pt 3.95pt 3.95pt 3.95pt"
valign="top">
<p class="MsoNormal"
style="text-align:left;line-height:12.95pt"
align="left"><span style="font-family:"Lucida
Sans
Unicode","sans-serif";color:#222222"
lang="EN-US">Matcher<<a moz-do-not-send="true"
href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>><o:p></o:p></span></p>
</td>
<td style="padding:3.95pt 3.95pt 3.95pt 3.95pt"
valign="top">
<p class="MsoNormal" style="line-height:12.95pt"><a
moz-do-not-send="true" name="equalsBoundNode1Anchor"><span
style="font-family:"Lucida Sans
Unicode","sans-serif";color:#222222"
lang="EN-US">equalsBoundNode</span></a><span
style="font-family:"Lucida Sans
Unicode","sans-serif";color:#222222"
lang="EN-US"><o:p></o:p></span></p>
</td>
<td style="padding:3.95pt 3.95pt 3.95pt 3.95pt"
valign="top">
<p class="MsoNormal" style="line-height:12.95pt"><span
style="font-family:"Lucida Sans
Unicode","sans-serif";color:#222222"
lang="EN-US">std::string ID<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">Matches if a node equals a previously bound
node.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">Matches a node if it equals the node previously
bound to ID.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">Given<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"> class X { int a; int b; };<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">recordDecl(<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"> has(fieldDecl(hasName("a"),
hasType(type().bind("t")))),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"> has(fieldDecl(hasName("b"),
hasType(type(equalsBoundNode("t"))))))<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"> matches the class X, as a and b have the same
type.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">Note that when multiple matches are involved
via forEach* matchers,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">equalsBoundNodes acts as a filter.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">For example:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">compoundStmt(<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US"> forEachDescendant(varDecl().bind("d")),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">
forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">will trigger a match for each combination of
variable declaration<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:left;background:white"
align="left"><span
style="font-size:12.0pt;font-family:宋体;color:#222222"
lang="EN-US">and reference to that variable declaration
within a compound statement.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</blockquote>
<br>
</body>
</html>