Skip to content

Commit 2836b7b

Browse files
committed
move up definition of SetImplicitCUDADevice
1 parent fa34a6c commit 2836b7b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ using MessageFormattedText = parser::MessageFormattedText;
5858
class ResolveNamesVisitor;
5959
class ScopeHandler;
6060

61-
void SetImplicitCUDADevice(bool inDeviceSubprogram, Symbol &symbol);
62-
6361
// ImplicitRules maps initial character of identifier to the DeclTypeSpec
6462
// representing the implicit type; std::nullopt if none.
6563
// It also records the presence of IMPLICIT NONE statements.
@@ -2830,6 +2828,17 @@ Scope &ScopeHandler::NonDerivedTypeScope() {
28302828
return currScope_->IsDerivedType() ? currScope_->parent() : *currScope_;
28312829
}
28322830

2831+
static void SetImplicitCUDADevice(bool inDeviceSubprogram, Symbol &symbol) {
2832+
if (inDeviceSubprogram && symbol.has<ObjectEntityDetails>()) {
2833+
auto *object{symbol.detailsIf<ObjectEntityDetails>()};
2834+
if (!object->cudaDataAttr() && !IsValue(symbol) &&
2835+
!IsFunctionResult(symbol)) {
2836+
// Implicitly set device attribute if none is set in device context.
2837+
object->set_cudaDataAttr(common::CUDADataAttr::Device);
2838+
}
2839+
}
2840+
}
2841+
28332842
void ScopeHandler::PushScope(Scope::Kind kind, Symbol *symbol) {
28342843
PushScope(currScope().MakeScope(kind, symbol));
28352844
}
@@ -9580,17 +9589,6 @@ void ResolveNamesVisitor::CreateGeneric(const parser::GenericSpec &x) {
95809589
info.Resolve(&MakeSymbol(symbolName, Attrs{}, std::move(genericDetails)));
95819590
}
95829591

9583-
void SetImplicitCUDADevice(bool inDeviceSubprogram, Symbol &symbol) {
9584-
if (inDeviceSubprogram && symbol.has<ObjectEntityDetails>()) {
9585-
auto *object{symbol.detailsIf<ObjectEntityDetails>()};
9586-
if (!object->cudaDataAttr() && !IsValue(symbol) &&
9587-
!IsFunctionResult(symbol)) {
9588-
// Implicitly set device attribute if none is set in device context.
9589-
object->set_cudaDataAttr(common::CUDADataAttr::Device);
9590-
}
9591-
}
9592-
}
9593-
95949592
void ResolveNamesVisitor::FinishSpecificationPart(
95959593
const std::list<parser::DeclarationConstruct> &decls) {
95969594
misparsedStmtFuncFound_ = false;

0 commit comments

Comments
 (0)