Skip to content

Commit c028472

Browse files
committed
Revert "[OPENMP50]Add initial support for OpenMP 5.0 iterator."
This reverts commit f08df46 to fix the bug with serialization support for iterator expression.
1 parent 1148f00 commit c028472

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+57
-907
lines changed

clang/include/clang-c/Index.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,12 +2180,7 @@ enum CXCursorKind {
21802180
*/
21812181
CXCursor_OMPArrayShapingExpr = 150,
21822182

2183-
/**
2184-
* OpenMP 5.0 [2.1.6 Iterators]
2185-
*/
2186-
CXCursor_OMPIteratorExpr = 151,
2187-
2188-
CXCursor_LastExpr = CXCursor_OMPIteratorExpr,
2183+
CXCursor_LastExpr = CXCursor_OMPArrayShapingExpr,
21892184

21902185
/* Statements */
21912186
CXCursor_FirstStmt = 200,

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
970970
#include "clang/Basic/OpenCLImageTypes.def"
971971
CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy;
972972
CanQualType OCLQueueTy, OCLReserveIDTy;
973-
CanQualType OMPArraySectionTy, OMPArrayShapingTy, OMPIteratorTy;
973+
CanQualType OMPArraySectionTy, OMPArrayShapingTy;
974974
#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
975975
CanQualType Id##Ty;
976976
#include "clang/Basic/OpenCLExtensionTypes.def"

clang/include/clang/AST/BuiltinTypes.def

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,8 @@ PLACEHOLDER_TYPE(OMPArraySection, OMPArraySectionTy)
316316
// A placeholder type for OpenMP array shaping operation.
317317
PLACEHOLDER_TYPE(OMPArrayShaping, OMPArrayShapingTy)
318318

319-
// A placeholder type for OpenMP iterators.
320-
PLACEHOLDER_TYPE(OMPIterator, OMPIteratorTy)
321-
322319
#ifdef LAST_BUILTIN_TYPE
323-
LAST_BUILTIN_TYPE(OMPIterator)
320+
LAST_BUILTIN_TYPE(OMPArrayShaping)
324321
#undef LAST_BUILTIN_TYPE
325322
#endif
326323

clang/include/clang/AST/ComputeDependence.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class PseudoObjectExpr;
8888
class AtomicExpr;
8989
class OMPArraySectionExpr;
9090
class OMPArrayShapingExpr;
91-
class OMPIteratorExpr;
9291
class ObjCArrayLiteral;
9392
class ObjCDictionaryLiteral;
9493
class ObjCBoxedExpr;
@@ -175,7 +174,6 @@ ExprDependence computeDependence(AtomicExpr *E);
175174

176175
ExprDependence computeDependence(OMPArraySectionExpr *E);
177176
ExprDependence computeDependence(OMPArrayShapingExpr *E);
178-
ExprDependence computeDependence(OMPIteratorExpr *E);
179177

180178
ExprDependence computeDependence(ObjCArrayLiteral *E);
181179
ExprDependence computeDependence(ObjCDictionaryLiteral *E);

clang/include/clang/AST/ExprOpenMP.h

Lines changed: 0 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -205,173 +205,6 @@ class OMPArrayShapingExpr final
205205
return const_child_range(Begin, Begin + NumDims + 1);
206206
}
207207
};
208-
209-
/// OpenMP 5.0 [2.1.6 Iterators]
210-
/// Iterators are identifiers that expand to multiple values in the clause on
211-
/// which they appear.
212-
/// The syntax of the iterator modifier is as follows:
213-
/// \code
214-
/// iterator(iterators-definition)
215-
/// \endcode
216-
/// where iterators-definition is one of the following:
217-
/// \code
218-
/// iterator-specifier [, iterators-definition ]
219-
/// \endcode
220-
/// where iterator-specifier is one of the following:
221-
/// \code
222-
/// [ iterator-type ] identifier = range-specification
223-
/// \endcode
224-
/// where identifier is a base language identifier.
225-
/// iterator-type is a type name.
226-
/// range-specification is of the form begin:end[:step], where begin and end are
227-
/// expressions for which their types can be converted to iterator-type and step
228-
/// is an integral expression.
229-
/// In an iterator-specifier, if the iterator-type is not specified then the
230-
/// type of that iterator is of int type.
231-
/// The iterator-type must be an integral or pointer type.
232-
/// The iterator-type must not be const qualified.
233-
class OMPIteratorExpr final
234-
: public Expr,
235-
private llvm::TrailingObjects<OMPIteratorExpr, Decl *, Expr *,
236-
SourceLocation> {
237-
public:
238-
/// Iterator range representation begin:end[:step].
239-
struct IteratorRange {
240-
Expr *Begin = nullptr;
241-
Expr *End = nullptr;
242-
Expr *Step = nullptr;
243-
};
244-
/// Iterator definition representation.
245-
struct IteratorDefinition {
246-
Decl *IteratorDecl = nullptr;
247-
IteratorRange Range;
248-
SourceLocation AssignmentLoc;
249-
SourceLocation ColonLoc, SecondColonLoc;
250-
};
251-
252-
private:
253-
friend TrailingObjects;
254-
friend class ASTStmtReader;
255-
friend class ASTStmtWriter;
256-
257-
/// Offset in the list of expressions for subelements of the ranges.
258-
enum class RangeExprOffset {
259-
Begin = 0,
260-
End = 1,
261-
Step = 2,
262-
Total = 3,
263-
};
264-
/// Offset in the list of locations for subelements of colon symbols
265-
/// locations.
266-
enum class RangeLocOffset {
267-
AssignLoc = 0,
268-
FirstColonLoc = 1,
269-
SecondColonLoc = 2,
270-
Total = 3,
271-
};
272-
/// Location of 'iterator' keyword.
273-
SourceLocation IteratorKwLoc;
274-
/// Location of '('.
275-
SourceLocation LPLoc;
276-
/// Location of ')'.
277-
SourceLocation RPLoc;
278-
/// Number of iterator definitions.
279-
unsigned NumIterators = 0;
280-
281-
OMPIteratorExpr(QualType ExprTy, SourceLocation IteratorKwLoc,
282-
SourceLocation L, SourceLocation R,
283-
ArrayRef<OMPIteratorExpr::IteratorDefinition> Data);
284-
285-
/// Construct an empty expression.
286-
explicit OMPIteratorExpr(EmptyShell Shell, unsigned NumIterators)
287-
: Expr(OMPIteratorExprClass, Shell), NumIterators(NumIterators) {}
288-
289-
/// Sets basic declaration for the specified iterator definition.
290-
void setIteratorDeclaration(unsigned I, Decl *D);
291-
292-
/// Sets the location of the assignment symbol for the specified iterator
293-
/// definition.
294-
void setAssignmentLoc(unsigned I, SourceLocation Loc);
295-
296-
/// Sets begin, end and optional step expressions for specified iterator
297-
/// definition.
298-
void setIteratorRange(unsigned I, Expr *Begin, SourceLocation ColonLoc,
299-
Expr *End, SourceLocation SecondColonLoc, Expr *Step);
300-
301-
unsigned numTrailingObjects(OverloadToken<Decl *>) const {
302-
return NumIterators;
303-
}
304-
305-
unsigned numTrailingObjects(OverloadToken<Expr *>) const {
306-
return NumIterators * static_cast<int>(RangeExprOffset::Total);
307-
}
308-
309-
unsigned numTrailingObjects(OverloadToken<SourceRange>) const {
310-
return NumIterators * static_cast<int>(RangeLocOffset::Total);
311-
}
312-
313-
public:
314-
static OMPIteratorExpr *Create(const ASTContext &Context, QualType T,
315-
SourceLocation IteratorKwLoc, SourceLocation L,
316-
SourceLocation R,
317-
ArrayRef<IteratorDefinition> Data);
318-
319-
static OMPIteratorExpr *CreateEmpty(const ASTContext &Context,
320-
unsigned NumIterators);
321-
322-
SourceLocation getLParenLoc() const { return LPLoc; }
323-
void setLParenLoc(SourceLocation L) { LPLoc = L; }
324-
325-
SourceLocation getRParenLoc() const { return RPLoc; }
326-
void setRParenLoc(SourceLocation L) { RPLoc = L; }
327-
328-
SourceLocation getIteratorKwLoc() const { return IteratorKwLoc; }
329-
void setIteratorKwLoc(SourceLocation L) { IteratorKwLoc = L; }
330-
SourceLocation getBeginLoc() const LLVM_READONLY { return IteratorKwLoc; }
331-
SourceLocation getEndLoc() const LLVM_READONLY { return RPLoc; }
332-
333-
/// Gets the iterator declaration for the given iterator.
334-
Decl *getIteratorDecl(unsigned I);
335-
const Decl *getIteratorDecl(unsigned I) const {
336-
return const_cast<OMPIteratorExpr *>(this)->getIteratorDecl(I);
337-
}
338-
339-
/// Gets the iterator range for the given iterator.
340-
IteratorRange getIteratorRange(unsigned I);
341-
const IteratorRange getIteratorRange(unsigned I) const {
342-
return const_cast<OMPIteratorExpr *>(this)->getIteratorRange(I);
343-
}
344-
345-
/// Gets the location of '=' for the given iterator definition.
346-
SourceLocation getAssignLoc(unsigned I) const;
347-
/// Gets the location of the first ':' in the range for the given iterator
348-
/// definition.
349-
SourceLocation getColonLoc(unsigned I) const;
350-
/// Gets the location of the second ':' (if any) in the range for the given
351-
/// iteratori definition.
352-
SourceLocation getSecondColonLoc(unsigned I) const;
353-
354-
/// Returns number of iterator definitions.
355-
unsigned numOfIterators() const { return NumIterators; }
356-
357-
static bool classof(const Stmt *T) {
358-
return T->getStmtClass() == OMPIteratorExprClass;
359-
}
360-
361-
// Iterators
362-
child_range children() {
363-
Stmt **Begin = reinterpret_cast<Stmt **>(getTrailingObjects<Expr *>());
364-
return child_range(
365-
Begin, Begin + NumIterators * static_cast<int>(RangeExprOffset::Total));
366-
}
367-
const_child_range children() const {
368-
Stmt *const *Begin =
369-
reinterpret_cast<Stmt *const *>(getTrailingObjects<Expr *>());
370-
return const_child_range(
371-
Begin, Begin + NumIterators * static_cast<int>(RangeExprOffset::Total));
372-
}
373-
};
374-
375208
} // end namespace clang
376209

