aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-01-17 17:35:00 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-01-17 17:35:00 +0000
commit617bb317a7aeb6c3468a4170a5d6c1058da7cea1 (patch)
tree64f183c0cf6c88a6d8d8d96feee5101f732c395e /lib/Sema/SemaDecl.cpp
parent5096a44f2ec5ab9e5b801424e04919f4fcf29f1d (diff)
Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 728a58ee61..a13d8b3b46 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -9871,6 +9871,12 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
}
}
+ // OpenCL v1.2 s6.9.c: bitfields are not supported.
+ if (BitWidth && getLangOpts().OpenCL) {
+ Diag(Loc, diag::err_opencl_bitfields);
+ InvalidDecl = true;
+ }
+
// C99 6.7.2.1p8: A member of a structure or union may have any type other
// than a variably modified type.
if (!InvalidDecl && T->isVariablyModifiedType()) {