diff options
| author | Pirama Arumuga Nainar <pirama@google.com> | 2016-06-09 23:34:20 +0000 |
|---|---|---|
| committer | Pirama Arumuga Nainar <pirama@google.com> | 2016-06-09 23:34:20 +0000 |
| commit | 8b788d013c7fb07ac96ac5f2f0a9a98141d0909b (patch) | |
| tree | bdf317a30de2582cdce90aeec58cbb6a2a0718b6 /clang/lib/Sema | |
| parent | b451f1bdf65d3bcd9fe60b21d26b003b18bf4601 (diff) | |
| download | bcm5719-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.cpp | 15 |
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; } } |

