<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello Eli,</div><div><br></div><div>I am able to crate QualType for all types of pointers by using <span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent">ASTContext::getPointerType()</span>. But again I am stuggling for <b>const int</b>.</div><div>I am trying to use this method <a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent" href="http://swtv.kaist.ac.kr/~bookman01/classclang_1_1ASTContext.html#a5930b71a916bc5b4eea3b69160ef6810">ASTContext</a><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent">::<a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent" href="http://swtv.kaist.ac.kr/~bookman01/classclang_1_1ASTContext.html#a17e4f89e87ad7a5a29c5333b478a384e">GetBuiltinType</a><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)"> (</span><a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent" href="http://swtv.kaist.ac.kr/~bookman01/classunsigned.html">unsigned</a><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)"> ID, </span><a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent" href="http://swtv.kaist.ac.kr/~bookman01/classclang_1_1ASTContext.html#aebda31ac75861bbfdb20ad6c54a2dc50">GetBuiltinTypeError</a><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)"> &</span><a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:none;word-spacing:0px;white-space:normal;background-color:transparent" href="http://swtv.kaist.ac.kr/~bookman01/namespaceclang.html#a19a831d7318de60497404ddf66dde9d4a902b0d55fddef6f8d651fe1035b7d4bd">Error</a>), but not sure if this is the method needs to be used and if so what is the ID value for "int".</span></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent"><br></span></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent">Once I get QualType, I can call the <a class="el" style="text-align:left;color:rgb(61,87,140);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:700;text-decoration:underline;word-spacing:0px;white-space:normal;background-color:transparent" href="https://clang.llvm.org/doxygen/classclang_1_1QualType.html#a43a8b5d4a9d63c319ad978252426379a">addConst</a><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)"> () to get const type qualifier.</span></span></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent"><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)"><br></span></span></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent"><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)">Regards,</span></span></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:transparent"><span style="text-align:left;color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(249,250,252)">Mona</span> </span><br></div></div></div></div></div></div></div><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Thu, Aug 15, 2019 at 8:58 PM Eli Friedman <<a href="mailto:efriedma@quicinc.com">efriedma@quicinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">





<div lang="EN-US">
<div class="gmail-m_96184272604094553WordSection1">
<p class="MsoNormal">Usually the cfe-dev mailing list is better for questions like this.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The type “int” is ASTContext::IntTy.  You can use QualType::withConst to add a “const” qualifier, and ASTContext::getPointerType to construct a pointer type.  Putting that together, you can construct a “const int*” with something like “Context->getPointerType(Context->IntTy.withConst())”.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">If you haven’t looked at the documentation yet, you might want to read
<a href="https://clang.llvm.org/docs/IntroductionToTheClangAST.html" target="_blank">https://clang.llvm.org/docs/IntroductionToTheClangAST.html</a> and
<a href="https://clang.llvm.org/docs/InternalsManual.html" target="_blank">https://clang.llvm.org/docs/InternalsManual.html</a> .<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-Eli<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>From:</b> cfe-commits <<a href="mailto:cfe-commits-bounces@lists.llvm.org" target="_blank">cfe-commits-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Monalisa Rout via cfe-commits<br>
<b>Sent:</b> Thursday, August 15, 2019 7:03 AM<br>
<b>To:</b> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<b>Subject:</b> [EXT] QualType<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<div>
<p class="MsoNormal">I want to create QualType instances for <b>const int</b>, <b>
int* const</b>,  and <b>const int* const.</b> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">How can I do that??<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Mona<u></u><u></u></p>
</div>
</div>
</div>
</div>

</blockquote></div>