summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-03-13 18:42:30 +0000
committerReid Kleckner <rnk@google.com>2017-03-13 18:42:30 +0000
commit75a7e6589f643f6ed47d1fc04339696e7fb1e120 (patch)
tree56221319c868388bd1be7171a959ed135a865e1e /clang
parentc984e21394b74e63eec7e8b03f14a25882c25ae6 (diff)
downloadbcm5719-llvm-75a7e6589f643f6ed47d1fc04339696e7fb1e120.tar.gz
bcm5719-llvm-75a7e6589f643f6ed47d1fc04339696e7fb1e120.zip
Widen bitfield for type specifiers for OpenCL types
Added a static_assert to catch this issue at compile time. llvm-svn: 297654
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/Specifiers.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h
index 369a36f3dca..33952f83ff2 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -82,11 +82,12 @@ namespace clang {
/// \brief Structure that packs information about the type specifiers that
/// were written in a particular type specifier sequence.
struct WrittenBuiltinSpecs {
- /*DeclSpec::TST*/ unsigned Type : 5;
+ static_assert(TST_error < 1 << 6, "Type bitfield not wide enough for TST");
+ /*DeclSpec::TST*/ unsigned Type : 6;
/*DeclSpec::TSS*/ unsigned Sign : 2;
/*DeclSpec::TSW*/ unsigned Width : 2;
unsigned ModeAttr : 1;
- };
+ };
/// \brief A C++ access specifier (public, private, protected), plus the
/// special value "none" which means different things in different contexts.
OpenPOWER on IntegriCloud