[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 1 06:08:40 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC333746: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file (authored by erichkeane, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46667?vs=147538&id=149441#toc

Repository:
  rC Clang

https://reviews.llvm.org/D46667

Files:
  include/clang/AST/DeclOpenMP.h
  lib/AST/DeclOpenMP.cpp


Index: lib/AST/DeclOpenMP.cpp
===================================================================
--- lib/AST/DeclOpenMP.cpp
+++ lib/AST/DeclOpenMP.cpp
@@ -92,13 +92,14 @@
 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 {
Index: include/clang/AST/DeclOpenMP.h
===================================================================
--- include/clang/AST/DeclOpenMP.h
+++ include/clang/AST/DeclOpenMP.h
@@ -189,8 +189,9 @@
   void anchor() override;
 
   OMPCapturedExprDecl(ASTContext &C, DeclContext *DC, IdentifierInfo *Id,
-                      QualType Type, SourceLocation StartLoc)
-      : VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, nullptr,
+                      QualType Type, TypeSourceInfo *TInfo,
+                      SourceLocation StartLoc)
+      : VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
                 SC_None) {
     setImplicit();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46667.149441.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180601/a0d9c4b3/attachment.bin>


More information about the cfe-commits mailing list