Skip to content

Commit ddfed81

Browse files
committed
Revert "[OpenMP] atomic compare fail : Parser & AST support"
This reverts commit edd675a. This breaks clang build where every component is a shared library. The file clang/lib/Basic/OpenMPKinds.cpp, which is a part of libclangBasic.so, uses `getOpenMPClauseName` which isn't: /usr/bin/ld: CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o: in functio n `clang ::getOpenMPSimpleClauseTypeName(llvm::omp::Clause, unsigned int )': OpenMPKinds.cpp:(.text._ZN5clang29getOpenMPSimpleClauseTypeNameEN4llvm3o mp6ClauseEj+0x9b): undefined reference to `llvm::omp::getOpenMPClauseNam e(llvm::omp::Clause)'
1 parent 882d400 commit ddfed81

File tree

20 files changed

+1
-255
lines changed

20 files changed

+1
-255
lines changed

clang/include/clang/AST/OpenMPClause.h

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,89 +2513,6 @@ class OMPRelaxedClause final : public OMPClause {
25132513
}
25142514
};
25152515

2516-
/// This represents 'fail' clause in the '#pragma omp atomic'
2517-
/// directive.
2518-
///
2519-
/// \code
2520-
/// #pragma omp atomic compare fail
2521-
/// \endcode
2522-
/// In this example directive '#pragma omp atomic compare' has 'fail' clause.
2523-
class OMPFailClause final : public OMPClause {
2524-
2525-
// FailParameter is a memory-order-clause. Storing the ClauseKind is
2526-
// sufficient for our purpose.
2527-
OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
2528-
SourceLocation FailParameterLoc;
2529-
SourceLocation LParenLoc;
2530-
2531-
friend class OMPClauseReader;
2532-
2533-
/// Sets the location of '(' in fail clause.
2534-
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
2535-
2536-
/// Sets the location of memoryOrder clause argument in fail clause.
2537-
void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
2538-
2539-
/// Sets the mem_order clause for 'atomic compare fail' directive.
2540-
void setFailParameter(OpenMPClauseKind FailParameter) {
2541-
this->FailParameter = FailParameter;
2542-
assert(checkFailClauseParameter(FailParameter) &&
2543-
"Invalid fail clause parameter");
2544-
}
2545-
2546-
public:
2547-
/// Build 'fail' clause.
2548-
///
2549-
/// \param StartLoc Starting location of the clause.
2550-
/// \param EndLoc Ending location of the clause.
2551-
OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
2552-
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
2553-
2554-
OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
2555-
SourceLocation StartLoc, SourceLocation LParenLoc,
2556-
SourceLocation EndLoc)
2557-
: OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
2558-
FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
2559-
2560-
setFailParameter(FailParameter);
2561-
}
2562-
2563-
/// Build an empty clause.
2564-
OMPFailClause()
2565-
: OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
2566-
2567-
child_range children() {
2568-
return child_range(child_iterator(), child_iterator());
2569-
}
2570-
2571-
const_child_range children() const {
2572-
return const_child_range(const_child_iterator(), const_child_iterator());
2573-
}
2574-
2575-
child_range used_children() {
2576-
return child_range(child_iterator(), child_iterator());
2577-
}
2578-
const_child_range used_children() const {
2579-
return const_child_range(const_child_iterator(), const_child_iterator());
2580-
}
2581-
2582-
static bool classof(const OMPClause *T) {
2583-
return T->getClauseKind() == llvm::omp::OMPC_fail;
2584-
}
2585-
2586-
/// Gets the location of '(' (for the parameter) in fail clause.
2587-
SourceLocation getLParenLoc() const {
2588-
return LParenLoc;
2589-
}
2590-
2591-
/// Gets the location of Fail Parameter (type memory-order-clause) in
2592-
/// fail clause.
2593-
SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
2594-
2595-
/// Gets the parameter (type memory-order-clause) in Fail clause.
2596-
OpenMPClauseKind getFailParameter() const { return FailParameter; }
2597-
};
2598-
25992516
/// This represents clause 'private' in the '#pragma omp ...' directives.
26002517
///
26012518
/// \code

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,11 +3398,6 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
33983398
return true;
33993399
}
34003400

3401-
template <typename Derived>
3402-
bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
3403-
return true;
3404-
}
3405-
34063401
template <typename Derived>
34073402
bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
34083403
return true;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10962,8 +10962,6 @@ def note_omp_atomic_compare: Note<
1096210962
"expect binary operator in conditional expression|expect '<', '>' or '==' as order operator|expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'|"
1096310963
"expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
1096410964
"expect a 'if' statement|expect no more than two statements|expect a compound statement|expect 'else' statement|expect a form 'r = x == e; if (r) ...'}0">;
10965-
def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
10966-
def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
1096710965
def err_omp_atomic_several_clauses : Error<
1096810966
"directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
1096910967
def err_omp_several_mem_order_clauses : Error<

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
#ifndef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
4242
#define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)
4343
#endif
44-
#ifndef OPENMP_ATOMIC_FAIL_MODIFIER
45-
#define OPENMP_ATOMIC_FAIL_MODIFIER(Name)
46-
#endif
4744
#ifndef OPENMP_AT_KIND
4845
#define OPENMP_AT_KIND(Name)
4946
#endif
@@ -141,11 +138,6 @@ OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(seq_cst)
141138
OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(acq_rel)
142139
OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(relaxed)
143140

144-
// Modifiers for atomic 'fail' clause.
145-
OPENMP_ATOMIC_FAIL_MODIFIER(seq_cst)
146-
OPENMP_ATOMIC_FAIL_MODIFIER(acquire)
147-
OPENMP_ATOMIC_FAIL_MODIFIER(relaxed)
148-
149141
// Modifiers for 'at' clause.
150142
OPENMP_AT_KIND(compilation)
151143
OPENMP_AT_KIND(execution)
@@ -234,7 +226,6 @@ OPENMP_DOACROSS_MODIFIER(source_omp_cur_iteration)
234226
#undef OPENMP_SCHEDULE_MODIFIER
235227
#undef OPENMP_SCHEDULE_KIND
236228
#undef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
237-
#undef OPENMP_ATOMIC_FAIL_MODIFIER
238229
#undef OPENMP_AT_KIND
239230
#undef OPENMP_SEVERITY_KIND
240231
#undef OPENMP_MAP_KIND

clang/include/clang/Basic/OpenMPKinds.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,6 @@ bool isOpenMPCombinedParallelADirective(OpenMPDirectiveKind DKind);
363363
/// \return true - if the above condition is met for this directive
364364
/// otherwise - false.
365365
bool needsTaskBasedThreadLimit(OpenMPDirectiveKind DKind);
366-
367-
/// Checks if the parameter to the fail clause in "#pragma atomic compare fail"
368-
/// is restricted only to memory order clauses of "OMPC_acquire",
369-
/// "OMPC_relaxed" and "OMPC_seq_cst".
370-
bool checkFailClauseParameter(OpenMPClauseKind FailClauseParameter);
371366
}
372367

373368
#endif

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12193,13 +12193,6 @@ class Sema final {
1219312193
/// Called on well-formed 'compare' clause.
1219412194
OMPClause *ActOnOpenMPCompareClause(SourceLocation StartLoc,
1219512195
SourceLocation EndLoc);
12196-
/// Called on well-formed 'fail' clause.
12197-
OMPClause *ActOnOpenMPFailClause(SourceLocation StartLoc,
12198-
SourceLocation EndLoc);
12199-
OMPClause *ActOnOpenMPFailClause(
12200-
OpenMPClauseKind Kind, SourceLocation KindLoc,
12201-
SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
12202-
1220312196
/// Called on well-formed 'seq_cst' clause.
1220412197
OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
1220512198
SourceLocation EndLoc);

clang/lib/AST/OpenMPClause.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
130130
case OMPC_update:
131131
case OMPC_capture:
132132
case OMPC_compare:
133-
case OMPC_fail:
134133
case OMPC_seq_cst:
135134
case OMPC_acq_rel:
136135
case OMPC_acquire:
@@ -228,7 +227,6 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
228227
case OMPC_update:
229228
case OMPC_capture:
230229
case OMPC_compare:
231-
case OMPC_fail:
232230
case OMPC_seq_cst:
233231
case OMPC_acq_rel:
234232
case OMPC_acquire:
@@ -1927,16 +1925,6 @@ void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
19271925
OS << "compare";
19281926
}
19291927

1930-
void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
1931-
OS << "fail";
1932-
if (Node) {
1933-
OS << "(";
1934-
OS << getOpenMPSimpleClauseTypeName(
1935-
Node->getClauseKind(), static_cast<int>(Node->getFailParameter()));
1936-
OS << ")";
1937-
}
1938-
}
1939-
19401928
void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
19411929
OS << "seq_cst";
19421930
}

clang/lib/AST/StmtProfile.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
582582

583583
void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
584584

585-
void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {}
586-
587585
void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
588586

589587
void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}

clang/lib/Basic/OpenMPKinds.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
104104
.Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
105105
#include "clang/Basic/OpenMPKinds.def"
106106
.Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
107-
case OMPC_fail:
108-
return static_cast<unsigned int>(llvm::StringSwitch<llvm::omp::Clause>(Str)
109-
#define OPENMP_ATOMIC_FAIL_MODIFIER(Name) .Case(#Name, OMPC_##Name)
110-
#include "clang/Basic/OpenMPKinds.def"
111-
.Default(OMPC_unknown));
112107
case OMPC_device_type:
113108
return llvm::StringSwitch<OpenMPDeviceType>(Str)
114109
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
@@ -439,11 +434,6 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
439434
#include "clang/Basic/OpenMPKinds.def"
440435
}
441436
llvm_unreachable("Invalid OpenMP 'depend' clause type");
442-
case OMPC_fail: {
443-
OpenMPClauseKind CK = static_cast<OpenMPClauseKind>(Type);
444-
return getOpenMPClauseName(CK).data();
445-
llvm_unreachable("Invalid OpenMP 'fail' clause modifier");
446-
}
447437
case OMPC_device:
448438
switch (Type) {
449439
case OMPC_DEVICE_unknown:
@@ -899,10 +889,3 @@ void clang::getOpenMPCaptureRegions(
899889
llvm_unreachable("Unknown OpenMP directive");
900890
}
901891
}
902-
903-
bool clang::checkFailClauseParameter(OpenMPClauseKind FailClauseParameter) {
904-
return FailClauseParameter == llvm::omp::OMPC_acquire ||
905-
FailClauseParameter == llvm::omp::OMPC_relaxed ||
906-
FailClauseParameter == llvm::omp::OMPC_seq_cst;
907-
}
908-

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6516,10 +6516,6 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
65166516
IsPostfixUpdate, IsFailOnly, Loc);
65176517
break;
65186518
}
6519-
case OMPC_fail: {
6520-
//TODO
6521-
break;
6522-
}
65236519
default:
65246520
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
65256521
}

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3248,7 +3248,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
32483248
else
32493249
Clause = ParseOpenMPSingleExprClause(CKind, WrongDirective);
32503250
break;
3251-
case OMPC_fail:
32523251
case OMPC_default:
32533252
case OMPC_proc_bind:
32543253
case OMPC_atomic_default_mem_order:

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12682,14 +12682,6 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
1268212682
}
1268312683
break;
1268412684
}
12685-
case OMPC_fail: {
12686-
if (AtomicKind != OMPC_compare) {
12687-
Diag(C->getBeginLoc(), diag::err_omp_atomic_fail_no_compare)
12688-
<< SourceRange(C->getBeginLoc(), C->getEndLoc());
12689-
return StmtError();
12690-
}
12691-
break;
12692-
}
1269312685
case OMPC_seq_cst:
1269412686
case OMPC_acq_rel:
1269512687
case OMPC_acquire:
@@ -16891,11 +16883,6 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
1689116883
static_cast<OpenMPAtomicDefaultMemOrderClauseKind>(Argument),
1689216884
ArgumentLoc, StartLoc, LParenLoc, EndLoc);
1689316885
break;
16894-
case OMPC_fail:
16895-
Res = ActOnOpenMPFailClause(
16896-
static_cast<OpenMPClauseKind>(Argument),
16897-
ArgumentLoc, StartLoc, LParenLoc, EndLoc);
16898-
break;
1689916886
case OMPC_update:
1690016887
Res = ActOnOpenMPUpdateClause(static_cast<OpenMPDependClauseKind>(Argument),
1690116888
ArgumentLoc, StartLoc, LParenLoc, EndLoc);
@@ -17536,9 +17523,6 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
1753617523
case OMPC_compare:
1753717524
Res = ActOnOpenMPCompareClause(StartLoc, EndLoc);
1753817525
break;
17539-
case OMPC_fail:
17540-
Res = ActOnOpenMPFailClause(StartLoc, EndLoc);
17541-
break;
1754217526
case OMPC_seq_cst:
1754317527
Res = ActOnOpenMPSeqCstClause(StartLoc, EndLoc);
1754417528
break;
@@ -17699,24 +17683,6 @@ OMPClause *Sema::ActOnOpenMPCompareClause(SourceLocation StartLoc,
1769917683
return new (Context) OMPCompareClause(StartLoc, EndLoc);
1770017684
}
1770117685

17702-
OMPClause *Sema::ActOnOpenMPFailClause(SourceLocation StartLoc,
17703-
SourceLocation EndLoc) {
17704-
return new (Context) OMPFailClause(StartLoc, EndLoc);
17705-
}
17706-
17707-
OMPClause *Sema::ActOnOpenMPFailClause(
17708-
OpenMPClauseKind Parameter, SourceLocation KindLoc,
17709-
SourceLocation StartLoc, SourceLocation LParenLoc,
17710-
SourceLocation EndLoc) {
17711-
17712-
if (!checkFailClauseParameter(Parameter)) {
17713-
Diag(KindLoc, diag::err_omp_atomic_fail_wrong_or_no_clauses);
17714-
return nullptr;
17715-
}
17716-
return new (Context)
17717-
OMPFailClause(Parameter, KindLoc, StartLoc, LParenLoc, EndLoc);
17718-
}
17719-
1772017686
OMPClause *Sema::ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
1772117687
SourceLocation EndLoc) {
1772217688
return new (Context) OMPSeqCstClause(StartLoc, EndLoc);

clang/lib/Sema/TreeTransform.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9866,12 +9866,6 @@ TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *C) {
98669866
return C;
98679867
}
98689868

9869-
template <typename Derived>
9870-
OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *C) {
9871-
// No need to rebuild this clause, no template-dependent parameters.
9872-
return C;
9873-
}
9874-
98759869
template <typename Derived>
98769870
OMPClause *
98779871
TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *C) {

clang/lib/Serialization/ASTReader.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10276,9 +10276,6 @@ OMPClause *OMPClauseReader::readClause() {
1027610276
case llvm::omp::OMPC_compare:
1027710277
C = new (Context) OMPCompareClause();
1027810278
break;
10279-
case llvm::omp::OMPC_fail:
10280-
C = new (Context) OMPFailClause();
10281-
break;
1028210279
case llvm::omp::OMPC_seq_cst:
1028310280
C = new (Context) OMPSeqCstClause();
1028410281
break;
@@ -10672,16 +10669,6 @@ void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {}
1067210669

1067310670
void OMPClauseReader::VisitOMPCompareClause(OMPCompareClause *) {}
1067410671

10675-
// Read the parameter of fail clause. This will have been saved when
10676-
// OMPClauseWriter is called.
10677-
void OMPClauseReader::VisitOMPFailClause(OMPFailClause *C) {
10678-
C->setLParenLoc(Record.readSourceLocation());
10679-
SourceLocation FailParameterLoc = Record.readSourceLocation();
10680-
C->setFailParameterLoc(FailParameterLoc);
10681-
OpenMPClauseKind CKind = Record.readEnum<OpenMPClauseKind>();
10682-
C->setFailParameter(CKind);
10683-
}
10684-
1068510672
void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
1068610673

1068710674
void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {}

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6622,13 +6622,6 @@ void OMPClauseWriter::VisitOMPCaptureClause(OMPCaptureClause *) {}
66226622

66236623
void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}
66246624

6625-
// Save the parameter of fail clause.
6626-
void OMPClauseWriter::VisitOMPFailClause(OMPFailClause *C) {
6627-
Record.AddSourceLocation(C->getLParenLoc());
6628-
Record.AddSourceLocation(C->getFailParameterLoc());
6629-
Record.writeEnum(C->getFailParameter());
6630-
}
6631-
66326625
void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
66336626

66346627
void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}

0 commit comments

Comments
 (0)