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 | 27ef9518decb4129bc22814b33c88ed06813b224 (patch) | |
tree | cdb9fc6b5b3e91bba544543080c05b7bef49dad9 /clang/lib/Serialization | |
parent | b062239d638b93b6f2f1b8f93d84329a13c66e87 (diff) | |
download | bcm5719-llvm-27ef9518decb4129bc22814b33c88ed06813b224.tar.gz bcm5719-llvm-27ef9518decb4129bc22814b33c88ed06813b224.zip |
[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.
llvm-svn: 356607
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index f37372fcb08..32bd82d077e 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/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/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 03956050a3f..c593dd98dba 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/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()); |