def Section : InheritableAttr {
let Spellings = [GNU<"section">, CXX11<"gnu", "section">];
let Args = [StringArgument<"Name">];
- let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag,
- "ExpectedFunctionOrGlobalVar">;
+ let Subjects = SubjectList<[Function, GlobalVar,
+ ObjCMethod, ObjCProperty], ErrorDiag,
+ "ExpectedFunctionGlobalVarMethodOrProperty">;
}
def Sentinel : InheritableAttr {
ExpectedObjCInterfaceDeclInitMethod,
ExpectedFunctionVariableOrClass,
ExpectedObjectiveCProtocol,
- ExpectedFunctionOrGlobalVar
+ ExpectedFunctionGlobalVarMethodOrProperty
};
} // end namespace clang
if (property->hasAttr<ObjCReturnsInnerPointerAttr>())
GetterMethod->addAttr(
::new (Context) ObjCReturnsInnerPointerAttr(Loc, Context));
+
+ if (const SectionAttr *SA = property->getAttr<SectionAttr>())
+ GetterMethod->addAttr(::new (Context) SectionAttr(Loc,
+ Context, SA->getName()));
if (getLangOpts().ObjCAutoRefCount)
CheckARCMethodDecl(GetterMethod);
// and the real context should be the same.
if (lexicalDC)
SetterMethod->setLexicalDeclContext(lexicalDC);
-
+ if (const SectionAttr *SA = property->getAttr<SectionAttr>())
+ SetterMethod->addAttr(::new (Context) SectionAttr(Loc,
+ Context, SA->getName()));
// It's possible for the user to have set a very odd custom
// setter selector that causes it to have a method family.
if (getLangOpts().ObjCAutoRefCount)
--- /dev/null
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://15450637.
+
+@interface NSObject @end
+
+@interface Foo : NSObject
+@property int p __attribute__((section("__TEXT,foo")));
+@end
+
+@implementation Foo @end
+
+// CHECK: define internal i32 @"\01-[Foo p]"({{.*}} section "__TEXT,foo" {
+// CHECK: define internal void @"\01-[Foo setP:]"({{.*}} section "__TEXT,foo" {