From 0d6ca11db071e4d4e1cd8fe89c3d6d6b4988d8d5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Dec 2007 21:43:25 +0000 Subject: [PATCH] Fix an ast-print/ast-dump bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44550 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/ASTConsumers.cpp | 4 ++-- test/Sema/ast-print.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/Sema/ast-print.c diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index da9cf64b3c..5cd3f77562 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -60,9 +60,9 @@ void DeclPrinter::PrintFunctionDeclStart(FunctionDecl *FD) { Out << "inline "; std::string Proto = FD->getName(); - FunctionType *AFT = cast(FD->getType()); + const FunctionType *AFT = FD->getType()->getAsFunctionType(); - if (FunctionTypeProto *FT = dyn_cast(AFT)) { + if (const FunctionTypeProto *FT = dyn_cast(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 index 0000000000..97ee84f4a6 --- /dev/null +++ b/test/Sema/ast-print.c @@ -0,0 +1,6 @@ +// RUN: clang %s -ast-print + +typedef void func_typedef(); +func_typedef xxx; + + -- 2.40.0