]> granicus.if.org Git - clang/commitdiff
Fix a bug handling typedefs of functions, patch by Nuno Lopes!
authorChris Lattner <sabre@nondot.org>
Thu, 6 Dec 2007 17:20:20 +0000 (17:20 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 6 Dec 2007 17:20:20 +0000 (17:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44661 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Decl.cpp
test/Sema/ast-print.c

index 16233b1d8254ba506328377b6c1f4f198b045711..cebd29525d52b25902dd7d73d8c6bae17c5daf4c 100644 (file)
@@ -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) {
index 97ee84f4a6751d3b2029432081e1e600ae026fc4..34b0411cfe08e8de79ddb6c8df847063991a2255 100644 (file)
@@ -3,4 +3,6 @@
 typedef void func_typedef();
 func_typedef xxx;
 
+typedef void func_t(int x);
+func_t a;