@@ -268,43 +268,6 @@ bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) {
268
268
return CheckAllowed (clause);
269
269
}
270
270
271
- void OmpStructureChecker::AnalyzeObject (
272
- const parser::OmpObject &object, bool allowAssumedSizeArrays) {
273
- if (std::holds_alternative<parser::Name>(object.u )) {
274
- // Do not analyze common block names. The analyzer will flag an error
275
- // on those.
276
- return ;
277
- }
278
- if (auto *symbol{GetObjectSymbol (object)}) {
279
- // Eliminate certain kinds of symbols before running the analyzer to
280
- // avoid confusing error messages. The analyzer assumes that the context
281
- // of the object use is an expression, and some diagnostics are tailored
282
- // to that.
283
- if (symbol->has <DerivedTypeDetails>() || symbol->has <MiscDetails>()) {
284
- // Type names, construct names, etc.
285
- return ;
286
- }
287
- if (auto *typeSpec{symbol->GetType ()}) {
288
- if (typeSpec->category () == DeclTypeSpec::Category::Character) {
289
- // Don't pass character objects to the analyzer, it can emit somewhat
290
- // cryptic errors (e.g. "'obj' is not an array"). Substrings are
291
- // checked elsewhere in OmpStructureChecker.
292
- return ;
293
- }
294
- }
295
- }
296
- evaluate::ExpressionAnalyzer ea{context_};
297
- auto restore{ea.AllowWholeAssumedSizeArray (allowAssumedSizeArrays)};
298
- common::visit ([&](auto &&s) { ea.Analyze (s); }, object.u );
299
- }
300
-
301
- void OmpStructureChecker::AnalyzeObjects (
302
- const parser::OmpObjectList &objects, bool allowAssumedSizeArrays) {
303
- for (const parser::OmpObject &object : objects.v ) {
304
- AnalyzeObject (object, allowAssumedSizeArrays);
305
- }
306
- }
307
-
308
271
bool OmpStructureChecker::IsCloselyNestedRegion (const OmpDirectiveSet &set) {
309
272
// Definition of close nesting:
310
273
//
@@ -2734,9 +2697,8 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
2734
2697
void OmpStructureChecker::Enter (const parser::OmpClause &x) {
2735
2698
SetContextClause (x);
2736
2699
2737
- llvm::omp::Clause id{x.Id ()};
2738
2700
// The visitors for these clauses do their own checks.
2739
- switch (id ) {
2701
+ switch (x. Id () ) {
2740
2702
case llvm::omp::Clause::OMPC_copyprivate:
2741
2703
case llvm::omp::Clause::OMPC_enter:
2742
2704
case llvm::omp::Clause::OMPC_lastprivate:
@@ -2750,7 +2712,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
2750
2712
// Named constants are OK to be used within 'shared' and 'firstprivate'
2751
2713
// clauses. The check for this happens a few lines below.
2752
2714
bool SharedOrFirstprivate = false ;
2753
- switch (id ) {
2715
+ switch (x. Id () ) {
2754
2716
case llvm::omp::Clause::OMPC_shared:
2755
2717
case llvm::omp::Clause::OMPC_firstprivate:
2756
2718
SharedOrFirstprivate = true ;
@@ -2759,20 +2721,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
2759
2721
break ;
2760
2722
}
2761
2723
2762
- auto allowsAssumedSizeArrays{[](llvm::omp::Clause c) {
2763
- // These clauses allow assumed-size-arrays as list items.
2764
- switch (c) {
2765
- case llvm::omp::Clause::OMPC_map:
2766
- case llvm::omp::Clause::OMPC_shared:
2767
- case llvm::omp::Clause::OMPC_use_device_addr:
2768
- return true ;
2769
- default :
2770
- return false ;
2771
- }
2772
- }};
2773
-
2774
2724
if (const parser::OmpObjectList *objList{GetOmpObjectList (x)}) {
2775
- AnalyzeObjects (*objList, allowsAssumedSizeArrays (id));
2776
2725
SymbolSourceMap symbols;
2777
2726
GetSymbolsInObjectList (*objList, symbols);
2778
2727
for (const auto &[symbol, source] : symbols) {
0 commit comments