[clang] 8b74074 - [clang][sema] Fix collectConjunctionTerms()
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 21:48:30 PDT 2022
Author: Timm Bäder
Date: 2022-08-05T06:45:32+02:00
New Revision: 8b74074731eeb3ff673bd7da4cd963efe78f8db6
URL: https://github.com/llvm/llvm-project/commit/8b74074731eeb3ff673bd7da4cd963efe78f8db6
DIFF: https://github.com/llvm/llvm-project/commit/8b74074731eeb3ff673bd7da4cd963efe78f8db6.diff
LOG: [clang][sema] Fix collectConjunctionTerms()
Consider:
A == 5 && A != 5
IfA is 5, the old collectConjunctionTerms() would call itself again for
the LHS (which it ignores), then the RHS (which it also ignores) and
then just return without ever adding anything to the Terms array.
Differential Revision: https://reviews.llvm.org/D131070
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaTemplate.cpp
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b9729a6a047f..c9f65b271413 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -60,6 +60,8 @@ Bug Fixes
- No longer assert/miscompile when trying to make a vectorized ``_BitInt`` type
using the ``ext_vector_type`` attribute (the ``vector_size`` attribute was
already properly diagnosing this case).
+- Fix clang not properly diagnosing the failing subexpression when chained
+ binary operators are used in a ``static_assert`` expression.
Improvements to Clang's diagnostics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index ec1d5421ff51..a9ed3ef6400c 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3585,9 +3585,8 @@ static void collectConjunctionTerms(Expr *Clause,
if (BinOp->getOpcode() == BO_LAnd) {
collectConjunctionTerms(BinOp->getLHS(), Terms);
collectConjunctionTerms(BinOp->getRHS(), Terms);
+ return;
}
-
- return;
}
Terms.push_back(Clause);
More information about the cfe-commits
mailing list