Re: QualType

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: QualType

Kristóf Umann via cfe-dev
Hello Eli,

I am able to crate QualType for all types of pointers by using ASTContext::getPointerType(). But again I am stuggling for const int.
I am trying to use this method ASTContext::GetBuiltinType (unsigned ID, GetBuiltinTypeError &Error), but not sure if this is the method needs to be used and if so what is the ID value for "int".

Once I get QualType, I can call the addConst () to get const type qualifier.

Regards,
Mona 

On Thu, Aug 15, 2019 at 8:58 PM Eli Friedman <[hidden email]> wrote:

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 <[hidden email]> On Behalf Of Monalisa Rout via cfe-commits
Sent: Thursday, August 15, 2019 7:03 AM
To: [hidden email]
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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: QualType

Kristóf Umann via cfe-dev

Like I said in my previous email, the type “int” is ASTContext::IntTy

 

-Eli

 

From: Monalisa Rout <[hidden email]>
Sent: Friday, August 16, 2019 1:57 AM
To: Eli Friedman <[hidden email]>; [hidden email]
Subject: [EXT] Re: QualType

 

Hello Eli,

 

I am able to crate QualType for all types of pointers by using ASTContext::getPointerType(). But again I am stuggling for const int.

I am trying to use this method ASTContext::GetBuiltinType (unsigned ID, GetBuiltinTypeError &Error), but not sure if this is the method needs to be used and if so what is the ID value for "int".

 

Once I get QualType, I can call the addConst () to get const type qualifier.

 

Regards,

Mona 

 

On Thu, Aug 15, 2019 at 8:58 PM Eli Friedman <[hidden email]> wrote:

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 <[hidden email]> On Behalf Of Monalisa Rout via cfe-commits
Sent: Thursday, August 15, 2019 7:03 AM
To: [hidden email]
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


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev