[cfe-dev] Qualifiers of a function

Jan Bierbaum s3306700 at inf.tu-dresden.de
Fri Nov 5 11:17:53 PDT 2010


Nimrod Partush meinte am 05.11.2010 16:19:

>>> When asking for the qualifiers of:
>>>
>>> const int f();
>>>
>>> I get null. Am i doing something wrong?
>>
>> Well, you don't say how you do it... ;-)
>>
>> Probably you're making the same mistake I did some time ago. What you
>> want is not the qualifiers of the function (it has none) but those of
>> its return type.
>
> Well, i tried various ways: Getting the FuncDecl qualifiers, Getting the
> ResultType qualifiers, Getting the TypeLoc and through that...
> 
> Why don't you tell me how you did it? :)

I'm not sure if we actually do the same thing. I need to know if the
function returns something that is qualified and use

FunctionDecl* fD;
...
fD->getType().isConstQualified()
fD->getType().isVolatileQualified()

But you wrote something about getting NULL which can't happen here. That
is why I was wondering how you try to do it. You could also have a look
at the old thread on this list [1]. Maybe you can use some of the advice
I got.


[1] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-September/010923.html


Regards, Jan.



More information about the cfe-dev mailing list