[all-commits] [llvm/llvm-project] d7eec9: [APINotes] Refactor APINotesReader to propagate ll...

Maria Fernanda GuimarĂ£es via All-commits all-commits at lists.llvm.org
Mon Mar 2 08:36:47 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d7eec97bd83fca9016e0718dca7fb929f42b2921
      https://github.com/llvm/llvm-project/commit/d7eec97bd83fca9016e0718dca7fb929f42b2921
  Author: Maria Fernanda GuimarĂ£es <66797940+mafeguimaraes at users.noreply.github.com>
  Date:   2026-03-02 (Mon, 02 Mar 2026)

  Changed paths:
    M clang/include/clang/APINotes/APINotesReader.h
    M clang/lib/APINotes/APINotesManager.cpp
    M clang/lib/APINotes/APINotesReader.cpp

  Log Message:
  -----------
  [APINotes] Refactor APINotesReader to propagate llvm::Error  (#183812)

**Context:** While exploring the `APINotes` codebase, I found 54 `FIXME`
comments in `APINotesReader.cpp` stating: `// FIXME this drops the error
on the floor.`

This happened because the internal `read*Block` methods returned a
boolean, and the `APINotesReader` constructor reported failures via a
`bool &Failed` out-parameter. This forced the actual `llvm::Errors`
returned from the bitstream cursor to be silently consumed with
`consumeError()`.

This patch refactors this behavior to properly propagate the errors up
the stack.

**Changes in this patch:**

**1.** Changed all `read*Block` methods in
`APINotesReader::Implementation` to return `llvm::Error` instead of
`bool`.

**2.** Made the `APINotesReader` and `Implementation` constructors
private.

**3.** Created a static factory method `APINotesReader::Create(...)`
that returns an `llvm::Expected<std::unique_ptr<APINotesReader>>`,
allowing us to propagate the error instead of dropping it.

**4.** Updated `APINotesManager.cpp` to handle the new `Expected` return
type. (Note: For now, `APINotesManager` consumes the error to maintain
its existing behavior, but the `APINotesReader` is now fully ready for
future error propagation).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list