]> granicus.if.org Git - clang/commitdiff
Fix an ast-print/ast-dump bug.
authorChris Lattner <sabre@nondot.org>
Mon, 3 Dec 2007 21:43:25 +0000 (21:43 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Dec 2007 21:43:25 +0000 (21:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44550 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/ASTConsumers.cpp
test/Sema/ast-print.c [new file with mode: 0644]

index da9cf64b3c35895b3150e4074481e5e8c8cebdf1..5cd3f77562b8a541fe7c87584fee28e528c21bba 100644 (file)
@@ -60,9 +60,9 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) {
     Out << "inline ";
   
   std::string Proto = FD->getName();
-  FunctionType *AFT = cast<FunctionType>(FD->getType());
+  const FunctionType *AFT = FD->getType()->getAsFunctionType();
 
-  if (FunctionTypeProto *FT = dyn_cast<FunctionTypeProto>(AFT)) {
+  if (const FunctionTypeProto *FT = dyn_cast<FunctionTypeProto>(AFT)) {
     Proto += "(";
     for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
       if (i) Proto += ", ";
diff --git a/test/Sema/ast-print.c b/test/Sema/ast-print.c
new file mode 100644 (file)
index 0000000..97ee84f
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: clang %s -ast-print
+
+typedef void func_typedef();
+func_typedef xxx;
+
+