Skip to content

[SYCL] Refactor sycl-post-link for better error handling and code simplicity#21579

Open
maksimsab wants to merge 3 commits intointel:syclfrom
maksimsab:refactor_tool_part1
Open

[SYCL] Refactor sycl-post-link for better error handling and code simplicity#21579
maksimsab wants to merge 3 commits intointel:syclfrom
maksimsab:refactor_tool_part1

Conversation

@maksimsab
Copy link
Contributor

This commit improves error handling and simplifies code in sycl-post-link without changing functionality:

Error handling improvements:

  • Convert functions to return Error instead of void
  • Propagate errors up to the stack to comply with LLVM guidelines
  • Introduce ExitOnError pattern for consistent error handling
  • Replace error() and checkError() calls with ExitOnErr() for cleaner flow

Code refactoring:

  • Refactor simple utility functions reusing LLVM functionality

Code simplification:

  • Remove unnecessary includes
  • Simplify SmallVector declarations by removing MAX_COLUMNS_IN_FILE_TABLE constant and using default template parameter

These changes prepare the code for extraction to a library component while improving maintainability and following LLVM error handling conventions. All refactored functions maintain the same functionality but with proper error propagation.

…plicity

This commit improves error handling and simplifies code in sycl-post-link
without changing functionality:

**Error handling improvements:**
- Convert functions to return Error instead of void
- Propagate errors up to the stack to comply with LLVM guidelines
- Introduce ExitOnError pattern for consistent error handling
- Replace error() and checkError() calls with ExitOnErr() for cleaner flow

**Code refactoring:**
- Refactor simple utility functions reusing LLVM functionality

**Code simplification:**
- Remove unnecessary includes
- Simplify SmallVector declarations by removing MAX_COLUMNS_IN_FILE_TABLE
  constant and using default template parameter

These changes prepare the code for extraction to a library component while
improving maintainability and following LLVM error handling conventions.
All refactored functions maintain the same functionality but with proper
error propagation.
@maksimsab maksimsab requested a review from a team as a code owner March 20, 2026 14:20
Copy link
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: was AI used to generate substantial amount of content of this PR?

@maksimsab
Copy link
Contributor Author

maksimsab commented Mar 24, 2026

What AI did:

  • Generated a PR description which was review by me before publishing.
  • Separated my own previous PR into two commits. This PR is the first commit. The content is a copy-paste of the code written by me only.

@maksimsab maksimsab requested a review from YuriPlyakhin March 24, 2026 15:13
@YuriPlyakhin
Copy link
Contributor

What AI did:

  • Generated a PR description which was review by me before publishing.
  • Separated my own previous PR into two commits. This PR is the first commit. The content is a copy-paste of the code written by me only.

sounds good, thanks. I just wanted to make sure we follow this policy: https://llvm.org/docs/AIToolPolicy.html

Error saveModuleSymbolTable(const module_split::ModuleDesc &MD,
const StringRef Filename) {
return writeToOutput(Filename, [&](raw_ostream &OS) -> Error {
OS << Table;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the code compiles after this change?

Copy link
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code is unlikely to compile...

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