forked from OSchip/llvm-project
Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.
llvm-svn: 170500
This commit is contained in:
parent
c467933dc7
commit
7967fc14b9
|
@ -2016,7 +2016,7 @@ enum CXCursorKind {
|
|||
*/
|
||||
CXCursor_TranslationUnit = 300,
|
||||
|
||||
/* Attributes */
|
||||
/* Attribute */
|
||||
CXCursor_FirstAttr = 400,
|
||||
/**
|
||||
* \brief An attribute whose specific kind is not exposed via this
|
||||
|
|
|
@ -46,13 +46,13 @@ enum ID {
|
|||
};
|
||||
|
||||
struct Info {
|
||||
const char *Name, *Type, *Attributes, *HeaderName;
|
||||
const char *Name, *Type, *Attribute, *HeaderName;
|
||||
LanguageID builtin_lang;
|
||||
|
||||
bool operator==(const Info &RHS) const {
|
||||
return !strcmp(Name, RHS.Name) &&
|
||||
!strcmp(Type, RHS.Type) &&
|
||||
!strcmp(Attributes, RHS.Attributes);
|
||||
!strcmp(Attribute, RHS.Attribute);
|
||||
}
|
||||
bool operator!=(const Info &RHS) const { return !(*this == RHS); }
|
||||
};
|
||||
|
@ -91,40 +91,40 @@ public:
|
|||
/// \brief Return true if this function has no side effects and doesn't
|
||||
/// read memory.
|
||||
bool isConst(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'c') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'c') != 0;
|
||||
}
|
||||
|
||||
/// \brief Return true if we know this builtin never throws an exception.
|
||||
bool isNoThrow(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'n') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'n') != 0;
|
||||
}
|
||||
|
||||
/// \brief Return true if we know this builtin never returns.
|
||||
bool isNoReturn(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'r') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'r') != 0;
|
||||
}
|
||||
|
||||
/// \brief Return true if we know this builtin can return twice.
|
||||
bool isReturnsTwice(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'j') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'j') != 0;
|
||||
}
|
||||
|
||||
/// \brief Return true if this is a builtin for a libc/libm function,
|
||||
/// with a "__builtin_" prefix (e.g. __builtin_abs).
|
||||
bool isLibFunction(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'F') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'F') != 0;
|
||||
}
|
||||
|
||||
/// \brief Determines whether this builtin is a predefined libc/libm
|
||||
/// function, such as "malloc", where we know the signature a
|
||||
/// priori.
|
||||
bool isPredefinedLibFunction(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'f') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'f') != 0;
|
||||
}
|
||||
|
||||
/// \brief Determines whether this builtin has custom typechecking.
|
||||
bool hasCustomTypechecking(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 't') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 't') != 0;
|
||||
}
|
||||
|
||||
/// \brief Completely forget that the given ID was ever considered a builtin,
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
///
|
||||
/// Such functions can be const when the MathErrno lang option is disabled.
|
||||
bool isConstWithoutErrno(unsigned ID) const {
|
||||
return strchr(GetRecord(ID).Attributes, 'e') != 0;
|
||||
return strchr(GetRecord(ID).Attribute, 'e') != 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -2091,7 +2091,7 @@ private:
|
|||
DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo,
|
||||
AccessSpecifier AS, bool EnteringContext,
|
||||
DeclSpecContext DSC,
|
||||
ParsedAttributesWithRange &Attributes);
|
||||
ParsedAttributesWithRange &Attribute);
|
||||
void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
|
||||
Decl *TagDecl);
|
||||
ExprResult ParseCXXMemberInitializer(Decl *D, bool IsFunction,
|
||||
|
|
|
@ -1506,7 +1506,7 @@ private:
|
|||
/// \brief Is this Declarator a redeclaration?
|
||||
bool Redeclaration : 1;
|
||||
|
||||
/// Attrs - Attributes.
|
||||
/// Attrs - Attribute.
|
||||
ParsedAttributes Attrs;
|
||||
|
||||
/// \brief The asm label, if specified.
|
||||
|
|
|
@ -2380,7 +2380,7 @@ public:
|
|||
Selector SetterSel,
|
||||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
const unsigned Attribute,
|
||||
const unsigned AttributesAsWritten,
|
||||
bool *isOverridingProperty,
|
||||
TypeSourceInfo *T,
|
||||
|
@ -2397,7 +2397,7 @@ public:
|
|||
Selector SetterSel,
|
||||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
const unsigned Attribute,
|
||||
const unsigned AttributesAsWritten,
|
||||
TypeSourceInfo *T,
|
||||
tok::ObjCKeywordKind MethodImplKind,
|
||||
|
@ -6148,11 +6148,11 @@ public:
|
|||
SmallVectorImpl<Decl *> &Protocols);
|
||||
|
||||
/// Ensure attributes are consistent with type.
|
||||
/// \param [in, out] Attributes The attributes to check; they will
|
||||
/// \param [in, out] Attribute The attributes to check; they will
|
||||
/// be modified to be consistent with \p PropertyTy.
|
||||
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
|
||||
SourceLocation Loc,
|
||||
unsigned &Attributes,
|
||||
unsigned &Attribute,
|
||||
bool propertyInPrimaryClass);
|
||||
|
||||
/// Process the specified property declaration and create decls for the
|
||||
|
|
|
@ -1399,7 +1399,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) {
|
|||
OS << ExceptionSpec;
|
||||
}
|
||||
|
||||
// FIXME: Attributes
|
||||
// FIXME: Attribute
|
||||
|
||||
// Print the trailing return type if it was specified in the source.
|
||||
if (Node->hasExplicitResultType())
|
||||
|
|
|
@ -51,7 +51,7 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
|
|||
const LangOptions& LangOpts) {
|
||||
// Step #1: mark all target-independent builtins with their ID's.
|
||||
for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
|
||||
if (!LangOpts.NoBuiltin || !strchr(BuiltinInfo[i].Attributes, 'f')) {
|
||||
if (!LangOpts.NoBuiltin || !strchr(BuiltinInfo[i].Attribute, 'f')) {
|
||||
if (LangOpts.ObjC1 ||
|
||||
BuiltinInfo[i].builtin_lang != clang::OBJC_LANG)
|
||||
Table.get(BuiltinInfo[i].Name).setBuiltinID(i);
|
||||
|
@ -59,7 +59,7 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
|
|||
|
||||
// Step #2: Register target-specific builtins.
|
||||
for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
|
||||
if (!LangOpts.NoBuiltin || !strchr(TSRecords[i].Attributes, 'f'))
|
||||
if (!LangOpts.NoBuiltin || !strchr(TSRecords[i].Attribute, 'f'))
|
||||
Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);
|
||||
}
|
||||
|
||||
|
@ -68,12 +68,12 @@ Builtin::Context::GetBuiltinNames(SmallVectorImpl<const char *> &Names,
|
|||
bool NoBuiltins) {
|
||||
// Final all target-independent names
|
||||
for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
|
||||
if (!NoBuiltins || !strchr(BuiltinInfo[i].Attributes, 'f'))
|
||||
if (!NoBuiltins || !strchr(BuiltinInfo[i].Attribute, 'f'))
|
||||
Names.push_back(BuiltinInfo[i].Name);
|
||||
|
||||
// Find target-specific names.
|
||||
for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
|
||||
if (!NoBuiltins || !strchr(TSRecords[i].Attributes, 'f'))
|
||||
if (!NoBuiltins || !strchr(TSRecords[i].Attribute, 'f'))
|
||||
Names.push_back(TSRecords[i].Name);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void Builtin::Context::ForgetBuiltin(unsigned ID, IdentifierTable &Table) {
|
|||
bool
|
||||
Builtin::Context::isPrintfLike(unsigned ID, unsigned &FormatIdx,
|
||||
bool &HasVAListArg) {
|
||||
const char *Printf = strpbrk(GetRecord(ID).Attributes, "pP");
|
||||
const char *Printf = strpbrk(GetRecord(ID).Attribute, "pP");
|
||||
if (!Printf)
|
||||
return false;
|
||||
|
||||
|
@ -103,7 +103,7 @@ Builtin::Context::isPrintfLike(unsigned ID, unsigned &FormatIdx,
|
|||
bool
|
||||
Builtin::Context::isScanfLike(unsigned ID, unsigned &FormatIdx,
|
||||
bool &HasVAListArg) {
|
||||
const char *Scanf = strpbrk(GetRecord(ID).Attributes, "sS");
|
||||
const char *Scanf = strpbrk(GetRecord(ID).Attribute, "sS");
|
||||
if (!Scanf)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -971,46 +971,46 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
CallingConv = FI.getEffectiveCallingConvention();
|
||||
|
||||
if (FI.isNoReturn())
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoReturn);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
|
||||
|
||||
// FIXME: handle sseregparm someday...
|
||||
if (TargetDecl) {
|
||||
if (TargetDecl->hasAttr<ReturnsTwiceAttr>())
|
||||
FuncAttrs.addAttribute(llvm::Attributes::ReturnsTwice);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::ReturnsTwice);
|
||||
if (TargetDecl->hasAttr<NoThrowAttr>())
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoUnwind);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
|
||||
else if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
|
||||
const FunctionProtoType *FPT = Fn->getType()->getAs<FunctionProtoType>();
|
||||
if (FPT && FPT->isNothrow(getContext()))
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoUnwind);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
|
||||
}
|
||||
|
||||
if (TargetDecl->hasAttr<NoReturnAttr>())
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoReturn);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
|
||||
|
||||
if (TargetDecl->hasAttr<ReturnsTwiceAttr>())
|
||||
FuncAttrs.addAttribute(llvm::Attributes::ReturnsTwice);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::ReturnsTwice);
|
||||
|
||||
// 'const' and 'pure' attribute functions are also nounwind.
|
||||
if (TargetDecl->hasAttr<ConstAttr>()) {
|
||||
FuncAttrs.addAttribute(llvm::Attributes::ReadNone);
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoUnwind);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::ReadNone);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
|
||||
} else if (TargetDecl->hasAttr<PureAttr>()) {
|
||||
FuncAttrs.addAttribute(llvm::Attributes::ReadOnly);
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoUnwind);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::ReadOnly);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
|
||||
}
|
||||
if (TargetDecl->hasAttr<MallocAttr>())
|
||||
RetAttrs.addAttribute(llvm::Attributes::NoAlias);
|
||||
RetAttrs.addAttribute(llvm::Attribute::NoAlias);
|
||||
}
|
||||
|
||||
if (CodeGenOpts.OptimizeSize)
|
||||
FuncAttrs.addAttribute(llvm::Attributes::OptimizeForSize);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::OptimizeForSize);
|
||||
if (CodeGenOpts.OptimizeSize == 2)
|
||||
FuncAttrs.addAttribute(llvm::Attributes::MinSize);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::MinSize);
|
||||
if (CodeGenOpts.DisableRedZone)
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoRedZone);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoRedZone);
|
||||
if (CodeGenOpts.NoImplicitFloat)
|
||||
FuncAttrs.addAttribute(llvm::Attributes::NoImplicitFloat);
|
||||
FuncAttrs.addAttribute(llvm::Attribute::NoImplicitFloat);
|
||||
|
||||
QualType RetTy = FI.getReturnType();
|
||||
unsigned Index = 1;
|
||||
|
@ -1018,9 +1018,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
switch (RetAI.getKind()) {
|
||||
case ABIArgInfo::Extend:
|
||||
if (RetTy->hasSignedIntegerRepresentation())
|
||||
RetAttrs.addAttribute(llvm::Attributes::SExt);
|
||||
RetAttrs.addAttribute(llvm::Attribute::SExt);
|
||||
else if (RetTy->hasUnsignedIntegerRepresentation())
|
||||
RetAttrs.addAttribute(llvm::Attributes::ZExt);
|
||||
RetAttrs.addAttribute(llvm::Attribute::ZExt);
|
||||
break;
|
||||
case ABIArgInfo::Direct:
|
||||
case ABIArgInfo::Ignore:
|
||||
|
@ -1028,18 +1028,18 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
|
||||
case ABIArgInfo::Indirect: {
|
||||
llvm::AttrBuilder SRETAttrs;
|
||||
SRETAttrs.addAttribute(llvm::Attributes::StructRet);
|
||||
SRETAttrs.addAttribute(llvm::Attribute::StructRet);
|
||||
if (RetAI.getInReg())
|
||||
SRETAttrs.addAttribute(llvm::Attributes::InReg);
|
||||
SRETAttrs.addAttribute(llvm::Attribute::InReg);
|
||||
PAL.push_back(llvm::
|
||||
AttributeWithIndex::get(Index,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
SRETAttrs)));
|
||||
|
||||
++Index;
|
||||
// sret disables readnone and readonly
|
||||
FuncAttrs.removeAttribute(llvm::Attributes::ReadOnly)
|
||||
.removeAttribute(llvm::Attributes::ReadNone);
|
||||
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
|
||||
.removeAttribute(llvm::Attribute::ReadNone);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
if (RetAttrs.hasAttributes())
|
||||
PAL.push_back(llvm::
|
||||
AttributeWithIndex::get(llvm::AttributeSet::ReturnIndex,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
RetAttrs)));
|
||||
|
||||
for (CGFunctionInfo::const_arg_iterator it = FI.arg_begin(),
|
||||
|
@ -1062,9 +1062,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
if (AI.getPaddingType()) {
|
||||
if (AI.getPaddingInReg()) {
|
||||
llvm::AttrBuilder PadAttrs;
|
||||
PadAttrs.addAttribute(llvm::Attributes::InReg);
|
||||
PadAttrs.addAttribute(llvm::Attribute::InReg);
|
||||
|
||||
llvm::Attributes A =llvm::Attributes::get(getLLVMContext(), PadAttrs);
|
||||
llvm::Attribute A =llvm::Attribute::get(getLLVMContext(), PadAttrs);
|
||||
PAL.push_back(llvm::AttributeWithIndex::get(Index, A));
|
||||
}
|
||||
// Increment Index if there is padding.
|
||||
|
@ -1077,13 +1077,13 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
switch (AI.getKind()) {
|
||||
case ABIArgInfo::Extend:
|
||||
if (ParamType->isSignedIntegerOrEnumerationType())
|
||||
Attrs.addAttribute(llvm::Attributes::SExt);
|
||||
Attrs.addAttribute(llvm::Attribute::SExt);
|
||||
else if (ParamType->isUnsignedIntegerOrEnumerationType())
|
||||
Attrs.addAttribute(llvm::Attributes::ZExt);
|
||||
Attrs.addAttribute(llvm::Attribute::ZExt);
|
||||
// FALL THROUGH
|
||||
case ABIArgInfo::Direct:
|
||||
if (AI.getInReg())
|
||||
Attrs.addAttribute(llvm::Attributes::InReg);
|
||||
Attrs.addAttribute(llvm::Attribute::InReg);
|
||||
|
||||
// FIXME: handle sseregparm someday...
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
if (Attrs.hasAttributes())
|
||||
for (unsigned I = 0; I < Extra; ++I)
|
||||
PAL.push_back(llvm::AttributeWithIndex::get(Index + I,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
Attrs)));
|
||||
Index += Extra;
|
||||
}
|
||||
|
@ -1101,16 +1101,16 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
|
||||
case ABIArgInfo::Indirect:
|
||||
if (AI.getInReg())
|
||||
Attrs.addAttribute(llvm::Attributes::InReg);
|
||||
Attrs.addAttribute(llvm::Attribute::InReg);
|
||||
|
||||
if (AI.getIndirectByVal())
|
||||
Attrs.addAttribute(llvm::Attributes::ByVal);
|
||||
Attrs.addAttribute(llvm::Attribute::ByVal);
|
||||
|
||||
Attrs.addAlignmentAttr(AI.getIndirectAlign());
|
||||
|
||||
// byval disables readnone and readonly.
|
||||
FuncAttrs.removeAttribute(llvm::Attributes::ReadOnly)
|
||||
.removeAttribute(llvm::Attributes::ReadNone);
|
||||
FuncAttrs.removeAttribute(llvm::Attribute::ReadOnly)
|
||||
.removeAttribute(llvm::Attribute::ReadNone);
|
||||
break;
|
||||
|
||||
case ABIArgInfo::Ignore:
|
||||
|
@ -1130,14 +1130,14 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
|
|||
|
||||
if (Attrs.hasAttributes())
|
||||
PAL.push_back(llvm::AttributeWithIndex::get(Index,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
Attrs)));
|
||||
++Index;
|
||||
}
|
||||
if (FuncAttrs.hasAttributes())
|
||||
PAL.push_back(llvm::
|
||||
AttributeWithIndex::get(llvm::AttributeSet::FunctionIndex,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
FuncAttrs)));
|
||||
}
|
||||
|
||||
|
@ -1186,8 +1186,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
|
|||
// Name the struct return argument.
|
||||
if (CGM.ReturnTypeUsesSRet(FI)) {
|
||||
AI->setName("agg.result");
|
||||
AI->addAttr(llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attributes::NoAlias));
|
||||
AI->addAttr(llvm::Attribute::get(getLLVMContext(),
|
||||
llvm::Attribute::NoAlias));
|
||||
++AI;
|
||||
}
|
||||
|
||||
|
@ -1258,8 +1258,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
|
|||
llvm::Value *V = AI;
|
||||
|
||||
if (Arg->getType().isRestrictQualified())
|
||||
AI->addAttr(llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attributes::NoAlias));
|
||||
AI->addAttr(llvm::Attribute::get(getLLVMContext(),
|
||||
llvm::Attribute::NoAlias));
|
||||
|
||||
// Ensure the argument is the correct type.
|
||||
if (V->getType() != ArgI.getCoerceToType())
|
||||
|
@ -2234,7 +2234,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||
AttributeList);
|
||||
|
||||
llvm::BasicBlock *InvokeDest = 0;
|
||||
if (!Attrs.getFnAttributes().hasAttribute(llvm::Attributes::NoUnwind))
|
||||
if (!Attrs.getFnAttributes().hasAttribute(llvm::Attribute::NoUnwind))
|
||||
InvokeDest = getInvokeDest();
|
||||
|
||||
llvm::CallSite CS;
|
||||
|
|
|
@ -946,7 +946,7 @@ void CodeGenFunction::EmitDestructorBody(FunctionArgList &Args) {
|
|||
// -fapple-kext must inline any call to this dtor into
|
||||
// the caller's body.
|
||||
if (getLangOpts().AppleKext)
|
||||
CurFn->addFnAttr(llvm::Attributes::AlwaysInline);
|
||||
CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ CreateGlobalInitOrDestructFunction(CodeGenModule &CGM,
|
|||
Fn->setDoesNotThrow();
|
||||
|
||||
if (CGM.getLangOpts().SanitizeAddress)
|
||||
Fn->addFnAttr(llvm::Attributes::AddressSafety);
|
||||
Fn->addFnAttr(llvm::Attribute::AddressSafety);
|
||||
|
||||
return Fn;
|
||||
}
|
||||
|
|
|
@ -2020,10 +2020,10 @@ void CodeGenFunction::EmitCheck(llvm::Value *Checked, StringRef CheckName,
|
|||
llvm::FunctionType::get(CGM.VoidTy, ArgTypes, false);
|
||||
llvm::AttrBuilder B;
|
||||
if (!Recover) {
|
||||
B.addAttribute(llvm::Attributes::NoReturn)
|
||||
.addAttribute(llvm::Attributes::NoUnwind);
|
||||
B.addAttribute(llvm::Attribute::NoReturn)
|
||||
.addAttribute(llvm::Attribute::NoUnwind);
|
||||
}
|
||||
B.addAttribute(llvm::Attributes::UWTable);
|
||||
B.addAttribute(llvm::Attribute::UWTable);
|
||||
|
||||
// Checks that have two variants use a suffix to differentiate them
|
||||
bool NeedsAbortSuffix = (RecoverKind != CRK_Unrecoverable) &&
|
||||
|
@ -2032,7 +2032,7 @@ void CodeGenFunction::EmitCheck(llvm::Value *Checked, StringRef CheckName,
|
|||
(NeedsAbortSuffix? "_abort" : "")).str();
|
||||
llvm::Value *Fn =
|
||||
CGM.CreateRuntimeFunction(FnType, FunctionName,
|
||||
llvm::Attributes::get(getLLVMContext(), B));
|
||||
llvm::Attribute::get(getLLVMContext(), B));
|
||||
llvm::CallInst *HandlerCall = Builder.CreateCall(Fn, Args);
|
||||
if (Recover) {
|
||||
Builder.CreateBr(Cont);
|
||||
|
|
|
@ -1713,7 +1713,7 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM,
|
|||
f->setLinkage(llvm::Function::ExternalWeakLinkage);
|
||||
// set nonlazybind attribute for these APIs for performance.
|
||||
if (fnName == "objc_retain" || fnName == "objc_release")
|
||||
f->addFnAttr(llvm::Attributes::NonLazyBind);
|
||||
f->addFnAttr(llvm::Attribute::NonLazyBind);
|
||||
}
|
||||
|
||||
return fn;
|
||||
|
|
|
@ -64,8 +64,8 @@ private:
|
|||
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
|
||||
params, true),
|
||||
"objc_msgSend",
|
||||
llvm::Attributes::get(CGM.getLLVMContext(),
|
||||
llvm::Attributes::NonLazyBind));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(),
|
||||
llvm::Attribute::NonLazyBind));
|
||||
}
|
||||
|
||||
/// void objc_msgSend_stret (id, SEL, ...)
|
||||
|
@ -582,8 +582,8 @@ public:
|
|||
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty,
|
||||
params, false),
|
||||
"_setjmp",
|
||||
llvm::Attributes::get(CGM.getLLVMContext(),
|
||||
llvm::Attributes::NonLazyBind));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(),
|
||||
llvm::Attribute::NonLazyBind));
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -1641,8 +1641,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
|
|||
/* IsAlignStack */ false, AsmDialect);
|
||||
llvm::CallInst *Result = Builder.CreateCall(IA, Args);
|
||||
Result->addAttribute(llvm::AttributeSet::FunctionIndex,
|
||||
llvm::Attributes::get(getLLVMContext(),
|
||||
llvm::Attributes::NoUnwind));
|
||||
llvm::Attribute::get(getLLVMContext(),
|
||||
llvm::Attribute::NoUnwind));
|
||||
|
||||
// Slap the source location of the inline asm into a !srcloc metadata on the
|
||||
// call. FIXME: Handle metadata for MS-style inline asms.
|
||||
|
|
|
@ -354,7 +354,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
|
|||
for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(),
|
||||
RE = FD->redecls_end(); RI != RE; ++RI)
|
||||
if (RI->isInlineSpecified()) {
|
||||
Fn->addFnAttr(llvm::Attributes::InlineHint);
|
||||
Fn->addFnAttr(llvm::Attribute::InlineHint);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -563,28 +563,28 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
|||
F->setHasUWTable();
|
||||
|
||||
if (!hasUnwindExceptions(LangOpts))
|
||||
F->addFnAttr(llvm::Attributes::NoUnwind);
|
||||
F->addFnAttr(llvm::Attribute::NoUnwind);
|
||||
|
||||
if (D->hasAttr<NakedAttr>()) {
|
||||
// Naked implies noinline: we should not be inlining such functions.
|
||||
F->addFnAttr(llvm::Attributes::Naked);
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::Naked);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
}
|
||||
|
||||
if (D->hasAttr<NoInlineAttr>())
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
|
||||
// (noinline wins over always_inline, and we can't specify both in IR)
|
||||
if ((D->hasAttr<AlwaysInlineAttr>() || D->hasAttr<ForceInlineAttr>()) &&
|
||||
!F->getFnAttributes().hasAttribute(llvm::Attributes::NoInline))
|
||||
F->addFnAttr(llvm::Attributes::AlwaysInline);
|
||||
!F->getFnAttributes().hasAttribute(llvm::Attribute::NoInline))
|
||||
F->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||
|
||||
// FIXME: Communicate hot and cold attributes to LLVM more directly.
|
||||
if (D->hasAttr<ColdAttr>())
|
||||
F->addFnAttr(llvm::Attributes::OptimizeForSize);
|
||||
F->addFnAttr(llvm::Attribute::OptimizeForSize);
|
||||
|
||||
if (D->hasAttr<MinSizeAttr>())
|
||||
F->addFnAttr(llvm::Attributes::MinSize);
|
||||
F->addFnAttr(llvm::Attribute::MinSize);
|
||||
|
||||
if (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D))
|
||||
F->setUnnamedAddr(true);
|
||||
|
@ -594,15 +594,15 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
|||
F->setUnnamedAddr(true);
|
||||
|
||||
if (LangOpts.getStackProtector() == LangOptions::SSPOn)
|
||||
F->addFnAttr(llvm::Attributes::StackProtect);
|
||||
F->addFnAttr(llvm::Attribute::StackProtect);
|
||||
else if (LangOpts.getStackProtector() == LangOptions::SSPReq)
|
||||
F->addFnAttr(llvm::Attributes::StackProtectReq);
|
||||
F->addFnAttr(llvm::Attribute::StackProtectReq);
|
||||
|
||||
if (LangOpts.SanitizeAddress) {
|
||||
// When AddressSanitizer is enabled, set AddressSafety attribute
|
||||
// unless __attribute__((no_address_safety_analysis)) is used.
|
||||
if (!D->hasAttr<NoAddressSafetyAnalysisAttr>())
|
||||
F->addFnAttr(llvm::Attributes::AddressSafety);
|
||||
F->addFnAttr(llvm::Attribute::AddressSafety);
|
||||
}
|
||||
|
||||
unsigned alignment = D->getMaxAlignment() / Context.getCharWidth();
|
||||
|
@ -1106,7 +1106,7 @@ llvm::Constant *
|
|||
CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName,
|
||||
llvm::Type *Ty,
|
||||
GlobalDecl D, bool ForVTable,
|
||||
llvm::Attributes ExtraAttrs) {
|
||||
llvm::Attribute ExtraAttrs) {
|
||||
// Lookup the entry, lazily creating it if necessary.
|
||||
llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
|
||||
if (Entry) {
|
||||
|
@ -1214,7 +1214,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD,
|
|||
llvm::Constant *
|
||||
CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy,
|
||||
StringRef Name,
|
||||
llvm::Attributes ExtraAttrs) {
|
||||
llvm::Attribute ExtraAttrs) {
|
||||
return GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(), /*ForVTable=*/false,
|
||||
ExtraAttrs);
|
||||
}
|
||||
|
@ -1823,7 +1823,7 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
|
|||
llvm::AttributeSet oldAttrs = callSite.getAttributes();
|
||||
|
||||
// Collect any return attributes from the call.
|
||||
llvm::Attributes returnAttrs = oldAttrs.getRetAttributes();
|
||||
llvm::Attribute returnAttrs = oldAttrs.getRetAttributes();
|
||||
if (returnAttrs.hasAttributes())
|
||||
newAttrs.push_back(llvm::AttributeWithIndex::get(
|
||||
llvm::AttributeSet::ReturnIndex, returnAttrs));
|
||||
|
@ -1844,14 +1844,14 @@ static void replaceUsesOfNonProtoConstant(llvm::Constant *old,
|
|||
}
|
||||
|
||||
// Add any parameter attributes.
|
||||
llvm::Attributes pAttrs = oldAttrs.getParamAttributes(argNo + 1);
|
||||
llvm::Attribute pAttrs = oldAttrs.getParamAttributes(argNo + 1);
|
||||
if (pAttrs.hasAttributes())
|
||||
newAttrs.push_back(llvm::AttributeWithIndex::get(argNo + 1, pAttrs));
|
||||
}
|
||||
if (dontTransform)
|
||||
continue;
|
||||
|
||||
llvm::Attributes fnAttrs = oldAttrs.getFnAttributes();
|
||||
llvm::Attribute fnAttrs = oldAttrs.getFnAttributes();
|
||||
if (fnAttrs.hasAttributes())
|
||||
newAttrs.push_back(llvm::
|
||||
AttributeWithIndex::get(llvm::AttributeSet::FunctionIndex,
|
||||
|
|
|
@ -711,8 +711,8 @@ public:
|
|||
/// type and name.
|
||||
llvm::Constant *CreateRuntimeFunction(llvm::FunctionType *Ty,
|
||||
StringRef Name,
|
||||
llvm::Attributes ExtraAttrs =
|
||||
llvm::Attributes());
|
||||
llvm::Attribute ExtraAttrs =
|
||||
llvm::Attribute());
|
||||
/// CreateRuntimeVariable - Create a new runtime global variable with the
|
||||
/// specified type and name.
|
||||
llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty,
|
||||
|
@ -890,8 +890,8 @@ private:
|
|||
llvm::Type *Ty,
|
||||
GlobalDecl D,
|
||||
bool ForVTable,
|
||||
llvm::Attributes ExtraAttrs =
|
||||
llvm::Attributes());
|
||||
llvm::Attribute ExtraAttrs =
|
||||
llvm::Attribute());
|
||||
llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
|
||||
llvm::PointerType *PTy,
|
||||
const VarDecl *D,
|
||||
|
|
|
@ -952,8 +952,8 @@ static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM,
|
|||
llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy),
|
||||
GuardPtrTy, /*isVarArg=*/false);
|
||||
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire",
|
||||
llvm::Attributes::get(CGM.getLLVMContext(),
|
||||
llvm::Attributes::NoUnwind));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(),
|
||||
llvm::Attribute::NoUnwind));
|
||||
}
|
||||
|
||||
static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
|
||||
|
@ -962,8 +962,8 @@ static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
|
|||
llvm::FunctionType *FTy =
|
||||
llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false);
|
||||
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release",
|
||||
llvm::Attributes::get(CGM.getLLVMContext(),
|
||||
llvm::Attributes::NoUnwind));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(),
|
||||
llvm::Attribute::NoUnwind));
|
||||
}
|
||||
|
||||
static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
|
||||
|
@ -972,8 +972,8 @@ static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
|
|||
llvm::FunctionType *FTy =
|
||||
llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false);
|
||||
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort",
|
||||
llvm::Attributes::get(CGM.getLLVMContext(),
|
||||
llvm::Attributes::NoUnwind));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(),
|
||||
llvm::Attribute::NoUnwind));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -1020,7 +1020,7 @@ void X86_32TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
|
|||
llvm::AttrBuilder B;
|
||||
B.addStackAlignmentAttr(16);
|
||||
Fn->addAttribute(llvm::AttributeSet::FunctionIndex,
|
||||
llvm::Attributes::get(CGM.getLLVMContext(), B));
|
||||
llvm::Attribute::get(CGM.getLLVMContext(), B));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3644,7 +3644,7 @@ SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
|
|||
// OpenCL __kernel functions get a kernel calling convention
|
||||
F->setCallingConv(llvm::CallingConv::PTX_Kernel);
|
||||
// And kernel functions are not subject to inlining
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3760,7 +3760,7 @@ void MBlazeTargetCodeGenInfo::SetTargetAttributes(const Decl *D,
|
|||
F->setCallingConv(CC);
|
||||
|
||||
// Step 2: Add attributes goodness.
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
}
|
||||
|
||||
// Step 3: Emit _interrupt_handler alias.
|
||||
|
@ -3798,7 +3798,7 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
|
|||
F->setCallingConv(llvm::CallingConv::MSP430_INTR);
|
||||
|
||||
// Step 2: Add attributes goodness.
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
|
||||
// Step 3: Emit ISR vector alias.
|
||||
unsigned Num = attr->getNumber() / 2;
|
||||
|
@ -4155,7 +4155,7 @@ void TCETargetCodeGenInfo::SetTargetAttributes(const Decl *D,
|
|||
if (M.getLangOpts().OpenCL) {
|
||||
if (FD->hasAttr<OpenCLKernelAttr>()) {
|
||||
// OpenCL C Kernel functions are not subject to inlining
|
||||
F->addFnAttr(llvm::Attributes::NoInline);
|
||||
F->addFnAttr(llvm::Attribute::NoInline);
|
||||
|
||||
if (FD->hasAttr<ReqdWorkGroupSizeAttr>()) {
|
||||
|
||||
|
|
|
@ -655,8 +655,8 @@ namespace clang {
|
|||
};
|
||||
|
||||
/// \brief The set of attributes that can be attached to a module.
|
||||
struct Attributes {
|
||||
Attributes() : IsSystem() { }
|
||||
struct Attribute {
|
||||
Attribute() : IsSystem() { }
|
||||
|
||||
/// \brief Whether this is a system module.
|
||||
unsigned IsSystem : 1;
|
||||
|
@ -709,7 +709,7 @@ namespace clang {
|
|||
void parseUmbrellaDirDecl(SourceLocation UmbrellaLoc);
|
||||
void parseExportDecl();
|
||||
void parseInferredModuleDecl(bool Framework, bool Explicit);
|
||||
bool parseOptionalAttributes(Attributes &Attrs);
|
||||
bool parseOptionalAttributes(Attribute &Attrs);
|
||||
|
||||
const DirectoryEntry *getOverriddenHeaderSearchDir();
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ void ModuleMapParser::parseModuleDecl() {
|
|||
SourceLocation ModuleNameLoc = Id.back().second;
|
||||
|
||||
// Parse the optional attribute list.
|
||||
Attributes Attrs;
|
||||
Attribute Attrs;
|
||||
parseOptionalAttributes(Attrs);
|
||||
|
||||
// Parse the opening brace.
|
||||
|
@ -1475,7 +1475,7 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) {
|
|||
}
|
||||
|
||||
// Parse optional attributes.
|
||||
Attributes Attrs;
|
||||
Attribute Attrs;
|
||||
parseOptionalAttributes(Attrs);
|
||||
|
||||
if (ActiveModule) {
|
||||
|
@ -1576,7 +1576,7 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) {
|
|||
/// \param Attrs Will be filled in with the parsed attributes.
|
||||
///
|
||||
/// \returns true if an error occurred, false otherwise.
|
||||
bool ModuleMapParser::parseOptionalAttributes(Attributes &Attrs) {
|
||||
bool ModuleMapParser::parseOptionalAttributes(Attribute &Attrs) {
|
||||
bool HadError = false;
|
||||
|
||||
while (Tok.is(MMToken::LSquare)) {
|
||||
|
|
|
@ -142,7 +142,7 @@ void Parser::ParseGNUAttributes(ParsedAttributes &attrs,
|
|||
new LateParsedAttribute(this, *AttrName, AttrNameLoc);
|
||||
LateAttrs->push_back(LA);
|
||||
|
||||
// Attributes in a class are parsed at the end of the class, along
|
||||
// Attribute in a class are parsed at the end of the class, along
|
||||
// with other late-parsed declarations.
|
||||
if (!ClassStack.empty() && !LateAttrs->parseSoon())
|
||||
getCurrentClass().LateParsedDeclarations.push_back(LA);
|
||||
|
@ -824,7 +824,7 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
|
|||
}
|
||||
|
||||
|
||||
// Late Parsed Attributes:
|
||||
// Late Parsed Attribute:
|
||||
// See other examples of late parsing in lib/Parse/ParseCXXInlineMethods
|
||||
|
||||
void Parser::LateParsedDeclaration::ParseLexedAttributes() {}
|
||||
|
@ -2793,15 +2793,15 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
|||
// These are attributes following class specifiers.
|
||||
// To produce better diagnostic, we parse them when
|
||||
// parsing class specifier.
|
||||
ParsedAttributesWithRange Attributes(AttrFactory);
|
||||
ParsedAttributesWithRange Attribute(AttrFactory);
|
||||
ParseClassSpecifier(Kind, Loc, DS, TemplateInfo, AS,
|
||||
EnteringContext, DSContext, Attributes);
|
||||
EnteringContext, DSContext, Attribute);
|
||||
|
||||
// If there are attributes following class specifier,
|
||||
// take them over and handle them here.
|
||||
if (!Attributes.empty()) {
|
||||
if (!Attribute.empty()) {
|
||||
AttrsLastTime = true;
|
||||
attrs.takeAllFrom(Attributes);
|
||||
attrs.takeAllFrom(Attribute);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2949,7 +2949,7 @@ ParseStructDeclaration(ParsingDeclSpec &DS, FieldCallback &Fields) {
|
|||
ParsingFieldDeclarator DeclaratorInfo(*this, DS);
|
||||
DeclaratorInfo.D.setCommaLoc(CommaLoc);
|
||||
|
||||
// Attributes are only allowed here on successive declarators.
|
||||
// Attribute are only allowed here on successive declarators.
|
||||
if (!FirstDeclarator)
|
||||
MaybeParseGNUAttributes(DeclaratorInfo.D);
|
||||
|
||||
|
@ -3162,7 +3162,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
|||
IsScopedUsingClassTag = Tok.is(tok::kw_class);
|
||||
ScopedEnumKWLoc = ConsumeToken();
|
||||
|
||||
// Attributes are not allowed between these keywords. Diagnose,
|
||||
// Attribute are not allowed between these keywords. Diagnose,
|
||||
// but then just treat them like they appeared in the right place.
|
||||
ProhibitAttributes(attrs);
|
||||
|
||||
|
|
|
@ -1052,7 +1052,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
|||
const ParsedTemplateInfo &TemplateInfo,
|
||||
AccessSpecifier AS,
|
||||
bool EnteringContext, DeclSpecContext DSC,
|
||||
ParsedAttributesWithRange &Attributes) {
|
||||
ParsedAttributesWithRange &Attribute) {
|
||||
DeclSpec::TST TagType;
|
||||
if (TagTokKind == tok::kw_struct)
|
||||
TagType = DeclSpec::TST_struct;
|
||||
|
@ -1250,7 +1250,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
|||
// For these, DSC is DSC_type_specifier.
|
||||
|
||||
// If there are attributes after class name, parse them.
|
||||
MaybeParseCXX0XAttributes(Attributes);
|
||||
MaybeParseCXX0XAttributes(Attribute);
|
||||
|
||||
Sema::TagUseKind TUK;
|
||||
if (DSC == DSC_trailing)
|
||||
|
@ -1324,7 +1324,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
|||
// to caller to handle.
|
||||
// FIXME: provide fix-it hints if we can.
|
||||
if (TUK != Sema::TUK_Reference)
|
||||
ProhibitAttributes(Attributes);
|
||||
ProhibitAttributes(Attribute);
|
||||
|
||||
// If this is an elaborated type specifier, and we delayed
|
||||
// diagnostics before, just merge them into the current pool.
|
||||
|
@ -2258,7 +2258,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
|||
HasInitializer = false;
|
||||
DeclaratorInfo.setCommaLoc(CommaLoc);
|
||||
|
||||
// Attributes are only allowed on the second declarator.
|
||||
// Attribute are only allowed on the second declarator.
|
||||
MaybeParseGNUAttributes(DeclaratorInfo);
|
||||
|
||||
if (Tok.isNot(tok::colon))
|
||||
|
|
|
@ -2403,7 +2403,7 @@ void Parser::ParseDirectNewDeclarator(Declarator &D) {
|
|||
|
||||
T.consumeClose();
|
||||
|
||||
// Attributes here appertain to the array type. C++11 [expr.new]p5.
|
||||
// Attribute here appertain to the array type. C++11 [expr.new]p5.
|
||||
ParsedAttributes Attrs(AttrFactory);
|
||||
MaybeParseCXX0XAttributes(Attrs);
|
||||
|
||||
|
|
|
@ -894,10 +894,10 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
|
||||
if (!OID)
|
||||
return;
|
||||
unsigned Attributes = PD->getPropertyAttributes();
|
||||
unsigned Attribute = PD->getPropertyAttributes();
|
||||
if (mustSynthesizeSetterGetterMethod(IMD, PD, true /*getter*/)) {
|
||||
bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
|
||||
(Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
bool GenGetProperty = !(Attribute & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
|
||||
(Attribute & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
ObjCPropertyDecl::OBJC_PR_copy));
|
||||
std::string Getr;
|
||||
if (GenGetProperty && !objcGetPropertyDefined) {
|
||||
|
@ -956,7 +956,7 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
|
||||
// Generate the 'setter' function.
|
||||
std::string Setr;
|
||||
bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
bool GenSetProperty = Attribute & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
ObjCPropertyDecl::OBJC_PR_copy);
|
||||
if (GenSetProperty && !objcSetPropertyDefined) {
|
||||
objcSetPropertyDefined = true;
|
||||
|
@ -976,11 +976,11 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
Setr += ", (id)";
|
||||
Setr += PD->getName();
|
||||
Setr += ", ";
|
||||
if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic)
|
||||
if (Attribute & ObjCPropertyDecl::OBJC_PR_nonatomic)
|
||||
Setr += "0, ";
|
||||
else
|
||||
Setr += "1, ";
|
||||
if (Attributes & ObjCPropertyDecl::OBJC_PR_copy)
|
||||
if (Attribute & ObjCPropertyDecl::OBJC_PR_copy)
|
||||
Setr += "1)";
|
||||
else
|
||||
Setr += "0)";
|
||||
|
|
|
@ -788,10 +788,10 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
|
||||
if (!OID)
|
||||
return;
|
||||
unsigned Attributes = PD->getPropertyAttributes();
|
||||
unsigned Attribute = PD->getPropertyAttributes();
|
||||
if (!PD->getGetterMethodDecl()->isDefined()) {
|
||||
bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
|
||||
(Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
bool GenGetProperty = !(Attribute & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
|
||||
(Attribute & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
ObjCPropertyDecl::OBJC_PR_copy));
|
||||
std::string Getr;
|
||||
if (GenGetProperty && !objcGetPropertyDefined) {
|
||||
|
@ -849,7 +849,7 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
|
||||
// Generate the 'setter' function.
|
||||
std::string Setr;
|
||||
bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
bool GenSetProperty = Attribute & (ObjCPropertyDecl::OBJC_PR_retain |
|
||||
ObjCPropertyDecl::OBJC_PR_copy);
|
||||
if (GenSetProperty && !objcSetPropertyDefined) {
|
||||
objcSetPropertyDefined = true;
|
||||
|
@ -869,11 +869,11 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
|
|||
Setr += ", (id)";
|
||||
Setr += PD->getName();
|
||||
Setr += ", ";
|
||||
if (Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic)
|
||||
if (Attribute & ObjCPropertyDecl::OBJC_PR_nonatomic)
|
||||
Setr += "0, ";
|
||||
else
|
||||
Setr += "1, ";
|
||||
if (Attributes & ObjCPropertyDecl::OBJC_PR_copy)
|
||||
if (Attribute & ObjCPropertyDecl::OBJC_PR_copy)
|
||||
Setr += "1)";
|
||||
else
|
||||
Setr += "0)";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- SemaAttr.cpp - Semantic Analysis for Attributes ------------------===//
|
||||
//===--- SemaAttr.cpp - Semantic Analysis for Attribute ------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -5806,8 +5806,8 @@ void Sema::checkUnsafeExprAssigns(SourceLocation Loc,
|
|||
if (!PD)
|
||||
return;
|
||||
|
||||
unsigned Attributes = PD->getPropertyAttributes();
|
||||
if (Attributes & ObjCPropertyDecl::OBJC_PR_assign) {
|
||||
unsigned Attribute = PD->getPropertyAttributes();
|
||||
if (Attribute & ObjCPropertyDecl::OBJC_PR_assign) {
|
||||
// when 'assign' attribute was not explicitly specified
|
||||
// by user, ignore it and rely on property type itself
|
||||
// for lifetime info.
|
||||
|
@ -5825,7 +5825,7 @@ void Sema::checkUnsafeExprAssigns(SourceLocation Loc,
|
|||
RHS = cast->getSubExpr();
|
||||
}
|
||||
}
|
||||
else if (Attributes & ObjCPropertyDecl::OBJC_PR_weak) {
|
||||
else if (Attribute & ObjCPropertyDecl::OBJC_PR_weak) {
|
||||
while (ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(RHS)) {
|
||||
if (cast->getCastKind() == CK_ARCConsumeObject) {
|
||||
Diag(Loc, diag::warn_arc_retained_assign)
|
||||
|
|
|
@ -4591,20 +4591,20 @@ void Sema::CodeCompleteObjCAtExpression(Scope *S) {
|
|||
|
||||
/// \brief Determine whether the addition of the given flag to an Objective-C
|
||||
/// property's attributes will cause a conflict.
|
||||
static bool ObjCPropertyFlagConflicts(unsigned Attributes, unsigned NewFlag) {
|
||||
static bool ObjCPropertyFlagConflicts(unsigned Attribute, unsigned NewFlag) {
|
||||
// Check if we've already added this flag.
|
||||
if (Attributes & NewFlag)
|
||||
if (Attribute & NewFlag)
|
||||
return true;
|
||||
|
||||
Attributes |= NewFlag;
|
||||
Attribute |= NewFlag;
|
||||
|
||||
// Check for collisions with "readonly".
|
||||
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_readwrite))
|
||||
if ((Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_readwrite))
|
||||
return true;
|
||||
|
||||
// Check for more than one of { assign, copy, retain, strong, weak }.
|
||||
unsigned AssignCopyRetMask = Attributes & (ObjCDeclSpec::DQ_PR_assign |
|
||||
unsigned AssignCopyRetMask = Attribute & (ObjCDeclSpec::DQ_PR_assign |
|
||||
ObjCDeclSpec::DQ_PR_unsafe_unretained |
|
||||
ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_retain |
|
||||
|
@ -4626,38 +4626,38 @@ void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) {
|
|||
if (!CodeCompleter)
|
||||
return;
|
||||
|
||||
unsigned Attributes = ODS.getPropertyAttributes();
|
||||
unsigned Attribute = ODS.getPropertyAttributes();
|
||||
|
||||
ResultBuilder Results(*this, CodeCompleter->getAllocator(),
|
||||
CodeCompleter->getCodeCompletionTUInfo(),
|
||||
CodeCompletionContext::CCC_Other);
|
||||
Results.EnterNewScope();
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readonly))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_readonly))
|
||||
Results.AddResult(CodeCompletionResult("readonly"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_assign))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_assign))
|
||||
Results.AddResult(CodeCompletionResult("assign"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes,
|
||||
if (!ObjCPropertyFlagConflicts(Attribute,
|
||||
ObjCDeclSpec::DQ_PR_unsafe_unretained))
|
||||
Results.AddResult(CodeCompletionResult("unsafe_unretained"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readwrite))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_readwrite))
|
||||
Results.AddResult(CodeCompletionResult("readwrite"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_retain))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_retain))
|
||||
Results.AddResult(CodeCompletionResult("retain"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_strong))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_strong))
|
||||
Results.AddResult(CodeCompletionResult("strong"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_copy))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_copy))
|
||||
Results.AddResult(CodeCompletionResult("copy"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_nonatomic))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_nonatomic))
|
||||
Results.AddResult(CodeCompletionResult("nonatomic"));
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_atomic))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_atomic))
|
||||
Results.AddResult(CodeCompletionResult("atomic"));
|
||||
|
||||
// Only suggest "weak" if we're compiling for ARC-with-weak-references or GC.
|
||||
if (getLangOpts().ObjCARCWeak || getLangOpts().getGC() != LangOptions::NonGC)
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_weak))
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_weak))
|
||||
Results.AddResult(CodeCompletionResult("weak"));
|
||||
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_setter)) {
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_setter)) {
|
||||
CodeCompletionBuilder Setter(Results.getAllocator(),
|
||||
Results.getCodeCompletionTUInfo());
|
||||
Setter.AddTypedTextChunk("setter");
|
||||
|
@ -4665,7 +4665,7 @@ void Sema::CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS) {
|
|||
Setter.AddPlaceholderChunk("method");
|
||||
Results.AddResult(CodeCompletionResult(Setter.TakeString()));
|
||||
}
|
||||
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_getter)) {
|
||||
if (!ObjCPropertyFlagConflicts(Attribute, ObjCDeclSpec::DQ_PR_getter)) {
|
||||
CodeCompletionBuilder Getter(Results.getAllocator(),
|
||||
Results.getCodeCompletionTUInfo());
|
||||
Getter.AddTypedTextChunk("getter");
|
||||
|
|
|
@ -2804,7 +2804,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
|||
|
||||
// Warn about ignored type attributes, for example:
|
||||
// __attribute__((aligned)) struct A;
|
||||
// Attributes should be placed after tag to apply to type declaration.
|
||||
// Attribute should be placed after tag to apply to type declaration.
|
||||
if (!DS.getAttributes().empty()) {
|
||||
DeclSpec::TST TypeSpecType = DS.getTypeSpecType();
|
||||
if (TypeSpecType == DeclSpec::TST_class ||
|
||||
|
|
|
@ -2722,7 +2722,7 @@ static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|||
}
|
||||
|
||||
/// Handle __attribute__((format_arg((idx)))) attribute based on
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attribute.html
|
||||
static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
if (!checkAttributeNumArgs(S, Attr, 1))
|
||||
return;
|
||||
|
@ -2824,7 +2824,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Format) {
|
|||
}
|
||||
|
||||
/// Handle __attribute__((init_priority(priority))) attributes based on
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attribute.html
|
||||
static void handleInitPriorityAttr(Sema &S, Decl *D,
|
||||
const AttributeList &Attr) {
|
||||
if (!S.getLangOpts().CPlusPlus) {
|
||||
|
@ -2896,7 +2896,7 @@ FormatAttr *Sema::mergeFormatAttr(Decl *D, SourceRange Range, StringRef Format,
|
|||
}
|
||||
|
||||
/// Handle __attribute__((format(type,idx,firstarg))) attributes based on
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
|
||||
/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attribute.html
|
||||
static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||
|
||||
if (!Attr.getParameterName()) {
|
||||
|
|
|
@ -434,7 +434,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
|
|||
if (ExplicitParams)
|
||||
CheckCXXDefaultArguments(Method);
|
||||
|
||||
// Attributes on the lambda apply to the method.
|
||||
// Attribute on the lambda apply to the method.
|
||||
ProcessDeclAttributes(CurScope, Method, ParamInfo);
|
||||
|
||||
// Introduce the function call operator as the current declaration context.
|
||||
|
|
|
@ -121,23 +121,23 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
bool *isOverridingProperty,
|
||||
tok::ObjCKeywordKind MethodImplKind,
|
||||
DeclContext *lexicalDC) {
|
||||
unsigned Attributes = ODS.getPropertyAttributes();
|
||||
unsigned Attribute = ODS.getPropertyAttributes();
|
||||
TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D, S);
|
||||
QualType T = TSI->getType();
|
||||
Attributes |= deduceWeakPropertyFromType(*this, T);
|
||||
Attribute |= deduceWeakPropertyFromType(*this, T);
|
||||
|
||||
bool isReadWrite = ((Attributes & ObjCDeclSpec::DQ_PR_readwrite) ||
|
||||
bool isReadWrite = ((Attribute & ObjCDeclSpec::DQ_PR_readwrite) ||
|
||||
// default is readwrite!
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_readonly));
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_readonly));
|
||||
// property is defaulted to 'assign' if it is readwrite and is
|
||||
// not retain or copy
|
||||
bool isAssign = ((Attributes & ObjCDeclSpec::DQ_PR_assign) ||
|
||||
bool isAssign = ((Attribute & ObjCDeclSpec::DQ_PR_assign) ||
|
||||
(isReadWrite &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_copy) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_weak)));
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_copy) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_weak)));
|
||||
|
||||
// Proceed with constructing the ObjCPropertDecls.
|
||||
ObjCContainerDecl *ClassDecl = cast<ObjCContainerDecl>(CurContext);
|
||||
|
@ -146,12 +146,12 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
Decl *Res = HandlePropertyInClassExtension(S, AtLoc, LParenLoc,
|
||||
FD, GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes,
|
||||
Attribute,
|
||||
ODS.getPropertyAttributes(),
|
||||
isOverridingProperty, TSI,
|
||||
MethodImplKind);
|
||||
if (Res) {
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attributes, false);
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attribute, false);
|
||||
if (getLangOpts().ObjCAutoRefCount)
|
||||
checkARCPropertyDecl(*this, cast<ObjCPropertyDecl>(Res));
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
ObjCPropertyDecl *Res = CreatePropertyDecl(S, ClassDecl, AtLoc, LParenLoc, FD,
|
||||
GetterSel, SetterSel,
|
||||
isAssign, isReadWrite,
|
||||
Attributes,
|
||||
Attribute,
|
||||
ODS.getPropertyAttributes(),
|
||||
TSI, MethodImplKind);
|
||||
if (lexicalDC)
|
||||
Res->setLexicalDeclContext(lexicalDC);
|
||||
|
||||
// Validate the attributes on the @property.
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attributes,
|
||||
CheckObjCPropertyAttributes(Res, AtLoc, Attribute,
|
||||
(isa<ObjCInterfaceDecl>(ClassDecl) ||
|
||||
isa<ObjCProtocolDecl>(ClassDecl)));
|
||||
|
||||
|
@ -181,31 +181,31 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
|
|||
}
|
||||
|
||||
static ObjCPropertyDecl::PropertyAttributeKind
|
||||
makePropertyAttributesAsWritten(unsigned Attributes) {
|
||||
makePropertyAttributesAsWritten(unsigned Attribute) {
|
||||
unsigned attributesAsWritten = 0;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readonly)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_readonly;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readwrite)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readwrite)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_readwrite;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_getter)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_getter)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_getter;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_setter)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_setter)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_setter;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_assign)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_assign)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_assign;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_retain;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_strong;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_weak)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_weak)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_weak;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_copy)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_copy)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_copy;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_unsafe_unretained;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_nonatomic)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_nonatomic;
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_atomic)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_atomic)
|
||||
attributesAsWritten |= ObjCPropertyDecl::OBJC_PR_atomic;
|
||||
|
||||
return (ObjCPropertyDecl::PropertyAttributeKind)attributesAsWritten;
|
||||
|
@ -259,7 +259,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
Selector GetterSel, Selector SetterSel,
|
||||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
const unsigned Attribute,
|
||||
const unsigned AttributesAsWritten,
|
||||
bool *isOverridingProperty,
|
||||
TypeSourceInfo *T,
|
||||
|
@ -292,9 +292,9 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
PropertyId, AtLoc, LParenLoc, T);
|
||||
PDecl->setPropertyAttributesAsWritten(
|
||||
makePropertyAttributesAsWritten(AttributesAsWritten));
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readonly)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly);
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readwrite)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readwrite)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite);
|
||||
// Set setter/getter selector name. Needed later.
|
||||
PDecl->setGetterName(GetterSel);
|
||||
|
@ -320,7 +320,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
ObjCPropertyDecl *PrimaryPDecl =
|
||||
CreatePropertyDecl(S, CCPrimary, AtLoc, LParenLoc,
|
||||
FD, GetterSel, SetterSel, isAssign, isReadWrite,
|
||||
Attributes,AttributesAsWritten, T, MethodImplKind, DC);
|
||||
Attribute,AttributesAsWritten, T, MethodImplKind, DC);
|
||||
|
||||
// A case of continuation class adding a new property in the class. This
|
||||
// is not what it was meant for. However, gcc supports it and so should we.
|
||||
|
@ -359,7 +359,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
unsigned PIkind = PIDecl->getPropertyAttributesAsWritten();
|
||||
if (isReadWrite && (PIkind & ObjCPropertyDecl::OBJC_PR_readonly)) {
|
||||
PIkind |= deduceWeakPropertyFromType(*this, PIDecl->getType());
|
||||
unsigned ClassExtensionMemoryModel = getOwnershipRule(Attributes);
|
||||
unsigned ClassExtensionMemoryModel = getOwnershipRule(Attribute);
|
||||
unsigned PrimaryClassMemoryModel = getOwnershipRule(PIkind);
|
||||
if (PrimaryClassMemoryModel && ClassExtensionMemoryModel &&
|
||||
(PrimaryClassMemoryModel != ClassExtensionMemoryModel)) {
|
||||
|
@ -391,11 +391,11 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy);
|
||||
}
|
||||
PIDecl->makeitReadWriteAttribute();
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain)
|
||||
PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain);
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong)
|
||||
PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_copy)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_copy)
|
||||
PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
|
||||
PIDecl->setSetterName(SetterSel);
|
||||
} else {
|
||||
|
@ -404,7 +404,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
|
|||
// This is a common error where the user often intended the original
|
||||
// declaration to be readonly.
|
||||
unsigned diag =
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_readwrite) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_readwrite) &&
|
||||
(PIkind & ObjCPropertyDecl::OBJC_PR_readwrite)
|
||||
? diag::err_use_continuation_class_redeclaration_readwrite
|
||||
: diag::err_use_continuation_class;
|
||||
|
@ -432,7 +432,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
|||
Selector SetterSel,
|
||||
const bool isAssign,
|
||||
const bool isReadWrite,
|
||||
const unsigned Attributes,
|
||||
const unsigned Attribute,
|
||||
const unsigned AttributesAsWritten,
|
||||
TypeSourceInfo *TInfo,
|
||||
tok::ObjCKeywordKind MethodImplKind,
|
||||
|
@ -443,7 +443,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
|||
// Issue a warning if property is 'assign' as default and its object, which is
|
||||
// gc'able conforms to NSCopying protocol
|
||||
if (getLangOpts().getGC() != LangOptions::NonGC &&
|
||||
isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign))
|
||||
isAssign && !(Attribute & ObjCDeclSpec::DQ_PR_assign))
|
||||
if (const ObjCObjectPointerType *ObjPtrTy =
|
||||
T->getAs<ObjCObjectPointerType>()) {
|
||||
ObjCInterfaceDecl *IDecl = ObjPtrTy->getObjectType()->getInterface();
|
||||
|
@ -487,44 +487,44 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
|
|||
PDecl->setPropertyAttributesAsWritten(
|
||||
makePropertyAttributesAsWritten(AttributesAsWritten));
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readonly)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readonly)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readonly);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_getter)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_getter)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_getter);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_setter)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_setter)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_setter);
|
||||
|
||||
if (isReadWrite)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_readwrite);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_retain);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_weak)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_weak)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_weak);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_copy)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_copy)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
|
||||
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_unsafe_unretained);
|
||||
|
||||
if (isAssign)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign);
|
||||
|
||||
// In the semantic attributes, one of nonatomic or atomic is always set.
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_nonatomic)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_nonatomic)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_nonatomic);
|
||||
else
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_atomic);
|
||||
|
||||
// 'unsafe_unretained' is alias for 'assign'.
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_assign);
|
||||
if (isAssign)
|
||||
PDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_unsafe_unretained);
|
||||
|
@ -644,8 +644,8 @@ static void setImpliedPropertyAttributeForReadOnlyProperty(
|
|||
static void
|
||||
DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
|
||||
ObjCPropertyDecl *property) {
|
||||
unsigned Attributes = property->getPropertyAttributesAsWritten();
|
||||
bool warn = (Attributes & ObjCDeclSpec::DQ_PR_readonly);
|
||||
unsigned Attribute = property->getPropertyAttributesAsWritten();
|
||||
bool warn = (Attribute & ObjCDeclSpec::DQ_PR_readonly);
|
||||
for (const ObjCCategoryDecl *CDecl = ClassDecl->getFirstClassExtension();
|
||||
CDecl; CDecl = CDecl->getNextClassExtension()) {
|
||||
ObjCPropertyDecl *ClassExtProperty = 0;
|
||||
|
@ -664,7 +664,7 @@ DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
|
|||
// can override readonly->readwrite and 'setter' attributes originally
|
||||
// placed on class's property declaration now make sense in the overridden
|
||||
// property.
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_readonly) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_readonly) {
|
||||
if (!classExtPropertyAttr ||
|
||||
(classExtPropertyAttr &
|
||||
(ObjCDeclSpec::DQ_PR_readwrite|
|
||||
|
@ -685,15 +685,15 @@ DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
|
|||
ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_retain |
|
||||
ObjCDeclSpec::DQ_PR_strong);
|
||||
if (Attributes & setterAttrs) {
|
||||
if (Attribute & setterAttrs) {
|
||||
const char * which =
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_assign) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_assign) ?
|
||||
"assign" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained) ?
|
||||
"unsafe_unretained" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_copy) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_copy) ?
|
||||
"copy" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_retain) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_retain) ?
|
||||
"retain" : "strong";
|
||||
|
||||
S.Diag(property->getLocation(),
|
||||
|
@ -1641,7 +1641,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
|
|||
ObjCMethodDecl *SetterMethod = 0;
|
||||
bool LookedUpGetterSetter = false;
|
||||
|
||||
unsigned Attributes = Property->getPropertyAttributes();
|
||||
unsigned Attribute = Property->getPropertyAttributes();
|
||||
unsigned AttributesAsWritten = Property->getPropertyAttributesAsWritten();
|
||||
|
||||
if (!(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_atomic) &&
|
||||
|
@ -1664,8 +1664,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
|
|||
}
|
||||
|
||||
// We only care about readwrite atomic property.
|
||||
if ((Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) ||
|
||||
!(Attributes & ObjCPropertyDecl::OBJC_PR_readwrite))
|
||||
if ((Attribute & ObjCPropertyDecl::OBJC_PR_nonatomic) ||
|
||||
!(Attribute & ObjCPropertyDecl::OBJC_PR_readwrite))
|
||||
continue;
|
||||
if (const ObjCPropertyImplDecl *PIDecl
|
||||
= IMPDecl->FindPropertyImplDecl(Property->getIdentifier())) {
|
||||
|
@ -1918,7 +1918,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
|
|||
|
||||
void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
||||
SourceLocation Loc,
|
||||
unsigned &Attributes,
|
||||
unsigned &Attribute,
|
||||
bool propertyInPrimaryClass) {
|
||||
// FIXME: Improve the reported location.
|
||||
if (!PDecl || PDecl->isInvalidDecl())
|
||||
|
@ -1928,7 +1928,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
|||
QualType PropertyTy = PropertyDecl->getType();
|
||||
|
||||
if (getLangOpts().ObjCAutoRefCount &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
PropertyTy->isObjCRetainableType()) {
|
||||
// 'readonly' property with no obvious lifetime.
|
||||
// its life time will be determined by its backing ivar.
|
||||
|
@ -1938,7 +1938,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
|||
ObjCDeclSpec::DQ_PR_strong |
|
||||
ObjCDeclSpec::DQ_PR_weak |
|
||||
ObjCDeclSpec::DQ_PR_assign);
|
||||
if ((Attributes & rel) == 0)
|
||||
if ((Attribute & rel) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1946,132 +1946,132 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
|||
// we postpone most property diagnosis until class's implementation
|
||||
// because, its readonly attribute may be overridden in its class
|
||||
// extensions making other attributes, which make no sense, to make sense.
|
||||
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_readwrite))
|
||||
if ((Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_readwrite))
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "readonly" << "readwrite";
|
||||
}
|
||||
// readonly and readwrite/assign/retain/copy conflict.
|
||||
else if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attributes & (ObjCDeclSpec::DQ_PR_readwrite |
|
||||
else if ((Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attribute & (ObjCDeclSpec::DQ_PR_readwrite |
|
||||
ObjCDeclSpec::DQ_PR_assign |
|
||||
ObjCDeclSpec::DQ_PR_unsafe_unretained |
|
||||
ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_retain |
|
||||
ObjCDeclSpec::DQ_PR_strong))) {
|
||||
const char * which = (Attributes & ObjCDeclSpec::DQ_PR_readwrite) ?
|
||||
const char * which = (Attribute & ObjCDeclSpec::DQ_PR_readwrite) ?
|
||||
"readwrite" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_assign) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_assign) ?
|
||||
"assign" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained) ?
|
||||
"unsafe_unretained" :
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_copy) ?
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_copy) ?
|
||||
"copy" : "retain";
|
||||
|
||||
Diag(Loc, (Attributes & (ObjCDeclSpec::DQ_PR_readwrite)) ?
|
||||
Diag(Loc, (Attribute & (ObjCDeclSpec::DQ_PR_readwrite)) ?
|
||||
diag::err_objc_property_attr_mutually_exclusive :
|
||||
diag::warn_objc_property_attr_mutually_exclusive)
|
||||
<< "readonly" << which;
|
||||
}
|
||||
|
||||
// Check for copy or retain on non-object types.
|
||||
if ((Attributes & (ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy |
|
||||
if ((Attribute & (ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong)) &&
|
||||
!PropertyTy->isObjCRetainableType() &&
|
||||
!PropertyDecl->getAttr<ObjCNSObjectAttr>()) {
|
||||
Diag(Loc, diag::err_objc_property_requires_object)
|
||||
<< (Attributes & ObjCDeclSpec::DQ_PR_weak ? "weak" :
|
||||
Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain (or strong)");
|
||||
Attributes &= ~(ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy |
|
||||
<< (Attribute & ObjCDeclSpec::DQ_PR_weak ? "weak" :
|
||||
Attribute & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain (or strong)");
|
||||
Attribute &= ~(ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong);
|
||||
PropertyDecl->setInvalidDecl();
|
||||
}
|
||||
|
||||
// Check for more than one of { assign, copy, retain }.
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_assign) {
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_copy) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_assign) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_copy) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "assign" << "copy";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_copy;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_copy;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "assign" << "retain";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "assign" << "strong";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
}
|
||||
if (getLangOpts().ObjCAutoRefCount &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "assign" << "weak";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
}
|
||||
} else if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained) {
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_copy) {
|
||||
} else if (Attribute & ObjCDeclSpec::DQ_PR_unsafe_unretained) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_copy) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "unsafe_unretained" << "copy";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_copy;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_copy;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "unsafe_unretained" << "retain";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "unsafe_unretained" << "strong";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
}
|
||||
if (getLangOpts().ObjCAutoRefCount &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "unsafe_unretained" << "weak";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
}
|
||||
} else if (Attributes & ObjCDeclSpec::DQ_PR_copy) {
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_retain) {
|
||||
} else if (Attribute & ObjCDeclSpec::DQ_PR_copy) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_retain) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "copy" << "retain";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_strong) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_strong) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "copy" << "strong";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_strong;
|
||||
}
|
||||
if (Attributes & ObjCDeclSpec::DQ_PR_weak) {
|
||||
if (Attribute & ObjCDeclSpec::DQ_PR_weak) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "copy" << "weak";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
}
|
||||
}
|
||||
else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
else if ((Attribute & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "retain" << "weak";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_retain;
|
||||
}
|
||||
else if ((Attributes & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
else if ((Attribute & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_weak)) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "strong" << "weak";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_weak;
|
||||
}
|
||||
|
||||
if ((Attributes & ObjCDeclSpec::DQ_PR_atomic) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_nonatomic)) {
|
||||
if ((Attribute & ObjCDeclSpec::DQ_PR_atomic) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_nonatomic)) {
|
||||
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
|
||||
<< "atomic" << "nonatomic";
|
||||
Attributes &= ~ObjCDeclSpec::DQ_PR_atomic;
|
||||
Attribute &= ~ObjCDeclSpec::DQ_PR_atomic;
|
||||
}
|
||||
|
||||
// Warn if user supplied no assignment attribute, property is
|
||||
// readwrite, and this is an object type.
|
||||
if (!(Attributes & (ObjCDeclSpec::DQ_PR_assign | ObjCDeclSpec::DQ_PR_copy |
|
||||
if (!(Attribute & (ObjCDeclSpec::DQ_PR_assign | ObjCDeclSpec::DQ_PR_copy |
|
||||
ObjCDeclSpec::DQ_PR_unsafe_unretained |
|
||||
ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong |
|
||||
ObjCDeclSpec::DQ_PR_weak)) &&
|
||||
|
@ -2080,7 +2080,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
|||
// With arc, @property definitions should default to (strong) when
|
||||
// not specified; including when property is 'readonly'.
|
||||
PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong);
|
||||
else if (!(Attributes & ObjCDeclSpec::DQ_PR_readonly)) {
|
||||
else if (!(Attribute & ObjCDeclSpec::DQ_PR_readonly)) {
|
||||
bool isAnyClassTy =
|
||||
(PropertyTy->isObjCClassType() ||
|
||||
PropertyTy->isObjCQualifiedClassType());
|
||||
|
@ -2107,19 +2107,19 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
|
|||
// (please trim this list while you are at it).
|
||||
}
|
||||
|
||||
if (!(Attributes & ObjCDeclSpec::DQ_PR_copy)
|
||||
&&!(Attributes & ObjCDeclSpec::DQ_PR_readonly)
|
||||
if (!(Attribute & ObjCDeclSpec::DQ_PR_copy)
|
||||
&&!(Attribute & ObjCDeclSpec::DQ_PR_readonly)
|
||||
&& getLangOpts().getGC() == LangOptions::GCOnly
|
||||
&& PropertyTy->isBlockPointerType())
|
||||
Diag(Loc, diag::warn_objc_property_copy_missing_on_block);
|
||||
else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
!(Attributes & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
else if ((Attribute & ObjCDeclSpec::DQ_PR_retain) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
!(Attribute & ObjCDeclSpec::DQ_PR_strong) &&
|
||||
PropertyTy->isBlockPointerType())
|
||||
Diag(Loc, diag::warn_objc_property_retain_of_block);
|
||||
|
||||
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attributes & ObjCDeclSpec::DQ_PR_setter))
|
||||
if ((Attribute & ObjCDeclSpec::DQ_PR_readonly) &&
|
||||
(Attribute & ObjCDeclSpec::DQ_PR_setter))
|
||||
Diag(Loc, diag::warn_objc_readonly_property_has_setter);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//===--- TargetAttributesSema.h - Semantic Analysis For Target Attributes -===//
|
||||
//===--- TargetAttributesSema.h - Semantic Analysis For Target Attribute -===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
|
|
@ -752,7 +752,7 @@ bool CursorVisitor::VisitFunctionDecl(FunctionDecl *ND) {
|
|||
if (FTL && VisitFunctionTypeLoc(*FTL, true))
|
||||
return true;
|
||||
|
||||
// FIXME: Attributes?
|
||||
// FIXME: Attribute?
|
||||
}
|
||||
|
||||
if (ND->doesThisDeclarationHaveABody() && !ND->isLateTemplateParsed()) {
|
||||
|
|
Loading…
Reference in New Issue