hylo-lang / Swifty-LLVM

Swifty interface for the LLVM compiler infrastructure.
Apache License 2.0
27 stars 5 forks source link

Use internal import to keep from exposing llvmc. #47

Closed dabrahams closed 6 months ago

dabrahams commented 6 months ago

Swift's existing behavior for import Foo is broken; Foo is implicitly re-exported from the module (the new, correct, model will be to have imports not be implicitly public, but that switch can't be made in Swift 5 for backward-compatibility reasons).

The implicit re-exporting, combined with the fact that we are now linking against a reduced LLVM library installation— combined with some other factors that I do not fully understand—were causing the hylo build to report link errors on Windows due to not finding libraries like lldCOFF.lib, which we neither package with LLVM nor use in Swifty-LLVM or Hylo. The mystery is how swiftc even learns of the existence of these libraries.

This commit makes the imports of llvmc internal rather than the implicit public, which prevents these spurious link errors. Along the way, the library gained some type-safety because distinct typealiases for OpaquePointer got their own wrapper struct types (see Refs.swift). This change made the use of the name llvm for properties somewhat inconsistent. I'll file an issue about that.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.71%. Comparing base (b8b7721) to head (197ed65).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #47 +/- ## ======================================= Coverage 85.71% 85.71% ======================================= Files 14 14 Lines 196 196 ======================================= Hits 168 168 Misses 28 28 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.