r184813 - Fix regression from r184810.

Eli Friedman eli.friedman at gmail.com
Mon Jun 24 18:55:41 PDT 2013


Author: efriedma
Date: Mon Jun 24 20:55:41 2013
New Revision: 184813

URL: http://llvm.org/viewvc/llvm-project?rev=184813&view=rev
Log:
Fix regression from r184810.

Specifically, CallExpr::getCalleeDecl() can return null, so make sure to
handle that correctly.

Modified:
    cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
    cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=184813&r1=184812&r2=184813&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Jun 24 20:55:41 2013
@@ -895,8 +895,10 @@ CanThrowResult Sema::canThrow(const Expr
       CT = CT_Dependent;
     else if (isa<CXXPseudoDestructorExpr>(CE->getCallee()->IgnoreParens()))
       CT = CT_Cannot;
-    else
+    else if (CE->getCalleeDecl())
       CT = canCalleeThrow(*this, E, CE->getCalleeDecl());
+    else
+      CT = CT_Can;
     if (CT == CT_Can)
       return CT;
     return mergeCanThrow(CT, canSubExprsThrow(*this, E));

Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp?rev=184813&r1=184812&r2=184813&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp Mon Jun 24 20:55:41 2013
@@ -39,6 +39,9 @@ void (*pallspec)() throw(...);
 void (*pintspec)() throw(int);
 void (*pemptyspec)() throw();
 
+typedef void (*funcptr)();
+funcptr returnsptr() throw();
+
 void callptr() {
   N(pnospec());
   N((*pnospec)());
@@ -48,6 +51,7 @@ void callptr() {
   N((*pintspec)());
   P(pemptyspec());
   P((*pemptyspec)());
+  N(returnsptr()());
 }
 
 struct S1 {





More information about the cfe-commits mailing list