@@ -61,9 +61,8 @@ template <typename T> class DirectiveAttributeVisitor {
6161 defaultMap;
6262
6363 std::optional<Symbol::Flag> FindSymbolWithDSA (const Symbol &symbol) {
64- auto it{objectWithDSA.find (&symbol)};
65- if (it != objectWithDSA.end ()) {
66- return std::make_optional (it->second );
64+ if (auto it{objectWithDSA.find (&symbol)}; it != objectWithDSA.end ()) {
65+ return it->second ;
6766 }
6867 return std::nullopt ;
6968 }
@@ -83,10 +82,9 @@ template <typename T> class DirectiveAttributeVisitor {
8382 }
8483 void PushContext (const parser::CharBlock &source, T dir, Scope &scope) {
8584 if constexpr (std::is_same_v<T, llvm::acc::Directive>) {
86- bool wasEmpty{dirContext_.empty ()};
8785 dirContext_.emplace_back (source, dir, scope);
88- if (!wasEmpty ) {
89- std::size_t lastIndex{dirContext_. size () - 1 };
86+ if (std:: size_t size{dirContext_. size ()}; size > 1 ) {
87+ std::size_t lastIndex{size - 1 };
9088 dirContext_[lastIndex].defaultDSA =
9189 dirContext_[lastIndex - 1 ].defaultDSA ;
9290 }
@@ -128,7 +126,7 @@ template <typename T> class DirectiveAttributeVisitor {
128126 return false ;
129127 }
130128
131- bool WithinContstruct () {
129+ bool WithinConstruct () {
132130 return !dirContext_.empty () && GetContext ().withinConstruct ;
133131 }
134132
@@ -1602,7 +1600,7 @@ void AccAttributeVisitor::Post(const parser::AccDefaultClause &x) {
16021600// and adjust the symbol for each Name if necessary
16031601void AccAttributeVisitor::Post (const parser::Name &name) {
16041602 auto *symbol{name.symbol };
1605- if (symbol && WithinContstruct ()) {
1603+ if (symbol && WithinConstruct ()) {
16061604 symbol = &symbol->GetUltimate ();
16071605 if (!symbol->owner ().IsDerivedType () && !symbol->has <ProcEntityDetails>() &&
16081606 !symbol->has <SubprogramDetails>() && !IsObjectWithVisibleDSA (*symbol)) {
@@ -1988,7 +1986,7 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
19881986// till OpenMP-5.0 standard.
19891987// In above both cases we skip the privatization of iteration variables.
19901988bool OmpAttributeVisitor::Pre (const parser::DoConstruct &x) {
1991- if (WithinContstruct ()) {
1989+ if (WithinConstruct ()) {
19921990 llvm::SmallVector<const parser::Name *> ivs;
19931991 if (x.IsDoNormal ()) {
19941992 const parser::Name *iv{GetLoopIndex (x)};
@@ -2714,7 +2712,7 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
27142712void OmpAttributeVisitor::Post (const parser::Name &name) {
27152713 auto *symbol{name.symbol };
27162714
2717- if (symbol && WithinContstruct ()) {
2715+ if (symbol && WithinConstruct ()) {
27182716 if (IsPrivatizable (symbol) && !IsObjectWithDSA (*symbol)) {
27192717 // TODO: create a separate function to go through the rules for
27202718 // predetermined, explicitly determined, and implicitly
0 commit comments