diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2019-01-11 04:57:34 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2019-01-11 04:57:34 +0000 |
commit | d458ceda24fde3bc0f2f910b80e3bd9f990af2fa (patch) | |
tree | 76a3709db53d61060dd18ebd5c56fe196d432b34 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | eb139def3d9b06b9c477148a74d5cc7dedecc3f5 (diff) | |
download | bcm5719-llvm-d458ceda24fde3bc0f2f910b80e3bd9f990af2fa.tar.gz bcm5719-llvm-d458ceda24fde3bc0f2f910b80e3bd9f990af2fa.zip |
[Sema] If CheckPlaceholderExpr rewrites the initializer of an auto
variable during auto type deduction, use the rewritten initializer when
performing initialization of the variable.
This silences spurious -Warc-repeated-use-of-weak warnings that are
issued when the initializer uses a weak ObjC pointer.
Differential Revision: https://reviews.llvm.org/D55662
llvm-svn: 350917
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 56af640aa45..22172ba3fb4 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1865,12 +1865,11 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal, if (Braced && !getLangOpts().CPlusPlus17) Diag(Initializer->getBeginLoc(), diag::ext_auto_new_list_init) << AllocType << TypeRange; - Expr *Deduce = Inits[0]; QualType DeducedType; - if (DeduceAutoType(AllocTypeInfo, Deduce, DeducedType) == DAR_Failed) + if (DeduceAutoType(AllocTypeInfo, Inits[0], DeducedType) == DAR_Failed) return ExprError(Diag(StartLoc, diag::err_auto_new_deduction_failure) - << AllocType << Deduce->getType() - << TypeRange << Deduce->getSourceRange()); + << AllocType << Inits[0]->getType() + << TypeRange << Inits[0]->getSourceRange()); if (DeducedType.isNull()) return ExprError(); AllocType = DeducedType; |