[cfe-dev] FunctionDecl question
Frank Redeker via cfe-dev
cfe-dev at lists.llvm.org
Tue Jul 18 05:19:04 PDT 2017
> On 18 July 2017 at 10:33, Frank Redeker via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
> Hello list,
>
> is there is an easy way to distinguish if a function is declared as
>
> void foo (void);
> or
> void foo ();
>
> The reason I'm asking is that I use an ASTVisitor to generate stub
> functions. But the compiler that I use reports an error when the
> prototype is declared with (void) but the implementation not.
>
> Am 18.07.2017 um 11:41 schrieb Alex L:
> You can look at it's type and check if it has a function prototype (i.e.
> it has parameters or (void), see the FunctionProtoType class), e.g.
> FD->getType()->isFunctionProtoType() .
>
Hallo Alex,
thanks for the hint. But the FD->getType()->isFunctionProtoType()
returns true in both cases and FD->getType()->isFunctionNoProtoType()
returns false in both cases.
So is there any other way to distinguish the declarations?
Frank
More information about the cfe-dev
mailing list