diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-30 00:19:18 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-30 00:19:18 +0000 |
commit | b085d898bdfe35097eba45f4072b0f6865f561dc (patch) | |
tree | 4839bc7d9f15f2be8e10ad3d610c897914b9a19e /lib/Serialization/ASTReaderStmt.cpp | |
parent | d0469525581a851b68f5b4f960ee4190dcc7c932 (diff) |
Add info to ObjCPropertyRefExpr to indicate whether the dot syntax property
reference is going to message the setter, the getter, or both.
Having this info on the ObjCPropertyRefExpr node makes it easier for AST
clients (like libclang) to reason about the meaning of the property reference.
[AST/Sema]
-Use 2 bits (with a PointerIntPair) in ObjCPropertyRefExpr to record the above info
-Have ObjCPropertyOpBuilder set the info appropriately.
[libclang]
-When there is an implicit property reference (property syntax using methods)
have clang_getCursorReferenced return a cursor for the method. If the property
reference is going to result in messaging both the getter and the setter choose
to return a cursor for the setter because it is less obvious from source inspection
that the setter is getting called.
The general idea has the seal of approval by John.
rdar://11151621
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReaderStmt.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderStmt.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp index d8289f227f..1c9817b955 100644 --- a/lib/Serialization/ASTReaderStmt.cpp +++ b/lib/Serialization/ASTReaderStmt.cpp @@ -887,13 +887,15 @@ void ASTStmtReader::VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { void ASTStmtReader::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { VisitExpr(E); + unsigned MethodRefFlags = Record[Idx++]; bool Implicit = Record[Idx++] != 0; if (Implicit) { ObjCMethodDecl *Getter = ReadDeclAs<ObjCMethodDecl>(Record, Idx); ObjCMethodDecl *Setter = ReadDeclAs<ObjCMethodDecl>(Record, Idx); - E->setImplicitProperty(Getter, Setter); + E->setImplicitProperty(Getter, Setter, MethodRefFlags); } else { - E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(Record, Idx)); + E->setExplicitProperty(ReadDeclAs<ObjCPropertyDecl>(Record, Idx), + MethodRefFlags); } E->setLocation(ReadSourceLocation(Record, Idx)); E->setReceiverLocation(ReadSourceLocation(Record, Idx)); |