summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorKelvin Li <kkwli0@gmail.com>2015-11-23 05:32:03 +0000
committerKelvin Li <kkwli0@gmail.com>2015-11-23 05:32:03 +0000
commit0bff7afab5bb88cafa91037c91b47436f5284331 (patch)
tree878fee7855d19dff45db6dfcc164870633e025bb /clang/lib/Serialization
parent67501ca1b95213d0ef46f4d8e24073d70e16a7bc (diff)
downloadbcm5719-llvm-0bff7afab5bb88cafa91037c91b47436f5284331.tar.gz
bcm5719-llvm-0bff7afab5bb88cafa91037c91b47436f5284331.zip
[OpenMP] Parsing and sema support for map clause
http://reviews.llvm.org/D14134 llvm-svn: 253849
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReaderStmt.cpp20
-rw-r--r--clang/lib/Serialization/ASTWriterStmt.cpp11
2 files changed, 31 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index ab82eee10e2..21708d24c60 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -1840,6 +1840,9 @@ OMPClause *OMPClauseReader::readClause() {
case OMPC_device:
C = new (Context) OMPDeviceClause();
break;
+ case OMPC_map:
+ C = OMPMapClause::CreateEmpty(Context, Record[Idx++]);
+ break;
}
Visit(C);
C->setLocStart(Reader->ReadSourceLocation(Record, Idx));
@@ -2147,6 +2150,23 @@ void OMPClauseReader::VisitOMPDeviceClause(OMPDeviceClause *C) {
C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
}
+void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) {
+ C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
+ C->setMapTypeModifier(
+ static_cast<OpenMPMapClauseKind>(Record[Idx++]));
+ C->setMapType(
+ static_cast<OpenMPMapClauseKind>(Record[Idx++]));
+ C->setMapLoc(Reader->ReadSourceLocation(Record, Idx));
+ C->setColonLoc(Reader->ReadSourceLocation(Record, Idx));
+ auto NumVars = C->varlist_size();
+ SmallVector<Expr *, 16> Vars;
+ Vars.reserve(NumVars);
+ for (unsigned i = 0; i != NumVars; ++i) {
+ Vars.push_back(Reader->Reader.ReadSubExpr());
+ }
+ C->setVarRefs(Vars);
+}
+
//===----------------------------------------------------------------------===//
// OpenMP Directives.
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index 74dc56e72fb..8ce85c711b7 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -1982,6 +1982,17 @@ void OMPClauseWriter::VisitOMPDeviceClause(OMPDeviceClause *C) {
Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
}
+void OMPClauseWriter::VisitOMPMapClause(OMPMapClause *C) {
+ Record.push_back(C->varlist_size());
+ Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
+ Record.push_back(C->getMapTypeModifier());
+ Record.push_back(C->getMapType());
+ Writer->Writer.AddSourceLocation(C->getMapLoc(), Record);
+ Writer->Writer.AddSourceLocation(C->getColonLoc(), Record);
+ for (auto *VE : C->varlists())
+ Writer->Writer.AddStmt(VE);
+}
+
//===----------------------------------------------------------------------===//
// OpenMP Directives.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud