[PATCH] D57948: [Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 05:59:05 PST 2019


riccibruno created this revision.
riccibruno added a reviewer: aaron.ballman.
riccibruno added a project: clang.
Herald added a subscriber: cfe-commits.

D54902 <https://reviews.llvm.org/D54902> removed `CallExpr::setNumArgs` in preparation of tail-allocating the arguments of `CallExpr`. It did this by allocating storage for `max(number of arguments, number of parameters in the prototype)`. The temporarily nulled arguments however causes issues in `BuildResolvedCallExpr` when typo correction is done just after the creation of the call expression.

This was unfortunately missed by the tests /:

To fix this, delay setting the number of arguments to `max(number of arguments, number of parameters in the prototype)` until we are ready for it. It would be nice to have this encapsulated in `CallExpr` but this is the best I can come up with under the constraint that we cannot add anything the `CallExpr`.

Fixes PR40286. This should probably be cherry-picked into the release branch.


Repository:
  rC Clang

https://reviews.llvm.org/D57948

Files:
  include/clang/AST/Expr.h
  lib/AST/Expr.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  test/Sema/typo-correction.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57948.185954.patch
Type: text/x-patch
Size: 7792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190208/43299f59/attachment.bin>


More information about the cfe-commits mailing list