[-fms-extensions] Allow missing exception specifications in redeclarations as an extension

Microsoft's ATL headers make use of this MSVC extension, add support for
it and issue a diagnostic under -Wmicrosoft-exception-spec.

This fixes PR25265.

llvm-svn: 250854
This commit is contained in:
David Majnemer
2015-10-20 20:49:21 +00:00
parent bb17881731
commit 06ce8a4c70
3 changed files with 22 additions and 7 deletions

View File

@@ -285,10 +285,14 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
NewProto->getExtProtoInfo().withExceptionSpec(ESI)));
}
// Allow missing exception specifications in redeclarations as an extension,
// when declaring a replaceable global allocation function.
if (New->isReplaceableGlobalAllocationFunction() &&
ESI.Type != EST_ComputedNoexcept) {
if (getLangOpts().MicrosoftExt && ESI.Type != EST_ComputedNoexcept) {
// Allow missing exception specifications in redeclarations as an extension.
DiagID = diag::ext_ms_missing_exception_specification;
ReturnValueOnError = false;
} else if (New->isReplaceableGlobalAllocationFunction() &&
ESI.Type != EST_ComputedNoexcept) {
// Allow missing exception specifications in redeclarations as an extension,
// when declaring a replaceable global allocation function.
DiagID = diag::ext_missing_exception_specification;
ReturnValueOnError = false;
} else {