[PATCH] D72494: [clangd] Fix targetDecl() on certain usage of ObjC properties.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 10 09:08:26 PST 2020
This revision was not accepted when it landed; it landed in state "Needs Revision".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c5a4514d145: [clangd] Fix targetDecl() on certain usage of ObjC properties. (authored by sammccall).
Changed prior to commit:
https://reviews.llvm.org/D72494?vs=237267&id=237356#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72494/new/
https://reviews.llvm.org/D72494
Files:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Index: clang-tools-extra/clangd/unittests/FindTargetTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -503,15 +503,15 @@
EXPECT_DECLS("ObjCPropertyRefExpr", "- (void)setX:(int)x");
Code = R"cpp(
- @interface Foo {}
- @property int x;
+ @interface I {}
+ @property(retain) I* x;
+ @property(retain) I* y;
@end
- void test(Foo *f) {
- [[f.x]] = 42;
+ void test(I *f) {
+ [[f.x]].y = 0;
}
)cpp";
- EXPECT_DECLS("ObjCPropertyRefExpr",
- "@property(atomic, assign, unsafe_unretained, readwrite) int x");
+ EXPECT_DECLS("OpaqueValueExpr", "@property(atomic, retain, readwrite) I *x");
Code = R"cpp(
@protocol Foo
Index: clang-tools-extra/clangd/FindTarget.cpp
===================================================================
--- clang-tools-extra/clangd/FindTarget.cpp
+++ clang-tools-extra/clangd/FindTarget.cpp
@@ -334,6 +334,12 @@
void VisitObjCProtocolExpr(const ObjCProtocolExpr *OPE) {
Outer.add(OPE->getProtocol(), Flags);
}
+ void VisitOpaqueValueExpr(const OpaqueValueExpr *OVE) {
+ Outer.add(OVE->getSourceExpr(), Flags);
+ }
+ void VisitPseudoObjectExpr(const PseudoObjectExpr *POE) {
+ Outer.add(POE->getSyntacticForm(), Flags);
+ }
};
Visitor(*this, Flags).Visit(S);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72494.237356.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200110/270f04d6/attachment.bin>
More information about the cfe-commits
mailing list