QualType

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 11:58:51 PDT 2019


Usually the cfe-dev mailing list is better for questions like this.

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())”.

If you haven’t looked at the documentation yet, you might want to read https://clang.llvm.org/docs/IntroductionToTheClangAST.html and https://clang.llvm.org/docs/InternalsManual.html .

-Eli

From: cfe-commits <cfe-commits-bounces at lists.llvm.org> On Behalf Of Monalisa Rout via cfe-commits
Sent: Thursday, August 15, 2019 7:03 AM
To: cfe-commits at lists.llvm.org
Subject: [EXT] QualType

Hello,
I want to create QualType instances for const int, int* const,  and const int* const.
How can I do that??

Regards,
Mona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190815/010aad70/attachment.html>


More information about the cfe-commits mailing list