@@ -8435,9 +8435,11 @@ bool ClangASTContext::AddObjCClassProperty(
8435
8435
const bool isInstance =
8436
8436
(property_attributes & ObjCPropertyDecl::OBJC_PR_class) == 0 ;
8437
8437
8438
- if (!getter_sel.isNull () &&
8439
- !(isInstance ? class_interface_decl->lookupInstanceMethod (getter_sel)
8440
- : class_interface_decl->lookupClassMethod (getter_sel))) {
8438
+ clang::ObjCMethodDecl *getter = nullptr ;
8439
+ if (!getter_sel.isNull ())
8440
+ getter = isInstance ? class_interface_decl->lookupInstanceMethod (getter_sel)
8441
+ : class_interface_decl->lookupClassMethod (getter_sel);
8442
+ if (!getter_sel.isNull () && !getter) {
8441
8443
const bool isVariadic = false ;
8442
8444
const bool isPropertyAccessor = false ;
8443
8445
const bool isSynthesizedAccessorStub = false ;
@@ -8447,28 +8449,31 @@ bool ClangASTContext::AddObjCClassProperty(
8447
8449
clang::ObjCMethodDecl::None;
8448
8450
const bool HasRelatedResultType = false ;
8449
8451
8450
- clang::ObjCMethodDecl * getter = clang::ObjCMethodDecl::Create (
8452
+ getter = clang::ObjCMethodDecl::Create (
8451
8453
*clang_ast, clang::SourceLocation (), clang::SourceLocation (),
8452
8454
getter_sel, ClangUtil::GetQualType (property_clang_type_to_access),
8453
8455
nullptr , class_interface_decl, isInstance, isVariadic,
8454
8456
isPropertyAccessor, isSynthesizedAccessorStub, isImplicitlyDeclared,
8455
8457
isDefined, impControl, HasRelatedResultType);
8456
8458
8457
- if (getter && metadata)
8458
- ClangASTContext::SetMetadata (clang_ast, getter, *metadata);
8459
-
8460
8459
if (getter) {
8461
- getter->setMethodParams (*clang_ast,
8460
+ if (metadata)
8461
+ ClangASTContext::SetMetadata (clang_ast, getter, *metadata);
8462
+ getter->setMethodParams (*clang_ast,
8462
8463
llvm::ArrayRef<clang::ParmVarDecl *>(),
8463
8464
llvm::ArrayRef<clang::SourceLocation>());
8464
-
8465
8465
class_interface_decl->addDecl (getter);
8466
8466
}
8467
8467
}
8468
+ if (getter) {
8469
+ getter->setPropertyAccessor (true );
8470
+ property_decl->setGetterMethodDecl (getter);
8471
+ }
8468
8472
8469
- if (!setter_sel.isNull () &&
8470
- !(isInstance ? class_interface_decl->lookupInstanceMethod (setter_sel)
8471
- : class_interface_decl->lookupClassMethod (setter_sel))) {
8473
+ clang::ObjCMethodDecl *setter = nullptr ;
8474
+ setter = isInstance ? class_interface_decl->lookupInstanceMethod (setter_sel)
8475
+ : class_interface_decl->lookupClassMethod (setter_sel);
8476
+ if (!setter_sel.isNull () && !setter) {
8472
8477
clang::QualType result_type = clang_ast->VoidTy ;
8473
8478
const bool isVariadic = false ;
8474
8479
const bool isPropertyAccessor = true ;
@@ -8479,31 +8484,35 @@ bool ClangASTContext::AddObjCClassProperty(
8479
8484
clang::ObjCMethodDecl::None;
8480
8485
const bool HasRelatedResultType = false ;
8481
8486
8482
- clang::ObjCMethodDecl * setter = clang::ObjCMethodDecl::Create (
8487
+ setter = clang::ObjCMethodDecl::Create (
8483
8488
*clang_ast, clang::SourceLocation (), clang::SourceLocation (),
8484
8489
setter_sel, result_type, nullptr , class_interface_decl, isInstance,
8485
8490
isVariadic, isPropertyAccessor, isSynthesizedAccessorStub,
8486
8491
isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType);
8487
8492
8488
- if (setter && metadata)
8489
- ClangASTContext::SetMetadata (clang_ast, setter, *metadata);
8493
+ if (setter) {
8494
+ if (metadata)
8495
+ ClangASTContext::SetMetadata (clang_ast, setter, *metadata);
8490
8496
8491
- llvm::SmallVector<clang::ParmVarDecl *, 1 > params;
8497
+ llvm::SmallVector<clang::ParmVarDecl *, 1 > params;
8492
8498
8493
- params.push_back (clang::ParmVarDecl::Create (
8494
- *clang_ast, setter, clang::SourceLocation (), clang::SourceLocation (),
8495
- nullptr , // anonymous
8496
- ClangUtil::GetQualType (property_clang_type_to_access), nullptr ,
8497
- clang::SC_Auto, nullptr ));
8499
+ params.push_back (clang::ParmVarDecl::Create (
8500
+ *clang_ast, setter, clang::SourceLocation (), clang::SourceLocation (),
8501
+ nullptr , // anonymous
8502
+ ClangUtil::GetQualType (property_clang_type_to_access), nullptr ,
8503
+ clang::SC_Auto, nullptr ));
8498
8504
8499
- if (setter) {
8500
8505
setter->setMethodParams (*clang_ast,
8501
8506
llvm::ArrayRef<clang::ParmVarDecl *>(params),
8502
8507
llvm::ArrayRef<clang::SourceLocation>());
8503
8508
8504
8509
class_interface_decl->addDecl (setter);
8505
8510
}
8506
8511
}
8512
+ if (setter) {
8513
+ setter->setPropertyAccessor (true );
8514
+ property_decl->setSetterMethodDecl (setter);
8515
+ }
8507
8516
8508
8517
return true ;
8509
8518
}
@@ -8939,16 +8948,23 @@ void ClangASTContext::DumpFromSymbolFile(Stream &s,
8939
8948
8940
8949
s << type->GetName ().AsCString () << " \n " ;
8941
8950
8942
- if (clang::TagDecl *tag_decl =
8943
- GetAsTagDecl (type-> GetFullCompilerType ()))
8951
+ CompilerType full_type = type-> GetFullCompilerType ();
8952
+ if (clang::TagDecl *tag_decl = GetAsTagDecl (full_type)) {
8944
8953
tag_decl->dump (s.AsRawOstream ());
8945
- else if (clang::TypedefNameDecl *typedef_decl =
8946
- GetAsTypedefDecl (type->GetFullCompilerType ()))
8954
+ continue ;
8955
+ }
8956
+ if (clang::TypedefNameDecl *typedef_decl = GetAsTypedefDecl (full_type)) {
8947
8957
typedef_decl->dump (s.AsRawOstream ());
8948
- else {
8949
- GetCanonicalQualType (type->GetFullCompilerType ().GetOpaqueQualType ())
8950
- .dump (s.AsRawOstream ());
8958
+ continue ;
8959
+ }
8960
+ if (auto *objc_obj = llvm::dyn_cast<clang::ObjCObjectType>(
8961
+ ClangUtil::GetQualType (full_type).getTypePtr ())) {
8962
+ if (clang::ObjCInterfaceDecl *interface_decl = objc_obj->getInterface ()) {
8963
+ interface_decl->dump (s.AsRawOstream ());
8964
+ continue ;
8965
+ }
8951
8966
}
8967
+ GetCanonicalQualType (full_type.GetOpaqueQualType ()).dump (s.AsRawOstream ());
8952
8968
}
8953
8969
}
8954
8970
0 commit comments