[flang-commits] [flang] [flang][OpenMP] Issue a warning when parsing future directive spelling (PR #147765)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Thu Jul 10 07:01:37 PDT 2025
================
@@ -259,6 +259,55 @@ void OmpStructureChecker::CheckVariableListItem(
}
}
+void OmpStructureChecker::CheckDirectiveSpelling(
+ parser::CharBlock spelling, llvm::omp::Directive id) {
+ // Directive names that contain spaces can be spelled in the source without
+ // any of the spaces. Because of that getOpenMPKind* is not guaranteed to
+ // work with the source spelling as the argument.
+ //
+ // To verify the source spellings, we have to get the spelling for a given
+ // version, remove spaces and compare it with the source spelling (also
+ // with spaces removed).
+ auto removeSpaces = [](llvm::StringRef s) {
+ std::string n{s.str()};
+ for (auto it{n.begin()}; it != n.end();) {
+ it = isspace(*it) ? n.erase(it) : std::next(it);
+ }
----------------
kparzysz wrote:
Done
https://github.com/llvm/llvm-project/pull/147765
More information about the flang-commits
mailing list