[all-commits] [llvm/llvm-project] a87a64: [clang-doc] Avoid deref of invalid std::optional (...

Paul Kirth via All-commits all-commits at lists.llvm.org
Thu Mar 20 14:05:20 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a87a64b2e487995f9de90a614c7caa7a888147df
      https://github.com/llvm/llvm-project/commit/a87a64b2e487995f9de90a614c7caa7a888147df
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-03-20 (Thu, 20 Mar 2025)

  Changed paths:
    M clang-tools-extra/clang-doc/HTMLGenerator.cpp
    A clang-tools-extra/test/clang-doc/DR-131697.cpp

  Log Message:
  -----------
  [clang-doc] Avoid deref of invalid std::optional (#131939)

Since our existing guard is insufficient to prevent accessing the
std::optional when in an invalid state, guard the access with
`.value_or()`. This maintains the desired behavior, without running into
UB.

The new test should prevent regressions.

Fixes #131697



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