[all-commits] [llvm/llvm-project] 985410: [clang] Hide the `TargetOptions` pointer from `Com...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Apr 28 07:43:47 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 985410f87f2d19910a8d327527fd30062b042b63
      https://github.com/llvm/llvm-project/commit/985410f87f2d19910a8d327527fd30062b042b63
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-04-28 (Mon, 28 Apr 2025)

  Changed paths:
    M clang-tools-extra/clangd/Preamble.cpp
    M clang-tools-extra/clangd/Preamble.h
    M clang-tools-extra/clangd/SystemIncludeExtractor.cpp
    M clang-tools-extra/modularize/ModularizeUtilities.cpp
    M clang/include/clang/Basic/TargetInfo.h
    M clang/include/clang/Frontend/ASTUnit.h
    M clang/include/clang/Frontend/CompilerInstance.h
    M clang/include/clang/Frontend/CompilerInvocation.h
    M clang/lib/Basic/Targets.cpp
    M clang/lib/Frontend/ASTUnit.cpp
    M clang/lib/Frontend/ChainedIncludesSource.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Interpreter/Interpreter.cpp
    M clang/tools/clang-import-test/clang-import-test.cpp
    M clang/unittests/Analysis/MacroExpansionContextTest.cpp
    M clang/unittests/Basic/SourceManagerTest.cpp
    M clang/unittests/CodeGen/TestCompiler.h
    M clang/unittests/Driver/ToolChainTest.cpp
    M clang/unittests/Frontend/UtilsTest.cpp
    M clang/unittests/Lex/HeaderSearchTest.cpp
    M clang/unittests/Lex/LexerTest.cpp
    M clang/unittests/Lex/ModuleDeclStateTest.cpp
    M clang/unittests/Lex/PPCallbacksTest.cpp
    M clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
    M clang/unittests/Lex/PPDependencyDirectivesTest.cpp
    M clang/unittests/Lex/PPMemoryAllocationsTest.cpp
    M clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

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

This PR hides the reference-counted pointer that holds `TargetOptions`
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.

There are two clients that currently share ownership of that pointer:

* `TargetInfo` - This was refactored to hold a non-owning reference to
`TargetOptions`. The options object is typically owned by the
`CompilerInvocation` or by the new `CompilerInstance::AuxTargetOpts` for
the auxiliary target. This needed a bit of care in `ASTUnit::Parse()` to
keep the `CompilerInvocation` alive.
* `clangd::PreambleData` - This was refactored to exclusively own the
`TargetOptions` that get moved out of the `CompilerInvocation`.



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