[all-commits] [llvm/llvm-project] eaca60: [clang] Hide the `DiagnosticOptions` pointer from ...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Mar 11 10:30:01 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eaca60d1a9a54ae0aa8626719decef4b11eb939d
      https://github.com/llvm/llvm-project/commit/eaca60d1a9a54ae0aa8626719decef4b11eb939d
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    M clang-tools-extra/clangd/Preamble.cpp
    M clang/include/clang/Basic/DiagnosticOptions.h
    M clang/include/clang/Frontend/CompilerInvocation.h

  Log Message:
  -----------
  [clang] Hide the `DiagnosticOptions` pointer from `CompilerInvocation` (#106274)

This PR hides the reference-counter pointer that holds
`DiagnosticOptions` from the public API of `CompilerInvocation`. This
gives `CompilerInvocation` an exclusive control over the lifetime of
this member, which will eventually be leveraged to implement a
copy-on-write behavior.

The only client that currently accesses that pointer is
`clangd::buildPreamble()` which takes care to reset it so that it's not
reset concurrently. This code is made redundant by making the reference
count of `DiagnosticOptions` atomic.



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