summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h9
-rw-r--r--include/clang/AST/StmtOpenMP.h57
-rw-r--r--include/clang/Basic/CapturedStmt.h3
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td8
-rw-r--r--include/clang/Basic/OpenMPKinds.def2
-rw-r--r--include/clang/Sema/Scope.h12
-rw-r--r--include/clang/Sema/ScopeInfo.h2
-rw-r--r--include/clang/Sema/Sema.h19
-rw-r--r--lib/AST/Stmt.cpp30
-rw-r--r--lib/AST/StmtPrinter.cpp8
-rw-r--r--lib/AST/StmtProfile.cpp3
-rw-r--r--lib/CodeGen/CGStmt.cpp6
-rw-r--r--lib/Parse/ParseOpenMP.cpp16
-rw-r--r--lib/Sema/Sema.cpp9
-rw-r--r--lib/Sema/SemaOpenMP.cpp506
-rw-r--r--lib/Sema/TreeTransform.h56
-rw-r--r--lib/Serialization/ASTReaderStmt.cpp13
-rw-r--r--lib/Serialization/ASTWriterStmt.cpp9
-rw-r--r--test/OpenMP/openmp_common.c2
-rw-r--r--test/OpenMP/parallel_default_messages.cpp8
-rw-r--r--test/OpenMP/parallel_messages.cpp49
-rw-r--r--test/OpenMP/parallel_private_messages.cpp26
-rw-r--r--test/OpenMP/parallel_shared_messages.cpp77
-rw-r--r--test/OpenMP/threadprivate_messages.cpp2
-rw-r--r--tools/libclang/CIndex.cpp3
-rw-r--r--tools/libclang/RecursiveASTVisitor.h6
26 files changed, 37 insertions, 904 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index ac7795f933..7e3c2cfd95 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -2346,17 +2346,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPDefaultClause(OMPDefaultClause *C) {
TraverseStmt(*I);
template<typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
+bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(
+ OMPPrivateClause *C) {
PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, C)
return true;
}
-template<typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
- PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C)
- return true;
-}
-
#undef PROCESS_OMP_CLAUSE_LIST
// FIXME: look at the following tricky-seeming exprs to see if we
diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h
index dc68d77a8c..fbaa4f1880 100644
--- a/include/clang/AST/StmtOpenMP.h
+++ b/include/clang/AST/StmtOpenMP.h
@@ -249,63 +249,6 @@ public:
}
};
-/// \brief This represents clause 'shared' in the '#pragma omp ...' directives.
-///
-/// \code
-/// #pragma omp parallel shared(a,b)
-/// \endcode
-/// In this example directive '#pragma omp parallel' has clause 'shared'
-/// with the variables 'a' and 'b'.
-///
-class OMPSharedClause : public OMPClause, public OMPVarList<OMPSharedClause> {
- /// \brief Build clause with number of variables \a N.
- ///
- /// \param StartLoc Starting location of the clause.
- /// \param LParenLoc Location of '('.
- /// \param EndLoc Ending location of the clause.
- /// \param N Number of the variables in the clause.
- ///
- OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
- SourceLocation EndLoc, unsigned N)
- : OMPClause(OMPC_shared, StartLoc, EndLoc),
- OMPVarList<OMPSharedClause>(LParenLoc, N) { }
-
- /// \brief Build an empty clause.
- ///
- /// \param N Number of variables.
- ///
- explicit OMPSharedClause(unsigned N)
- : OMPClause(OMPC_private, SourceLocation(), SourceLocation()),
- OMPVarList<OMPSharedClause>(SourceLocation(), N) { }
-public:
- /// \brief Creates clause with a list of variables \a VL.
- ///
- /// \param C AST context.
- /// \param StartLoc Starting location of the clause.
- /// \param LParenLoc Location of '('.
- /// \param EndLoc Ending location of the clause.
- /// \param VL List of references to the variables.
- ///
- static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc,
- SourceLocation LParenLoc,
- SourceLocation EndLoc, ArrayRef<Expr *> VL);
- /// \brief Creates an empty clause with \a N variables.
- ///
- /// \param C AST context.
- /// \param N The number of variables.
- ///
- static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N);
-
- StmtRange children() {
- return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
- reinterpret_cast<Stmt **>(varlist_end()));
- }
-
- static bool classof(const OMPClause *T) {
- return T->getClauseKind() == OMPC_shared;
- }
-};
-
//===----------------------------------------------------------------------===//
// AST classes for directives.
//===----------------------------------------------------------------------===//
diff --git a/include/clang/Basic/CapturedStmt.h b/include/clang/Basic/CapturedStmt.h
index c4a289b696..484bbb1fee 100644
--- a/include/clang/Basic/CapturedStmt.h
+++ b/include/clang/Basic/CapturedStmt.h
@@ -15,8 +15,7 @@ namespace clang {
/// \brief The different kinds of captured statement.
enum CapturedRegionKind {
- CR_Default,
- CR_OpenMP
+ CR_Default
};
} // end namespace clang
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 2e40809ef6..b7f8f00369 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6601,14 +6601,6 @@ def err_omp_clause_ref_type_arg : Error<
"arguments of OpenMP clause '%0' cannot be of reference type %1">;
def err_omp_threadprivate_incomplete_type : Error<
"threadprivate variable with incomplete type %0">;
-def err_omp_no_dsa_for_variable : Error <
- "variable %0 must have explicitly specified data sharing attributes">;
-def err_omp_wrong_dsa : Error<
- "%0 variable cannot be %1">;
-def note_omp_explicit_dsa : Note <
- "defined as %0">;
-def note_omp_predetermined_dsa : Note <
- "predetermined as %0">;
} // end of OpenMP category
let CategoryName = "Related Result Type Issue" in {
diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def
index e7e58c2699..4e15cfec4d 100644
--- a/include/clang/Basic/OpenMPKinds.def
+++ b/include/clang/Basic/OpenMPKinds.def
@@ -33,12 +33,10 @@ OPENMP_DIRECTIVE(task)
// OpenMP clauses.
OPENMP_CLAUSE(default, OMPDefaultClause)
OPENMP_CLAUSE(private, OMPPrivateClause)
-OPENMP_CLAUSE(shared, OMPSharedClause)
// Clauses allowed for OpenMP directives.
OPENMP_PARALLEL_CLAUSE(default)
OPENMP_PARALLEL_CLAUSE(private)
-OPENMP_PARALLEL_CLAUSE(shared)
// Static attributes for 'default' clause.
OPENMP_DEFAULT_KIND(none)
diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h
index c9c3099914..d016b9b887 100644
--- a/include/clang/Sema/Scope.h
+++ b/include/clang/Sema/Scope.h
@@ -91,10 +91,7 @@ public:
TryScope = 0x2000,
/// \brief This is the scope for a function-level C++ try or catch scope.
- FnTryCatchScope = 0x4000,
-
- /// \brief This is the scope of OpenMP executable directive
- OpenMPDirectiveScope = 0x8000
+ FnTryCatchScope = 0x4000
};
private:
/// The parent scope for this scope. This is null for the translation-unit
@@ -304,12 +301,7 @@ public:
}
return false;
}
-
- /// \brief Determines whether this scope is the OpenMP directive scope
- bool isOpenMPDirectiveScope() const {
- return (getFlags() & Scope::OpenMPDirectiveScope);
- }
-
+
/// \brief Determine whether this scope is a C++ 'try' block.
bool isTryScope() const { return getFlags() & Scope::TryScope; }
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index bc49dcda66..86725e1cb1 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -567,8 +567,6 @@ public:
switch (CapRegionKind) {
case CR_Default:
return "default captured statement";
- case CR_OpenMP:
- return "OpenMP region";
}
llvm_unreachable("Invalid captured region kind!");
}
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 75784b1c84..cc8535ae30 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -6884,20 +6884,6 @@ public:
unsigned SpellingListIndex, bool IsPackExpansion);
// OpenMP directives and clauses.
-private:
- void *VarDataSharingAttributesStack;
- /// \brief Initialization of data-sharing attributes stack.
- void InitDataSharingAttributesStack();
- void DestroyDataSharingAttributesStack();
-public:
- /// \brief Called on start of new data sharing attribute block.
- void StartOpenMPDSABlock(OpenMPDirectiveKind K,
- const DeclarationNameInfo &DirName,
- Scope *CurScope);
- /// \brief Called on end of data sharing attribute block.
- void EndOpenMPDSABlock(Stmt *CurDirective);
-
- // OpenMP directives and clauses.
/// \brief Called on correct id-expression from the '#pragma omp
/// threadprivate'.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope,
@@ -6947,11 +6933,6 @@ public:
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc);
- /// \brief Called on well-formed 'shared' clause.
- OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
- SourceLocation StartLoc,
- SourceLocation LParenLoc,
- SourceLocation EndLoc);
/// \brief The kind of conversion being performed.
enum CheckedConversionKind {
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 0d654eeee3..2711e9ba97 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -1111,16 +1111,6 @@ bool CapturedStmt::capturesVariable(const VarDecl *Var) const {
return false;
}
-StmtRange OMPClause::children() {
- switch(getClauseKind()) {
- default : break;
-#define OPENMP_CLAUSE(Name, Class) \
- case OMPC_ ## Name : return static_cast<Class *>(this)->children();
-#include "clang/Basic/OpenMPKinds.def"
- }
- llvm_unreachable("unknown OMPClause");
-}
-
OMPPrivateClause *OMPPrivateClause::Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation LParenLoc,
@@ -1141,26 +1131,6 @@ OMPPrivateClause *OMPPrivateClause::CreateEmpty(const ASTContext &C,
return new (Mem) OMPPrivateClause(N);
}
-OMPSharedClause *OMPSharedClause::Create(const ASTContext &C,
- SourceLocation StartLoc,
- SourceLocation LParenLoc,
- SourceLocation EndLoc,
- ArrayRef<Expr *> VL) {
- void *Mem = C.Allocate(sizeof(OMPSharedClause) + sizeof(Expr *) * VL.size(),
- llvm::alignOf<OMPSharedClause>());
- OMPSharedClause *Clause = new (Mem) OMPSharedClause(StartLoc, LParenLoc,
- EndLoc, VL.size());
- Clause->setVarRefs(VL);
- return Clause;
-}
-
-OMPSharedClause *OMPSharedClause::CreateEmpty(const ASTContext &C,
- unsigned N) {
- void *Mem = C.Allocate(sizeof(OMPSharedClause) + sizeof(Expr *) * N,
- llvm::alignOf<OMPSharedClause>());
- return new (Mem) OMPSharedClause(N);
-}
-
void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
assert(Clauses.size() == this->Clauses.size() &&
"Number of clauses is not the same as the preallocated buffer");
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 98b56bcbc7..d59475e48c 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -614,14 +614,6 @@ void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
}
}
-void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) {
- if (!Node->varlist_empty()) {
- OS << "shared";
- PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, Node, '(')
- OS << ")";
- }
-}
-
#undef PROCESS_OMP_CLAUSE_LIST
}
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 77c34c41aa..eb93c1df0e 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -272,9 +272,6 @@ void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, C)
}
-void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
- PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C)
-}
#undef PROCESS_OMP_CLAUSE_LIST
}
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index e3095403f9..7af7725c3a 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -136,10 +136,8 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
case Stmt::SwitchStmtClass: EmitSwitchStmt(cast<SwitchStmt>(*S)); break;
case Stmt::GCCAsmStmtClass: // Intentional fall-through.
case Stmt::MSAsmStmtClass: EmitAsmStmt(cast<AsmStmt>(*S)); break;
- case Stmt::CapturedStmtClass: {
- const CapturedStmt *CS = cast<CapturedStmt>(S);
- EmitCapturedStmt(*CS, CS->getCapturedRegionKind());
- }
+ case Stmt::CapturedStmtClass:
+ EmitCapturedStmt(cast<CapturedStmt>(*S), CR_Default);
break;
case Stmt::ObjCAtTryStmtClass:
EmitObjCAtTryStmt(cast<ObjCAtTryStmt>(*S));
diff --git a/lib/Parse/ParseOpenMP.cpp b/lib/Parse/ParseOpenMP.cpp
index de76b17dd9..59450e7008 100644
--- a/lib/Parse/ParseOpenMP.cpp
+++ b/lib/Parse/ParseOpenMP.cpp
@@ -84,14 +84,11 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
SmallVector<OMPClause *, 5> Clauses;
SmallVector<llvm::PointerIntPair<OMPClause *, 1, bool>, NUM_OPENMP_CLAUSES>
FirstClauses(NUM_OPENMP_CLAUSES);
- const unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope |
- Scope::OpenMPDirectiveScope;
+ const unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope;
SourceLocation Loc = ConsumeToken(), EndLoc;
OpenMPDirectiveKind DKind = Tok.isAnnotation() ?
OMPD_unknown :
getOpenMPDirectiveKind(PP.getSpelling(Tok));
- // Name of critical directive.
- DeclarationNameInfo DirName;
StmtResult Directive = StmtError();
switch (DKind) {
@@ -114,9 +111,6 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
break;
case OMPD_parallel: {
ConsumeToken();
-
- Actions.StartOpenMPDSABlock(DKind, DirName, Actions.getCurScope());
-
while (Tok.isNot(tok::annot_pragma_openmp_end)) {
OpenMPClauseKind CKind = Tok.isAnnotation() ?
OMPC_unknown :
@@ -144,7 +138,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
{
// The body is a block scope like in Lambdas and Blocks.
Sema::CompoundScopeRAII CompoundScope(Actions);
- Actions.ActOnCapturedRegionStart(Loc, getCurScope(), CR_OpenMP, 1);
+ Actions.ActOnCapturedRegionStart(Loc, getCurScope(), CR_Default, 1);
Actions.ActOnStartOfCompoundStmt();
// Parse statement
AssociatedStmt = ParseStatement();
@@ -163,7 +157,6 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
Loc, EndLoc);
// Exit scope.
- Actions.EndOpenMPDSABlock(Directive.get());
OMPDirectiveScope.Exit();
}
break;
@@ -252,7 +245,7 @@ bool Parser::ParseOpenMPSimpleVarList(OpenMPDirectiveKind Kind,
/// \brief Parsing of OpenMP clauses.
///
/// clause:
-/// default-clause|private-clause|shared-clause
+/// default-clause|private-clause
///
OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OpenMPClauseKind CKind, bool FirstClause) {
@@ -278,7 +271,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
Clause = ParseOpenMPSimpleClause(CKind);
break;
case OMPC_private:
- case OMPC_shared:
Clause = ParseOpenMPVarListClause(CKind);
break;
case OMPC_unknown:
@@ -330,8 +322,6 @@ OMPClause *Parser::ParseOpenMPSimpleClause(OpenMPClauseKind Kind) {
///
/// private-clause:
/// 'private' '(' list ')'
-/// shared-clause:
-/// 'shared' '(' list ')'
///
OMPClause *Parser::ParseOpenMPVarListClause(OpenMPClauseKind Kind) {
SourceLocation Loc = Tok.getLocation();
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 71d726f619..a3b1bfa1c2 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -90,8 +90,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false),
NonInstantiationEntries(0), ArgumentPackSubstitutionIndex(-1),
CurrentInstantiationScope(0), TyposCorrected(0),
- AnalysisWarnings(*this), VarDataSharingAttributesStack(0), CurScope(0),
- Ident_super(0), Ident___float128(0)
+ AnalysisWarnings(*this), CurScope(0), Ident_super(0), Ident___float128(0)
{
TUScope = 0;
@@ -114,9 +113,6 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
false, 0, false));
FunctionScopes.push_back(new FunctionScopeInfo(Diags));
-
- // Initilization of data sharing attributes stack for OpenMP
- InitDataSharingAttributesStack();
}
void Sema::Initialize() {
@@ -203,9 +199,6 @@ Sema::~Sema() {
// If Sema's ExternalSource is the multiplexer - we own it.
if (isMultiplexExternalSource)
delete ExternalSource;
-
- // Destroys data sharing attributes stack for OpenMP
- DestroyDataSharingAttributesStack();
}
/// makeUnavailableInSystemHeader - There is an error in the current
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index 1048c5ad7b..09ecfe0909 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -27,325 +27,6 @@
#include "clang/Sema/ScopeInfo.h"
using namespace clang;
-//===----------------------------------------------------------------------===//
-// Stack of data-sharing attributes for variables
-//===----------------------------------------------------------------------===//
-
-namespace {
-/// \brief Default data sharing attributes, which can be applied to directive.
-enum DefaultDataSharingAttributes {
- DSA_unspecified = 0, /// \brief Data sharing attribute not specified.
- DSA_none = 1 << 0, /// \brief Default data sharing attribute 'none'.
- DSA_shared = 1 << 1 /// \brief Default data sharing attribute 'shared'.
-};
-
-/// \brief Stack for tracking declarations used in OpenMP directives and
-/// clauses and their data-sharing attributes.
-class DSAStackTy {
-public:
- struct DSAVarData {
- OpenMPDirectiveKind DKind;
- OpenMPClauseKind CKind;
- DeclRefExpr *RefExpr;
- DSAVarData() : DKind(OMPD_unknown), CKind(OMPC_unknown), RefExpr(0) { }
- };
-private:
- struct DSAInfo {
- OpenMPClauseKind Attributes;
- DeclRefExpr *RefExpr;
- };
- typedef llvm::SmallDenseMap<VarDecl *, DSAInfo, 64> DeclSAMapTy;
-
- struct SharingMapTy {
- DeclSAMapTy SharingMap;
- DefaultDataSharingAttributes DefaultAttr;
- OpenMPDirectiveKind Directive;
- DeclarationNameInfo DirectiveName;
- Scope *CurScope;
- SharingMapTy(OpenMPDirectiveKind DKind,
- const DeclarationNameInfo &Name,
- Scope *CurScope)
- : SharingMap(), DefaultAttr(DSA_unspecified), Directive(DKind),
- DirectiveName(Name), CurScope(CurScope) { }
- SharingMapTy()
- : SharingMap(), DefaultAttr(DSA_unspecified),
- Directive(OMPD_unknown), DirectiveName(),
- CurScope(0) { }
- };
-
- typedef SmallVector<SharingMapTy, 64> StackTy;
-
- /// \brief Stack of used declaration and their data-sharing attributes.
- StackTy Stack;
- Sema &Actions;
-
- typedef SmallVector<SharingMapTy, 8>::reverse_iterator reverse_iterator;
-
- DSAVarData getDSA(StackTy::reverse_iterator Iter, VarDecl *D);
-public:
- explicit DSAStackTy(Sema &S) : Stack(1), Actions(S) { }
-
- void push(OpenMPDirectiveKind DKind, const DeclarationNameInfo &DirName,
- Scope *CurScope) {
- Stack.push_back(SharingMapTy(DKind, DirName, CurScope));
- }
-
- void pop() {
- assert(Stack.size() > 1 && "Data-sharing attributes stack is empty!");
- Stack.pop_back();
- }
-
- /// \brief Adds explicit data sharing attribute to the specified declaration.
- void addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A);
-
- /// \brief Checks if the variable is a local for OpenMP region.
- bool isOpenMPLocal(VarDecl *D);
-
- /// \brief Returns data sharing attributes from top of the stack for the
- /// specified declaration.
- DSAVarData getTopDSA(VarDecl *D);
- /// \brief Returns data-sharing attributes for the specified declaration.
- DSAVarData getImplicitDSA(VarDecl *D);
-
- /// \brief Returns currently analyzed directive.
- OpenMPDirectiveKind getCurrentDirective() const {
- return Stack.back().Directive;
- }
-
- /// \brief Set default data sharing attribute to none.
- void setDefaultDSANone() { Stack.back().DefaultAttr = DSA_none; }
- /// \brief Set default data sharing attribute to shared.
- void setDefaultDSAShared() { Stack.back().DefaultAttr = DSA_shared; }
-
- DefaultDataSharingAttributes getDefaultDSA() const {
- return Stack.back().DefaultAttr;
- }
-
- Scope *getCurScope() { return Stack.back().CurScope; }
-};
-} // end anonymous namespace.
-
-DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter,
- VarDecl *D) {
- DSAVarData DVar;
- if (Iter == Stack.rend() - 1) {
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a region but not in construct]
- // File-scope or namespace-scope variables referenced in called routines
- // in the region are shared unless they appear in a threadprivate
- // directive.
- // TODO
- if (!D->isFunctionOrMethodVarDecl())
- DVar.CKind = OMPC_shared;
-
- return DVar;
- }
- DVar.DKind = Iter->Directive;
- // Explicitly specified attributes and local variables with predetermined
- // attributes.
- if (Iter->SharingMap.count(D)) {
- DVar.RefExpr = Iter->SharingMap[D].RefExpr;
- DVar.CKind = Iter->SharingMap[D].Attributes;
- return DVar;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, implicitly determined, p.1]
- // In a parallel or task construct, the data-sharing attributes of these
- // variables are determined by the default clause, if present.
- switch (Iter->DefaultAttr) {
- case DSA_shared:
- DVar.CKind = OMPC_shared;
- return DVar;
- case DSA_none:
- return DVar;
- case DSA_unspecified:
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, implicitly determined, p.2]
- // In a parallel construct, if no default clause is present, these
- // variables are shared.
- if (DVar.DKind == OMPD_parallel) {
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, implicitly determined, p.4]
- // In a task construct, if no default clause is present, a variable that in
- // the enclosing context is determined to be shared by all implicit tasks
- // bound to the current team is shared.
- // TODO
- if (DVar.DKind == OMPD_task) {
- DSAVarData DVarTemp;
- for (StackTy::reverse_iterator I = Iter + 1,
- EE = Stack.rend() - 1;
- I != EE; ++I) {
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, implicitly determined, p.6]
- // In a task construct, if no default clause is present, a variable
- // whose data-sharing attribute is not determined by the rules above is
- // firstprivate.
- DVarTemp = getDSA(I, D);
- if (DVarTemp.CKind != OMPC_shared) {
- DVar.RefExpr = 0;
- DVar.DKind = OMPD_task;
- DVar.CKind = OMPC_unknown;
- // TODO: should return OMPC_firstprivate
- return DVar;
- }
- if (I->Directive == OMPD_parallel) break;
- }
- DVar.DKind = OMPD_task;
- // TODO: Should return OMPC_firstprivate instead of OMPC_unknown.
- DVar.CKind =
- (DVarTemp.CKind == OMPC_unknown) ? OMPC_unknown : OMPC_shared;
- return DVar;
- }
- }
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, implicitly determined, p.3]
- // For constructs other than task, if no default clause is present, these
- // variables inherit their data-sharing attributes from the enclosing
- // context.
- return getDSA(Iter + 1, D);
-}
-
-void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) {
- if (A == OMPC_threadprivate) {
- Stack[0].SharingMap[D].Attributes = A;
- Stack[0].SharingMap[D].RefExpr = E;
- } else {
- assert(Stack.size() > 1 && "Data-sharing attributes stack is empty");
- Stack.back().SharingMap[D].Attributes = A;
- Stack.back().SharingMap[D].RefExpr = E;
- }
-}
-
-bool DSAStackTy::isOpenMPLocal(VarDecl *D) {
- Scope *CurScope = getCurScope();
- while (CurScope && !CurScope->isDeclScope(D))
- CurScope = CurScope->getParent();
- while (CurScope && !CurScope->isOpenMPDirectiveScope())
- CurScope = CurScope->getParent();
- bool isOpenMPLocal = !!CurScope;
- if (!isOpenMPLocal) {
- CurScope = getCurScope();
- while (CurScope && !CurScope->isOpenMPDirectiveScope())
- CurScope = CurScope->getParent();
- isOpenMPLocal =
- CurScope &&
- isa<CapturedDecl>(D->getDeclContext()) &&
- static_cast<DeclContext *>(
- CurScope->getFnParent()->getEntity())->Encloses(D->getDeclContext());
- }
- return isOpenMPLocal;
-}
-
-DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D) {
- DSAVarData DVar;
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.1]
- // Variables appearing in threadprivate directives are threadprivate.
- if (D->getTLSKind() != VarDecl::TLS_None) {
- DVar.CKind = OMPC_threadprivate;
- return DVar;
- }
- if (Stack[0].SharingMap.count(D)) {
- DVar.RefExpr = Stack[0].SharingMap[D].RefExpr;
- DVar.CKind = OMPC_threadprivate;
- return DVar;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.1]
- // Variables with automatic storage duration that are declared in a scope
- // inside the construct are private.
- if (isOpenMPLocal(D) && D->isLocalVarDecl() &&
- (D->getStorageClass() == SC_Auto ||
- D->getStorageClass() == SC_None)) {
- DVar.CKind = OMPC_private;
- return DVar;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.4]
- // Static data memebers are shared.
- if (D->isStaticDataMember()) {
- // Variables with const-qualified type having no mutable member may be
- // listed in a firstprivate clause, even if they are static data members.
- // TODO:
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
- QualType Type = D->getType().getNonReferenceType().getCanonicalType();
- bool IsConstant = Type.isConstant(Actions.getASTContext());
- while (Type->isArrayType()) {
- QualType ElemType = cast<ArrayType>(Type.getTypePtr())->getElementType();
- Type = ElemType.getNonReferenceType().getCanonicalType();
- }
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.6]
- // Variables with const qualified type having no mutable member are
- // shared.
- CXXRecordDecl *RD = Actions.getLangOpts().CPlusPlus ?
- Type->getAsCXXRecordDecl() : 0;
- if (IsConstant &&
- !(Actions.getLangOpts().CPlusPlus && RD && RD->hasMutableFields())) {
- // Variables with const-qualified type having no mutable member may be
- // listed in a firstprivate clause, even if they are static data members.
- // TODO
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct, C/C++, predetermined, p.7]
- // Variables with static storage duration that are declared in a scope
- // inside the construct are shared.
- if (isOpenMPLocal(D) && D->isStaticLocal()) {
- DVar.CKind = OMPC_shared;
- return DVar;
- }
-
- // Explicitly specified attributes and local variables with predetermined
- // attributes.
- if (Stack.back().SharingMap.count(D)) {
- DVar.RefExpr = Stack.back().SharingMap[D].RefExpr;
- DVar.CKind = Stack.back().SharingMap[D].Attributes;
- }
-
- return DVar;
-}
-
-DSAStackTy::DSAVarData DSAStackTy::getImplicitDSA(VarDecl *D) {
- return getDSA(Stack.rbegin() + 1, D);
-}
-
-void Sema::InitDataSharingAttributesStack() {
- VarDataSharingAttributesStack = new DSAStackTy(*this);
-}
-
-#define DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack)
-
-void Sema::DestroyDataSharingAttributesStack() {
- delete DSAStack;
-}
-
-void Sema::StartOpenMPDSABlock(OpenMPDirectiveKind DKind,
- const DeclarationNameInfo &DirName,
- Scope *CurScope) {
- DSAStack->push(DKind, DirName, CurScope);
- PushExpressionEvaluationContext(PotentiallyEvaluated);
-}
-
-void Sema::EndOpenMPDSABlock(Stmt *CurDirective) {
- DSAStack->pop();
- DiscardCleanupsInEvaluationContext();
- PopExpressionEvaluationContext();
-}
-
namespace {
class VarDeclFilterCCC : public CorrectionCandidateCallback {
@@ -449,7 +130,6 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope,
QualType ExprType = VD->getType().getNonReferenceType();
ExprResult DE = BuildDeclRefExpr(VD, ExprType, VK_RValue, Id.getLoc());
- DSAStack->addDSA(VD, cast<DeclRefExpr>(DE.get()), OMPC_threadprivate);
return DE;
}
@@ -512,93 +192,12 @@ OMPThreadPrivateDecl *Sema::CheckOMPThreadPrivateDecl(
Loc, Vars);
}
-namespace {
-class DSAAttrChecker : public StmtVisitor<DSAAttrChecker, void> {
- DSAStackTy *Stack;
- Sema &Actions;
- bool ErrorFound;
- CapturedStmt *CS;
-public:
- void VisitDeclRefExpr(DeclRefExpr *E) {
- if(VarDecl *VD = dyn_cast<VarDecl>(E->getDecl())) {
- if (VD->isImplicit() && VD->hasAttr<UnusedAttr>()) return;
- // Skip internally declared variables.
- if (VD->isLocalVarDecl() && !CS->capturesVariable(VD)) return;
-
- SourceLocation ELoc = E->getExprLoc();
-
- OpenMPDirectiveKind DKind = Stack->getCurrentDirective();
- DSAStackTy::DSAVarData DVar = Stack->getTopDSA(VD);
- if (DVar.CKind != OMPC_unknown) {
- if (DKind == OMPD_task && DVar.CKind != OMPC_shared &&
- DVar.CKind != OMPC_threadprivate && !DVar.RefExpr)
- // TODO: should be marked as firstprivate.
- ;
- return;
- }
- // The default(none) clause requires that each variable that is referenced
- // in the construct, and does not have a predetermined data-sharing
- // attribute, must have its data-sharing attribute explicitly determined
- // by being listed in a data-sharing attribute clause.
- if (DVar.CKind == OMPC_unknown && Stack->getDefaultDSA() == DSA_none &&
- (DKind == OMPD_parallel || DKind == OMPD_task)) {
- ErrorFound = true;
- Actions.Diag(ELoc, diag::err_omp_no_dsa_for_variable) << VD;
- return;
- }
-
- // OpenMP [2.9.3.6, Restrictions, p.2]
- // A list item that appears in a reduction clause of the innermost
- // enclosing worksharing or parallel construct may not be accessed in an
- // explicit task.
- // TODO:
-
- // Define implicit data-sharing attributes for task.
- DVar = Stack->getImplicitDSA(VD);
- if (DKind == OMPD_task && DVar.CKind != OMPC_shared) {
- // TODO: should be marked as firstprivate.
- }
- }
- }
- void VisitOMPExecutableDirective(OMPExecutableDirective *S) {
- for (ArrayRef<OMPClause *>::iterator I = S->clauses().begin(),
- E = S->clauses().end();
- I != E; ++I)
- if (OMPClause *C = *I)
- for (StmtRange R = C->children(); R; ++R)
- if (Stmt *Child = *R)
- Visit(Child);
- }
- void VisitStmt(Stmt *S) {
- for (Stmt::child_iterator I = S->child_begin(), E = S->child_end();
- I != E; ++I)
- if (Stmt *Child = *I)
- if (!isa<OMPExecutableDirective>(Child))
- Visit(Child);
- }
-
- bool isErrorFound() { return ErrorFound; }
-
- DSAAttrChecker(DSAStackTy *S, Sema &Actions, CapturedStmt *CS)
- : Stack(S), Actions(Actions), ErrorFound(false), CS(CS) { }
-};
-}
-
StmtResult Sema::ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind,
ArrayRef<OMPClause *> Clauses,
Stmt *AStmt,
SourceLocation StartLoc,
SourceLocation EndLoc) {
- assert(AStmt && isa<CapturedStmt>(AStmt) && "Captured statement expected");
-
StmtResult Res = StmtError();
-
- // Check default data sharing attributes for referenced variables.
- DSAAttrChecker DSAChecker(DSAStack, *this, cast<CapturedStmt>(AStmt));
- DSAChecker.Visit(cast<CapturedStmt>(AStmt)->getCapturedStmt());
- if (DSAChecker.isErrorFound())
- return StmtError();
-
switch (Kind) {
case OMPD_parallel:
Res = ActOnOpenMPParallelDirective(Clauses, AStmt, StartLoc, EndLoc);
@@ -632,12 +231,11 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(OpenMPClauseKind Kind,
OMPClause *Res = 0;
switch (Kind) {
case OMPC_default:
- Res =
- ActOnOpenMPDefaultClause(static_cast<OpenMPDefaultClauseKind>(Argument),
- ArgumentLoc, StartLoc, LParenLoc, EndLoc);
+ Res = ActOnOpenMPDefaultClause(
+ static_cast<OpenMPDefaultClauseKind>(Argument),
+ ArgumentLoc, StartLoc, LParenLoc, EndLoc);
break;
case OMPC_private:
- case OMPC_shared:
case OMPC_threadprivate:
case OMPC_unknown:
case NUM_OPENMP_CLAUSES:
@@ -674,16 +272,6 @@ OMPClause *Sema::ActOnOpenMPDefaultClause(OpenMPDefaultClauseKind Kind,
<< Values << getOpenMPClauseName(OMPC_default);
return 0;
}
- switch (Kind) {
- case OMPC_DEFAULT_none:
- DSAStack->setDefaultDSANone();
- break;
- case OMPC_DEFAULT_shared:
- DSAStack->setDefaultDSAShared();
- break;
- default:
- break;
- }
return new (Context) OMPDefaultClause(Kind, KindKwLoc, StartLoc, LParenLoc,
EndLoc);
}
@@ -698,9 +286,6 @@ OMPClause *Sema::ActOnOpenMPVarListClause(OpenMPClauseKind Kind,
case OMPC_private:
Res = ActOnOpenMPPrivateClause(VarList, StartLoc, LParenLoc, EndLoc);
break;
- case OMPC_shared:
- Res = ActOnOpenMPSharedClause(VarList, StartLoc, LParenLoc, EndLoc);
- break;
case OMPC_default:
case OMPC_threadprivate:
case OMPC_unknown:
@@ -811,29 +396,6 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
}
}
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct]
- // Variables with the predetermined data-sharing attributes may not be
- // listed in data-sharing attributes clauses, except for the cases
- // listed below. For these exceptions only, listing a predetermined
- // variable in a data-sharing attribute clause is allowed and overrides
- // the variable's predetermined data-sharing attributes.
- DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(VD);
- if (DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private) {
- Diag(ELoc, diag::err_omp_wrong_dsa)
- << getOpenMPClauseName(DVar.CKind)
- << getOpenMPClauseName(OMPC_private);
- if (DVar.RefExpr) {
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- } else {
- Diag(VD->getLocation(), diag::note_omp_predetermined_dsa)
- << getOpenMPClauseName(DVar.CKind);
- }
- continue;
- }
-
- DSAStack->addDSA(VD, DE, OMPC_private);
Vars.push_back(DE);
}
@@ -842,65 +404,3 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
return OMPPrivateClause::Create(Context, StartLoc, LParenLoc, EndLoc, Vars);
}
-OMPClause *Sema::ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
- SourceLocation StartLoc,
- SourceLocation LParenLoc,
- SourceLocation EndLoc) {
- SmallVector<Expr *, 8> Vars;
- for (ArrayRef<Expr *>::iterator I = VarList.begin(), E = VarList.end();
- I != E; ++I) {
- if (*I && isa<DependentScopeDeclRefExpr>(*I)) {
- // It will be analyzed later.
- Vars.push_back(*I);
- continue;
- }
-
- SourceLocation ELoc = (*I)->getExprLoc();
- // OpenMP [2.1, C/C++]
- // A list item is a variable name.
- // OpenMP [2.9.3.4, Restrictions, p.1]
- // A variable that is part of another variable (as an array or
- // structure element) cannot appear in a private clause.
- DeclRefExpr *DE = dyn_cast<DeclRefExpr>(*I);
- if (!DE || !isa<VarDecl>(DE->getDecl())) {
- Diag(ELoc, diag::err_omp_expected_var_name)
- << (*I)->getSourceRange();
- continue;
- }
- Decl *D = DE->getDecl();
- VarDecl *VD = cast<VarDecl>(D);
-
- QualType Type = VD->getType();
- if (Type->isDependentType() || Type->isInstantiationDependentType()) {
- // It will be analyzed later.
- Vars.push_back(DE);
- continue;
- }
-
- // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
- // in a Construct]
- // Variables with the predetermined data-sharing attributes may not be
- // listed in data-sharing attributes clauses, except for the cases
- // listed below. For these exceptions only, listing a predetermined
- // variable in a data-sharing attribute clause is allowed and overrides
- // the variable's predetermined data-sharing attributes.
- DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(VD);
- if (DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_shared && DVar.RefExpr) {
- Diag(ELoc, diag::err_omp_wrong_dsa)
- << getOpenMPClauseName(DVar.CKind)
- << getOpenMPClauseName(OMPC_shared);
- Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_explicit_dsa)
- << getOpenMPClauseName(DVar.CKind);
- continue;
- }
-
- DSAStack->addDSA(VD, DE, OMPC_shared);
- Vars.push_back(DE);
- }
-
- if (Vars.empty()) return 0;
-
- return OMPSharedClause::Create(Context, StartLoc, LParenLoc, EndLoc, Vars);
-}
-
-#undef DSAStack
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 1e08af45a0..0d0603f2d8 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1307,14 +1307,6 @@ public:
EndLoc);
}
- OMPClause *RebuildOMPSharedClause(ArrayRef<Expr *> VarList,
- SourceLocation StartLoc,
- SourceLocation LParenLoc,
- SourceLocation EndLoc) {
- return getSema().ActOnOpenMPSharedClause(VarList, StartLoc, LParenLoc,
- EndLoc);
- }
-
/// \brief Rebuild the operand to an Objective-C \@synchronized statement.
///
/// By default, performs semantic analysis to build the new statement.
@@ -6257,44 +6249,33 @@ TreeTransform<Derived>::TransformSEHHandler(Stmt *Handler) {
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
- DeclarationNameInfo DirName;
- getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, 0);
-
// Transform the clauses
- llvm::SmallVector<OMPClause *, 16> TClauses;
+ SmallVector<OMPClause *, 5> TClauses;
ArrayRef<OMPClause *> Clauses = D->clauses();
TClauses.reserve(Clauses.size());
for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
I != E; ++I) {
if (*I) {
OMPClause *Clause = getDerived().TransformOMPClause(*I);
- if (!Clause) {
- getSema().EndOpenMPDSABlock(0);
+ if (!Clause)
return StmtError();
- }
TClauses.push_back(Clause);
}
else {
TClauses.push_back(0);
}
}
- if (!D->getAssociatedStmt()) {
- getSema().EndOpenMPDSABlock(0);
+ if (!D->getAssociatedStmt())
return StmtError();
- }
StmtResult AssociatedStmt =
getDerived().TransformStmt(D->getAssociatedStmt());
- if (AssociatedStmt.isInvalid()) {
- getSema().EndOpenMPDSABlock(0);
+ if (AssociatedStmt.isInvalid())
return StmtError();
- }
- StmtResult Res = getDerived().RebuildOMPParallelDirective(TClauses,
- AssociatedStmt.take(),
- D->getLocStart(),
- D->getLocEnd());
- getSema().EndOpenMPDSABlock(Res.get());
- return Res;
+ return getDerived().RebuildOMPParallelDirective(TClauses,
+ AssociatedStmt.take(),
+ D->getLocStart(),
+ D->getLocEnd());
}
template<typename Derived>
@@ -6310,7 +6291,7 @@ TreeTransform<Derived>::TransformOMPDefaultClause(OMPDefaultClause *C) {
template<typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
- llvm::SmallVector<Expr *, 16> Vars;
+ SmallVector<Expr *, 5> Vars;
Vars.reserve(C->varlist_size());
for (OMPVarList<OMPPrivateClause>::varlist_iterator I = C->varlist_begin(),
E = C->varlist_end();
@@ -6326,25 +6307,6 @@ TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
C->getLocEnd());
}
-template<typename Derived>
-OMPClause *
-TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
- llvm::SmallVector<Expr *, 16> Vars;
- Vars.reserve(C->varlist_size());
- for (OMPVarList<OMPSharedClause>::varlist_iterator I = C->varlist_begin(),
- E = C->varlist_end();
- I != E; ++I) {
- ExprResult EVar = getDerived().TransformExpr(cast<Expr>(*I));
- if (EVar.isInvalid())
- return 0;
- Vars.push_back(EVar.take());
- }
- return getDerived().RebuildOMPSharedClause(Vars,
- C->getLocStart(),
- C->getLParenLoc(),
- C->getLocEnd());
-}
-
//===----------------------------------------------------------------------===//
// Expression transformation
//===----------------------------------------------------------------------===//
diff --git a/lib/Serialization/ASTReaderStmt.cpp b/lib/Serialization/ASTReaderStmt.cpp
index 62459d8974..eaea0f905c 100644
--- a/lib/Serialization/ASTReaderStmt.cpp
+++ b/lib/Serialization/ASTReaderStmt.cpp
@@ -1689,9 +1689,6 @@ OMPClause *OMPClauseReader::readClause() {
case OMPC_private:
C = OMPPrivateClause::CreateEmpty(Context, Record[Idx++]);
break;
- case OMPC_shared:
- C = OMPSharedClause::CreateEmpty(Context, Record[Idx++]);
- break;
}
Visit(C);
C->setLocStart(Reader->ReadSourceLocation(Record, Idx));
@@ -1717,16 +1714,6 @@ void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
C->setVarRefs(Vars);
}
-void OMPClauseReader::VisitOMPSharedClause(OMPSharedClause *C) {
- C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
- unsigned 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/lib/Serialization/ASTWriterStmt.cpp b/lib/Serialization/ASTWriterStmt.cpp
index 6e87129e84..95b9676687 100644
--- a/lib/Serialization/ASTWriterStmt.cpp
+++ b/lib/Serialization/ASTWriterStmt.cpp
@@ -1703,15 +1703,6 @@ void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {
Writer->Writer.AddStmt(*I);
}
-void OMPClauseWriter::VisitOMPSharedClause(OMPSharedClause *C) {
- Record.push_back(C->varlist_size());
- Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
- for (OMPVarList<OMPSharedClause>::varlist_iterator I = C->varlist_begin(),
- E = C->varlist_end();
- I != E; ++I)
- Writer->Writer.AddStmt(*I);
-}
-
//===----------------------------------------------------------------------===//
// OpenMP Directives.
//===----------------------------------------------------------------------===//
diff --git a/test/OpenMP/openmp_common.c b/test/OpenMP/openmp_common.c
index 3765f4c5dc..ca5d89a662 100644
--- a/test/OpenMP/openmp_common.c
+++ b/test/OpenMP/openmp_common.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s
#pragma omp // expected-error {{expected an OpenMP directive}}
#pragma omp unknown_directive // expected-error {{expected an OpenMP directive}}
diff --git a/test/OpenMP/parallel_default_messages.cpp b/test/OpenMP/parallel_default_messages.cpp
index cbc6a73fe3..e5e2572110 100644
--- a/test/OpenMP/parallel_default_messages.cpp
+++ b/test/OpenMP/parallel_default_messages.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s
void foo();
@@ -11,11 +11,5 @@ int main(int argc, char **argv) {
#pragma omp parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
foo();
- #pragma omp parallel default(none)
- ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
-
- #pragma omp parallel default(none)
- #pragma omp parallel default(shared)
- ++argc;
return 0;
}
diff --git a/test/OpenMP/parallel_messages.cpp b/test/OpenMP/parallel_messages.cpp
deleted file mode 100644
index c046f873d1..0000000000
--- a/test/OpenMP/parallel_messages.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
-
-void foo() {
-}
-
-#pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}}
-
-int main(int argc, char **argv) {
- #pragma omp parallel
- #pragma omp parallel unknown() // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
- foo();
- L1:
- foo();
- #pragma omp parallel
- ;
- #pragma omp parallel
- {
- goto L1; // expected-error {{use of undeclared label 'L1'}}
- argc++;
- }
-
- for (int i = 0; i < 10; ++i) {
- switch(argc) {
- case (0):
- #pragma omp parallel
- {
- foo();
- break; // expected-error {{'break' statement not in loop or switch statement}}
- continue; // expected-error {{'continue' statement not in loop statement}}
- }
- default:
- break;
- }
- }
- #pragma omp parallel default(none)
- ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
-
- goto L2; // expected-error {{use of undeclared label 'L2'}}
- #pragma omp parallel
- L2:
- foo();
- #pragma omp parallel
- {
- return 1; // expected-error {{cannot return from OpenMP region}}
- }
-
- return 0;
-}
-
diff --git a/test/OpenMP/parallel_private_messages.cpp b/test/OpenMP/parallel_private_messages.cpp
index 102bf300aa..e64fac8003 100644
--- a/test/OpenMP/parallel_private_messages.cpp
+++ b/test/OpenMP/parallel_private_messages.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 %s
void foo() {
}
@@ -13,7 +13,7 @@ class S2 {
mutable int a;
public:
S2():a(0) { }
- static float S2s; // expected-note {{predetermined as shared}}
+ static float S2s;
};
const S2 b;
const S2 ba[5];
@@ -22,9 +22,9 @@ class S3 {
public:
S3():a(0) { }
};
-const S3 c; // expected-note {{predetermined as shared}}
-const S3 ca[5]; // expected-note {{predetermined as shared}}
-extern const int f; // expected-note {{predetermined as shared}}
+const S3 c;
+const S3 ca[5];
+extern const int f;
class S4 { // expected-note {{'S4' declared here}}
int a;
S4();
@@ -38,12 +38,9 @@ public:
S5(int v):a(v) { }
};
-int threadvar;
-#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
-
int main(int argc, char **argv) {
- const int d = 5; // expected-note {{predetermined as shared}}
- const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
+ const int d = 5;
+ const int da[5] = { 0 };
S4 e(4); // expected-note {{'e' defined here}}
S5 g(5); // expected-note {{'g' defined here}}
int i;
@@ -56,14 +53,13 @@ int main(int argc, char **argv) {
#pragma omp parallel private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
#pragma omp parallel private (argc argv) // expected-error {{expected ',' or ')' in 'private' clause}}
#pragma omp parallel private (S1) // expected-error {{'S1' does not refer to a value}}
- #pragma omp parallel private (a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be private}}
+ #pragma omp parallel private (a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}}
#pragma omp parallel private (argv[1]) // expected-error {{expected variable name}}
#pragma omp parallel private(ba)
- #pragma omp parallel private(ca) // expected-error {{shared variable cannot be private}}
- #pragma omp parallel private(da) // expected-error {{shared variable cannot be private}}
- #pragma omp parallel private(S2::S2s) // expected-error {{shared variable cannot be private}}
+ #pragma omp parallel private(ca)
+ #pragma omp parallel private(da)
+ #pragma omp parallel private(S2::S2s)
#pragma omp parallel private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
- #pragma omp parallel private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}}
foo();
#pragma omp parallel private(i)
#pragma omp parallel private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type 'int &'}}
diff --git a/test/OpenMP/parallel_shared_messages.cpp b/test/OpenMP/parallel_shared_messages.cpp
deleted file mode 100644
index 0d8894e0d4..0000000000
--- a/test/OpenMP/parallel_shared_messages.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
-
-void foo() {
-}
-
-bool foobool(int argc) {
- return argc;
-}
-
-struct S1; // expected-note {{declared here}}
-extern S1 a;
-class S2 {
- mutable int a;
-public:
- S2():a(0) { }
- S2(S2 &s2):a(s2.a) { }
-};
-const S2 b;
-const S2 ba[5];
-class S3 {
- int a;
-public:
- S3():a(0) { }
- S3(S3 &s3):a(s3.a) { }
-};
-const S3 c;
-const S3 ca[5];
-extern const int f;
-class S4 {
- int a;
- S4();
- S4(const S4 &s4);
-public:
- S4(int v):a(v) { }
-};
-class S5 {
- int a;
- S5():a(0) {}
- S5(const S5 &s5):a(s5.a) { }
-public:
- S5(int v):a(v) { }
-};
-
-S3 h;
-#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
-
-int main(int argc, char **argv) {
- const int d = 5;
- const int da[5] = { 0 };
- S4 e(4);
- S5 g(5);
- int i;
- int &j = i;
- #pragma omp parallel shared // expected-error {{expected '(' after 'shared'}}
- #pragma omp parallel shared ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- #pragma omp parallel shared () // expected-error {{expected expression}}
- #pragma omp parallel shared (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
- #pragma omp parallel shared (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
- #pragma omp parallel shared (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
- #pragma omp parallel shared (argc)
- #pragma omp parallel shared (S1) // expected-error {{'S1' does not refer to a value}}
- #pragma omp parallel shared (a, b, c, d, f)
- #pragma omp parallel shared (argv[1]) // expected-error {{expected variable name}}
- #pragma omp parallel shared(ba)
- #pragma omp parallel shared(ca)
- #pragma omp parallel shared(da)
- #pragma omp parallel shared(e, g)
- #pragma omp parallel shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}}
- #pragma omp parallel private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}}
- foo();
- #pragma omp parallel private(i)
- #pragma omp parallel shared(i)
- #pragma omp parallel shared(j)
- foo();
-
- return 0;
-}
diff --git a/test/OpenMP/threadprivate_messages.cpp b/test/OpenMP/threadprivate_messages.cpp
index 42624207e3..a188a0b05d 100644
--- a/test/OpenMP/threadprivate_messages.cpp
+++ b/test/OpenMP/threadprivate_messages.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 %s
#pragma omp threadprivate // expected-error {{expected '(' after 'threadprivate'}}
#pragma omp threadprivate( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index cb85123ed7..765c900012 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1936,9 +1936,6 @@ void OMPClauseEnqueue::VisitOMPDefaultClause(const OMPDefaultClause *C) { }
void OMPClauseEnqueue::VisitOMPPrivateClause(const OMPPrivateClause *C) {
PROCESS_OMP_CLAUSE_LIST(OMPPrivateClause, C)
}
-void OMPClauseEnqueue::VisitOMPSharedClause(const OMPSharedClause *C) {
- PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C)
-}
#undef PROCESS_OMP_CLAUSE_LIST
}
void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
diff --git a/tools/libclang/RecursiveASTVisitor.h b/tools/libclang/RecursiveASTVisitor.h
index 4d2b3a9840..701de89991 100644
--- a/tools/libclang/RecursiveASTVisitor.h
+++ b/tools/libclang/RecursiveASTVisitor.h
@@ -2337,12 +2337,6 @@ bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
return true;
}
-template<typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPSharedClause(OMPSharedClause *C) {
- PROCESS_OMP_CLAUSE_LIST(OMPSharedClause, C)
- return true;
-}
-
#undef PROCESS_OMP_CLAUSE_LIST
// FIXME: look at the following tricky-seeming exprs to see if we