forked from OSchip/llvm-project
ObjectiveC. support "section" attribute on properties
and methods. rdar://15450637 llvm-svn: 197625
This commit is contained in:
parent
83a71c076c
commit
cb8c7da266
|
@ -818,8 +818,9 @@ def InitPriority : InheritableAttr {
|
|||
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 {
|
||||
|
|
|
@ -912,7 +912,7 @@ enum AttributeDeclKind {
|
|||
ExpectedObjCInterfaceDeclInitMethod,
|
||||
ExpectedFunctionVariableOrClass,
|
||||
ExpectedObjectiveCProtocol,
|
||||
ExpectedFunctionOrGlobalVar
|
||||
ExpectedFunctionGlobalVarMethodOrProperty
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -1934,6 +1934,10 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
|
|||
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);
|
||||
|
@ -1984,7 +1988,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
|
|||
// 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)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// 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" {
|
Loading…
Reference in New Issue