[clang] [clang][frontend] Expose `CompilerInstance::cloneForModuleCompile()` (PR #135405)

2025-04-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/135405 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-04-05 Thread Ben Langmuir via cfe-commits
@@ -116,7 +116,7 @@ class ASTUnit { std::shared_ptr PP; IntrusiveRefCntPtr Ctx; std::shared_ptr TargetOpts; - std::shared_ptrHSOpts; + std::unique_ptr HSOpts; benlangmuir wrote: Is there still a reason to keep this a poi

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-04-05 Thread Ben Langmuir via cfe-commits
@@ -48,7 +48,7 @@ void ASTMergeAction::ExecuteAction() { /*ShouldOwnClient=*/true)); std::unique_ptr Unit = ASTUnit::LoadFromASTFile( ASTFiles[I], CI.getPCHContainerReader(), ASTUnit::LoadEverything, Diags, -CI.getFileSys

[clang] [clang][deps] Respect `Lexer::cutOffLexing()` (PR #134404)

2025-04-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/134404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Avoid unchecked error assertion (PR #134284)

2025-04-03 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/134284 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang] Do not share ownership of `PreprocessorOptions` (PR #133467)

2025-03-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Sounds great, thanks for explaining! https://github.com/llvm/llvm-project/pull/133467 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-03-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/132984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-03-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: Basically LGTM but there are two clients that I'm not familiar with. https://github.com/llvm/llvm-project/pull/132984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailm

[clang] [clang] Do not share ownership of `HeaderSearchOptions` (PR #132984)

2025-03-28 Thread Ben Langmuir via cfe-commits
@@ -569,7 +569,7 @@ CrossTranslationUnitContext::ASTLoader::loadFromDump(StringRef ASTDumpPath) { return ASTUnit::LoadFromASTFile( ASTDumpPath, CI.getPCHContainerOperations()->getRawReader(), ASTUnit::LoadEverything, Diags, CI.getFileSystemOpts(), - CI.getHe

[clang] [clang-tools-extra] [clang] Do not share ownership of `PreprocessorOptions` (PR #133467)

2025-03-28 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Are you planning to do the same for LangOpts and HSOpts? What's the ultimate goal here? There's also this comment on `CompilerInvocationBase`: ``` /// ... It keeps individual option objects /// behind reference-counted pointers, which is useful for clients that want to /// ke

[clang] [clang] Remove deprecated `FileManager` APIs (PR #132063)

2025-03-19 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/132063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Correctly set module map systemness (PR #131940)

2025-03-19 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/131940 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DependencyScanning] Track modules that resolve from "shared" locations (PR #130634)

2025-03-17 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/130634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DependencyScanning] Track modules that resolve from "shared" locations (PR #130634)

2025-03-17 Thread Ben Langmuir via cfe-commits
@@ -739,6 +795,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) { MDC.ScanInstance.getASTReader()->visitInputFileInfos( *MF, /*IncludeSystem=*/true, [&](const serialization::InputFileInfo &IFI, bool IsSystem) { +if (MD.IsShareable) { +

[clang] [clang][DependencyScanning] Track modules that resolve from "shared" locations (PR #130634)

2025-03-17 Thread Ben Langmuir via cfe-commits
@@ -157,6 +157,32 @@ static void optimizeCWD(CowCompilerInvocation &BuildInvocation, StringRef CWD) { } } +/// Check a subset of invocation options to determine whether the current +/// context can safely be considered as shareable. +static bool areOptionsInSharedDir(CowCom

[clang] [llvm] [Support] Return `LockFileManager` errors right away (PR #130627)

2025-03-15 Thread Ben Langmuir via cfe-commits
@@ -157,42 +157,35 @@ class RemoveUniqueLockFileOnSignal { } // end anonymous namespace -LockFileManager::LockFileManager(StringRef FileName) -{ - this->FileName = FileName; - if (std::error_code EC = sys::fs::make_absolute(this->FileName)) { -std::string S("failed to o

[clang] [llvm] [Support] Return `LockFileManager` errors right away (PR #130627)

2025-03-15 Thread Ben Langmuir via cfe-commits
@@ -248,39 +236,14 @@ LockFileManager::LockFileManager(StringRef FileName) // There is a lock file that nobody owns; try to clean it up and get // ownership. -if ((EC = sys::fs::remove(LockFileName))) { - std::string S("failed to remove lockfile "); - S.a

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
@@ -739,6 +748,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) { MDC.ScanInstance.getASTReader()->visitInputFileInfos( *MF, /*IncludeSystem=*/true, [&](const serialization::InputFileInfo &IFI, bool IsSystem) { +if (MD.IsInSysroot) { +

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/130634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
@@ -739,6 +748,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) { MDC.ScanInstance.getASTReader()->visitInputFileInfos( *MF, /*IncludeSystem=*/true, [&](const serialization::InputFileInfo &IFI, bool IsSystem) { +if (MD.IsInSysroot) { +

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/130634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
@@ -835,6 +850,13 @@ void ModuleDepCollectorPP::addAllSubmoduleDeps( }); } +void ModuleDepCollectorPP::addClangModule(const Module *M, const ModuleID ID, benlangmuir wrote: How about something like "addOneModuleDep"? If find it hard to guess from the name

[clang] [clang][DependencyScanning] Track modules that resolve from sysroot. (PR #130634)

2025-03-14 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: I have a similar concern to @jansvoboda11 that we probably need to check the invocation paths as well. > I would think that if ModuleDepCollector only found dependency inputs that > resolve to sysroot locations, the command line for building the spec

[clang] [clang-tools-extra] [clang][modules] Introduce new `ModuleCache` interface (PR #131193)

2025-03-14 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/131193 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][modules] Introduce new `ModuleCache` interface (PR #131193)

2025-03-14 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,44 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[clang] [llvm] [Support] Remove output file checks from `LockFileManager` (PR #130395)

2025-03-13 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/130395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Support] Return `LockFileManager` errors right away (PR #130627)

2025-03-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/130627 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Remove dependency on llvm targets from lib DependencyScanning (PR #129774)

2025-03-05 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir closed https://github.com/llvm/llvm-project/pull/129774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Propagate the entire service (PR #128959)

2025-02-26 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/128959 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Propagate the entire service (PR #128959)

2025-02-26 Thread Ben Langmuir via cfe-commits
@@ -130,11 +130,11 @@ class DependencyScanningWorker { DependencyActionController &Controller, StringRef ModuleName); - bool shouldEagerLoadModules() const { return EagerLoadModules; } - llvm::vfs::FileSys

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-02-26 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/119740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Fix local submodule visibility of macros from transitive import (PR #122955)

2025-02-21 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir closed https://github.com/llvm/llvm-project/pull/122955 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Ensure DiagnosticConsumer::finish is always called (PR #127110)

2025-02-13 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir closed https://github.com/llvm/llvm-project/pull/127110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Make serialized diagnostics more reliable (PR #100681)

2025-02-13 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: There's another call to finish() in DependencyScanningWorker that should be removed if we do this. https://github.com/llvm/llvm-project/pull/100681 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [clang][deps] Ensure DiagnosticConsumer::finish is always called (PR #127110)

2025-02-13 Thread Ben Langmuir via cfe-commits
, or if the command line contained no scannable actions we would fail to finish(), which would break some consumers (e.g. serialized diag consumer). >From c94b7df49f9b92b574c44fddc8b8faee1b7cdce0 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 13 Feb 2025 10:50:09 -0800 Subject: [PA

[clang] [DependencyScanning] Add ability to scan TU with a buffer input (PR #125111)

2025-02-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/125111 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DependencyScanning] Add ability to scan TU with a buffer input (PR #125111)

2025-01-30 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,111 @@ +// UNSUPPORTED: target=powerpc64-ibm-aix{{.*}} + +// RUN: rm -rf %t +// RUN: split-file %s %t + +//--- module.modulemap +module root { header "root.h" } +module direct { header "direct.h" } +module transitive { header "transitive.h" } +module addition { header "

[clang] [DependencyScanning] Add ability to scan TU with a buffer input (PR #125111)

2025-01-30 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,111 @@ +// UNSUPPORTED: target=powerpc64-ibm-aix{{.*}} + +// RUN: rm -rf %t +// RUN: split-file %s %t + +//--- module.modulemap +module root { header "root.h" } +module direct { header "direct.h" } +module transitive { header "transitive.h" } +module addition { header "

[clang] [compiler-rt] [llvm] Revert "Reapply "[ORC] Enable JIT support for the compact-unwind frame..." with fixes." (PR #125098)

2025-01-30 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Failure looks unrelated. Merging. https://github.com/llvm/llvm-project/pull/125098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] Revert "Reapply "[ORC] Enable JIT support for the compact-unwind frame..." with fixes." (PR #125098)

2025-01-30 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir closed https://github.com/llvm/llvm-project/pull/125098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] Revert "Reapply "[ORC] Enable JIT support for the compact-unwind frame..." with fixes." (PR #125098)

2025-01-30 Thread Ben Langmuir via cfe-commits
-darwin.TestCases/Darwin/Generic.exceptions.cpp ORC-x86_64-darwin.TestCases/Darwin/x86-64.lljit-ehframe.cpp >From d2cf4b637cc667f2ccd094097828058524c90ec9 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 30 Jan 2025 09:48:33 -0800 Subject: [PATCH] Revert "Reapply "[ORC] Enabl

[clang] [Modules] Delay deserialization of preferred_name attribute at r… (PR #122726)

2025-01-24 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: There's probably a better way, but I just built my first clang normally then built a second one with `-DCMAKE_C_COMPILER` and `-DCMAKE_CXX_COMPILER` pointing to the first one, and `-DLLVM_ENABLE_MODULES=1` to enable modules. https://github.com/llvm/llvm-project/pull/122726 _

[clang] [Modules] Delay deserialization of preferred_name attribute at r… (PR #122726)

2025-01-23 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: I see that this change has already been reverted by @ilya-biryukov , but FYI before this is re-applied: I am seeing crashes from this change if I attempt to bootstrap a build of clang with modules enabled on Darwin. I haven't yet managed to minimize a test case, but compili

[clang] [clang][modules] Partially revert 48d0eb518 to fix -gmodules output (PR #124003)

2025-01-22 Thread Ben Langmuir via cfe-commits
-memory module cache rather than reading it from the pcm file that was written. This broke bootstrapping a build of clang with modules enabled on Darwin. rdar://143418834 >From 40879d967ff8b7463f3eb56d437cacde6e2689ef Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Wed, 22 Jan 2025 12:52

[clang] [clang][modules] Fix local submodule visibility of macros from transitive import (PR #122955)

2025-01-14 Thread Ben Langmuir via cfe-commits
ether the submodules involved were explicitly defined (module X) or implicitly defined from an umbrella (module *). rdar://136524433 >From 5541ea0e31d35dfd20a3157a52997b1b2f6d3966 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Tue, 14 Jan 2025 10:57:56 -0800 Subject: [PATCH] [clang][modu

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-01-10 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: I'm happy with the way this split of the code worked out! > Currently this has no effect other than slightly changing diagnostics. Can you say more about the ordering changes? I understand we can't always emit diagnostics in source order, but it's help

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-01-10 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,141 @@ +//===- ModuleMapFile.h - Parsing and representation -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-01-10 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/119740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-01-10 Thread Ben Langmuir via cfe-commits
@@ -3157,25 +2140,18 @@ bool ModuleMap::parseModuleMapFile(FileEntryRef File, bool IsSystem, assert((!Offset || *Offset <= Buffer->getBufferSize()) && "invalid buffer offset"); - // Parse this module map file. - Lexer L(SourceMgr.getLocForStartOfFile(ID), MMapLan

[clang] [clang][modules] Separate parsing of modulemaps (PR #119740)

2025-01-10 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,141 @@ +//===- ModuleMapFile.h - Parsing and representation -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [clang][serialization] Blobify IMPORTS strings and signatures (PR #116095)

2024-11-18 Thread Ben Langmuir via cfe-commits
@@ -350,9 +350,8 @@ enum ControlRecordTypes { /// and information about the compiler used to build this AST file. METADATA = 1, - /// Record code for the list of other AST files imported by - /// this AST file. - IMPORTS, + /// Record code for other AST file imported b

[clang] [clang][serialization] Blobify IMPORTS strings and signatures (PR #116095)

2024-11-18 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Gotta love having three copies of this code 😬 but obviously not something you need to fix here. LGTM https://github.com/llvm/llvm-project/pull/116095 ___ cfe-commits mailing list cfe-commits@

[clang] [clang][serialization] Blobify IMPORTS strings and signatures (PR #116095)

2024-11-18 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/116095 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/115237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Only write preprocessor info into PCMs (PR #115239)

2024-11-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/115239 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-11 Thread Ben Langmuir via cfe-commits
@@ -661,8 +661,8 @@ class ASTWriter : public ASTDeserializationListener, /// Write a precompiled header for the given semantic analysis. /// - /// \param SemaRef a reference to the semantic analysis object that processed - /// the AST to be written into the precompiled h

[clang] [clang][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-11 Thread Ben Langmuir via cfe-commits
@@ -4858,14 +4860,21 @@ time_t ASTWriter::getTimestampForOutput(const FileEntry *E) const { return IncludeTimestamps ? E->getModificationTime() : 0; } -ASTFileSignature ASTWriter::WriteAST(Sema &SemaRef, StringRef OutputFile, - Module *Wr

[clang] [clang][serialization] Pass `ASTContext` explicitly (PR #115235)

2024-11-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/115235 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][serialization] Pass `ASTContext` explicitly (PR #115235)

2024-11-07 Thread Ben Langmuir via cfe-commits
@@ -4753,15 +4755,12 @@ void ASTWriter::AddString(StringRef Str, RecordDataImpl &Record) { } bool ASTWriter::PreparePathForOutput(SmallVectorImpl &Path) { - assert(Context && "should have context when outputting path"); - // Leave special file names as they are. String

[clang] [clang][serialization] Pass `ASTContext` explicitly (PR #115235)

2024-11-07 Thread Ben Langmuir via cfe-commits
@@ -4753,15 +4755,12 @@ void ASTWriter::AddString(StringRef Str, RecordDataImpl &Record) { } bool ASTWriter::PreparePathForOutput(SmallVectorImpl &Path) { - assert(Context && "should have context when outputting path"); - // Leave special file names as they are. String

[clang] [clang][deps][modules] Allocate input file paths lazily (PR #114457)

2024-11-06 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/114457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Share `FileManager` between modules (PR #115065)

2024-11-05 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/115065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Stop relying on name of inferred module maps (PR #114085)

2024-11-01 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/114085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Stop relying on name of inferred module maps (PR #114085)

2024-11-01 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Okay, sounds impractical https://github.com/llvm/llvm-project/pull/114085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][lex] Remove `HeaderFileInfo::Framework` (PR #114460)

2024-10-31 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/114460 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][lex] Remove `-index-header-map` (PR #114459)

2024-10-31 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/114459 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] De-duplicate some logic in `HeaderFileInfoTrait` (PR #114330)

2024-10-31 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/114330 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-30 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/113984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-30 Thread Ben Langmuir via cfe-commits
@@ -1342,19 +1343,47 @@ class ASTReader bool Complain = true); /// Buffer we use as temporary storage backing resolved paths. - SmallString<256> PathBuf; + std::optional> PathBuf{{}}; + + /// A RAII wrapper around \c StringRef that

[clang] [clang][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-30 Thread Ben Langmuir via cfe-commits
@@ -1342,19 +1343,47 @@ class ASTReader bool Complain = true); /// Buffer we use as temporary storage backing resolved paths. - SmallString<256> PathBuf; + std::optional> PathBuf{{}}; + + /// A RAII wrapper around \c StringRef that

[clang] [clang][deps] Stop relying on name of inferred module maps (PR #114085)

2024-10-29 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: Can this be tested? https://github.com/llvm/llvm-project/pull/114085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Stop sorting file dependencies (PR #114079)

2024-10-29 Thread Ben Langmuir via cfe-commits
@@ -34,8 +34,8 @@ module mod { header "mod.h" } // CHECK:], // CHECK-NEXT: "context-hash": "[[HASH_MOD:.*]]", // CHECK-NEXT: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/mod.h" -// CHECK-NEXT: "[[PREFIX]]/module.modulemap" +// CHECK-DAG:

[clang] [clang][deps] Stop sorting file dependencies (PR #114079)

2024-10-29 Thread Ben Langmuir via cfe-commits
@@ -472,7 +465,8 @@ class FullDeps { JOS.attributeArray("command-line", toJSONStrings(JOS, MD.getBuildArguments())); JOS.attribute("context-hash", StringRef(MD.ID.ContextHash)); -JOS.attributeArray("file-deps",

[clang] [clang][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-29 Thread Ben Langmuir via cfe-commits
@@ -1341,9 +1341,22 @@ class ASTReader serialization::InputFile getInputFile(ModuleFile &F, unsigned ID, bool Complain = true); + /// Buffer we use as temporary storage backing resolved paths. + SmallString<256> PathBuf;

[clang] [clang][deps] Stop sorting file dependencies (PR #114079)

2024-10-29 Thread Ben Langmuir via cfe-commits
@@ -34,8 +34,8 @@ module mod { header "mod.h" } // CHECK:], // CHECK-NEXT: "context-hash": "[[HASH_MOD:.*]]", // CHECK-NEXT: "file-deps": [ -// CHECK-NEXT: "[[PREFIX]]/mod.h" -// CHECK-NEXT: "[[PREFIX]]/module.modulemap" +// CHECK-DAG:

[clang] [clang][deps] Stop sorting file dependencies (PR #114079)

2024-10-29 Thread Ben Langmuir via cfe-commits
@@ -472,7 +465,8 @@ class FullDeps { JOS.attributeArray("command-line", toJSONStrings(JOS, MD.getBuildArguments())); JOS.attribute("context-hash", StringRef(MD.ID.ContextHash)); -JOS.attributeArray("file-deps",

[clang] [clang][deps] Improve timing output (PR #113726)

2024-10-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/113726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Preserve the module map that allowed inferring (PR #113389)

2024-10-28 Thread Ben Langmuir via cfe-commits
@@ -3018,13 +3019,19 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) { SourceLocationEncoding::RawLocEncoding DefinitionLoc = getRawSourceLocationEncoding(getAdjustedLocation(Mod->DefinitionLoc)); +ModuleMap &ModMap = PP->getHeaderSearchInfo().getModu

[clang] [clang][modules] Optimize construction and usage of the submodule index (PR #113391)

2024-10-28 Thread Ben Langmuir via cfe-commits
@@ -541,11 +541,11 @@ class ModuleMap { /// /// \param IsExplicit Whether this is an explicit submodule. /// - /// \returns The found or newly-created module, along with a boolean value - /// that will be true if the module is newly-created. - std::pair findOrCreateMod

[clang] [clang][modules] Optimize construction and usage of the submodule index (PR #113391)

2024-10-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/113391 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Preserve the module map that allowed inferring (PR #113389)

2024-10-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/113389 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Improve timing output (PR #113726)

2024-10-25 Thread Ben Langmuir via cfe-commits
@@ -34,6 +34,7 @@ def deprecated_driver_command : F<"deprecated-driver-command", "use a single dri defm resource_dir_recipe : Eq<"resource-dir-recipe", "How to produce missing '-resource-dir' argument">; def print_timing : F<"print-timing", "Print timing information">; +def

[clang] [clang][modules] Only serialize info for locally-included headers (PR #113718)

2024-10-25 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/113718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Improve timing output (PR #113726)

2024-10-25 Thread Ben Langmuir via cfe-commits
@@ -88,6 +88,7 @@ static bool DeprecatedDriverCommand; static ResourceDirRecipeKind ResourceDirRecipe; static bool Verbose; static bool PrintTiming; +static bool NoPrintTimingHeader; benlangmuir wrote: Nit: even if the command-line argument is "-no" I would ph

[clang] [clang][modules] Timestamp PCM files when writing (PR #112452)

2024-10-22 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/112452 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Allocate `Module` instances in `BumpPtrAllocator` (PR #112795)

2024-10-21 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/112795 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-11 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Right, that's what I meant by "Is it trying to set it too early before the VFS is created or something?". We could make the driver setup the VFS like the frontend would and do that before checking the -working-directory; not sure if there's a reason we don't do that already

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-11 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: @sheredom I think I'm missing something. What's the actual failure? Setting `-working-directory` causes `FileManager` to prepend to paths the configured directory, so the VFS lookups would then be absolute paths not relative. I see the driver checks if the path in `-working

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-11 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > We tried setting -working-directory=Z:/working, but the VFS requires that > this is a real path. What error are you seeing if it's not? Is it trying to set it too early before the VFS is created or something? https://github.com/llvm/llvm-project/pull/106577 __

[clang] [clang][deps] Serialize JSON without creating intermediate objects (PR #111734)

2024-10-09 Thread Ben Langmuir via cfe-commits
@@ -450,58 +458,65 @@ class FullDeps { ModuleIDs.push_back(M.first); llvm::sort(ModuleIDs); -using namespace llvm::json; - -Array OutModules; -for (auto &&ModID : ModuleIDs) { - auto &MD = Modules[ModID]; - Object O{{"name", MD.ID.ModuleName}, -

[clang] [clang][deps] Serialize JSON without creating intermediate objects (PR #111734)

2024-10-09 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/111734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-04 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > Build machine A with a path E:/foo/header.h which wants to make a PCH from > it. We want it to remap E:/foo -> Z:/fake. What I have in mind is that you have a VFS on build machine A that maps Z:/fake (virtual path) -> E:/foo (external path), with use-external-names: false.

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-04 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: I think it's something much earlier in clang is not using the VFS at all when looking up the main input path, so then it only knows the external path for that case. My guess is that if that were fixed then the ASTWriter/Reader would do the right thing here. https://githu

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-10-04 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > `-emit-pch -o "%t.pch" %t/From/../From/B.h` > `'could not find file > 'D:\llvm-project\build\tools\clang\test\VFS\Output\remap-to-fake.c.tmp\From\..\From\B.h'` Isn't that the same issue I mentioned, that it doesn't appear to work for the main PCH input file? If you remov

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-09-30 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: It looks like it almost works: if I create a module in a virtual path and use `use-external-names: false`, then the module stores the virtual path for its input files. E.g. ``` { "version": 0, "use-external-names": false, "roots": [ { "contents": [

[clang] [clang-tools-extra] [clang] Make deprecations of some `FileManager` APIs formal (PR #110014)

2024-09-25 Thread Ben Langmuir via cfe-commits
@@ -427,12 +427,8 @@ static void InitializeFileRemapping(DiagnosticsEngine &Diags, } // Create the file entry for the file that we're mapping from. -const FileEntry *FromFile = -FileMgr.getVirtualFile(RF.first, ToFile->getSize(), 0); -if (!FromFile) {

[clang] [clang-tools-extra] [clang] Make deprecations of some `FileManager` APIs formal (PR #110014)

2024-09-25 Thread Ben Langmuir via cfe-commits
@@ -199,7 +199,7 @@ int main(int argc, const char **argv) { for (auto I = Files.begin(), E = Files.end(); I != E; ++I) { OS << " {\n"; OS << "\"FilePath\": \"" << *I << "\",\n"; -const auto Entry = FileMgr.getFile(*I); +const auto Entr

[clang] [clang-tools-extra] [clang] Make deprecations of some `FileManager` APIs formal (PR #110014)

2024-09-25 Thread Ben Langmuir via cfe-commits
@@ -1925,8 +1921,8 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST( M = HS.lookupModule(ModuleName, ImportLoc, true, !IsInclusionDirective); // Check whether M refers to the file in the prebuilt module path. -if (M && M->getASTFile()) - if

[clang] [clang-tools-extra] [clang] Make deprecations of some `FileManager` APIs formal (PR #110014)

2024-09-25 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Thanks for cleaning this up! https://github.com/llvm/llvm-project/pull/110014 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Make PCH's respect any VFS specified. (PR #106577)

2024-09-24 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: Sorry for being slow to look at this in more detail: > When generating a PCH map the original directory to some fake directory. You > could imagine D:/Foo being mapped to Z:/Foo for instance. Can you clarify what this means? Is `Z:/Foo` a virtual-only

  1   2   3   4   5   6   7   8   9   >