[llvm-branch-commits] [cfe-branch] r156679 - in /cfe/branches/release_31: ./ lib/Sema/SemaDeclCXX.cpp test/CXX/class/class.mem/p2.cpp test/SemaCXX/warn-unreachable.cpp

Bill Wendling isanbard at gmail.com
Fri May 11 17:26:39 PDT 2012


Author: void
Date: Fri May 11 19:26:39 2012
New Revision: 156679

URL: http://llvm.org/viewvc/llvm-project?rev=156679&view=rev
Log:
Merging r155424:
------------------------------------------------------------------------
r155424 | rsmith | 2012-04-23 22:06:35 -0700 (Mon, 23 Apr 2012) | 3 lines

PR12629: Cope with parenthesized function types when attaching a delayed
exception specification to a function.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_31/   (props changed)
    cfe/branches/release_31/lib/Sema/SemaDeclCXX.cpp
    cfe/branches/release_31/test/CXX/class/class.mem/p2.cpp
    cfe/branches/release_31/test/SemaCXX/warn-unreachable.cpp   (props changed)

Propchange: cfe/branches/release_31/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 11 19:26:39 2012
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:155076,155278-155279,155342,155356,155534-155535,155576,155608,155670,155728,155788,155803,155823,155860,155910,155975,156047,156322
+/cfe/trunk:155076,155278-155279,155342,155356,155424,155534-155535,155576,155608,155670,155728,155788,155803,155823,155860,155910,155975,156047,156322
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_31/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_31/lib/Sema/SemaDeclCXX.cpp?rev=156679&r1=156678&r2=156679&view=diff
==============================================================================
--- cfe/branches/release_31/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/release_31/lib/Sema/SemaDeclCXX.cpp Fri May 11 19:26:39 2012
@@ -11279,11 +11279,9 @@
   if (!Method)
     return;
   
-  // Dig out the prototype. This should never fail.
+  // Dig out the prototype, looking through only parens. This should never fail.
   const FunctionProtoType *Proto
-    = dyn_cast<FunctionProtoType>(Method->getType());
-  if (!Proto)
-    return;
+    = cast<FunctionProtoType>(Method->getType().IgnoreParens());
   
   // Check the exception specification.
   llvm::SmallVector<QualType, 4> Exceptions;
@@ -11296,6 +11294,12 @@
                                        Proto->arg_type_begin(),
                                        Proto->getNumArgs(),
                                        EPI);
+
+  // Rebuild any parens around the function type.
+  for (const ParenType *PT = dyn_cast<ParenType>(Method->getType()); PT;
+       PT = dyn_cast<ParenType>(PT->getInnerType()))
+    T = Context.getParenType(T);
+
   if (TypeSourceInfo *TSInfo = Method->getTypeSourceInfo()) {
     // FIXME: When we get proper type location information for exceptions,
     // we'll also have to rebuild the TypeSourceInfo. For now, we just patch

Modified: cfe/branches/release_31/test/CXX/class/class.mem/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_31/test/CXX/class/class.mem/p2.cpp?rev=156679&r1=156678&r2=156679&view=diff
==============================================================================
--- cfe/branches/release_31/test/CXX/class/class.mem/p2.cpp (original)
+++ cfe/branches/release_31/test/CXX/class/class.mem/p2.cpp Fri May 11 19:26:39 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
 // C++11 [class.mem]p2:
 //   A class is considered a completely-defined object type (or
@@ -56,3 +56,12 @@
 
   template struct A2<int>;
 }
+
+namespace PR12629 {
+  struct S {
+    static int (f)() throw();
+    static int ((((((g))))() throw(int)));
+  };
+  static_assert(noexcept(S::f()), "");
+  static_assert(!noexcept(S::g()), "");
+}

Propchange: cfe/branches/release_31/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May 11 19:26:39 2012
@@ -1,2 +1,2 @@
 /cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,155076,155278-155279,155342,155356,155534-155535,155576,155608,155670,155728,155788,155803,155823,155860,155910,155975,156047
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,155076,155278-155279,155342,155356,155424,155534-155535,155576,155608,155670,155728,155788,155803,155823,155860,155910,155975,156047





More information about the llvm-branch-commits mailing list