diff options
author | Hans Wennborg <hans@hanshq.net> | 2019-02-18 09:31:05 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2019-02-18 09:31:05 +0000 |
commit | c484df6c4d82f395d38f814ada9f7b7447727a51 (patch) | |
tree | f1d98a3d8dbbdcf167e7eaab89fa07346b0ca5f0 /include/clang | |
parent | 8f39121d6c4bfe80f757a3032e895359da3536ae (diff) |
Merging r354035:
------------------------------------------------------------------------
r354035 | brunoricci | 2019-02-14 16:43:17 +0100 (Thu, 14 Feb 2019) | 23 lines
[Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"
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.
Differential Revision: https://reviews.llvm.org/D57948
Reviewed By: aaron.ballman
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_80@354247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/Expr.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 3de7342882..bf4f3babbd 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -2577,6 +2577,11 @@ public: NumArgs = NewNumArgs; } + /// Bluntly set a new number of arguments without doing any checks whatsoever. + /// Only used during construction of a CallExpr in a few places in Sema. + /// FIXME: Find a way to remove it. + void setNumArgsUnsafe(unsigned NewNumArgs) { NumArgs = NewNumArgs; } + typedef ExprIterator arg_iterator; typedef ConstExprIterator const_arg_iterator; typedef llvm::iterator_range<arg_iterator> arg_range; |