aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-03-14 09:54:43 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-03-14 09:54:43 +0000
commit96cead513761d287c88a4f05c712aee3b26b9d6f (patch)
tree24c61d7927c36601c108c6ee72ff46262b1989b4 /lib/Sema/SemaDeclAttr.cpp
parent8ef19a22956defa392df46c79e2d499ab7b16647 (diff)
Add support for the 'endian' attribute for OpenCL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index c9ccf80191..c6e28c3e61 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -2799,6 +2799,15 @@ static void handleVecTypeHint(Sema &S, Decl *D, const AttributeList &Attr) {
ParmType, Attr.getLoc()));
}
+static void handleEndianAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+ if (!dyn_cast<VarDecl>(D))
+ S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << "endian"
+ << 9;
+ StringRef EndianType = Attr.getParameterName()->getName();
+ if (EndianType != "host" && EndianType != "device")
+ S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_endian) << EndianType;
+}
+
SectionAttr *Sema::mergeSectionAttr(Decl *D, SourceRange Range,
StringRef Name,
unsigned AttrSpellingListIndex) {
@@ -4783,6 +4792,10 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_VecTypeHint:
handleVecTypeHint(S, D, Attr); break;
+ case AttributeList::AT_Endian:
+ handleEndianAttr(S, D, Attr);
+ break;
+
case AttributeList::AT_InitPriority:
handleInitPriorityAttr(S, D, Attr); break;