summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
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
commit0608ae89a251e6bf417d696df67f87d6b0294252 (patch)
treea5da3e6b75c5dc04986bb62c3d7f25937b0f7ced /clang/lib/Sema
parentbf4755bb28ea7c6601487f6d20ffb665ca1bb093 (diff)
downloadbcm5719-llvm-0608ae89a251e6bf417d696df67f87d6b0294252.tar.gz
bcm5719-llvm-0608ae89a251e6bf417d696df67f87d6b0294252.zip
Add support for the 'endian' attribute for OpenCL.
llvm-svn: 177035
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index c9ccf80191e..c6e28c3e61a 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud