diff options
author | Francois Pichet <pichet2000@gmail.com> | 2011-03-19 23:05:18 +0000 |
---|---|---|
committer | Francois Pichet <pichet2000@gmail.com> | 2011-03-19 23:05:18 +0000 |
commit | 13b4e68642b9cc1701456ee624a3d44e355ce27a (patch) | |
tree | f9e50293525a757c8f8d2c1ee0c7bf30fbb627f9 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | ccacd0df19d4c547555dbc11ae87c5ec6251cae4 (diff) | |
download | bcm5719-llvm-13b4e68642b9cc1701456ee624a3d44e355ce27a.tar.gz bcm5719-llvm-13b4e68642b9cc1701456ee624a3d44e355ce27a.zip |
Downgrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. MSVC doesn't do any validation on exception specifications.
This remove 1 error when parsing MSVC stl lib with clang.
llvm-svn: 127961
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 490934c4b04..1512a257897 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -100,7 +100,11 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { bool IsOperatorNew = OO == OO_New || OO == OO_Array_New; bool MissingExceptionSpecification = false; bool MissingEmptyExceptionSpecification = false; - if (!CheckEquivalentExceptionSpec(PDiag(diag::err_mismatched_exception_spec), + unsigned DiagID = diag::err_mismatched_exception_spec; + if (getLangOptions().Microsoft) + DiagID = diag::war_mismatched_exception_spec; + + if (!CheckEquivalentExceptionSpec(PDiag(DiagID), PDiag(diag::note_previous_declaration), Old->getType()->getAs<FunctionProtoType>(), Old->getLocation(), @@ -247,7 +251,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { return false; } - Diag(New->getLocation(), diag::err_mismatched_exception_spec); + Diag(New->getLocation(), DiagID); Diag(Old->getLocation(), diag::note_previous_declaration); return true; } @@ -259,8 +263,11 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { bool Sema::CheckEquivalentExceptionSpec( const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc) { + unsigned DiagID = diag::err_mismatched_exception_spec; + if (getLangOptions().Microsoft) + DiagID = diag::war_mismatched_exception_spec; return CheckEquivalentExceptionSpec( - PDiag(diag::err_mismatched_exception_spec), + PDiag(DiagID), PDiag(diag::note_previous_declaration), Old, OldLoc, New, NewLoc); } @@ -339,14 +346,6 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, return true; } - if (getLangOptions().Microsoft) { - // Treat throw(whatever) as throw(...) to be compatible with MS headers. - if (OldEST == EST_Dynamic) - OldEST = EST_MSAny; - if (NewEST == EST_Dynamic) - NewEST = EST_MSAny; - } - // The MS extension throw(...) is compatible with itself. if (OldEST == EST_MSAny && NewEST == EST_MSAny) return false; |