377210
#endif

clang/include/clang/AST/OpenMPClause.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,9 +4372,6 @@ class OMPDependClause final
43724372
/// Set colon location.
43734373
void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
43744374

4375-
/// Sets optional dependency modifier.
4376-
void setModifier(Expr *DepModifier);
4377-
43784375
public:
43794376
/// Creates clause with a list of variables \a VL.
43804377
///
@@ -4390,7 +4387,7 @@ class OMPDependClause final
43904387
/// clause.
43914388
static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc,
43924389
SourceLocation LParenLoc,
4393-
SourceLocation EndLoc, Expr *DepModifier,
4390+
SourceLocation EndLoc,
43944391
OpenMPDependClauseKind DepKind,
43954392
SourceLocation DepLoc, SourceLocation ColonLoc,
43964393
ArrayRef<Expr *> VL, unsigned NumLoops);
@@ -4407,12 +4404,6 @@ class OMPDependClause final
44074404
/// Get dependency type.
44084405
OpenMPDependClauseKind getDependencyKind() const { return DepKind; }
44094406

4410-
/// Return optional depend modifier.
4411-
Expr *getModifier();
4412-
const Expr *getModifier() const {
4413-
return const_cast<OMPDependClause *>(this)->getModifier();
4414-
}
4415-
44164407
/// Get dependency type location.
44174408
SourceLocation getDependencyLoc() const { return DepLoc; }
44184409

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,6 @@ DEF_TRAVERSE_STMT(AddrLabelExpr, {})
25522552
DEF_TRAVERSE_STMT(ArraySubscriptExpr, {})
25532553
DEF_TRAVERSE_STMT(OMPArraySectionExpr, {})
25542554
DEF_TRAVERSE_STMT(OMPArrayShapingExpr, {})
2555-
DEF_TRAVERSE_STMT(OMPIteratorExpr, {})
25562555

