Skip to content

Commit f4c444b

Browse files
committed
fix examples
1 parent 4846849 commit f4c444b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

flang/examples/FeatureList/FeatureList.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,9 @@ struct NodeVisitor {
445445
READ_FEATURE(ObjectDecl)
446446
READ_FEATURE(OldParameterStmt)
447447
READ_FEATURE(OmpAlignedClause)
448-
READ_FEATURE(OmpBeginBlockDirective)
448+
READ_FEATURE(OmpBeginDirective)
449449
READ_FEATURE(OmpBeginLoopDirective)
450450
READ_FEATURE(OmpBeginSectionsDirective)
451-
READ_FEATURE(OmpBlockDirective)
452451
READ_FEATURE(OmpClause)
453452
READ_FEATURE(OmpClauseList)
454453
READ_FEATURE(OmpCriticalDirective)
@@ -472,7 +471,7 @@ struct NodeVisitor {
472471
READ_FEATURE(OmpIteration)
473472
READ_FEATURE(OmpIterationOffset)
474473
READ_FEATURE(OmpIterationVector)
475-
READ_FEATURE(OmpEndBlockDirective)
474+
READ_FEATURE(OmpEndDirective)
476475
READ_FEATURE(OmpEndCriticalDirective)
477476
READ_FEATURE(OmpEndLoopDirective)
478477
READ_FEATURE(OmpEndSectionsDirective)

flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,30 +146,31 @@ std::string OpenMPCounterVisitor::getName(const OpenMPConstruct &c) {
146146
const CharBlock &source{std::get<0>(c.t).source};
147147
return normalize_construct_name(source.ToString());
148148
},
149-
[&](const OpenMPAllocatorsConstruct &c) -> std::string {
150-
const CharBlock &source{std::get<0>(c.t).source};
151-
return normalize_construct_name(source.ToString());
152-
},
153-
[&](const OpenMPAtomicConstruct &c) -> std::string {
154-
auto &dirSpec = std::get<OmpDirectiveSpecification>(c.t);
155-
auto &dirName = std::get<OmpDirectiveName>(dirSpec.t);
156-
return normalize_construct_name(dirName.source.ToString());
157-
},
158149
[&](const OpenMPUtilityConstruct &c) -> std::string {
159150
const CharBlock &source{c.source};
160151
return normalize_construct_name(source.ToString());
161152
},
162153
[&](const OpenMPSectionConstruct &c) -> std::string {
163154
return "section";
164155
},
165-
// OpenMPSectionsConstruct, OpenMPLoopConstruct,
166-
// OpenMPBlockConstruct, OpenMPCriticalConstruct Get the source from
167-
// the directive field of the begin directive or from the verbatim
168-
// field of the begin directive in Critical
169-
[&](const auto &c) -> std::string {
156+
[&](const OpenMPCriticalConstruct &c) -> std::string {
170157
const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source};
171158
return normalize_construct_name(source.ToString());
172159
},
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+
},
173174
},
174175
c.u);
175176
}

0 commit comments

Comments
 (0)