Author: Mariya Podchishchaeva Date: 2020-05-30T12:27:58+03:00 New Revision: bd85b7d6688725e854a694f9f3e8baa6a3077a4a
URL: https://github.com/llvm/llvm-project/commit/bd85b7d6688725e854a694f9f3e8baa6a3077a4a DIFF: https://github.com/llvm/llvm-project/commit/bd85b7d6688725e854a694f9f3e8baa6a3077a4a.diff LOG: [OpenMP][SYCL] Do not crash on attempt to diagnose unsupported type use Summary: Do not ask size of type if it is dependent. ASTContext doesn't seem expecting this. Reviewers: jdoerfert, ABataev, bader Reviewed By: ABataev Subscribers: yaxunl, guansong, ebevhan, Anastasia, sstefan1, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D80829 Added: Modified: clang/lib/Sema/Sema.cpp clang/test/OpenMP/nvptx_unsupported_type_messages.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 8c11a1a59e9c..ffe2e4d4d56a 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1725,6 +1725,9 @@ void Sema::checkDeviceDecl(const ValueDecl *D, SourceLocation Loc) { } auto CheckType = [&](QualType Ty) { + if (Ty->isDependentType()) + return; + if ((Ty->isFloat16Type() && !Context.getTargetInfo().hasFloat16Type()) || ((Ty->isFloat128Type() || (Ty->isRealFloatingType() && Context.getTypeSize(Ty) == 128)) && diff --git a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp index 22ce8175fd05..e56105adeb83 100644 --- a/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp +++ b/clang/test/OpenMP/nvptx_unsupported_type_messages.cpp @@ -120,3 +120,14 @@ void hostFoo() { long double qa, qb; decltype(qa + qb) qc; double qd[sizeof(-(-(qc * 2)))]; + +struct A { }; + +template <bool> +struct A_type { typedef A type; }; + +template <class Sp, class Tp> +struct B { + enum { value = bool(Sp::value) || bool(Tp::value) }; + typedef typename A_type<value>::type type; +}; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits