packages feed

libclang-bindings-0.2.0.0: CHANGELOG.md

# Revision history for libclang-bindings

## ?.?.?.? -- YYYY-mm-dd

### Breaking changes

### New features

### Minor changes

### Bug fixes

## 0.2.0.0 -- 2026-10-06

### Breaking changes

* Add `CXType_PredefinedSugar` to `CXTypeKind`. LLVM/Clang 23 reports this kind
  for the predefined types `__size_t`, `__signed_size_t` and `__ptrdiff_t`;
  see [predefined-sugar-unexposed (llvm/llvm-project#202209)][llvm-202209].
* `SingleLoc`, `MultiLoc`, and `Token` are parameterized by path type
  (`SingleLoc path`, `MultiLoc path`, `Token path a`).
* High-level location functions such as `clang_getCursorLocation` return
  `RealPath` locations. They throw `ClangRealPathException` if the expansion
  location is in a virtual file, where 0.1.0.0 returned a location, and set a
  spelling or file location in a virtual file to `Nothing`. Use
  `toMultiSourcePath`/`toRangeSourcePath` for virtual files. See
  [location-wrappers-throw (#84)][issue-84].
* `RealPath` locations compare canonical paths: `Eq`, `Ord`,
  `compareSingleLoc` and `rangeContainsLoc` treat a file reached under two
  spellings as one file. See
  [binding-specs-path-spelling (well-typed/hs-bindgen#2236)][hs-bindgen-2236].
* Diagnostics use `SourcePath` locations: `Diagnostic`, `FixIt`,
  `clang_getDiagnosticLocation`, `clang_getDiagnosticRange` and
  `clang_getDiagnosticFixIt` do not throw for virtual files.
* `toMulti`/`toRange` renamed to `toMultiRealPath`/`toRangeRealPath`;
  new `toMultiSourcePath`/`toRangeSourcePath` for virtual files.
* `prettySingleLoc`, `prettyMultiLoc`, `prettyRangeSingleLoc` and
  `prettyRangeMultiLoc` take a `path -> String` argument. `SingleLoc`,
  `MultiLoc` and their ranges have `Show` instances only for `RealPath` and
  `SourcePath`.
* `clang_tokenize` takes a `CXSourceRange` instead of a `Range SingleLoc`, and
  returns `[Token SourcePath TokenSpelling]`. It passes the range to `libclang`
  unchanged, so a range that starts inside a macro expansion is tokenized from
  the macro definition; see the documentation of `clang_tokenize`.
* Remove `fromSingle` and `fromRange`. They looked up the `CXFile` by path,
  which fails for locations in buffers without one. Use `clang_getLocation`
  and `clang_getRange` from `Clang.LowLevel.Core` instead.
* Remove `nullSourcePath`. Use `Data.Text.null . getSourcePathText` instead.

### New features

* Bind `clang_File_tryGetRealPathName` and `clang_File_isEqual`.
* Add the `RealPath` newtype with `getRealPath`, `getRealPathText` and
  `realPathToSourcePath`. Add `getSourcePathText`.
* Add `clang_getRealPath`, which throws `ClangRealPathException` for a virtual
  file, and `clang_tryGetRealPath`, which returns `Nothing` for one.
* Add `toMultiCXFile`: builds `MultiLoc CXFile`.
* `SingleLoc` and `MultiLoc` derive `Functor`, `Foldable` and `Traversable`.
* Bind `clang_hashCursor`. See [hash-cursor (PR #81)][pr-81].

### Minor changes

* `Clang.HighLevel.Types` re-exports `RealPath` and `SourcePath`.

### Bug fixes

* `MultiLoc` no longer drops a presumed, spelling or file location that differs
  from the expansion location in only some of file, line and column. It used
  to drop, for example, the spelling location of a macro defined in the same
  file, and every presumed location set by a `#line` directive. See
  [macro-spelling-dropped (#85)][issue-85].
* `clang_tokenize` no longer throws for a range in a buffer without a file on
  disk, such as the predefines buffer holding macros defined with `-D`. See
  [header-redefines-D-macro (well-typed/hs-bindgen#2280)][hs-bindgen-2280].
* `clang_tokenize` returns `[]` for a range without tokens instead of failing.

[pr-81]: https://github.com/well-typed/libclang-bindings/pull/81
[issue-84]: https://github.com/well-typed/libclang-bindings/issues/84
[issue-85]: https://github.com/well-typed/libclang-bindings/issues/85
[llvm-202209]: https://github.com/llvm/llvm-project/pull/202209
[hs-bindgen-2236]: https://github.com/well-typed/hs-bindgen/issues/2236
[hs-bindgen-2280]: https://github.com/well-typed/hs-bindgen/issues/2280

## 0.1.0.0 -- 2026-07-14

### Breaking changes

* Removed `LLVM_CONFIG` configuration variable. Configure `PATH` so that the
  desired `llvm-config` is found instead.

### New features

* Add a binding for `clang_isBeforeInTranslationUnit`. This function is only
  available for Clang versions 20.1 and newer; see [PR #53][pr-53].
* Add a binding for the `clang_Type_getOffsetOf` function. See [PR #37][pr-37].
* Add a new `clang_disposeToken` function to free a single `CXToken`. This is a
  helper function alongside the existing `clang_disposeTokens` functions, which
  frees arrays of `CXToken`s. See [PR #42][pr-42].
* Add a new `foldTry` function that behaves like `foldWithHandler`, but it
  returns the caught exception as a value like `Control.Exception.try` would.
  The caught exception is represented using a new type called `FoldException`.
  See [PR #47][pr-47].
* Add a compile-time check of the `CLANG_VERSION` macro. See the
  `Clang.Version.checkUserClangVersion` documentation for details.
* Add `--with-so` option to the `configure` script, used to work around Cabal
  linking issues.
* Add the `Clang.Discover` module, providing `getPaths` to discover the `clang`
  executable and the builtin include directory.

### Minor changes

### Bug fixes

* Silence `-Wdeprecated-declarations` warnings emitted by `<clang-c/Index.h>`
  on Clang 21 at the system-header include sites only, so that deprecation
  warnings for libclang APIs we actually call remain visible. See
  [issue #58][issue-58].

[pr-37]: https://github.com/well-typed/libclang-bindings/pull/37
[pr-42]: https://github.com/well-typed/libclang-bindings/pull/42
[pr-47]: https://github.com/well-typed/libclang-bindings/pull/47
[pr-53]: https://github.com/well-typed/libclang-bindings/pull/53
[issue-58]: https://github.com/well-typed/libclang-bindings/issues/58

## 0.1.0-alpha -- 2026-02-06

* Release candidate.