summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2016-06-09 23:34:20 +0000
committerPirama Arumuga Nainar <pirama@google.com>2016-06-09 23:34:20 +0000
commit8b788d013c7fb07ac96ac5f2f0a9a98141d0909b (patch)
treebdf317a30de2582cdce90aeec58cbb6a2a0718b6 /clang/lib/Sema
parentb451f1bdf65d3bcd9fe60b21d26b003b18bf4601 (diff)
downloadbcm5719-llvm-8b788d013c7fb07ac96ac5f2f0a9a98141d0909b.tar.gz
bcm5719-llvm-8b788d013c7fb07ac96ac5f2f0a9a98141d0909b.zip
RenderScript support in the Frontend
Summary: Create a new Frontend LangOpt to specify the renderscript language. It is enabled by the "-x renderscript" option from the driver. Add a "kernel" function attribute only for RenderScript (an "ignored attribute" warning is generated otherwise). Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied by the RenderScript LangOpt. Reviewers: rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21198 llvm-svn: 272342
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f4cce2febd9..e99876b10b7 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -4185,6 +4185,17 @@ static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D,
Attr.getAttributeSpellingListIndex()));
}
+static void handleKernelAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+ if (S.LangOpts.RenderScript) {
+ D->addAttr(::new (S.Context)
+ KernelAttr(Attr.getRange(), S.Context,
+ Attr.getAttributeSpellingListIndex()));
+ } else {
+ S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+ }
+}
+
+
//===----------------------------------------------------------------------===//
// Checker-specific attribute handlers.
//===----------------------------------------------------------------------===//
@@ -5914,6 +5925,10 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_TypeTagForDatatype:
handleTypeTagForDatatypeAttr(S, D, Attr);
break;
+
+ case AttributeList::AT_Kernel:
+ handleKernelAttr(S, D, Attr);
+ break;
}
}
OpenPOWER on IntegriCloud