aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-06 17:20:20 +0000
committerChris Lattner <sabre@nondot.org>2007-12-06 17:20:20 +0000
commitec584d6f64f1f40a57fafc94ddf161a6735c30a9 (patch)
tree9b228c75dd331a11fcb21a76bde4ea715a739bc4
parent39caea961530bc95d19114ab546ebcdb229263c9 (diff)
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
-rw-r--r--AST/Decl.cpp4
-rw-r--r--test/Sema/ast-print.c2
2 files changed, 4 insertions, 2 deletions
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<FunctionTypeNoProto>(getType())) return 0;
- return cast<FunctionTypeProto>(getType())->getNumArgs();
+ if (isa<FunctionTypeNoProto>(getCanonicalType())) return 0;
+ return cast<FunctionTypeProto>(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;