Switch back to clang's MultiplexExternalSemaSource (#7416)

The necessary changes were upstreamed, and made available in #7413.
This commit is contained in:
Nicholas Bishop
2026-06-25 17:10:06 +00:00
committed by GitHub
parent 9108812bc2
commit 093dc04db6
5 changed files with 5 additions and 891 deletions
+5 -5
View File
@@ -18,6 +18,7 @@
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Parse/Parser.h"
#include "clang/Sema/ExternalSemaSource.h"
#include "clang/Sema/MultiplexExternalSemaSource.h"
#include "clang/Sema/Sema.h"
#include "common/check.h"
#include "common/map.h"
@@ -26,7 +27,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include "third_party/llvm/multiplex_external_sema_source.h"
#include "toolchain/base/kind_switch.h"
#include "toolchain/check/context.h"
#include "toolchain/check/cpp/access.h"
@@ -908,9 +908,9 @@ auto GenerateAst(Context& context,
// using `MultiplexExternalSemaSource`, we can keep the top-level
// `ExternalASTSource` pointer the same, and only update its children.
auto multiplex_source_ref_cnt_ptr =
llvm::makeIntrusiveRefCnt<MultiplexExternalSemaSource>();
auto* multiplex_source =
cast<MultiplexExternalSemaSource>(multiplex_source_ref_cnt_ptr.get());
llvm::makeIntrusiveRefCnt<clang::MultiplexExternalSemaSource>();
auto* multiplex_source = cast<clang::MultiplexExternalSemaSource>(
multiplex_source_ref_cnt_ptr.get());
if (auto* existing_source = llvm::cast_or_null<clang::ExternalSemaSource>(
ast.getExternalSource())) {
multiplex_source->AddSource(existing_source);
@@ -975,7 +975,7 @@ auto FinishAst(Context& context) -> void {
// the source may be accessed later during lowering, but the
// `CarbonExternalASTSource` has a pointer to `Check::Context` that
// will not remain valid.
auto* multiplex_source = cast<MultiplexExternalSemaSource>(
auto* multiplex_source = cast<clang::MultiplexExternalSemaSource>(
context.ast_context().getExternalSource());
multiplex_source->EraseIf([](const auto& src) {
// `CarbonExternalASTSource` inherits from `ReadOnlyASTSource`.