diff --git a/src/Func.cc b/src/Func.cc index 432c1b5b70..5b39e453aa 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -864,7 +864,7 @@ static int get_func_priority(const std::vector& attrs) for ( const auto& a : attrs ) { - if ( a->Tag() == ATTR_DEPRECATED ) + if ( a->Tag() == ATTR_DEPRECATED || a->Tag() == ATTR_IS_USED ) continue; if ( a->Tag() != ATTR_PRIORITY ) @@ -903,7 +903,23 @@ function_ingredients::function_ingredients(ScopePtr scope, StmtPtr body) const auto& attrs = this->scope->Attrs(); - priority = (attrs ? get_func_priority(*attrs) : 0); + if ( attrs ) + { + priority = get_func_priority(*attrs); + + for ( const auto& a : *attrs ) + if ( a->Tag() == ATTR_IS_USED ) + { + // Associate this with the identifier, too. + std::vector used_attr; + used_attr.emplace_back(make_intrusive(ATTR_IS_USED)); + id->AddAttrs(make_intrusive(used_attr, nullptr, false, true)); + break; + } + } + else + priority = 0; + this->body = std::move(body); }