diff options
author | John McCall <rjmccall@apple.com> | 2010-12-14 07:30:51 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-14 07:30:51 +0000 |
commit | 5546da68bb616a27e06a3f8a4cfc0a275916a14e (patch) | |
tree | 7c40bef1ecfdc6a39c54e5137f52639c5f6e1f74 /clang/lib/Sema/SemaExceptionSpec.cpp | |
parent | 9fd838d31b44108b99327ebc927ed8bed70634f9 (diff) | |
download | bcm5719-llvm-5546da68bb616a27e06a3f8a4cfc0a275916a14e.tar.gz bcm5719-llvm-5546da68bb616a27e06a3f8a4cfc0a275916a14e.zip |
Pull out r121752 in case it's causing the selfhost breakage.
llvm-svn: 121759
Diffstat (limited to 'clang/lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index d08e84dacd2..885e52dd76a 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -115,9 +115,6 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { if (!MissingExceptionSpecification && !MissingEmptyExceptionSpecification) return true; - const FunctionProtoType *NewProto - = New->getType()->getAs<FunctionProtoType>(); - // The new function declaration is only missing an empty exception // specification "throw()". If the throw() specification came from a // function in a system header that has C linkage, just add an empty @@ -126,38 +123,42 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // to many libc functions as an optimization. Unfortunately, that // optimization isn't permitted by the C++ standard, so we're forced // to work around it here. - if (MissingEmptyExceptionSpecification && NewProto && + if (MissingEmptyExceptionSpecification && + isa<FunctionProtoType>(New->getType()) && (Old->getLocation().isInvalid() || Context.getSourceManager().isInSystemHeader(Old->getLocation())) && Old->isExternC()) { - FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); - EPI.HasExceptionSpec = true; - EPI.HasAnyExceptionSpec = false; - EPI.NumExceptions = 0; + const FunctionProtoType *NewProto + = cast<FunctionProtoType>(New->getType()); QualType NewType = Context.getFunctionType(NewProto->getResultType(), NewProto->arg_type_begin(), NewProto->getNumArgs(), - EPI); + NewProto->isVariadic(), + NewProto->getTypeQuals(), + true, false, 0, 0, + NewProto->getExtInfo()); New->setType(NewType); return false; } - if (MissingExceptionSpecification && NewProto) { + if (MissingExceptionSpecification && isa<FunctionProtoType>(New->getType())) { + const FunctionProtoType *NewProto + = cast<FunctionProtoType>(New->getType()); const FunctionProtoType *OldProto = Old->getType()->getAs<FunctionProtoType>(); - FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); - EPI.HasExceptionSpec = OldProto->hasExceptionSpec(); - EPI.HasAnyExceptionSpec = OldProto->hasAnyExceptionSpec(); - EPI.NumExceptions = OldProto->getNumExceptions(); - EPI.Exceptions = OldProto->exception_begin(); - // Update the type of the function with the appropriate exception // specification. QualType NewType = Context.getFunctionType(NewProto->getResultType(), NewProto->arg_type_begin(), NewProto->getNumArgs(), - EPI); + NewProto->isVariadic(), + NewProto->getTypeQuals(), + OldProto->hasExceptionSpec(), + OldProto->hasAnyExceptionSpec(), + OldProto->getNumExceptions(), + OldProto->exception_begin(), + NewProto->getExtInfo()); New->setType(NewType); // If exceptions are disabled, suppress the warning about missing |