summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprMember.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-12-13 14:06:24 -0800
committerRichard Smith <richard@metafoo.co.uk>2019-12-15 22:02:30 -0800
commit0ec1e99001291b894de4cd8d7ecc2a283d9a3bfc (patch)
tree0056d23c6bbb37726033b240fc58d92230e8b407 /clang/lib/Sema/SemaExprMember.cpp
parentf036f1cc85deddff852705e6b44d31d1d0d47773 (diff)
downloadbcm5719-llvm-0ec1e99001291b894de4cd8d7ecc2a283d9a3bfc.tar.gz
bcm5719-llvm-0ec1e99001291b894de4cd8d7ecc2a283d9a3bfc.zip
Resolve exception specifications after marking the corresponding
function as referenced, not before. No functionality change intended. This is groundwork for computing the exception specification of a defaulted comparison, for which we'd like to use the implicit body where possible.
Diffstat (limited to 'clang/lib/Sema/SemaExprMember.cpp')
-rw-r--r--clang/lib/Sema/SemaExprMember.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp
index 87114a0fac6..ebfc1ec4b97 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -919,6 +919,18 @@ MemberExpr *Sema::BuildMemberExpr(
VK, OK, getNonOdrUseReasonInCurrentContext(Member));
E->setHadMultipleCandidates(HadMultipleCandidates);
MarkMemberReferenced(E);
+
+ // C++ [except.spec]p17:
+ // An exception-specification is considered to be needed when:
+ // - in an expression the function is the unique lookup result or the
+ // selected member of a set of overloaded functions
+ if (auto *FPT = Ty->getAs<FunctionProtoType>()) {
+ if (isUnresolvedExceptionSpec(FPT->getExceptionSpecType())) {
+ if (auto *NewFPT = ResolveExceptionSpec(MemberNameInfo.getLoc(), FPT))
+ E->setType(Context.getQualifiedType(NewFPT, Ty.getQualifiers()));
+ }
+ }
+
return E;
}
OpenPOWER on IntegriCloud