summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorKarthik Bhat <kv.bhat@samsung.com>2017-06-28 08:52:08 +0000
committerKarthik Bhat <kv.bhat@samsung.com>2017-06-28 08:52:08 +0000
commite1ae1b23c99010db5fb27c00d80fed700a49160f (patch)
tree5893e7b715ca986f7680b53a176096686b2297fd /clang/lib
parent002655df17a64a2e57601c7da0d92479d70d15f4 (diff)
downloadbcm5719-llvm-e1ae1b23c99010db5fb27c00d80fed700a49160f.tar.gz
bcm5719-llvm-e1ae1b23c99010db5fb27c00d80fed700a49160f.zip
Fix crash in clang while handling __has_trivial_destructor.
Fix crash in clang when an array of unknown bounds of an incomplete type is passed to __has_trivial_destructor. Patch by Puneetha https://reviews.llvm.org/D34198 llvm-svn: 306519
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 710ead30790..71c4c8070e7 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4093,15 +4093,9 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
case UTT_IsStandardLayout:
case UTT_IsPOD:
case UTT_IsLiteral:
- ArgTy = QualType(ArgTy->getBaseElementTypeUnsafe(), 0);
- LLVM_FALLTHROUGH;
-
- // C++1z [meta.unary.prop]:
- // T shall be a complete type, cv void, or an array of unknown bound.
- case UTT_IsDestructible:
- case UTT_IsNothrowDestructible:
- case UTT_IsTriviallyDestructible:
- // Per the GCC type traits documentation, the same constraints apply to these.
+ // Per the GCC type traits documentation, T shall be a complete type, cv void,
+ // or an array of unknown bound. But GCC actually imposes the same constraints
+ // as above.
case UTT_HasNothrowAssign:
case UTT_HasNothrowMoveAssign:
case UTT_HasNothrowConstructor:
@@ -4113,6 +4107,14 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
case UTT_HasTrivialCopy:
case UTT_HasTrivialDestructor:
case UTT_HasVirtualDestructor:
+ ArgTy = QualType(ArgTy->getBaseElementTypeUnsafe(), 0);
+ LLVM_FALLTHROUGH;
+
+ // C++1z [meta.unary.prop]:
+ // T shall be a complete type, cv void, or an array of unknown bound.
+ case UTT_IsDestructible:
+ case UTT_IsNothrowDestructible:
+ case UTT_IsTriviallyDestructible:
if (ArgTy->isIncompleteArrayType() || ArgTy->isVoidType())
return true;
OpenPOWER on IntegriCloud