Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9e64628
[clang][deps] Remove dependency on `tooling::ToolAction` (#149904)
jansvoboda11 Jul 22, 2025
a7299db
Reland "[clang] Delay normalization of `-fmodules-cache-path` (#150123)"
jansvoboda11 Sep 10, 2025
f9d542f
NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (…
jyknight Jul 31, 2025
3c62cab
NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (…
jyknight Aug 2, 2025
af70946
Merge commit '30633f308941' from llvm.org/main into next
jansvoboda11 Sep 17, 2025
93b3165
Merge pull request #11450 from swiftlang/jan_svoboda/cas-fix-early-vfs
jansvoboda11 Sep 18, 2025
b17b047
[clang] Avoid reparsing VFS overlay files for module dep collector (#…
jansvoboda11 Sep 15, 2025
d421359
[clang] Don't fail `ExecuteCompilerInvocation()` due to caller errors…
jansvoboda11 Sep 15, 2025
4db01ae
[clang] Only set non-empty bypass to scan VFS (#159605)
jansvoboda11 Sep 18, 2025
6398a13
Merge commit '0e35f56d40d3' from llvm.org/main into next
Sep 27, 2025
98baff9
[clang] NFCI: Clean up `CompilerInstance::create{File,Source}Manager(…
jansvoboda11 Oct 2, 2025
dad6f36
Merge commit '436861645247' from llvm.org/main into next
Oct 4, 2025
b5fa133
[clang] Pass VFS into `ASTUnit::LoadFromASTFile()` (#159166)
jansvoboda11 Sep 18, 2025
a2aeddf
Fix a line missing when merging 30633f30894129919050f24fdd1f8f6bc46beae0
qiongsiwu Oct 17, 2025
579e9f0
Fix merge conflicts.
qiongsiwu Oct 25, 2025
a5d76b3
[clang][deps] Fix a use-after-free from expanding response files (#16…
benlangmuir Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv);

DiagnosticOptions DiagOpts;
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts);

// Determine a formatting style from options.
auto FormatStyleOrError = format::getStyle(FormatStyleOpt, FormatStyleConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ int main(int argc, const char **argv) {
LangOptions DefaultLangOptions;
DiagnosticOptions DiagOpts;
clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
&DiagnosticPrinter, false);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts,
&DiagnosticPrinter, false);
auto &FileMgr = Tool.getFiles();
SourceManager Sources(Diagnostics, FileMgr);
Rewriter Rewrite(Sources, DefaultLangOptions);
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Action : public clang::ASTFrontendAction {

Compiler->createSema(getTranslationUnitKind(), CompletionConsumer);
SemaSource->setCompilerInstance(Compiler);
Compiler->getSema().addExternalSource(SemaSource.get());
Compiler->getSema().addExternalSource(SemaSource);

clang::ParseAST(Compiler->getSema(), Compiler->getFrontendOpts().ShowStats,
Compiler->getFrontendOpts().SkipFunctionBodies);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ int includeFixerMain(int argc, const char **argv) {

// Set up a new source manager for applying the resulting replacements.
DiagnosticOptions DiagOpts;
DiagnosticsEngine Diagnostics(new DiagnosticIDs, DiagOpts);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts);
TextDiagnosticPrinter DiagnosticPrinter(outs(), DiagOpts);
SourceManager SM(Diagnostics, tool.getFiles());
Diagnostics.setClient(&DiagnosticPrinter, false);
Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clang-move/tool/ClangMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ int main(int argc, const char **argv) {

DiagnosticOptions DiagOpts;
clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
&DiagnosticPrinter, false);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts,
&DiagnosticPrinter, false);
auto &FileMgr = Tool.getFiles();
SourceManager SM(Diagnostics, FileMgr);
Rewriter Rewrite(SM, LangOptions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ int main(int argc, const char **argv) {
LangOptions DefaultLangOptions;
DiagnosticOptions DiagOpts;
TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
&DiagnosticPrinter, false);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts,
&DiagnosticPrinter, false);

auto &FileMgr = Tool.getFiles();
SourceManager Sources(Diagnostics, FileMgr);
Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clang-tidy/ClangTidy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ class ErrorReporter {
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
: Files(FileSystemOptions(), std::move(BaseFS)),
DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), DiagOpts)),
Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), DiagOpts,
DiagPrinter),
Diags(DiagnosticIDs::create(), DiagOpts, DiagPrinter),
SourceMgr(Diags, Files), Context(Context), ApplyFixes(ApplyFixes) {
DiagOpts.ShowColors = Context.getOptions().UseColor.value_or(
llvm::sys::Process::StandardOutHasColors());
Expand Down Expand Up @@ -570,7 +569,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,

ClangTidyDiagnosticConsumer DiagConsumer(Context, nullptr, true, ApplyAnyFix);
auto DiagOpts = std::make_unique<DiagnosticOptions>();
DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer,
DiagnosticsEngine DE(DiagnosticIDs::create(), *DiagOpts, &DiagConsumer,
/*ShouldOwnClient=*/false);
Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
Tool.setDiagnosticConsumer(&DiagConsumer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
InMemoryFs(new llvm::vfs::InMemoryFileSystem),
Sources(Compiler.getSourceManager()),
// Forward the new diagnostics to the original DiagnosticConsumer.
Diags(new DiagnosticIDs, DiagOpts,
Diags(DiagnosticIDs::create(), DiagOpts,
new ForwardingDiagnosticConsumer(Compiler.getDiagnosticClient())),
LangOpts(Compiler.getLangOpts()), HSOpts(Compiler.getHeaderSearchOpts()) {
// Add a FileSystem containing the extra files needed in place of modular
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ClangTidyPluginAction : public PluginASTAction {
new ClangTidyDiagnosticConsumer(*Context, &Compiler.getDiagnostics());
auto DiagOpts = std::make_unique<DiagnosticOptions>();
auto DiagEngine = std::make_unique<DiagnosticsEngine>(
new DiagnosticIDs, *DiagOpts, DiagConsumer);
DiagnosticIDs::create(), *DiagOpts, DiagConsumer);
Context->setDiagnosticsEngine(std::move(DiagOpts), DiagEngine.get());

// Create the AST consumer.
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/Preamble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
WallTimer PreambleTimer;
PreambleTimer.startTimer();
auto BuiltPreamble = PrecompiledPreamble::Build(
CI, ContentsBuffer.get(), Bounds, *PreambleDiagsEngine,
CI, ContentsBuffer.get(), Bounds, PreambleDiagsEngine,
Stats ? TimedFS : StatCacheFS, std::make_shared<PCHContainerOperations>(),
StoreInMemory, /*StoragePath=*/"", CapturedInfo);

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/SystemIncludeExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ bool isValidTarget(llvm::StringRef Triple) {
std::shared_ptr<TargetOptions> TargetOpts(new TargetOptions);
TargetOpts->Triple = Triple.str();
DiagnosticOptions DiagOpts;
DiagnosticsEngine Diags(new DiagnosticIDs, DiagOpts,
DiagnosticsEngine Diags(DiagnosticIDs::create(), DiagOpts,
new IgnoringDiagConsumer);
llvm::IntrusiveRefCntPtr<TargetInfo> Target =
TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) {
"typecheck_bool_condition",
"unexpected_friend", "warn_alloca"));
clang::DiagnosticOptions DiagOpts;
clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, DiagOpts,
clang::DiagnosticsEngine DiagEngine(DiagnosticIDs::create(), DiagOpts,
new clang::IgnoringDiagConsumer);

using Diag = clang::Diagnostic;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST(FileEdits, AbsolutePath) {
MemFS->addFile(Path, 0, llvm::MemoryBuffer::getMemBuffer("", Path));
FileManager FM(FileSystemOptions(), MemFS);
DiagnosticOptions DiagOpts;
DiagnosticsEngine DE(new DiagnosticIDs, DiagOpts);
DiagnosticsEngine DE(DiagnosticIDs::create(), DiagOpts);
SourceManager SM(DE, FM);

for (const auto *Path : RelPaths) {
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/modularize/ModularizeUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ModularizeUtilities::ModularizeUtilities(std::vector<std::string> &InputPaths,
ProblemFilesPath(ProblemFilesListPath), HasModuleMap(false),
MissingHeaderCount(0),
// Init clang stuff needed for loading the module map and preprocessing.
LangOpts(new LangOptions()), DiagIDs(new DiagnosticIDs()),
LangOpts(new LangOptions()), DiagIDs(DiagnosticIDs::create()),
DC(llvm::errs(), DiagnosticOpts),
Diagnostics(new DiagnosticsEngine(DiagIDs, DiagnosticOpts, &DC, false)),
TargetOpts(new ModuleMapTargetOptions()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ makeTUDiagnostics(const std::string &MainSourceFile, StringRef DiagnosticName,
// before applying.
TEST(ApplyReplacementsTest, mergeDiagnosticsWithNoFixes) {
DiagnosticOptions DiagOpts;
DiagnosticsEngine Diagnostics(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts);
DiagnosticsEngine Diagnostics(DiagnosticIDs::create(), DiagOpts);
FileManager Files((FileSystemOptions()));
SourceManager SM(Diagnostics, Files);
TUReplacements TURs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ TEST(CheckOptionsValidation, MissingOptions) {
ClangTidyGlobalOptions(), Options));
ClangTidyDiagnosticConsumer DiagConsumer(Context);
auto DiagOpts = std::make_unique<DiagnosticOptions>();
DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer, false);
DiagnosticsEngine DE(DiagnosticIDs::create(), *DiagOpts, &DiagConsumer,
false);
Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
TestCheck TestCheck(&Context);
EXPECT_FALSE(TestCheck.getLocal("Opt"));
Expand Down Expand Up @@ -348,7 +349,8 @@ TEST(CheckOptionsValidation, ValidIntOptions) {
ClangTidyGlobalOptions(), Options));
ClangTidyDiagnosticConsumer DiagConsumer(Context);
auto DiagOpts = std::make_unique<DiagnosticOptions>();
DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer, false);
DiagnosticsEngine DE(DiagnosticIDs::create(), *DiagOpts, &DiagConsumer,
false);
Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
TestCheck TestCheck(&Context);

Expand Down Expand Up @@ -410,7 +412,8 @@ TEST(ValidConfiguration, ValidEnumOptions) {
ClangTidyGlobalOptions(), Options));
ClangTidyDiagnosticConsumer DiagConsumer(Context);
auto DiagOpts = std::make_unique<DiagnosticOptions>();
DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer, false);
DiagnosticsEngine DE(DiagnosticIDs::create(), *DiagOpts, &DiagConsumer,
false);
Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
TestCheck TestCheck(&Context);

Expand Down
3 changes: 2 additions & 1 deletion clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ runCheckOnCode(StringRef Code, std::vector<ClangTidyError> *Errors = nullptr,
ClangTidyGlobalOptions(), Options));
ClangTidyDiagnosticConsumer DiagConsumer(Context);
auto DiagOpts = std::make_unique<DiagnosticOptions>();
DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer, false);
DiagnosticsEngine DE(DiagnosticIDs::create(), *DiagOpts, &DiagConsumer,
false);
Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);

std::vector<std::string> Args(1, "clang-tidy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class VirtualFileHelper {

public:
VirtualFileHelper()
: Diagnostics(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs),
DiagOpts),
: Diagnostics(DiagnosticIDs::create(), DiagOpts),
DiagnosticPrinter(llvm::outs(), DiagOpts),
Files((FileSystemOptions())) {}

Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,12 @@ class ASTContext : public RefCountedBase<ASTContext> {
return ExternalSource.get();
}

/// Retrieve a pointer to the external AST source associated
/// with this AST context, if any. Returns as an IntrusiveRefCntPtr.
IntrusiveRefCntPtr<ExternalASTSource> getExternalSourcePtr() const {
return ExternalSource;
}

/// Attach an AST mutation listener to the AST context.
///
/// The AST mutation listener provides the ability to track modifications to
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/Basic/DiagnosticIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
DiagnosticIDs();
~DiagnosticIDs();

// Convenience method to construct a new refcounted DiagnosticIDs.
static llvm::IntrusiveRefCntPtr<DiagnosticIDs> create() {
return llvm::makeIntrusiveRefCnt<DiagnosticIDs>();
}

/// Return an ID for a diagnostic with the specified format string and
/// level.
///
Expand Down
22 changes: 17 additions & 5 deletions clang/include/clang/Frontend/ASTUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,27 @@ class ASTUnit {

const DiagnosticsEngine &getDiagnostics() const { return *Diagnostics; }
DiagnosticsEngine &getDiagnostics() { return *Diagnostics; }
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> getDiagnosticsPtr() {
return Diagnostics;
}

const SourceManager &getSourceManager() const { return *SourceMgr; }
SourceManager &getSourceManager() { return *SourceMgr; }
llvm::IntrusiveRefCntPtr<SourceManager> getSourceManagerPtr() {
return SourceMgr;
}

const Preprocessor &getPreprocessor() const { return *PP; }
Preprocessor &getPreprocessor() { return *PP; }
std::shared_ptr<Preprocessor> getPreprocessorPtr() const { return PP; }

const ASTContext &getASTContext() const { return *Ctx; }
ASTContext &getASTContext() { return *Ctx; }
llvm::IntrusiveRefCntPtr<ASTContext> getASTContextPtr() { return Ctx; }

void setASTContext(ASTContext *ctx) { Ctx = ctx; }
void setASTContext(llvm::IntrusiveRefCntPtr<ASTContext> ctx) {
Ctx = std::move(ctx);
}
void setPreprocessor(std::shared_ptr<Preprocessor> pp);

/// Enable source-range based diagnostic messages.
Expand Down Expand Up @@ -495,6 +504,7 @@ class ASTUnit {

const FileManager &getFileManager() const { return *FileMgr; }
FileManager &getFileManager() { return *FileMgr; }
IntrusiveRefCntPtr<FileManager> getFileManagerPtr() { return FileMgr; }

const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; }

Expand Down Expand Up @@ -802,8 +812,8 @@ class ASTUnit {
std::shared_ptr<CompilerInvocation> CI,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
std::shared_ptr<DiagnosticOptions> DiagOpts,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags, FileManager *FileMgr,
bool OnlyLocalDecls = false,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
IntrusiveRefCntPtr<FileManager> FileMgr, bool OnlyLocalDecls = false,
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
unsigned PrecompilePreambleAfterNParses = 0,
TranslationUnitKind TUKind = TU_Complete,
Expand Down Expand Up @@ -920,8 +930,10 @@ class ASTUnit {
bool IncludeCodePatterns, bool IncludeBriefComments,
CodeCompleteConsumer &Consumer,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
DiagnosticsEngine &Diag, LangOptions &LangOpts,
SourceManager &SourceMgr, FileManager &FileMgr,
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diag,
LangOptions &LangOpts,
llvm::IntrusiveRefCntPtr<SourceManager> SourceMgr,
llvm::IntrusiveRefCntPtr<FileManager> FileMgr,
SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics,
SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers,
std::unique_ptr<SyntaxOnlyAction> Act);
Expand Down
10 changes: 5 additions & 5 deletions clang/include/clang/Frontend/CompilerInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class CompilerInstance : public ModuleLoader {
}

/// setDiagnostics - Replace the current diagnostics engine.
void setDiagnostics(DiagnosticsEngine *Value);
void setDiagnostics(llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Value);

DiagnosticConsumer &getDiagnosticClient() const {
assert(Diagnostics && Diagnostics->getClient() &&
Expand Down Expand Up @@ -504,8 +504,8 @@ class CompilerInstance : public ModuleLoader {
FileMgr.resetWithoutRelease();
}

/// Replace the current file manager.
void setFileManager(FileManager *Value);
/// Replace the current file manager and virtual file system.
void setFileManager(IntrusiveRefCntPtr<FileManager> Value);

/// @}
/// @name Output Manager
Expand Down Expand Up @@ -549,7 +549,7 @@ class CompilerInstance : public ModuleLoader {
}

/// setSourceManager - Replace the current source manager.
void setSourceManager(SourceManager *Value);
void setSourceManager(llvm::IntrusiveRefCntPtr<SourceManager> Value);

/// @}
/// @name Preprocessor
Expand Down Expand Up @@ -594,7 +594,7 @@ class CompilerInstance : public ModuleLoader {
}

/// setASTContext - Replace the current AST context.
void setASTContext(ASTContext *Value);
void setASTContext(llvm::IntrusiveRefCntPtr<ASTContext> Value);

/// Replace the current Sema; the compiler instance takes ownership
/// of S.
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Frontend/PrecompiledPreamble.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PrecompiledPreamble {
static llvm::ErrorOr<PrecompiledPreamble>
Build(const CompilerInvocation &Invocation,
const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
DiagnosticsEngine &Diagnostics,
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
bool StoreInMemory, StringRef StoragePath,
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Frontend/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void AttachHeaderIncludeGen(Preprocessor &PP,
/// memory, mainly for testing.
IntrusiveRefCntPtr<ExternalSemaSource>
createChainedIncludesSource(CompilerInstance &CI,
IntrusiveRefCntPtr<ExternalSemaSource> &Reader);
IntrusiveRefCntPtr<ASTReader> &OutReader);

/// Optional inputs to createInvocation.
struct CreateInvocationOptions {
Expand Down
9 changes: 4 additions & 5 deletions clang/include/clang/Sema/MultiplexExternalSemaSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MultiplexExternalSemaSource : public ExternalSemaSource {
static char ID;

private:
SmallVector<ExternalSemaSource *, 2> Sources;
SmallVector<llvm::IntrusiveRefCntPtr<ExternalSemaSource>, 2> Sources;

public:
/// Constructs a new multiplexing external sema source and appends the
Expand All @@ -49,15 +49,14 @@ class MultiplexExternalSemaSource : public ExternalSemaSource {
///\param[in] S1 - A non-null (old) ExternalSemaSource.
///\param[in] S2 - A non-null (new) ExternalSemaSource.
///
MultiplexExternalSemaSource(ExternalSemaSource *S1, ExternalSemaSource *S2);

~MultiplexExternalSemaSource() override;
MultiplexExternalSemaSource(llvm::IntrusiveRefCntPtr<ExternalSemaSource> S1,
llvm::IntrusiveRefCntPtr<ExternalSemaSource> S2);

/// Appends new source to the source list.
///
///\param[in] Source - An ExternalSemaSource.
///
void AddSource(ExternalSemaSource *Source);
void AddSource(llvm::IntrusiveRefCntPtr<ExternalSemaSource> Source);

//===--------------------------------------------------------------------===//
// ExternalASTSource.
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ class Sema final : public SemaBase {
///
///\param[in] E - A non-null external sema source.
///
void addExternalSource(ExternalSemaSource *E);
void addExternalSource(IntrusiveRefCntPtr<ExternalSemaSource> E);

/// Print out statistics about the semantic analysis.
void PrintStats() const;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Basic/SourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2381,8 +2381,8 @@ SourceManagerForFile::SourceManagerForFile(StringRef FileName,
DiagOpts = std::make_unique<DiagnosticOptions>();
// This is passed to `SM` as reference, so the pointer has to be referenced
// by `Environment` due to the same reason above.
Diagnostics = std::make_unique<DiagnosticsEngine>(
IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), *DiagOpts);
Diagnostics =
std::make_unique<DiagnosticsEngine>(DiagnosticIDs::create(), *DiagOpts);
SourceMgr = std::make_unique<SourceManager>(*Diagnostics, *FileMgr);
FileEntryRef FE = llvm::cantFail(FileMgr->getFileRef(FileName));
FileID ID =
Expand Down
Loading