How can I get const attribute of cpp functions ? [message #170603] |
Thu, 01 June 2006 03:50  |
Eclipse User |
|
|
|
Hi,
I am developing a tool built on CDT parser.
org.eclipse.cdt.core.parser.ast.IASTMethod contains isConst() method.
However new parser's interface org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction
or ICPPMethod does not contain such method.
Is there any way to get the const attribute of cpp functions ?
Thank you in advance.
--
Hitoshi Sato
|
|
|
|
|
Re: How can I get const attribute of cpp functions ? [message #171071 is a reply to message #171056] |
Thu, 08 June 2006 11:47  |
Eclipse User |
|
|
|
Hitoshi,
Unfortunately it seems you have found a missing piece from the binding
interface. There is no way to check for pure-virtual directly from the
binding. (You might want to raise a bug for this).
The pure-virtual is available on the ICPPASTFunctionDeclarator for the
method declaration in the class. If you got the binding from the
IASTName on the method declaration then the declarator is easy to get,
however if you got the binding from the definition or from a reference
then you will need to find the declaration (either using internal
methods or using the IASTTranslationUnit#getDeclarations).
-Andrew
Hitoshi Sato wrote:
> Thanks a lot Andrew,
> This is a break-through for me.
> I have gotten a const attribute.
>
> However, I still could not get a pure virtual attribute of a class method.
>
> Old interface org,eclipse.cdt.core.parser.ast.IASTMethod contains
> isPureVirtual() method.
> New interfaces including ICPPFunctionType do not contain such a method.
>
> Is there any way to get a pure-virutal attribute of a class method ?
>
> --
> Hitoshi Sato
>
> "Andrew Niefer" <aniefer@ca.ibm.com> wrote in message
> news:e64cr0$d7u$2@utils.eclipse.org...
>
>> Hitoshi,
>> Call IFunction#getType(). For C++ you should get back an
>> ICPPFunctionType object which has a isConst() and isVolatile() methods.
>>
>> -Andrew
>>
>> Hitoshi Sato wrote:
>>
>>> Hi,
>>>
>>> I am developing a tool built on CDT parser.
>>>
>>> org.eclipse.cdt.core.parser.ast.IASTMethod contains isConst() method.
>>> However new parser's interface
>>> org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction or ICPPMethod does not
>>> contain such method.
>>> Is there any way to get the const attribute of cpp functions ?
>>>
>>> Thank you in advance.
>>>
>>> --
>>> Hitoshi Sato
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05485 seconds