diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-20 20:14:22 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-20 20:14:22 +0000 |
commit | da1812dcb198a84f6c45919e4ba7e0cf035238c8 (patch) | |
tree | 81b7cb2552bbc612130e3216054f39a0b22054c5 /lib/Serialization | |
parent | 4f7e7882e9972ec567a0529a38737cb83324c91b (diff) | |
download | clang-da1812dcb198a84f6c45919e4ba7e0cf035238c8.tar.gz |
[OPENMP]Improve detection of omp_allocator_handle_t type and predefined
allocators.
It is better to deduce omp_allocator_handle_t type from the predefined
allocators, because omp.h header might not define it explicitly. Plus,
it allows to identify the predefined allocators correctly when trying to
build the allcoator for the global variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 9 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index f37372fcb0..32bd82d077 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -4490,10 +4490,15 @@ void ASTDeclReader::UpdateDecl(Decl *D, ReadSourceRange())); break; - case UPD_DECL_MARKED_OPENMP_ALLOCATE: + case UPD_DECL_MARKED_OPENMP_ALLOCATE: { + auto AllocatorKind = + static_cast<OMPAllocateDeclAttr::AllocatorTypeTy>(Record.readInt()); + Expr *Allocator = Record.readExpr(); + SourceRange SR = ReadSourceRange(); D->addAttr(OMPAllocateDeclAttr::CreateImplicit( - Reader.getContext(), Record.readExpr(), ReadSourceRange())); + Reader.getContext(), AllocatorKind, Allocator, SR)); break; + } case UPD_DECL_EXPORTED: { unsigned SubmoduleID = readSubmoduleID(); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 03956050a3..c593dd98db 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -5290,10 +5290,13 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { D->getAttr<OMPThreadPrivateDeclAttr>()->getRange()); break; - case UPD_DECL_MARKED_OPENMP_ALLOCATE: - Record.AddStmt(D->getAttr<OMPAllocateDeclAttr>()->getAllocator()); - Record.AddSourceRange(D->getAttr<OMPAllocateDeclAttr>()->getRange()); + case UPD_DECL_MARKED_OPENMP_ALLOCATE: { + auto *A = D->getAttr<OMPAllocateDeclAttr>(); + Record.push_back(A->getAllocatorType()); + Record.AddStmt(A->getAllocator()); + Record.AddSourceRange(A->getRange()); break; + } case UPD_DECL_MARKED_OPENMP_DECLARETARGET: Record.push_back(D->getAttr<OMPDeclareTargetDeclAttr>()->getMapType()); |