diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-07-26 16:35:53 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-07-26 16:35:53 +0000 |
commit | 7a0666d0f312ee33dba0935018e7b758b89d202c (patch) | |
tree | a2356834a765655df4ad2f5290c6400ab8b59f69 /lib/AST | |
parent | 3378e4c41b473dcb573f8d7c99fc15eb8e855428 (diff) |
Merging r309058:
------------------------------------------------------------------------
r309058 | majnemer | 2017-07-25 16:33:58 -0700 (Tue, 25 Jul 2017) | 9 lines
[CodeGen] Correctly model std::byte's aliasing properties
std::byte, when defined as an enum, needs to be given special treatment
with regards to its aliasing properties. An array of std::byte is
allowed to be used as storage for other types.
This fixes PR33916.
Differential Revision: https://reviews.llvm.org/D35824
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@309135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/Type.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index eac02c0102..d21781dc38 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -2313,6 +2313,15 @@ bool Type::isAlignValT() const { return false; } +bool Type::isStdByteType() const { + if (auto *ET = getAs<EnumType>()) { + auto *II = ET->getDecl()->getIdentifier(); + if (II && II->isStr("byte") && ET->getDecl()->isInStdNamespace()) + return true; + } + return false; +} + bool Type::isPromotableIntegerType() const { if (const BuiltinType *BT = getAs<BuiltinType>()) switch (BT->getKind()) { |