diff options
| author | Akira Hatanaka <ahatanaka@apple.com> | 2019-07-08 20:04:39 +0000 |
|---|---|---|
| committer | Akira Hatanaka <ahatanaka@apple.com> | 2019-07-08 20:04:39 +0000 |
| commit | 8b1becf2e31d9170ee356a19c7b6ea991d3a520f (patch) | |
| tree | a9c76d8550fb47fedb89c9c523d92ecc7806d811 /clang/test/SemaObjC | |
| parent | c9fa99d066f0f615538e106880fdb9fb48f8e55b (diff) | |
| download | bcm5719-llvm-8b1becf2e31d9170ee356a19c7b6ea991d3a520f.tar.gz bcm5719-llvm-8b1becf2e31d9170ee356a19c7b6ea991d3a520f.zip | |
[Sema] Resolve placeholder types before type deduction to silence
spurious `-Warc-repeated-use-of-weak` warnings
The spurious -Warc-repeated-use-of-weak warnings are issued when an
initializer expression uses a weak ObjC pointer.
My first attempt to silence the warnings (r350917) caused clang to
reject code that is legal in C++17. The patch is based on the feedback I
received from Richard when the patch was reverted.
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190422/268945.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190422/268943.html
Differential Revision: https://reviews.llvm.org/D62645
llvm-svn: 365382
Diffstat (limited to 'clang/test/SemaObjC')
| -rw-r--r-- | clang/test/SemaObjC/arc-repeated-weak.mm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/test/SemaObjC/arc-repeated-weak.mm b/clang/test/SemaObjC/arc-repeated-weak.mm index 4eec4d2fe69..6c7a6292f99 100644 --- a/clang/test/SemaObjC/arc-repeated-weak.mm +++ b/clang/test/SemaObjC/arc-repeated-weak.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s -// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -std=c++14 -Warc-repeated-use-of-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++14 -Warc-repeated-use-of-weak -verify %s @interface Test { @public @@ -467,6 +467,18 @@ void foo() { __typeof__(NSBundle2.foo2.weakProp) t5; } +void testAuto() { + auto __weak wp = NSBundle2.foo2.weakProp; +} + +void testLambdaCaptureInit() { + [capture(NSBundle2.foo2.weakProp)] {} (); +} + +void testAutoNew() { + auto p = new auto(NSBundle2.foo2.weakProp); +} + // This used to crash in the constructor of WeakObjectProfileTy when a // DeclRefExpr was passed that didn't reference a VarDecl. |

