google / google/xls

DSLX transpiler should not include unused headers in generated code

Open
#2,385 0 comments 0 reactions 0 assignees View on GitHub
build cleanup
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Currently it seems that the DSLX transpiler un-conditionally include stdlib and library headers:
https://github.com/google/xls/blob/722bd8ad2125865e494897128d3c3a2cc686bd61/xls/dslx/cpp_transpiler/cpp_transpiler.cc#L45-L49
https://github.com/google/xls/blob/722bd8ad2125865e494897128d3c3a2cc686bd61/xls/dslx/cpp_transpiler/cpp_transpiler.cc#L61-L72
independently of the the fact that the generated code is using it or not.

It would be nice if the transpiled code only included headers that's actually needed so that linter and other static analysis don't flag the generated code: e.g: if only converting DSLX constants `ostream` or `vector` shouldn't be needed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.