aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaExprMember.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2022-03-30 07:12:04 -0400
committerAaron Ballman <aaron@aaronballman.com>2022-03-30 07:12:49 -0400
commitcf4a67bcbbb109347b1e2d6cedf69bae142a182f (patch)
tree2da978a3efec8c4b7df946674a10b6a88ada4d8f /clang/lib/Sema/SemaExprMember.cpp
parent4a33b9ece076d85be5f73e3511f7f64269c74888 (diff)
downloadllvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.zip
llvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.tar.gz
llvm-cf4a67bcbbb109347b1e2d6cedf69bae142a182f.tar.bz2
Don't diagnostic atomic object access as UB in an unevaluated context
We started diagnosing this situation with a more clear diagnostic message, but it was pointed out that unevaluated contexts don't really have the undefined behavior property as there is no runtime access involved. This augments the changes in https://reviews.llvm.org/D122656 to not diagnose in an unevaluated context.
Diffstat (limited to 'clang/lib/Sema/SemaExprMember.cpp')
-rw-r--r--clang/lib/Sema/SemaExprMember.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp
index 152b39d..cb95f70 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -1298,7 +1298,8 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult &R,
// lvalue. Because this is inherently unsafe as an atomic operation, the
// warning defaults to an error.
if (const auto *ATy = BaseType->getAs<AtomicType>()) {
- S.Diag(OpLoc, diag::warn_atomic_member_access);
+ S.DiagRuntimeBehavior(OpLoc, nullptr,
+ S.PDiag(diag::warn_atomic_member_access));
BaseType = ATy->getValueType().getUnqualifiedType();
BaseExpr = ImplicitCastExpr::Create(
S.Context, IsArrow ? S.Context.getPointerType(BaseType) : BaseType,