Skip to content

Conversation

sgscheffler
Copy link

Summary

Add LlvmLinkerParser for LLVM lld linker error parsing

Changes

  • Add LlvmLinkerParser class for parsing ld.lld error messages
  • Support versioned linkers (ld.lld-15, etc.)
  • Handle error/warning/note severity levels
  • Integrate with ClangDescriptor using composite pattern
  • Add comprehensive unit and integration tests

Resolves JENKINS-76141

Testing Done

Unit Tests

  • Created LlvmLinkerParserTest with 7 test methods covering:
    • Basic parsing functionality (4 different severity levels)
    • Versioned LLD linkers (ld.lld-15, ld.lld-18)
    • Mixed output filtering (ignores non-LLD lines)
    • Real-world scenario from JENKINS-76141

Integration Tests

  • Added shouldFindAllClangAndLldIssues to ParsersTest
  • Validates composite parser functionality (Clang + LLD together)
  • All 115 existing parser tests continue to pass

Manual Testing

  • Verified Maven build: mvn clean test passes
  • Confirmed no regressions in existing functionality
  • Tested with sample LLD error output

Verification

  • All tests pass locally
  • No breaking changes to existing parsers
  • Follows established code patterns (based on ClangParser/Gcc4LinkerParser)
  • Comprehensive test coverage for new functionality

Submitter Checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

- Add LlvmLinkerParser class for parsing ld.lld error messages
- Support versioned linkers (ld.lld-15, etc.)
- Handle error/warning/note severity levels
- Integrate with ClangDescriptor using composite pattern
- Add comprehensive unit and integration tests

Resolves JENKINS-76141
@uhafner uhafner added the feature New features label Sep 28, 2025
Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

Thanks for your pull request! Just some small comments...

private static final long serialVersionUID = 1L;

// Pattern that captures the linker name specifically
private static final String LLD_LINKER_PATTERN = "^.*[/\\\\]?(ld\\.lld(?:-\\d+)?):\\s*(error|warning|note):\\s*(.*)$";
Copy link
Member

Choose a reason for hiding this comment

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

Can you please use names for capturing groups? This would make the pattern more readable for future changes: https://jdriven.com/blog/2020/04/Java-Joy-Using-Named-Capturing-Groups-In-Regular-Expressions

.buildOptional();
}

private Severity mapPriority(final String severity) {
Copy link
Member

Choose a reason for hiding this comment

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

We have an automatic mapping in Severity#guessSeverity (it maps errors to Severity.ERROR though). But if you want to map errors to severity HIGH then your code is just fine.

/**
* A parser for LLVM lld linker warnings and errors.
*
* @author [Your Name]
Copy link
Member

Choose a reason for hiding this comment

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

Either your name or remove the lines:

Suggested change
* @author [Your Name]
* @author Steven Scheffler

/**
* Tests the class {@link LlvmLinkerParser}.
*
* @author [Your Name]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @author [Your Name]
* @author Steven Scheffler

Comment on lines +85 to +87
assertThat(warnings.stream().allMatch(issue ->
issue.getFileName().endsWith("ld.lld")))
.isTrue();
Copy link
Member

Choose a reason for hiding this comment

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

Normally in AssertJ one would use:

         assertThat(warnings.stream())
                .allSatisfy(issue -> assertThat(issue).hasFileName("ld.lld"));

But this is semantically equivalent...

@uhafner
Copy link
Member

uhafner commented Oct 3, 2025

@sgscheffler ping: I'm not sure if you have enabled your notifications...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants