summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-03-02 02:04:40 +0000
committerJohn McCall <rjmccall@apple.com>2011-03-02 02:04:40 +0000
commit8feeb4966210bb7563cbbd07b9e322a386c0cb10 (patch)
treef2dc72170eb52f4d0673fc99c6a3f48a54f0471e
parentc52264e71931352cc1e87130713b4a4bc6872a03 (diff)
downloadbcm5719-llvm-8feeb4966210bb7563cbbd07b9e322a386c0cb10.tar.gz
bcm5719-llvm-8feeb4966210bb7563cbbd07b9e322a386c0cb10.zip
Semantic checking for exception specifications should be triggered by
whether C++ exceptions are enabled, not exceptions in general. PR9358. llvm-svn: 126820
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp6
-rw-r--r--clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp2
-rw-r--r--clang/test/CXX/except/except.spec/p14.cpp2
-rw-r--r--clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp2
-rw-r--r--clang/test/SemaCXX/MicrosoftExtensions.cpp2
-rw-r--r--clang/test/SemaCXX/exception-spec-no-exceptions.cpp7
-rw-r--r--clang/test/SemaCXX/exception-spec.cpp2
7 files changed, 12 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 5d7993b1afb..123e185cab3 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -160,7 +160,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
// If exceptions are disabled, suppress the warning about missing
// exception specifications for new and delete operators.
- if (!getLangOptions().Exceptions) {
+ if (!getLangOptions().CXXExceptions) {
switch (New->getDeclName().getCXXOverloadedOperator()) {
case OO_New:
case OO_Array_New:
@@ -249,7 +249,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID,
bool *MissingExceptionSpecification,
bool *MissingEmptyExceptionSpecification) {
// Just completely ignore this under -fno-exceptions.
- if (!getLangOptions().Exceptions)
+ if (!getLangOptions().CXXExceptions)
return false;
if (MissingExceptionSpecification)
@@ -331,7 +331,7 @@ bool Sema::CheckExceptionSpecSubset(
const FunctionProtoType *Subset, SourceLocation SubLoc) {
// Just auto-succeed under -fno-exceptions.
- if (!getLangOptions().Exceptions)
+ if (!getLangOptions().CXXExceptions)
return false;
// FIXME: As usual, we could be more specific in our error messages, but
diff --git a/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp b/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
index 37a4f976bad..47b51585556 100644
--- a/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
+++ b/clang/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fexceptions -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
int *use_new(int N) {
if (N == 1)
return new int;
diff --git a/clang/test/CXX/except/except.spec/p14.cpp b/clang/test/CXX/except/except.spec/p14.cpp
index 9450b1cf80d..f5e83eaac61 100644
--- a/clang/test/CXX/except/except.spec/p14.cpp
+++ b/clang/test/CXX/except/except.spec/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify %s
struct A { };
struct B { };
struct C { };
diff --git a/clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp b/clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
index e2fa1229372..71839727e0d 100644
--- a/clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
+++ b/clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
template<typename... Types> struct tuple;
template<int I> struct int_c;
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp
index 30ad4d0482f..6a12d0dc963 100644
--- a/clang/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions
+// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions -fcxx-exceptions
// ::type_info is predeclared with forward class declartion
diff --git a/clang/test/SemaCXX/exception-spec-no-exceptions.cpp b/clang/test/SemaCXX/exception-spec-no-exceptions.cpp
index 1fe45b0cffc..2e180706d3b 100644
--- a/clang/test/SemaCXX/exception-spec-no-exceptions.cpp
+++ b/clang/test/SemaCXX/exception-spec-no-exceptions.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s
-// Note: this is intentionally -fno-exceptions, not just accidentally
-// so because that's the current -cc1 default.
+// Note that we're specifically excluding -fcxx-exceptions in the command line above.
+
+// That this should work even with -fobjc-exceptions is PR9358
// PR7243: redeclarations
namespace test0 {
diff --git a/clang/test/SemaCXX/exception-spec.cpp b/clang/test/SemaCXX/exception-spec.cpp
index b4bc78aa9a6..80fd2c3d883 100644
--- a/clang/test/SemaCXX/exception-spec.cpp
+++ b/clang/test/SemaCXX/exception-spec.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions %s
// Straight from the standard:
// Plain function with spec
OpenPOWER on IntegriCloud