diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-08 01:46:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-08 01:46:34 +0000 |
commit | bab8a96f2f509218bc1a25d67bc182581d65e50e (patch) | |
tree | a994fe755cc4162606d8c860ed630e2d5b1d9aaf /clang/lib/Sema/SemaExprObjC.cpp | |
parent | af3d4af4ebec2c519823a745665729ded3f9bbce (diff) | |
download | bcm5719-llvm-bab8a96f2f509218bc1a25d67bc182581d65e50e.tar.gz bcm5719-llvm-bab8a96f2f509218bc1a25d67bc182581d65e50e.zip |
Implement the Objective-C 'instancetype' type, which is an alias of
'id' that can be used (only!) via a contextual keyword as the result
type of an Objective-C message send. 'instancetype' then gives the
method a related result type, which we have already been inferring for
a variety of methods (new, alloc, init, self, retain). Addresses
<rdar://problem/9267640>.
llvm-svn: 139275
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index aa9b4748a03..9f2696e1288 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -328,6 +328,10 @@ void Sema::EmitRelatedResultTypeNote(const Expr *E) { MsgSend->getType())) return; + if (!Context.hasSameUnqualifiedType(Method->getResultType(), + Context.getObjCInstanceType())) + return; + Diag(Method->getLocation(), diag::note_related_result_type_inferred) << Method->isInstanceMethod() << Method->getSelector() << MsgSend->getType(); |