summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DumpXML.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-11 01:09:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-11 01:09:30 +0000
commit33823727c80ad78773c09a588d8399fc0f4f0b9a (patch)
tree50d799ac17909bce14702c0b8a689ebabd05f9e8 /clang/lib/AST/DumpXML.cpp
parent3d4e64b082717170ef918cb88b337087fb461b35 (diff)
downloadbcm5719-llvm-33823727c80ad78773c09a588d8399fc0f4f0b9a.tar.gz
bcm5719-llvm-33823727c80ad78773c09a588d8399fc0f4f0b9a.zip
Implement Objective-C Related Result Type semantics.
Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
Diffstat (limited to 'clang/lib/AST/DumpXML.cpp')
-rw-r--r--clang/lib/AST/DumpXML.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/AST/DumpXML.cpp b/clang/lib/AST/DumpXML.cpp
index 12806aad1d7..dfe0119f597 100644
--- a/clang/lib/AST/DumpXML.cpp
+++ b/clang/lib/AST/DumpXML.cpp
@@ -848,6 +848,7 @@ struct XMLDumper : public XMLDeclVisitor<XMLDumper>,
setFlag("variadic", D->isVariadic());
setFlag("synthesized", D->isSynthesized());
setFlag("defined", D->isDefined());
+ setFlag("related_result_type", D->hasRelatedResultType());
}
void visitObjCMethodDeclChildren(ObjCMethodDecl *D) {
dispatch(D->getResultType());
OpenPOWER on IntegriCloud