Skip to content

Fix NodeAttrHelper string default lifetime - #32019

Merged
Akshay Sonawane (apsonawane) merged 1 commit into
mainfrom
fix/node-attr-string-default-lifetime
Aug 13, 2026
Merged

Akshay Sonawane (apsonawane) merged 1 commit into
mainfrom
fix/node-attr-string-default-lifetime

Conversation

@apsonawane

Copy link
Copy Markdown
Contributor

This pull request enhances the NodeAttrHelper utility by adding overloads for retrieving string attributes with different types of default values, improving safety and flexibility when handling attribute lookups. It also updates usages to leverage these new overloads and clarifies ownership semantics for returned strings.

Node attribute retrieval improvements:

  • Added two new overloads to NodeAttrHelper::Get for string attributes: one that accepts an rvalue (std::string&&) and one that accepts a C-style string (const char*). These overloads return owned strings, ensuring safe return of temporaries or literals. The documentation was updated to clarify that lvalue defaults may be returned by reference, while temporaries and literals are returned as owned strings. (onnxruntime/core/providers/qnn/ort_api.h [1] onnxruntime/core/providers/shared/utils/utils.h [2]
  • Implemented the new overloads in both QNN and shared utility implementations of NodeAttrHelper. (onnxruntime/core/providers/qnn/ort_api.cc [1] onnxruntime/core/providers/shared/utils/utils.cc [2]
  • Included <utility> header for std::move usage. (onnxruntime/core/providers/shared/utils/utils.cc onnxruntime/core/providers/shared/utils/utils.ccR7-R8)

Usage updates and bug fixes:

@apsonawane
Akshay Sonawane (apsonawane) merged commit 47fa461 into main Aug 13, 2026
87 checks passed
@apsonawane
Akshay Sonawane (apsonawane) deleted the fix/node-attr-string-default-lifetime branch August 13, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants