[cfe-dev] Qualifiers of a function

Douglas Gregor dgregor at apple.com
Fri Nov 5 12:56:19 PDT 2010


On Nov 5, 2010, at 12:53 PM, Nimrod Partush wrote:

> These methods might work fine, but what i need is the location of the qualifier. Any idea how do i translate fD->getType() to a SourceLocation?

Clang doesn't keep track of the locations of qualifiers. This could be added to QualifiedTypeLoc, but isn't there now.

	- Doug

> Your help is greatly appreciated :)
> 
> On Fri, Nov 5, 2010 at 8:17 PM, Jan Bierbaum <s3306700 at inf.tu-dresden.de> wrote:
> 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.
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101105/be59993f/attachment.html>


More information about the cfe-dev mailing list