summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-05-31 14:26:19 +0000
committerErich Keane <erich.keane@intel.com>2019-05-31 14:26:19 +0000
commit54182eb7b0dbc601787a6c5270626b28796beb48 (patch)
treea621729cc3606af03e7a2e48bc53f73c4d0c03d6 /clang/lib/Sema/SemaExceptionSpec.cpp
parent60d88e0e9050e232faa80ddee2c7f0b3cae649f8 (diff)
downloadbcm5719-llvm-54182eb7b0dbc601787a6c5270626b28796beb48.tar.gz
bcm5719-llvm-54182eb7b0dbc601787a6c5270626b28796beb48.zip
Fix for PR42089, regression from r362119
The implementation of the NoThrow ExceptionSpecificationType missed a switch statement for forming the diagnostic when an out-of-line member redeclaration misses the exception specification. This patch adds the correct case statement. llvm-svn: 362225
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--clang/lib/Sema/SemaExceptionSpec.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp
index 59b919bb86c..e8f559af4da 100644
--- a/clang/lib/Sema/SemaExceptionSpec.cpp
+++ b/clang/lib/Sema/SemaExceptionSpec.cpp
@@ -381,6 +381,11 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
// when declaring a replaceable global allocation function.
DiagID = diag::ext_missing_exception_specification;
ReturnValueOnError = false;
+ } else if (ESI.Type == EST_NoThrow) {
+ // Allow missing attribute 'nothrow' in redeclarations, since this is a very
+ // common omission.
+ DiagID = diag::ext_missing_exception_specification;
+ ReturnValueOnError = false;
} else {
DiagID = diag::err_missing_exception_specification;
ReturnValueOnError = true;
@@ -421,7 +426,9 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
OldProto->getNoexceptExpr()->printPretty(OS, nullptr, getPrintingPolicy());
OS << ")";
break;
-
+ case EST_NoThrow:
+ OS <<"__attribute__((nothrow))";
+ break;
default:
llvm_unreachable("This spec type is compatible with none.");
}
OpenPOWER on IntegriCloud