[cfe-commits] r44661 - in /cfe/trunk: AST/Decl.cpp test/Sema/ast-print.c

Chris Lattner sabre at nondot.org
Thu Dec 6 09:20:23 PST 2007


Author: lattner
Date: Thu Dec  6 11:20:20 2007
New Revision: 44661

URL: http://llvm.org/viewvc/llvm-project?rev=44661&view=rev
Log:
Fix a bug handling typedefs of functions, patch by Nuno Lopes!

Modified:
    cfe/trunk/AST/Decl.cpp
    cfe/trunk/test/Sema/ast-print.c

Modified: cfe/trunk/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Decl.cpp?rev=44661&r1=44660&r2=44661&view=diff

==============================================================================
--- cfe/trunk/AST/Decl.cpp (original)
+++ cfe/trunk/AST/Decl.cpp Thu Dec  6 11:20:20 2007
@@ -242,8 +242,8 @@
 }
 
 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) {

Modified: cfe/trunk/test/Sema/ast-print.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ast-print.c?rev=44661&r1=44660&r2=44661&view=diff

==============================================================================
--- cfe/trunk/test/Sema/ast-print.c (original)
+++ cfe/trunk/test/Sema/ast-print.c Thu Dec  6 11:20:20 2007
@@ -3,4 +3,6 @@
 typedef void func_typedef();
 func_typedef xxx;
 
+typedef void func_t(int x);
+func_t a;
 





More information about the cfe-commits mailing list