-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][OpenMP] Make Symbol::OmpFlagToClauseName static #113586
Conversation
It doesn't need the Symbol object for anything.
@llvm/pr-subscribers-flang-semantics @llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesIt doesn't need the Symbol object for anything. Full diff: https://github.com/llvm/llvm-project/pull/113586.diff 2 Files Affected:
diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h
index cf0350735b5b94..0767d8ea84bc6b 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -778,7 +778,7 @@ class Symbol {
void set_offset(std::size_t offset) { offset_ = offset; }
// Give the symbol a name with a different source location but same chars.
void ReplaceName(const SourceName &);
- std::string OmpFlagToClauseName(Flag ompFlag);
+ static std::string OmpFlagToClauseName(Flag ompFlag);
// Does symbol have this type of details?
template <typename D> bool has() const {
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 490d802cddf42f..33936ba4c2b34f 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2320,7 +2320,7 @@ void OmpAttributeVisitor::ResolveOmpObject(
if (auto *symbol{ResolveOmp(*name, ompFlag, currScope())}) {
auto checkExclusivelists =
[&](const Symbol *symbol1, Symbol::Flag firstOmpFlag,
- Symbol *symbol2, Symbol::Flag secondOmpFlag) {
+ const Symbol *symbol2, Symbol::Flag secondOmpFlag) {
if ((symbol1->test(firstOmpFlag) &&
symbol2->test(secondOmpFlag)) ||
(symbol1->test(secondOmpFlag) &&
@@ -2330,9 +2330,8 @@ void OmpAttributeVisitor::ResolveOmpObject(
"appear on both %s and %s "
"clauses on a %s construct"_err_en_US,
symbol2->name(),
- const_cast<Symbol *>(symbol1)->OmpFlagToClauseName(
- firstOmpFlag),
- symbol2->OmpFlagToClauseName(secondOmpFlag),
+ Symbol::OmpFlagToClauseName(firstOmpFlag),
+ Symbol::OmpFlagToClauseName(secondOmpFlag),
parser::ToUpperCaseLetters(
llvm::omp::getOpenMPDirectiveName(
GetContext().directive)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It doesn't need the Symbol object for anything.
It doesn't need the Symbol object for anything.