[cfe-dev] How to change calling convention.

Anderson, Todd A todd.a.anderson at intel.com
Wed Jul 27 09:09:35 PDT 2011

I tried creating a copy of the type using the copy constructor of FunctionType but that just gave me a bunch of compile errors about the Type constructor being private.  Then I wanted to change the calling convention of that copied type and call setType.  I'm currently trying to construct a new FunctionType using get methods on the previous type to fill in the parts that remain constant.  The problem at the moment is that isVariadic() seems to be private but I presume that function types cannot be Variadic so I'll just pass false there and then try setType.

What I'm trying to do is add pragmas that control the default calling convention.  If there is a way to do this all within the Lexer rather than changing it afterwards I'm all ears.


-----Original Message-----
From: Eli Friedman [mailto:eli.friedman at gmail.com] 
Sent: Tuesday, July 26, 2011 4:50 PM
To: Anderson, Todd A
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] How to change calling convention.

On Tue, Jul 26, 2011 at 4:36 PM, Anderson, Todd A <todd.a.anderson at intel.com> wrote:
> From within HandleTopLevelDecl, I'm trying to modify a function's 
> calling convention if it is not explicitly given.  getType() returns a 
> const though.  Any suggestions how to modify the underlying type?

Types are immutable, but FunctionDecl's do have a setType method.

> Also, what would be the best way to call a method on the Lexer from 
> BackendConsumer::HandleTopLevelDecl?

What are you trying to do?


More information about the cfe-dev mailing list