From: Chris Lattner Date: Thu, 6 Dec 2007 17:20:20 +0000 (+0000) Subject: Fix a bug handling typedefs of functions, patch by Nuno Lopes! X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec584d6f64f1f40a57fafc94ddf161a6735c30a9;p=clang Fix a bug handling typedefs of functions, patch by Nuno Lopes! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44661 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/Decl.cpp b/AST/Decl.cpp index 16233b1d82..cebd29525d 100644 --- a/AST/Decl.cpp +++ b/AST/Decl.cpp @@ -242,8 +242,8 @@ FunctionDecl::~FunctionDecl() { } unsigned FunctionDecl::getNumParams() const { - if (isa(getType())) return 0; - return cast(getType())->getNumArgs(); + if (isa(getCanonicalType())) return 0; + return cast(getCanonicalType())->getNumArgs(); } void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) { diff --git a/test/Sema/ast-print.c b/test/Sema/ast-print.c index 97ee84f4a6..34b0411cfe 100644 --- a/test/Sema/ast-print.c +++ b/test/Sema/ast-print.c @@ -3,4 +3,6 @@ typedef void func_typedef(); func_typedef xxx; +typedef void func_t(int x); +func_t a;