[cfe-commits] r104942 - in /cfe/trunk: lib/Sema/SemaExceptionSpec.cpp test/SemaCXX/exception-spec-no-exceptions.cpp

John McCall rjmccall at apple.com
Fri May 28 01:37:35 PDT 2010


Author: rjmccall
Date: Fri May 28 03:37:35 2010
New Revision: 104942

URL: http://llvm.org/viewvc/llvm-project?rev=104942&view=rev
Log:
Disable exception-spec compatibility checking under -fno-exceptions.
Fixes PR7243.


Added:
    cfe/trunk/test/SemaCXX/exception-spec-no-exceptions.cpp
Modified:
    cfe/trunk/lib/Sema/SemaExceptionSpec.cpp

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=104942&r1=104941&r2=104942&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Fri May 28 03:37:35 2010
@@ -249,6 +249,10 @@
                                         SourceLocation NewLoc,
                                         bool *MissingExceptionSpecification,
                                      bool *MissingEmptyExceptionSpecification)  {
+  // Just completely ignore this under -fno-exceptions.
+  if (!getLangOptions().Exceptions)
+    return false;
+
   if (MissingExceptionSpecification)
     *MissingExceptionSpecification = false;
 
@@ -318,6 +322,11 @@
     const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
     const FunctionProtoType *Superset, SourceLocation SuperLoc,
     const FunctionProtoType *Subset, SourceLocation SubLoc) {
+
+  // Just auto-succeed under -fno-exceptions.
+  if (!getLangOptions().Exceptions)
+    return false;
+
   // FIXME: As usual, we could be more specific in our error messages, but
   // that better waits until we've got types with source locations.
 

Added: cfe/trunk/test/SemaCXX/exception-spec-no-exceptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/exception-spec-no-exceptions.cpp?rev=104942&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/exception-spec-no-exceptions.cpp (added)
+++ cfe/trunk/test/SemaCXX/exception-spec-no-exceptions.cpp Fri May 28 03:37:35 2010
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note: this is intentionally -fno-exceptions, not just accidentally
+// so because that's the current -cc1 default.
+
+// PR7243: redeclarations
+namespace test0 {
+  void foo() throw(int);
+  void foo() throw();
+}
+
+// Overrides.
+namespace test1 {
+  struct A {
+    virtual void foo() throw();
+  };
+
+  struct B : A {
+    virtual void foo() throw(int);
+  };
+}
+
+// Calls from less permissive contexts.  We don't actually do this
+// check, but if we did it should also be disabled under
+// -fno-exceptions.
+namespace test2 {
+  void foo() throw(int);
+  void bar() throw() {
+    foo();
+  }
+}
+





More information about the cfe-commits mailing list