[clang] [clang] Fix comma location tracking inside ParenListExpr. (PR #199411)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 22 08:39:56 PDT 2026
================
@@ -4958,33 +4958,42 @@ SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
}
ParenListExpr::ParenListExpr(SourceLocation LParenLoc, ArrayRef<Expr *> Exprs,
- SourceLocation RParenLoc)
+ SourceLocation RParenLoc,
+ ArrayRef<SourceLocation> CommaLocs)
: Expr(ParenListExprClass, QualType(), VK_PRValue, OK_Ordinary),
- LParenLoc(LParenLoc), RParenLoc(RParenLoc) {
+ LParenLoc(LParenLoc), RParenLoc(RParenLoc), NumCommas(CommaLocs.size()) {
+ assert((CommaLocs.empty() || CommaLocs.size() + 1 == Exprs.size()) &&
----------------
erichkeane wrote:
Why do we need the 1st condition in this assert? Can we have a case of no commas, but >1 expressions?
That said, this confirms to me we dont need to separately store the number of commas.
https://github.com/llvm/llvm-project/pull/199411
More information about the cfe-commits
mailing list