diff options
author | Logan Chien <tzuhsiang.chien@gmail.com> | 2012-10-20 06:11:33 +0000 |
---|---|---|
committer | Logan Chien <tzuhsiang.chien@gmail.com> | 2012-10-20 06:11:33 +0000 |
commit | b687f3ba4cdc3fd6e4fa9a89addc1efa61761eeb (patch) | |
tree | 868b03964a6d5776ccacc7f69cd53c17ed59a35e /lib/Sema/SemaExpr.cpp | |
parent | b59b580a57a36df9d146473098d14c64508ff319 (diff) |
Fix __builtin_va_arg assertion failure in ARM AAPCS.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index a71da15322..6a6fe897c5 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -9643,6 +9643,16 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc, if (Result.isInvalid()) return ExprError(); E = Result.take(); + } else if (VaListType->isRecordType() && getLangOpts().CPlusPlus) { + // If va_list is a record type and we are compiling in C++ mode, + // check the argument using reference binding. + InitializedEntity Entity + = InitializedEntity::InitializeParameter(Context, + Context.getLValueReferenceType(VaListType), false); + ExprResult Init = PerformCopyInitialization(Entity, SourceLocation(), E); + if (Init.isInvalid()) + return ExprError(); + E = Init.takeAs<Expr>(); } else { // Otherwise, the va_list argument must be an l-value because // it is modified by va_arg. |