summaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-11-20 17:36:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-20 17:36:30 +0000
commit846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (patch)
tree73c1a7a230c8bb19317a3893d937c4d8a219e91c /clang/lib/Sema/SemaChecking.cpp
parentc0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff)
Vendor import of llvm-project main llvmorg-14-init-10223-g401b76fdf2b3.vendor/llvm-project/llvmorg-14-init-10223-g401b76fdf2b3
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6ffd2096cbc5..a0f6702a5f82 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5532,8 +5532,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
// For an arithmetic operation, the implied arithmetic must be well-formed.
if (Form == Arithmetic) {
- // gcc does not enforce these rules for GNU atomics, but we do so for
- // sanity.
+ // GCC does not enforce these rules for GNU atomics, but we do, because if
+ // we didn't it would be very confusing. FIXME: For whom? How so?
auto IsAllowedValueType = [&](QualType ValType) {
if (ValType->isIntegerType())
return true;
@@ -5574,7 +5574,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
if (!IsC11 && !AtomTy.isTriviallyCopyableType(Context) &&
!AtomTy->isScalarType()) {
// For GNU atomics, require a trivially-copyable type. This is not part of
- // the GNU atomics specification, but we enforce it for sanity.
+ // the GNU atomics specification, but we enforce it, because if we didn't it
+ // would be very confusing. FIXME: For whom? How so?
Diag(ExprRange.getBegin(), diag::err_atomic_op_needs_trivial_copy)
<< Ptr->getType() << Ptr->getSourceRange();
return ExprError();