diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2018-09-13 16:54:05 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-09-13 16:54:05 +0000 |
| commit | e6aa4694de2d11fdc3e352a29b1491740bfcb5e5 (patch) | |
| tree | 544278f19137d1f2e4d9ceb4011e0b2ea9093fc8 /clang/lib/Serialization | |
| parent | 939468d4b278a2432df1ed962fe3ba447b3adafe (diff) | |
| download | bcm5719-llvm-e6aa4694de2d11fdc3e352a29b1491740bfcb5e5.tar.gz bcm5719-llvm-e6aa4694de2d11fdc3e352a29b1491740bfcb5e5.zip | |
[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
declare reduction.
If the declare reduction construct with the non-dependent type is
defined in the template construct, the compiler might crash on the
template instantition. Reworked the whole instantiation scheme for the
declare reduction constructs to fix this problem correctly.
llvm-svn: 342151
Diffstat (limited to 'clang/lib/Serialization')
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 15 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 82951074764..d06a6226af7 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2633,10 +2633,17 @@ void ASTDeclReader::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) { void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) { VisitValueDecl(D); D->setLocation(ReadSourceLocation()); - D->setCombiner(Record.readExpr()); - D->setInitializer( - Record.readExpr(), - static_cast<OMPDeclareReductionDecl::InitKind>(Record.readInt())); + Expr *In = Record.readExpr(); + Expr *Out = Record.readExpr(); + D->setCombinerData(In, Out); + Expr *Combiner = Record.readExpr(); + D->setCombiner(Combiner); + Expr *Orig = Record.readExpr(); + Expr *Priv = Record.readExpr(); + D->setInitializerData(Orig, Priv); + Expr *Init = Record.readExpr(); + auto IK = static_cast<OMPDeclareReductionDecl::InitKind>(Record.readInt()); + D->setInitializer(Init, IK); D->PrevDeclInScope = ReadDeclID(); } diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index 8eb6c61525d..d757f609ea2 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -1742,7 +1742,11 @@ void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) { void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) { VisitValueDecl(D); Record.AddSourceLocation(D->getBeginLoc()); + Record.AddStmt(D->getCombinerIn()); + Record.AddStmt(D->getCombinerOut()); Record.AddStmt(D->getCombiner()); + Record.AddStmt(D->getInitOrig()); + Record.AddStmt(D->getInitPriv()); Record.AddStmt(D->getInitializer()); Record.push_back(D->getInitializerKind()); Record.AddDeclRef(D->getPrevDeclInScope()); |

