@@ -65,32 +65,9 @@ SourcePosition OpenMPCounterVisitor::getLocation(
6565 c.u );
6666}
6767SourcePosition OpenMPCounterVisitor::getLocation (const OpenMPConstruct &c) {
68- return std::visit (
69- Fortran::common::visitors{
70- [&](const OpenMPStandaloneConstruct &c) -> SourcePosition {
71- return parsing->allCooked ().GetSourcePositionRange (c.source )->first ;
72- },
73- // OpenMPSectionsConstruct, OpenMPLoopConstruct,
74- // OpenMPBlockConstruct, OpenMPCriticalConstruct Get the source from
75- // the directive field.
76- [&](const auto &c) -> SourcePosition {
77- const CharBlock &source{std::get<0 >(c.t ).source };
78- return parsing->allCooked ().GetSourcePositionRange (source)->first ;
79- },
80- [&](const OpenMPAtomicConstruct &c) -> SourcePosition {
81- const CharBlock &source{c.source };
82- return parsing->allCooked ().GetSourcePositionRange (source)->first ;
83- },
84- [&](const OpenMPSectionConstruct &c) -> SourcePosition {
85- const CharBlock &source{c.source };
86- return parsing->allCooked ().GetSourcePositionRange (source)->first ;
87- },
88- [&](const OpenMPUtilityConstruct &c) -> SourcePosition {
89- const CharBlock &source{c.source };
90- return parsing->allCooked ().GetSourcePositionRange (source)->first ;
91- },
92- },
93- c.u );
68+ return parsing->allCooked ()
69+ .GetSourcePositionRange (omp::GetOmpDirectiveName (c).source )
70+ ->first ;
9471}
9572
9673std::string OpenMPCounterVisitor::getName (const OmpWrapperType &w) {
0 commit comments