25572556
DEF_TRAVERSE_STMT(BlockExpr, {
25582557
TRY_TO(TraverseDecl(S->getBlockDecl()));

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ class TextNodeDumper
274274
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node);
275275
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
276276
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
277-
void VisitOMPIteratorExpr(const OMPIteratorExpr *Node);
278277

279278
void VisitRValueReferenceType(const ReferenceType *T);
280279
void VisitArrayType(const ArrayType *T);

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,10 +1220,6 @@ def err_omp_expected_identifier_for_critical : Error<
12201220
"expected identifier specifying the name of the 'omp critical' directive">;
12211221
def err_omp_expected_reduction_identifier : Error<
12221222
"expected identifier or one of the following operators: '+', '-', '*', '&', '|', '^', '&&', or '||'">;
1223-
def err_omp_expected_equal_in_iterator : Error<
1224-
"expected '=' in iterator specifier">;
1225-
def err_omp_expected_punc_after_iterator : Error<
1226-
"expected ',' or ')' after iterator specifier">;
12271223
def err_omp_decl_in_declare_simd_variant : Error<
12281224
"function declaration is expected after 'declare %select{simd|variant}0' directive">;
12291225
def err_omp_unknown_map_type : Error<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9760,14 +9760,6 @@ def note_omp_conversion_here : Note<
97609760
def err_omp_ambiguous_conversion : Error<
97619761
"ambiguous conversion from type %0 to an integral or unscoped "
97629762
"enumeration type">;
9763-
def err_omp_iterator_not_integral_or_pointer : Error<
9764-
"expected integral or pointer type as the iterator-type, not %0">;
9765-
def err_omp_iterator_constant : Error<
9766-
"expected non-constant type as the iterator-type, constant %0 is provided">;
9767-
def err_omp_iterator_step_not_integral : Error<
9768-
"iterator step expression %0 is not the integral expression">;
9769-
def err_omp_iterator_step_constant_zero : Error<
9770-
"iterator step expression %0 evaluates to 0">;
97719763
def err_omp_required_access : Error<
97729764
"%0 variable must be %1">;
97739765
def err_omp_const_variable : Error<
@@ -9961,7 +9953,6 @@ def err_omp_invalid_mapper: Error<
99619953
"cannot find a valid user-defined mapper for type %0 with name %1">;
99629954
def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
99639955
def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
9964-
def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
99659956
def err_omp_typecheck_section_value : Error<
99669957
"subscripted value is not an array or pointer">;
99679958
def err_omp_typecheck_section_not_integer : Error<
@@ -10040,10 +10031,6 @@ def err_omp_depend_sink_source_not_allowed : Error<
1004010031
"'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
1004110032
def err_omp_depend_zero_length_array_section_not_allowed : Error<
1004210033
"zero-length array section is not allowed in 'depend' clause">;
10043-
def err_omp_depend_sink_source_with_modifier : Error<
10044-
"depend modifier cannot be used with 'sink' or 'source' depend type">;
10045-
def err_omp_depend_modifier_not_iterator : Error<
10046-
"expected iterator specification as depend modifier">;
1004710034
def err_omp_linear_ordered : Error<
1004810035
"'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
1004910036
def err_omp_unexpected_schedule_modifier : Error<

0 commit comments

Comments
 (0)