[cfe-commits] r170233 - in /cfe/trunk: lib/AST/Expr.cpp test/CodeGenCXX/predefined-expr.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Dec 14 11:44:11 PST 2012


Author: akirtzidis
Date: Fri Dec 14 13:44:11 2012
New Revision: 170233

URL: http://llvm.org/viewvc/llvm-project?rev=170233&view=rev
Log:
Don't hit an assertion failure when calculating the __PRETTY_FUNCTION__
of a member function with parenthesized declarator.

Like this test case:

class Foo {
  const char *(baz)() {
    return __PRETTY_FUNCTION__;
  }
};

Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/CodeGenCXX/predefined-expr.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=170233&r1=170232&r2=170233&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri Dec 14 13:44:11 2012
@@ -510,7 +510,7 @@
     POut << ")";
 
     if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
-      const FunctionType *FT = cast<FunctionType>(MD->getType().getTypePtr());
+      const FunctionType *FT = MD->getType()->castAs<FunctionType>();
       if (FT->isConst())
         POut << " const";
       if (FT->isVolatile())

Modified: cfe/trunk/test/CodeGenCXX/predefined-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/predefined-expr.cpp?rev=170233&r1=170232&r2=170233&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/predefined-expr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/predefined-expr.cpp Fri Dec 14 13:44:11 2012
@@ -142,7 +142,7 @@
     printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);
   }
 
-  inline void inlineFunction() {
+  inline void (inlineFunction)() {
     printf("__func__ %s\n", __func__);
     printf("__FUNCTION__ %s\n", __FUNCTION__);
     printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__);





More information about the cfe-commits mailing list