diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 3 | ||||
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 1 | ||||
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 7 | ||||
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 6 | ||||
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 332 | ||||
-rw-r--r-- | lib/Sema/SemaStmtAttr.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 92 | ||||
-rw-r--r-- | lib/Sema/TargetAttributesSema.cpp | 4 |
9 files changed, 225 insertions, 224 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index e4545c152f..9aac837eb7 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -556,9 +556,6 @@ bool CXXDynamicCastExpr::isAlwaysNull() const const CXXRecordDecl *SrcRD = cast<CXXRecordDecl>(SrcType->castAs<RecordType>()->getDecl()); - if (!SrcRD->hasAttr<FinalAttr>()) - return false; - const CXXRecordDecl *DestRD = cast<CXXRecordDecl>(DestType->castAs<RecordType>()->getDecl()); diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 9cb9ed6061..3c14b7ce8c 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -791,6 +791,7 @@ static bool HasAttribute(const IdentifierInfo *II) { if (Name.startswith("__") && Name.endswith("__") && Name.size() >= 4) Name = Name.substr(2, Name.size() - 4); + // FIXME: Do we need to handle namespaces here? return llvm::StringSwitch<bool>(Name) #include "clang/Lex/AttrSpellings.inc" .Default(false); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2e95a317fd..dc8e120f57 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -277,7 +277,7 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName, Attrs.addNew(AttrName, SourceRange(AttrNameLoc, RParen), 0, AttrNameLoc, ParmName, ParmLoc, ArgExprs.take(), ArgExprs.size(), AttributeList::AS_GNU); - if (BuiltinType && attr->getKind() == AttributeList::AT_iboutletcollection) + if (BuiltinType && attr->getKind() == AttributeList::AT_IBOutletCollection) Diag(Tok, diag::err_iboutletcollection_builtintype); } } @@ -1875,9 +1875,12 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs, ExprVector ArgExprs(Actions); ArgExprs.push_back(ArgExpr.release()); + // FIXME: This should not be GNU, but we since the attribute used is + // based on the spelling, and there is no true spelling for + // C++11 attributes, this isn't accepted. Attrs.addNew(PP.getIdentifierInfo("aligned"), KWLoc, 0, KWLoc, 0, T.getOpenLocation(), ArgExprs.take(), 1, - AttributeList::AS_CXX11); + AttributeList::AS_GNU); } /// ParseDeclarationSpecifiers diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index b9062927c6..6e391c9022 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -2902,11 +2902,11 @@ void Parser::ParseCXX11AttributeSpecifier(ParsedAttributes &attrs, switch (AttributeList::getKind(AttrName, ScopeName, AttributeList::AS_CXX11)) { // No arguments - case AttributeList::AT_carries_dependency: + case AttributeList::AT_CarriesDependency: // FIXME: implement generic support of attributes with C++11 syntax // see Parse/ParseDecl.cpp: ParseGNUAttributes - case AttributeList::AT_fallthrough: - case AttributeList::AT_noreturn: { + case AttributeList::AT_FallThrough: + case AttributeList::AT_NoReturn: { if (Tok.is(tok::l_paren)) { Diag(Tok.getLocation(), diag::err_cxx11_attribute_forbids_arguments) << AttrName->getName(); diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index f6764c2999..c57699b23f 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -753,7 +753,7 @@ void DeclSpec::SaveWrittenBuiltinSpecs() { writtenBS.ModeAttr = false; AttributeList* attrs = getAttributes().getList(); while (attrs) { - if (attrs->getKind() == AttributeList::AT_mode) { + if (attrs->getKind() == AttributeList::AT_Mode) { writtenBS.ModeAttr = true; break; } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index e8682d78af..94a6f74a32 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3306,22 +3306,22 @@ static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) { } switch (Attr.getKind()) { - case AttributeList::AT_fastcall: + case AttributeList::AT_FastCall: D->addAttr(::new (S.Context) FastCallAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_stdcall: + case AttributeList::AT_StdCall: D->addAttr(::new (S.Context) StdCallAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_thiscall: + case AttributeList::AT_ThisCall: D->addAttr(::new (S.Context) ThisCallAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_cdecl: + case AttributeList::AT_CDecl: D->addAttr(::new (S.Context) CDeclAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_pascal: + case AttributeList::AT_Pascal: D->addAttr(::new (S.Context) PascalAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_pcs: { + case AttributeList::AT_Pcs: { Expr *Arg = Attr.getArg(0); StringLiteral *Str = dyn_cast<StringLiteral>(Arg); if (!Str || !Str->isAscii()) { @@ -3360,7 +3360,7 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC) { return true; if ((attr.getNumArgs() != 0 && - !(attr.getKind() == AttributeList::AT_pcs && attr.getNumArgs() == 1)) || + !(attr.getKind() == AttributeList::AT_Pcs && attr.getNumArgs() == 1)) || attr.getParameterName()) { Diag(attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0; attr.setInvalid(); @@ -3370,12 +3370,12 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC) { // TODO: diagnose uses of these conventions on the wrong target. Or, better // move to TargetAttributesSema one day. switch (attr.getKind()) { - case AttributeList::AT_cdecl: CC = CC_C; break; - case AttributeList::AT_fastcall: CC = CC_X86FastCall; break; - case AttributeList::AT_stdcall: CC = CC_X86StdCall; break; - case AttributeList::AT_thiscall: CC = CC_X86ThisCall; break; - case AttributeList::AT_pascal: CC = CC_X86Pascal; break; - case AttributeList::AT_pcs: { + case AttributeList::AT_CDecl: CC = CC_C; break; + case AttributeList::AT_FastCall: CC = CC_X86FastCall; break; + case AttributeList::AT_StdCall: CC = CC_X86StdCall; break; + case AttributeList::AT_ThisCall: CC = CC_X86ThisCall; break; + case AttributeList::AT_Pascal: CC = CC_X86Pascal; break; + case AttributeList::AT_Pcs: { Expr *Arg = attr.getArg(0); StringLiteral *Str = dyn_cast<StringLiteral>(Arg); if (!Str || !Str->isAscii()) { @@ -3526,7 +3526,7 @@ static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) { } bool typeOK, cf; - if (Attr.getKind() == AttributeList::AT_ns_consumed) { + if (Attr.getKind() == AttributeList::AT_NSConsumed) { typeOK = isValidSubjectOfNSAttribute(S, param->getType()); cf = false; } else { @@ -3567,7 +3567,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) returnType = PD->getType(); else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) && - (Attr.getKind() == AttributeList::AT_ns_returns_retained)) + (Attr.getKind() == AttributeList::AT_NSReturnsRetained)) return; // ignore: was handled as a type attribute else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) returnType = FD->getResultType(); @@ -3582,15 +3582,15 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, bool cf; switch (Attr.getKind()) { default: llvm_unreachable("invalid ownership attribute"); - case AttributeList::AT_ns_returns_autoreleased: - case AttributeList::AT_ns_returns_retained: - case AttributeList::AT_ns_returns_not_retained: + case AttributeList::AT_NSReturnsAutoreleased: + case AttributeList::AT_NSReturnsRetained: + case AttributeList::AT_NSReturnsNotRetained: typeOK = isValidSubjectOfNSAttribute(S, returnType); cf = false; break; - case AttributeList::AT_cf_returns_retained: - case AttributeList::AT_cf_returns_not_retained: + case AttributeList::AT_CFReturnsRetained: + case AttributeList::AT_CFReturnsNotRetained: typeOK = isValidSubjectOfCFAttribute(S, returnType); cf = true; break; @@ -3605,23 +3605,23 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, switch (Attr.getKind()) { default: llvm_unreachable("invalid ownership attribute"); - case AttributeList::AT_ns_returns_autoreleased: + case AttributeList::AT_NSReturnsAutoreleased: D->addAttr(::new (S.Context) NSReturnsAutoreleasedAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_cf_returns_not_retained: + case AttributeList::AT_CFReturnsNotRetained: D->addAttr(::new (S.Context) CFReturnsNotRetainedAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_ns_returns_not_retained: + case AttributeList::AT_NSReturnsNotRetained: D->addAttr(::new (S.Context) NSReturnsNotRetainedAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_cf_returns_retained: + case AttributeList::AT_CFReturnsRetained: D->addAttr(::new (S.Context) CFReturnsRetainedAttr(Attr.getRange(), S.Context)); return; - case AttributeList::AT_ns_returns_retained: + case AttributeList::AT_NSReturnsRetained: D->addAttr(::new (S.Context) NSReturnsRetainedAttr(Attr.getRange(), S.Context)); return; @@ -3665,7 +3665,7 @@ static void handleCFTransferAttr(Sema &S, Decl *D, const AttributeList &A) { return; } - bool IsAudited = (A.getKind() == AttributeList::AT_cf_audited_transfer); + bool IsAudited = (A.getKind() == AttributeList::AT_CFAuditedTransfer); // Check whether there's a conflicting attribute already present. Attr *Existing; @@ -3780,14 +3780,14 @@ static bool isKnownDeclSpecAttr(const AttributeList &Attr) { switch (Attr.getKind()) { default: return false; - case AttributeList::AT_dllimport: - case AttributeList::AT_dllexport: - case AttributeList::AT_uuid: - case AttributeList::AT_deprecated: - case AttributeList::AT_noreturn: - case AttributeList::AT_nothrow: - case AttributeList::AT_naked: - case AttributeList::AT_noinline: + case AttributeList::AT_DLLImport: + case AttributeList::AT_DLLExport: + case AttributeList::AT_Uuid: + case AttributeList::AT_Deprecated: + case AttributeList::AT_NoReturn: + case AttributeList::AT_NoThrow: + case AttributeList::AT_Naked: + case AttributeList::AT_NoInline: return true; } } @@ -3853,13 +3853,13 @@ static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (S.LangOpts.MicrosoftExt) { AttributeList::Kind Kind = Attr.getKind(); - if (Kind == AttributeList::AT_single_inheritance) + if (Kind == AttributeList::AT_SingleInheritance) D->addAttr( ::new (S.Context) SingleInheritanceAttr(Attr.getRange(), S.Context)); - else if (Kind == AttributeList::AT_multiple_inheritance) + else if (Kind == AttributeList::AT_MultipleInheritance) D->addAttr( ::new (S.Context) MultipleInheritanceAttr(Attr.getRange(), S.Context)); - else if (Kind == AttributeList::AT_virtual_inheritance) + else if (Kind == AttributeList::AT_VirtualInheritance) D->addAttr( ::new (S.Context) VirtualInheritanceAttr(Attr.getRange(), S.Context)); } else @@ -3869,13 +3869,13 @@ static void handleInheritanceAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void handlePortabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (S.LangOpts.MicrosoftExt) { AttributeList::Kind Kind = Attr.getKind(); - if (Kind == AttributeList::AT_ptr32) + if (Kind == AttributeList::AT_Ptr32) D->addAttr( ::new (S.Context) Ptr32Attr(Attr.getRange(), S.Context)); - else if (Kind == AttributeList::AT_ptr64) + else if (Kind == AttributeList::AT_Ptr64) D->addAttr( ::new (S.Context) Ptr64Attr(Attr.getRange(), S.Context)); - else if (Kind == AttributeList::AT_w64) + else if (Kind == AttributeList::AT_Win64) D->addAttr( ::new (S.Context) Win64Attr(Attr.getRange(), S.Context)); } else @@ -3896,9 +3896,9 @@ static void handleForceInlineAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void ProcessNonInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, const AttributeList &Attr) { switch (Attr.getKind()) { - case AttributeList::AT_device: handleDeviceAttr (S, D, Attr); break; - case AttributeList::AT_host: handleHostAttr (S, D, Attr); break; - case AttributeList::AT_overloadable:handleOverloadableAttr(S, D, Attr); break; + case AttributeList::AT_CUDADevice: handleDeviceAttr (S, D, Attr); break; + case AttributeList::AT_CUDAHost: handleHostAttr (S, D, Attr); break; + case AttributeList::AT_Overloadable:handleOverloadableAttr(S, D, Attr); break; default: break; } @@ -3907,242 +3907,242 @@ static void ProcessNonInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, const AttributeList &Attr) { switch (Attr.getKind()) { - case AttributeList::AT_ibaction: handleIBAction(S, D, Attr); break; - case AttributeList::AT_iboutlet: handleIBOutlet(S, D, Attr); break; - case AttributeList::AT_iboutletcollection: + case AttributeList::AT_IBAction: handleIBAction(S, D, Attr); break; + case AttributeList::AT_IBOutlet: handleIBOutlet(S, D, Attr); break; + case AttributeList::AT_IBOutletCollection: handleIBOutletCollection(S, D, Attr); break; - case AttributeList::AT_address_space: - case AttributeList::AT_opencl_image_access: - case AttributeList::AT_objc_gc: - case AttributeList::AT_vector_size: - case AttributeList::AT_neon_vector_type: - case AttributeList::AT_neon_polyvector_type: + case AttributeList::AT_AddressSpace: + case AttributeList::AT_OpenCLImageAccess: + case AttributeList::AT_ObjCGC: + case AttributeList::AT_VectorSize: + case AttributeList::AT_NeonVectorType: + case AttributeList::AT_NeonPolyVectorType: // Ignore these, these are type attributes, handled by // ProcessTypeAttributes. break; - case AttributeList::AT_device: - case AttributeList::AT_host: - case AttributeList::AT_overloadable: + case AttributeList::AT_CUDADevice: + case AttributeList::AT_CUDAHost: + case AttributeList::AT_Overloadable: // Ignore, this is a non-inheritable attribute, handled // by ProcessNonInheritableDeclAttr. break; - case AttributeList::AT_alias: handleAliasAttr (S, D, Attr); break; - case AttributeList::AT_aligned: handleAlignedAttr (S, D, Attr); break; - case AttributeList::AT_alloc_size: handleAllocSizeAttr (S, D, Attr); break; - case AttributeList::AT_always_inline: + case AttributeList::AT_Alias: handleAliasAttr (S, D, Attr); break; + case AttributeList::AT_Aligned: handleAlignedAttr (S, D, Attr); break; + case AttributeList::AT_AllocSize: handleAllocSizeAttr (S, D, Attr); break; + case AttributeList::AT_AlwaysInline: handleAlwaysInlineAttr (S, D, Attr); break; - case AttributeList::AT_analyzer_noreturn: + case AttributeList::AT_AnalyzerNoReturn: handleAnalyzerNoReturnAttr (S, D, Attr); break; - case AttributeList::AT_annotate: handleAnnotateAttr (S, D, Attr); break; - case AttributeList::AT_availability:handleAvailabilityAttr(S, D, Attr); break; - case AttributeList::AT_carries_dependency: + case AttributeList::AT_Annotate: handleAnnotateAttr (S, D, Attr); break; + case AttributeList::AT_Availability:handleAvailabilityAttr(S, D, Attr); break; + case AttributeList::AT_CarriesDependency: handleDependencyAttr (S, D, Attr); break; - case AttributeList::AT_common: handleCommonAttr (S, D, Attr); break; - case AttributeList::AT_constant: handleConstantAttr (S, D, Attr); break; - case AttributeList::AT_constructor: handleConstructorAttr (S, D, Attr); break; - case AttributeList::AT_deprecated: + case AttributeList::AT_Common: handleCommonAttr (S, D, Attr); break; + case AttributeList::AT_CUDAConstant:handleConstantAttr (S, D, Attr); break; + case AttributeList::AT_Constructor: handleConstructorAttr (S, D, Attr); break; + case AttributeList::AT_Deprecated: handleAttrWithMessage<DeprecatedAttr>(S, D, Attr, "deprecated"); break; - case AttributeList::AT_destructor: handleDestructorAttr (S, D, Attr); break; - case AttributeList::AT_ext_vector_type: + case AttributeList::AT_Destructor: handleDestructorAttr (S, D, Attr); break; + case AttributeList::AT_ExtVectorType: handleExtVectorTypeAttr(S, scope, D, Attr); break; - case AttributeList::AT_format: handleFormatAttr (S, D, Attr); break; - case AttributeList::AT_format_arg: handleFormatArgAttr (S, D, Attr); break; - case AttributeList::AT_global: handleGlobalAttr (S, D, Attr); break; - case AttributeList::AT_gnu_inline: handleGNUInlineAttr (S, D, Attr); break; - case AttributeList::AT_launch_bounds: + case AttributeList::AT_Format: handleFormatAttr (S, D, Attr); break; + case AttributeList::AT_FormatArg: handleFormatArgAttr (S, D, Attr); break; + case AttributeList::AT_CUDAGlobal: handleGlobalAttr (S, D, Attr); break; + case AttributeList::AT_GNUInline: handleGNUInlineAttr (S, D, Attr); break; + case AttributeList::AT_CUDALaunchBounds: handleLaunchBoundsAttr(S, D, Attr); break; - case AttributeList::AT_mode: handleModeAttr (S, D, Attr); break; - case AttributeList::AT_malloc: handleMallocAttr (S, D, Attr); break; - case AttributeList::AT_may_alias: handleMayAliasAttr (S, D, Attr); break; - case AttributeList::AT_nocommon: handleNoCommonAttr (S, D, Attr); break; - case AttributeList::AT_nonnull: handleNonNullAttr (S, D, Attr); break; + case AttributeList::AT_Mode: handleModeAttr (S, D, Attr); break; + case AttributeList::AT_Malloc: handleMallocAttr (S, D, Attr); break; + case AttributeList::AT_MayAlias: handleMayAliasAttr (S, D, Attr); break; + case AttributeList::AT_NoCommon: handleNoCommonAttr (S, D, Attr); break; + case AttributeList::AT_NonNull: handleNonNullAttr (S, D, Attr); break; case AttributeList::AT_ownership_returns: case AttributeList::AT_ownership_takes: case AttributeList::AT_ownership_holds: handleOwnershipAttr (S, D, Attr); break; - case AttributeList::AT_cold: handleColdAttr (S, D, Attr); break; - case AttributeList::AT_hot: handleHotAttr (S, D, Attr); break; - case AttributeList::AT_naked: handleNakedAttr (S, D, Attr); break; - case AttributeList::AT_noreturn: handleNoReturnAttr (S, D, Attr); break; - case AttributeList::AT_nothrow: handleNothrowAttr (S, D, Attr); break; - case AttributeList::AT_shared: handleSharedAttr (S, D, Attr); break; - case AttributeList::AT_vecreturn: handleVecReturnAttr (S, D, Attr); break; - - case AttributeList::AT_objc_ownership: + case AttributeList::AT_Cold: handleColdAttr (S, D, Attr); break; + case AttributeList::AT_Hot: handleHotAttr (S, D, Attr); break; + case AttributeList::AT_Naked: handleNakedAttr (S, D, Attr); break; + case AttributeList::AT_NoReturn: handleNoReturnAttr (S, D, Attr); break; + case AttributeList::AT_NoThrow: handleNothrowAttr (S, D, Attr); break; + case AttributeList::AT_CUDAShared: handleSharedAttr (S, D, Attr); break; + case AttributeList::AT_VecReturn: handleVecReturnAttr (S, D, Attr); break; + + case AttributeList::AT_ObjCOwnership: handleObjCOwnershipAttr(S, D, Attr); break; - case AttributeList::AT_objc_precise_lifetime: + case AttributeList::AT_ObjCPreciseLifetime: handleObjCPreciseLifetimeAttr(S, D, Attr); break; - case AttributeList::AT_objc_returns_inner_pointer: + case AttributeList::AT_ObjCReturnsInnerPointer: handleObjCReturnsInnerPointerAttr(S, D, Attr); break; - case AttributeList::AT_ns_bridged: + case AttributeList::AT_NSBridged: handleNSBridgedAttr(S, scope, D, Attr); break; - case AttributeList::AT_cf_audited_transfer: - case AttributeList::AT_cf_unknown_transfer: + case AttributeList::AT_CFAuditedTransfer: + case AttributeList::AT_CFUnknownTransfer: handleCFTransferAttr(S, D, Attr); break; // Checker-specific. - case AttributeList::AT_cf_consumed: - case AttributeList::AT_ns_consumed: handleNSConsumedAttr (S, D, Attr); break; - case AttributeList::AT_ns_consumes_self: + case AttributeList::AT_CFConsumed: + case AttributeList::AT_NSConsumed: handleNSConsumedAttr (S, D, Attr); break; + case AttributeList::AT_NSConsumesSelf: handleNSConsumesSelfAttr(S, D, Attr); break; - case AttributeList::AT_ns_returns_autoreleased: - case AttributeList::AT_ns_returns_not_retained: - case AttributeList::AT_cf_returns_not_retained: - case AttributeList::AT_ns_returns_retained: - case AttributeList::AT_cf_returns_retained: + case AttributeList::AT_NSReturnsAutoreleased: + case AttributeList::AT_NSReturnsNotRetained: + case AttributeList::AT_CFReturnsNotRetained: + case AttributeList::AT_NSReturnsRetained: + case AttributeList::AT_CFReturnsRetained: handleNSReturnsRetainedAttr(S, D, Attr); break; - case AttributeList::AT_reqd_work_group_size: + case AttributeList::AT_ReqdWorkGroupSize: handleReqdWorkGroupSize(S, D, Attr); break; - case AttributeList::AT_init_priority: + case AttributeList::AT_InitPriority: handleInitPriorityAttr(S, D, Attr); break; - case AttributeList::AT_packed: handlePackedAttr (S, D, Attr); break; - case AttributeList::AT_section: handleSectionAttr (S, D, Attr); break; - case AttributeList::AT_unavailable: + case AttributeList::AT_Packed: handlePackedAttr (S, D, Attr); break; + case AttributeList::AT_Section: handleSectionAttr (S, D, Attr); break; + case AttributeList::AT_Unavailable: handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable"); break; - case AttributeList::AT_objc_arc_weak_reference_unavailable: + case AttributeList::AT_ArcWeakrefUnavailable: handleArcWeakrefUnavailableAttr (S, D, Attr); break; - case AttributeList::AT_objc_root_class: + case AttributeList::AT_ObjCRootClass: handleObjCRootClassAttr(S, D, Attr); break; - case AttributeList::AT_objc_requires_property_definitions: + case AttributeList::AT_ObjCRequiresPropertyDefs: handleObjCRequiresPropertyDefsAttr (S, D, Attr); break; - case AttributeList::AT_unused: handleUnusedAttr (S, D, Attr); break; - case AttributeList::AT_returns_twice: + case AttributeList::AT_Unused: handleUnusedAttr (S, D, Attr); break; + case AttributeList::AT_ReturnsTwice: handleReturnsTwiceAttr(S, D, Attr); break; - case AttributeList::AT_used: handleUsedAttr (S, D, Attr); break; - case AttributeList::AT_visibility: handleVisibilityAttr (S, D, Attr); break; - case AttributeList::AT_warn_unused_result: handleWarnUnusedResult(S, D, Attr); + case AttributeList::AT_Used: handleUsedAttr (S, D, Attr); break; + case AttributeList::AT_Visibility: handleVisibilityAttr (S, D, Attr); break; + case AttributeList::AT_WarnUnusedResult: handleWarnUnusedResult(S, D, Attr); break; - case AttributeList::AT_weak: handleWeakAttr (S, D, Attr); break; - case AttributeList::AT_weakref: handleWeakRefAttr (S, D, Attr); break; - case AttributeList::AT_weak_import: handleWeakImportAttr (S, D, Attr); break; - case AttributeList::AT_transparent_union: + case AttributeList::AT_Weak: handleWeakAttr (S, D, Attr); break; + case AttributeList::AT_WeakRef: handleWeakRefAttr (S, D, Attr); break; + case AttributeList::AT_WeakImport: handleWeakImportAttr (S, D, Attr); break; + case AttributeList::AT_TransparentUnion: handleTransparentUnionAttr(S, D, Attr); break; - case AttributeList::AT_objc_exception: + case AttributeList::AT_ObjCException: handleObjCExceptionAttr(S, D, Attr); break; - case AttributeList::AT_objc_method_family: + case AttributeList::AT_ObjCMethodFamily: handleObjCMethodFamilyAttr(S, D, Attr); break; - case AttributeList::AT_NSObject: handleObjCNSObject (S, D, Attr); break; - case AttributeList::AT_blocks: handleBlocksAttr (S, D, Attr); break; - case AttributeList::AT_sentinel: handleSentinelAttr (S, D, Attr); break; - case AttributeList::AT_const: handleConstAttr (S, D, Attr); break; - case AttributeList::AT_pure: handlePureAttr (S, D, Attr); break; - case AttributeList::AT_cleanup: handleCleanupAttr (S, D, Attr); break; - case AttributeList::AT_nodebug: handleNoDebugAttr (S, D, Attr); break; - case AttributeList::AT_noinline: handleNoInlineAttr (S, D, Attr); break; - case AttributeList::AT_regparm: handleRegparmAttr (S, D, Attr); break; + case AttributeList::AT_ObjCNSObject:handleObjCNSObject (S, D, Attr); break; + case AttributeList::AT_Blocks: handleBlocksAttr (S, D, Attr); break; + case AttributeList::AT_Sentinel: handleSentinelAttr (S, D, Attr); break; + case AttributeList::AT_Const: handleConstAttr (S, D, Attr); break; + case AttributeList::AT_Pure: handlePureAttr (S, D, Attr); break; + case AttributeList::AT_Cleanup: handleCleanupAttr (S, D, Attr); break; + case AttributeList::AT_NoDebug: handleNoDebugAttr (S, D, Attr); break; + case AttributeList::AT_NoInline: handleNoInlineAttr (S, D, Attr); break; + case AttributeList::AT_Regparm: handleRegparmAttr (S, D, Attr); break; case AttributeList::IgnoredAttribute: // Just ignore break; - case AttributeList::AT_no_instrument_function: // Interacts with -pg. + case AttributeList::AT_NoInstrumentFunction: // Interacts with -pg. handleNoInstrumentFunctionAttr(S, D, Attr); break; - case AttributeList::AT_stdcall: - case AttributeList::AT_cdecl: - case AttributeList::AT_fastcall: - case AttributeList::AT_thiscall: - case AttributeList::AT_pascal: - case AttributeList::AT_pcs: + case AttributeList::AT_StdCall: + case AttributeList::AT_CDecl: + case AttributeList::AT_FastCall: + case AttributeList::AT_ThisCall: + case AttributeList::AT_Pascal: + case AttributeList::AT_Pcs: handleCallConvAttr(S, D, Attr); break; - case AttributeList::AT_opencl_kernel_function: + case AttributeList::AT_OpenCLKernel: handleOpenCLKernelAttr(S, D, Attr); break; // Microsoft attributes: - case AttributeList::AT_ms_struct: + case AttributeList::AT_MsStruct: handleMsStructAttr(S, D, Attr); break; - case AttributeList::AT_uuid: + case AttributeList::AT_Uuid: handleUuidAttr(S, D, Attr); break; - case AttributeList::AT_single_inheritance: - case AttributeList::AT_multiple_inheritance: - case AttributeList::AT_virtual_inheritance: + case AttributeList::AT_SingleInheritance: + case AttributeList::AT_MultipleInheritance: + case AttributeList::AT_VirtualInheritance: handleInheritanceAttr(S, D, Attr); break; - case AttributeList::AT_w64: - case AttributeList::AT_ptr32: - case AttributeList::AT_ptr64: + case AttributeList::AT_Win64: + case AttributeList::AT_Ptr32: + case AttributeList::AT_Ptr64: handlePortabilityAttr(S, D, Attr); break; - case AttributeList::AT_forceinline: + case AttributeList::AT_ForceInline: handleForceInlineAttr(S, D, Attr); break; // Thread safety attributes: - case AttributeList::AT_guarded_var: + case AttributeList::AT_GuardedVar: handleGuardedVarAttr(S, D, Attr); break; - case AttributeList::AT_pt_guarded_var: + case AttributeList::AT_PtGuardedVar: handleGuardedVarAttr(S, D, Attr, /*pointer = */true); break; - case AttributeList::AT_scoped_lockable: + case AttributeList::AT_ScopedLockable: handleLockableAttr(S, D, Attr, /*scoped = */true); break; - case AttributeList::AT_no_address_safety_analysis: + case AttributeList::AT_NoAddressSafetyAnalysis: handleNoAddressSafetyAttr(S, D, Attr); break; - case AttributeList::AT_no_thread_safety_analysis: + case AttributeList::AT_NoThreadSafetyAnalysis: handleNoThreadSafetyAttr(S, D, Attr); break; - case AttributeList::AT_lockable: + case AttributeList::AT_Lockable: handleLockableAttr(S, D, Attr); break; - case AttributeList::AT_guarded_by: + case AttributeList::AT_GuardedBy: handleGuardedByAttr(S, D, Attr); break; - case AttributeList::AT_pt_guarded_by: + case AttributeList::AT_PtGuardedBy: handleGuardedByAttr(S, D, Attr, /*pointer = */true); break; - case AttributeList::AT_exclusive_lock_function: + case AttributeList::AT_ExclusiveLockFunction: handleLockFunAttr(S, D, Attr, /*exclusive = */true); break; - case AttributeList::AT_exclusive_locks_required: + case AttributeList::AT_ExclusiveLocksRequired: handleLocksRequiredAttr(S, D, Attr, /*exclusive = */true); break; - case AttributeList::AT_exclusive_trylock_function: + case AttributeList::AT_ExclusiveTrylockFunction: handleTrylockFunAttr(S, D, Attr, /*exclusive = */true); break; - case AttributeList::AT_lock_returned: + case AttributeList::AT_LockReturned: handleLockReturnedAttr(S, D, Attr); break; - case AttributeList::AT_locks_excluded: + case AttributeList::AT_LocksExcluded: handleLocksExcludedAttr(S, D, Attr); break; - case AttributeList::AT_shared_lock_function: + case AttributeList::AT_SharedLockFunction: handleLockFunAttr(S, D, Attr); break; - case AttributeList::AT_shared_locks_required: + case AttributeList::AT_SharedLocksRequired: handleLocksRequiredAttr(S, D, Attr); break; - case AttributeList::AT_shared_trylock_function: + case AttributeList::AT_SharedTrylockFunction: handleTrylockFunAttr(S, D, Attr); break; - case AttributeList::AT_unlock_function: + case AttributeList::AT_UnlockFunction: handleUnlockFunAttr(S, D, Attr); break; - case AttributeList::AT_acquired_before: + case AttributeList::AT_AcquiredBefore: handleAcquireOrderAttr(S, D, Attr, /*before = */true); break; - case AttributeList::AT_acquired_after: + case AttributeList::AT_AcquiredAfter: handleAcquireOrderAttr(S, D, Attr, /*before = */false); break; @@ -4201,7 +4201,7 @@ void Sema::ProcessDeclAttributeList(Scope *S, Decl *D, bool Sema::ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const AttributeList *AttrList) { for (const AttributeList* l = AttrList; l; l = l->getNext()) { - if (l->getKind() == AttributeList::AT_annotate) { + if (l->getKind() == AttributeList::AT_Annotate) { handleAnnotateAttr(*this, ASDecl, *l); } else { Diag(l->getLoc(), diag::err_only_annotate_after_access_spec); diff --git a/lib/Sema/SemaStmtAttr.cpp b/lib/Sema/SemaStmtAttr.cpp index 60b2d1e3ff..395b9d6259 100644 --- a/lib/Sema/SemaStmtAttr.cpp +++ b/lib/Sema/SemaStmtAttr.cpp @@ -48,7 +48,7 @@ static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const AttributeList &A, static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A, SourceRange Range) { switch (A.getKind()) { - case AttributeList::AT_fallthrough: + case AttributeList::AT_FallThrough: return handleFallThroughAttr(S, St, A, Range); default: // if we're here, then we parsed an attribute, but didn't recognize it as a diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 0bdf75b3ae..d6c8d92ce8 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -59,12 +59,12 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, unsigned diagID = 0; switch (attr.getKind()) { - case AttributeList::AT_objc_gc: + case AttributeList::AT_ObjCGC: diagID = diag::warn_pointer_attribute_wrong_type; useExpansionLoc = true; break; - case AttributeList::AT_objc_ownership: + case AttributeList::AT_ObjCOwnership: diagID = diag::warn_objc_object_attribute_wrong_type; useExpansionLoc = true; break; @@ -93,19 +93,19 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, // objc_gc applies to Objective-C pointers or, otherwise, to the // smallest available pointer type (i.e. 'void*' in 'void**'). #define OBJC_POINTER_TYPE_ATTRS_CASELIST \ - case AttributeList::AT_objc_gc: \ - case AttributeList::AT_objc_ownership + case AttributeList::AT_ObjCGC: \ + case AttributeList::AT_ObjCOwnership // Function type attributes. #define FUNCTION_TYPE_ATTRS_CASELIST \ - case AttributeList::AT_noreturn: \ - case AttributeList::AT_cdecl: \ - case AttributeList::AT_fastcall: \ - case AttributeList::AT_stdcall: \ - case AttributeList::AT_thiscall: \ - case AttributeList::AT_pascal: \ - case AttributeList::AT_regparm: \ - case AttributeList::AT_pcs \ + case AttributeList::AT_NoReturn: \ + case AttributeList::AT_CDecl: \ + case AttributeList::AT_FastCall: \ + case AttributeList::AT_StdCall: \ + case AttributeList::AT_ThisCall: \ + case AttributeList::AT_Pascal: \ + case AttributeList::AT_Regparm: \ + case AttributeList::AT_Pcs \ namespace { /// An object which stores processing state for the entire @@ -284,9 +284,9 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, static bool handleObjCPointerTypeAttr(TypeProcessingState &state, AttributeList &attr, QualType &type) { - if (attr.getKind() == AttributeList::AT_objc_gc) + if (attr.getKind() == AttributeList::AT_ObjCGC) return handleObjCGCTypeAttr(state, attr, type); - assert(attr.getKind() == AttributeList::AT_objc_ownership); + assert(attr.getKind() == AttributeList::AT_ObjCOwnership); return handleObjCOwnershipTypeAttr(state, attr, type); } @@ -505,7 +505,7 @@ static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, distributeObjCPointerTypeAttrFromDeclarator(state, *attr, declSpecType); break; - case AttributeList::AT_ns_returns_retained: + case AttributeList::AT_NSReturnsRetained: if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; // fallthrough @@ -1719,7 +1719,7 @@ static void inferARCWriteback(TypeProcessingState &state, return; for (const AttributeList *attr = chunk.getAttrs(); attr; attr = attr->getNext()) - if (attr->getKind() == AttributeList::AT_objc_ownership) + if (attr->getKind() == AttributeList::AT_ObjCOwnership) return; transferARCOwnershipToDeclaratorChunk(state, Qualifiers::OCL_Autoreleasing, @@ -2280,7 +2280,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, bool Overloadable = false; for (const AttributeList *Attrs = D.getAttributes(); Attrs; Attrs = Attrs->getNext()) { - if (Attrs->getKind() == AttributeList::AT_overloadable) { + if (Attrs->getKind() == AttributeList::AT_Overloadable) { Overloadable = true; break; } @@ -2710,7 +2710,7 @@ static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state, DeclaratorChunk &chunk = D.getTypeObject(chunkIndex); for (const AttributeList *attr = chunk.getAttrs(); attr; attr = attr->getNext()) - if (attr->getKind() == AttributeList::AT_objc_ownership) + if (attr->getKind() == AttributeList::AT_ObjCOwnership) return; const char *attrStr = 0; @@ -2806,33 +2806,33 @@ TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) { static AttributeList::Kind getAttrListKind(AttributedType::Kind kind) { switch (kind) { case AttributedType::attr_address_space: - return AttributeList::AT_address_space; + return AttributeLi |