diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 5f6f81de14..d764bee097 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3859,6 +3859,11 @@ static void handleCallConvAttr(Sema &S, Decl *D, const AttributeList &Attr) { } switch (Attr.getKind()) { + case AttributeList::AT_ColdCC: + D->addAttr(::new (S.Context) + ColdCCAttr(Attr.getRange(), S.Context, + Attr.getAttributeSpellingListIndex())); + return; case AttributeList::AT_FastCall: D->addAttr(::new (S.Context) FastCallAttr(Attr.getRange(), S.Context, @@ -3939,6 +3944,7 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, // move to TargetAttributesSema one day. switch (attr.getKind()) { case AttributeList::AT_CDecl: CC = CC_C; break; + case AttributeList::AT_ColdCC: CC = CC_Cold; 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; @@ -3971,6 +3977,9 @@ bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, default: llvm_unreachable("unexpected attribute kind"); } + if (!isTargetSpecific(CC)) + return false; + const TargetInfo &TI = Context.getTargetInfo(); TargetInfo::CallingConvCheckResult A = TI.checkCallingConvention(CC); if (A == TargetInfo::CCCR_Warning) { @@ -4774,6 +4783,7 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D, break; case AttributeList::AT_StdCall: case AttributeList::AT_CDecl: + case AttributeList::AT_ColdCC: case AttributeList::AT_FastCall: case AttributeList::AT_ThisCall: case AttributeList::AT_Pascal: diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index c47a7f59ac..402e522eeb 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -100,6 +100,7 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, #define FUNCTION_TYPE_ATTRS_CASELIST \ case AttributeList::AT_NoReturn: \ case AttributeList::AT_CDecl: \ + case AttributeList::AT_ColdCC: \ case AttributeList::AT_FastCall: \ case AttributeList::AT_StdCall: \ case AttributeList::AT_ThisCall: \ @@ -3103,6 +3104,8 @@ static AttributeList::Kind getAttrListKind(AttributedType::Kind kind) { return AttributeList::AT_NoReturn; case AttributedType::attr_cdecl: return AttributeList::AT_CDecl; + case AttributedType::attr_coldcc: + return AttributeList::AT_ColdCC; case AttributedType::attr_fastcall: return AttributeList::AT_FastCall; case AttributedType::attr_stdcall: |