Skip to content

Commit c056e74

Browse files
committed
fix them harder
1 parent f4c444b commit c056e74

File tree

3 files changed

+6
-64
lines changed

3 files changed

+6
-64
lines changed

flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "FlangOmpReportVisitor.h"
10+
#include "flang/Parser/openmp-utils.h"
1011
#include "llvm/ADT/StringExtras.h"
1112
#include "llvm/Frontend/OpenMP/OMP.h"
1213

@@ -118,61 +119,8 @@ std::string OpenMPCounterVisitor::getName(const OpenMPDeclarativeConstruct &c) {
118119
c.u);
119120
}
120121
std::string OpenMPCounterVisitor::getName(const OpenMPConstruct &c) {
121-
return std::visit(
122-
Fortran::common::visitors{
123-
[&](const OpenMPStandaloneConstruct &c) -> std::string {
124-
return common::visit(
125-
common::visitors{
126-
[&](const OmpMetadirectiveDirective &d) {
127-
return normalize_construct_name(d.source.ToString());
128-
},
129-
[&](auto &&d) {
130-
const CharBlock &source{
131-
std::get<OmpDirectiveName>(d.v.t).source};
132-
return normalize_construct_name(source.ToString());
133-
},
134-
},
135-
c.u);
136-
},
137-
[&](const OpenMPExecutableAllocate &c) -> std::string {
138-
const CharBlock &source{std::get<0>(c.t).source};
139-
return normalize_construct_name(source.ToString());
140-
},
141-
[&](const OpenMPDeclarativeAllocate &c) -> std::string {
142-
const CharBlock &source{std::get<0>(c.t).source};
143-
return normalize_construct_name(source.ToString());
144-
},
145-
[&](const OpenMPAssumeConstruct &c) -> std::string {
146-
const CharBlock &source{std::get<0>(c.t).source};
147-
return normalize_construct_name(source.ToString());
148-
},
149-
[&](const OpenMPUtilityConstruct &c) -> std::string {
150-
const CharBlock &source{c.source};
151-
return normalize_construct_name(source.ToString());
152-
},
153-
[&](const OpenMPSectionConstruct &c) -> std::string {
154-
return "section";
155-
},
156-
[&](const OpenMPCriticalConstruct &c) -> std::string {
157-
const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source};
158-
return normalize_construct_name(source.ToString());
159-
},
160-
[&](const OpenMPLoopConstruct &c) -> std::string {
161-
const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source};
162-
return normalize_construct_name(source.ToString());
163-
},
164-
[&](const OpenMPSectionsConstruct &c) -> std::string {
165-
const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source};
166-
return normalize_construct_name(source.ToString());
167-
},
168-
[&](const auto &c) -> std::string {
169-
using T = llvm::remove_cvref_t<decltype(c)>;
170-
static_assert(std::is_base_of_v<OmpBlockConstruct, T>);
171-
return normalize_construct_name(
172-
c.BeginDir().DirName().source.ToString());
173-
},
174-
},
175-
c.u);
122+
return normalize_construct_name(
123+
omp::GetOmpDirectiveName(c).source.ToString());
176124
}
177125

178126
bool OpenMPCounterVisitor::Pre(const OpenMPDeclarativeConstruct &c) {
@@ -256,11 +204,6 @@ void OpenMPCounterVisitor::Post(const OmpScheduleClause::Kind &c) {
256204
clauseDetails +=
257205
"type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";";
258206
}
259-
void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) {
260-
clauseDetails += "name_modifier=" +
261-
llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() +
262-
";";
263-
}
264207
void OpenMPCounterVisitor::Post(const OmpClause &c) {
265208
PostClauseCommon(normalize_clause_name(c.source.ToString()));
266209
clauseDetails.clear();

flang/examples/FlangOmpReport/FlangOmpReportVisitor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ struct OpenMPCounterVisitor {
7777
void Post(const OmpTaskDependenceType::Value &c);
7878
void Post(const OmpMapType::Value &c);
7979
void Post(const OmpScheduleClause::Kind &c);
80-
void Post(const OmpDirectiveNameModifier &c);
8180
void Post(const OmpClause &c);
8281
void PostClauseCommon(const ClauseInfo &ci);
8382

flang/test/Examples/omp-atomic.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@
3131
! CHECK-NEXT: - clause: read
3232
! CHECK-NEXT: details: ''
3333
! CHECK-NEXT: - clause: seq_cst
34-
! CHECK-NEXT: details: 'name_modifier=atomic;'
34+
! CHECK-NEXT: details: ''
3535
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'
3636
! CHECK-NEXT: line: 12
3737
! CHECK-NEXT: construct: atomic
3838
! CHECK-NEXT: clauses:
3939
! CHECK-NEXT: - clause: seq_cst
40-
! CHECK-NEXT: details: 'name_modifier=atomic;'
40+
! CHECK-NEXT: details: ''
4141
! CHECK-NEXT: - clause: write
4242
! CHECK-NEXT: details: ''
4343
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'
4444
! CHECK-NEXT: line: 16
4545
! CHECK-NEXT: construct: atomic
4646
! CHECK-NEXT: clauses:
4747
! CHECK-NEXT: - clause: capture
48-
! CHECK-NEXT: details: 'name_modifier=atomic;name_modifier=atomic;'
48+
! CHECK-NEXT: details: ''
4949
! CHECK-NEXT: - clause: seq_cst
5050
! CHECK-NEXT: details: ''
5151
! CHECK-NEXT:- file: '{{[^"]*}}omp-atomic.f90'

0 commit comments

Comments
 (0)