@@ -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