forked from OSchip/llvm-project
Fixed a problem in our local Clang's method for
performing Objective-C instance variable lookup. Previously, it only completed the derived class that was the beginning of the search. Now, as it walks up the superclass chain looking for the ivar, it completes each superclass in turn. Also added a testcase covering this issue. llvm-svn: 147621
This commit is contained in:
parent
de30e523b4
commit
3c88eae154
|
|
@ -0,0 +1,19 @@
|
|||
Index: lib/AST/DeclObjC.cpp
|
||||
===================================================================
|
||||
--- lib/AST/DeclObjC.cpp (revision 146622)
|
||||
+++ lib/AST/DeclObjC.cpp (working copy)
|
||||
@@ -244,11 +244,11 @@
|
||||
|
||||
ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID,
|
||||
ObjCInterfaceDecl *&clsDeclared) {
|
||||
- if (ExternallyCompleted)
|
||||
- LoadExternalDefinition();
|
||||
-
|
||||
ObjCInterfaceDecl* ClassDecl = this;
|
||||
while (ClassDecl != NULL) {
|
||||
+ if (ClassDecl->ExternallyCompleted)
|
||||
+ ClassDecl->LoadExternalDefinition();
|
||||
+
|
||||
if (ObjCIvarDecl *I = ClassDecl->getIvarDecl(ID)) {
|
||||
clsDeclared = ClassDecl;
|
||||
return I;
|
||||
|
|
@ -165,6 +165,10 @@ class FoundationTestCase(TestBase):
|
|||
substrs = ["(MyString) *self",
|
||||
"(NSString *) str",
|
||||
"(NSDate *) date"])
|
||||
|
||||
# isa should be accessible.
|
||||
self.expect("expression self->isa", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ["(Class)"])
|
||||
|
||||
# This should fail expectedly.
|
||||
self.expect("expression self->non_existent_member",
|
||||
|
|
|
|||
Loading…
Reference in New Issue