summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclOpenMP.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-06-01 13:04:26 +0000
committerErich Keane <erich.keane@intel.com>2018-06-01 13:04:26 +0000
commited6bc3422636dc8d4de58d18f319ae0b56827de9 (patch)
tree11a69ecdfe0a5267fc6e7e26a1cb55ee2f1a267a /clang/lib/AST/DeclOpenMP.cpp
parent8a17f1f43e7f00544715da8a63955263fd109be5 (diff)
downloadbcm5719-llvm-ed6bc3422636dc8d4de58d18f319ae0b56827de9.tar.gz
bcm5719-llvm-ed6bc3422636dc8d4de58d18f319ae0b56827de9.zip
[OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
Compiler crashes when omp simd is used in an OpenCL file: clang -c -fopenmp omp_simd.cl __kernel void test(global int *data, int size) { #pragma omp simd for (int i = 0; i < size; ++i) { } } The problem seems to be the check added to verify block pointers have initializers. An OMPCapturedExprDecl is created to capture ‘size’ but there is no TypeSourceInfo. The change just uses getType() directly. Patch-By: mikerice Differential Revision: https://reviews.llvm.org/D46667 llvm-svn: 333746
Diffstat (limited to 'clang/lib/AST/DeclOpenMP.cpp')
-rw-r--r--clang/lib/AST/DeclOpenMP.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp
index a86c0ebd48d..f5c3599ef6c 100644
--- a/clang/lib/AST/DeclOpenMP.cpp
+++ b/clang/lib/AST/DeclOpenMP.cpp
@@ -92,13 +92,14 @@ void OMPCapturedExprDecl::anchor() {}
OMPCapturedExprDecl *OMPCapturedExprDecl::Create(ASTContext &C, DeclContext *DC,
IdentifierInfo *Id, QualType T,
SourceLocation StartLoc) {
- return new (C, DC) OMPCapturedExprDecl(C, DC, Id, T, StartLoc);
+ return new (C, DC) OMPCapturedExprDecl(
+ C, DC, Id, T, C.getTrivialTypeSourceInfo(T), StartLoc);
}
OMPCapturedExprDecl *OMPCapturedExprDecl::CreateDeserialized(ASTContext &C,
unsigned ID) {
- return new (C, ID)
- OMPCapturedExprDecl(C, nullptr, nullptr, QualType(), SourceLocation());
+ return new (C, ID) OMPCapturedExprDecl(C, nullptr, nullptr, QualType(),
+ /*TInfo=*/nullptr, SourceLocation());
}
SourceRange OMPCapturedExprDecl::getSourceRange() const {
OpenPOWER on IntegriCloud