diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-03 03:58:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-05-03 03:58:32 +0000 |
commit | eaf11ad70904679593d3c7c100bcbcc395c91a89 (patch) | |
tree | 257b3b16ed8dd6c92f949e57987c29e3741a169b /clang/lib/Sema/SemaOverload.cpp | |
parent | 58fce7e54b50af99023b34a24992fc881ace77b6 (diff) | |
download | bcm5719-llvm-eaf11ad70904679593d3c7c100bcbcc395c91a89.tar.gz bcm5719-llvm-eaf11ad70904679593d3c7c100bcbcc395c91a89.zip |
Track the result of evaluating a computed noexcept specification on the
FunctionProtoType.
We previously re-evaluated the expression each time we wanted to know whether
the type is noexcept or not. We now evaluate the expression exactly once.
This is not quite "no functional change": it fixes a crasher bug during AST
deserialization where we would try to evaluate the noexcept specification in a
situation where we have not deserialized sufficient portions of the AST to
permit such evaluation.
llvm-svn: 331428
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 4b5898883b3..f534589c507 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1481,7 +1481,7 @@ bool Sema::IsFunctionConversion(QualType FromType, QualType ToType, // Drop 'noexcept' if not present in target type. if (const auto *FromFPT = dyn_cast<FunctionProtoType>(FromFn)) { const auto *ToFPT = cast<FunctionProtoType>(ToFn); - if (FromFPT->isNothrow(Context) && !ToFPT->isNothrow(Context)) { + if (FromFPT->isNothrow() && !ToFPT->isNothrow()) { FromFn = cast<FunctionType>( Context.getFunctionTypeWithExceptionSpec(QualType(FromFPT, 0), EST_None) @@ -2809,9 +2809,9 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, // Handle exception specification differences on canonical type (in C++17 // onwards). if (cast<FunctionProtoType>(FromFunction->getCanonicalTypeUnqualified()) - ->isNothrow(Context) != + ->isNothrow() != cast<FunctionProtoType>(ToFunction->getCanonicalTypeUnqualified()) - ->isNothrow(Context)) { + ->isNothrow()) { PDiag << ft_noexcept; return; } |