Fixed a bug showed up the meta-data for protocol
instance methods by building print-class-info.m,
whose output is now identical to what gcc puts out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61339 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 6045fa2..a14e3ba 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -468,7 +468,11 @@
property->getGetterName(),
property->getType(),
D,
- true, false, true, ObjCMethodDecl::Required);
+ true, false, true,
+ (property->getPropertyImplementation() ==
+ ObjCPropertyDecl::Optional) ?
+ ObjCMethodDecl::Optional :
+ ObjCMethodDecl::Required);
insMethods.push_back(GetterDecl);
InsMap[property->getGetterName()] = GetterDecl;
}
@@ -493,7 +497,11 @@
property->getSetterName(),
Context.VoidTy,
D,
- true, false, true, ObjCMethodDecl::Required);
+ true, false, true,
+ (property->getPropertyImplementation() ==
+ ObjCPropertyDecl::Optional) ?
+ ObjCMethodDecl::Optional :
+ ObjCMethodDecl::Required);
insMethods.push_back(SetterDecl);
InsMap[property->getSetterName()] = SetterDecl;
// Invent the arguments for the setter. We don't bother making a