[clang] Pass LangOpts from CompilerInstance to DependencyScanningWorker (PR #93753)

2024-11-21 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > But the list of tokens depends on things like what features are enabled, > right? e.g., `-fchar8_t` introduces a new keyword, while `_Atomic` isn't a > keyword in OpenCL, and `bool` is only a keyword in C23 and later but is > always a keyword in C++, etc. Ah, but in terms

[clang] clang: Relax LangOpts checks when lexing quoted numbers during preprocessing (PR #95798)

2024-11-21 Thread Jan Svoboda via cfe-commits
@@ -2068,7 +2068,8 @@ bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { } // If we have a digit separator, continue. - if (C == '\'' && (LangOpts.CPlusPlus14 || LangOpts.C23)) { + if (C == '\'' && + (LangOpts.CPlusPlus14 || LangOpts.C23 || Parsing

[clang] [ASTWriter] Do not allocate source location space for module maps used only for textual headers (PR #116374)

2024-11-20 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Does preprocessing from AST files (ab75597ddac52f24e9cbd794cded195262ef670e) with decluse checking (f3f846162a5d6b5b84ed7d146a29dc175542c2c0) still work with this patch? I'm surprised that removing of module maps just because they only provided a textual header doesn't have

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

2024-11-18 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] Blobify IMPORTS strings and signatures (PR #116095)

2024-11-18 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/116095 >From 3d50eff35fe68cfa7d94d27ccd51e9d1b864417a Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 13 Nov 2024 11:17:14 -0800 Subject: [PATCH 1/2] [clang][serialization] Blobify IMPORTS strings and signa

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

2024-11-13 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/116095 This PR changes a part of the PCM format to store string-like things in the blob attached to a record instead of VBR6-encoding them into the record itself. Applied to the `IMPORTS` section (which is very h

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

2024-11-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][deps] Only write preprocessor info into PCMs (PR #115239)

2024-11-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/115239 >From 136e484907d24f1ba0efc4f658fabcdb95fa8498 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Nov 2024 14:16:51 -0800 Subject: [PATCH 1/2] [clang][deps] Only write preprocessor info into PCMs ---

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

2024-11-11 Thread Jan Svoboda 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 Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-11 Thread Jan Svoboda 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] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/115237 >From 24f60890a4a1cef2c9387040fce6d0864fcb01f4 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Nov 2024 11:18:09 -0800 Subject: [PATCH 1/3] [clang][serialization] Make `ASTWriter` accept `Preproces

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

2024-11-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][serialization] Enable `ASTWriter` to work with `Preprocessor` only (PR #115237)

2024-11-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/115237 >From 24f60890a4a1cef2c9387040fce6d0864fcb01f4 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Nov 2024 11:18:09 -0800 Subject: [PATCH 1/2] [clang][serialization] Make `ASTWriter` accept `Preproces

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

2024-11-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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][serialization] Make `ASTWriter` work with `Preprocessor` only (PR #115237)

2024-11-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/115237 >From 24f60890a4a1cef2c9387040fce6d0864fcb01f4 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Nov 2024 11:18:09 -0800 Subject: [PATCH] [clang][serialization] Make `ASTWriter` accept `Preprocessor`

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

2024-11-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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 Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/115235 >From 27985cf8df00f1edf6e74b7e50ce5be13569591c Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 6 Nov 2024 09:54:06 -0800 Subject: [PATCH 1/3] [clang][serialization] Pass `ASTContext` explicitly ---

[clang] [ASTWriter] Detect more non-affecting FileIDs to reduce source location duplication (PR #112015)

2024-11-07 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. Sounds good, thank you! https://github.com/llvm/llvm-project/pull/112015 ___ 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 Jan Svoboda 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] Fix ASTWriter crash after merging named enums (PR #114240)

2024-11-07 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > @jansvoboda11 for OC related things Thanks! CC @vsapsai and @ian-twilightcoder. https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

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

2024-11-06 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/115239 This patch builds on top of https://github.com/llvm/llvm-project/pull/115237 and https://github.com/llvm/llvm-project/pull/115235, only passing the `Preprocessor` object to `ASTWriter`. This reduces the si

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

2024-11-06 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: To clarify, the main reason for this patch is that I find passing a reference much less error-prone than having an omnipresent pointer that will only be null during dependency scanning. https://github.com/llvm/llvm-project/pull/115235 ___

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

2024-11-06 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/115237 This PR builds on top of https://github.com/llvm/llvm-project/pull/115235 and makes it possible to call `ASTWriter::WriteAST()` with `Preprocessor` only instead of full `Sema` object. So far, there are no

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

2024-11-06 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/115235 This patch removes `ASTWriter::Context` and starts passing `ASTContext &` explicitly to functions that actually need it. This is a non-functional change with the end-goal of being able to write lightweight

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

2024-11-06 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] 304c412 - [clang][serialization] Reduce `ASTWriter::writeUnhashedControlBlock()` scope

2024-11-06 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2024-11-06T12:54:01-08:00 New Revision: 304c41217303ce613de8f4042e570ac6ca8757e8 URL: https://github.com/llvm/llvm-project/commit/304c41217303ce613de8f4042e570ac6ca8757e8 DIFF: https://github.com/llvm/llvm-project/commit/304c41217303ce613de8f4042e570ac6ca8757e8.diff L

[clang] 0276621 - [clang][serialization] Reduce `ASTWriter::WriteControlBlock()` scope

2024-11-06 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2024-11-06T12:36:46-08:00 New Revision: 0276621f8f5ae489fbe9343cb4cca07579a244a4 URL: https://github.com/llvm/llvm-project/commit/0276621f8f5ae489fbe9343cb4cca07579a244a4 DIFF: https://github.com/llvm/llvm-project/commit/0276621f8f5ae489fbe9343cb4cca07579a244a4.diff L

[clang] bcb64e1 - [clang][serialization] Reduce `ASTWriter::WriteSourceManagerBlock()` scope

2024-11-06 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2024-11-06T12:34:24-08:00 New Revision: bcb64e13172c9b894be03ccefcf967e99949b32a URL: https://github.com/llvm/llvm-project/commit/bcb64e13172c9b894be03ccefcf967e99949b32a DIFF: https://github.com/llvm/llvm-project/commit/bcb64e13172c9b894be03ccefcf967e99949b32a.diff L

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

2024-11-05 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/115065 The `FileManager` sharing between module-building `CompilerInstance`s was disabled a while ago due to `FileEntry::getName()` being unreliable. Now that we use `FileEntryRef::getNameAsRequested()` in places

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

2024-11-05 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Ping. 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] Move VFS overlays from `HeaderSearchOptions` to `FileSystemOptions` (PR #86534)

2024-11-02 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/86534 >From d49ef2de83b37156ab73c0028676d9b0425ef2ed Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 25 Mar 2024 10:15:33 -0700 Subject: [PATCH] [clang] Move VFS overlays from `HeaderSearchOptions` to `File

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

2024-11-01 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > Can this be tested? Hmm, I'm not sure. The current tests for inferred module maps still pass. The other ways how `SourceManager` ends up overwriting a file are: * is by using the `-remap-file`, which is unsupported with modules (`ASTWriter` intentionally asserts), * using

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

2024-11-01 Thread Jan Svoboda via cfe-commits
@@ -779,23 +795,16 @@ static StringRef makeAbsoluteAndPreferred(CompilerInstance &CI, StringRef Path, void ModuleDepCollector::addFileDep(StringRef Path) { if (IsStdModuleP1689Format) { // Within P1689 format, we don't want all the paths to be absolute path -// since

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

2024-11-01 Thread Jan Svoboda via cfe-commits
@@ -779,23 +795,16 @@ static StringRef makeAbsoluteAndPreferred(CompilerInstance &CI, StringRef Path, void ModuleDepCollector::addFileDep(StringRef Path) { if (IsStdModuleP1689Format) { // Within P1689 format, we don't want all the paths to be absolute path -// since

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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][modules] Allocate input file paths lazily (PR #114457)

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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][lex] Remove `-index-header-map` (PR #114459)

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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-tools-extra] [clang][lex] Remove `HeaderFileInfo::Framework` (PR #114460)

2024-10-31 Thread Jan Svoboda via cfe-commits
@@ -2045,21 +2041,7 @@ namespace { LE.write( Writer.getIdentifierRef(Data.HFI.LazyControllingMacro.getPtr())); - unsigned Offset = 0; - if (!Data.HFI.Framework.empty()) { -// If this header refers into a framework, save the framework name.

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/114457 >From 3be61a8f1eecdc64c0df5d6635f5bf7809c31de4 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 09:41:18 -0700 Subject: [PATCH 1/2] [clang][deps][modules] Reduce allocations of input file

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114460 This PR removes the `HeaderFileInfo::Framework` member and reduces the size of this data type from 32B to 16B. This should improve Clang's memory usage in situations where it keeps track of lots of header

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114459 This PR removes the `-index-header-map` functionality from Clang. AFAIK this was only used internally at Apple and is now dead code. The main motivation behind this change is to enable the removal of `Head

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/114079 ___ 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-31 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Ok, abandoning in favor of #114457. https://github.com/llvm/llvm-project/pull/114079 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-10-31 Thread Jan Svoboda via cfe-commits
@@ -472,7 +465,9 @@ 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][modules] Allocate input file paths lazily (PR #114457)

2024-10-31 Thread Jan Svoboda via cfe-commits
@@ -779,23 +795,16 @@ static StringRef makeAbsoluteAndPreferred(CompilerInstance &CI, StringRef Path, void ModuleDepCollector::addFileDep(StringRef Path) { if (IsStdModuleP1689Format) { // Within P1689 format, we don't want all the paths to be absolute path -// since

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

2024-10-31 Thread Jan Svoboda via cfe-commits
@@ -21,6 +21,16 @@ using namespace clang; using namespace tooling; using namespace dependencies; +void ModuleDeps::forEachFileDep(llvm::function_ref Cb) const { + SmallString<0> PathBuf; + PathBuf.reserve(256); jansvoboda11 wrote: Curious what people think

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114457 This PR builds on top of #113984 and attempts to avoid allocating input file paths eagerly. Instead, the `InputFileInfo` type used by `ASTReader` now only holds `StringRef`s that point into the PCM file bu

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113984 >From c11ea47908e93fedf83021377f904d296802e627 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 30 Oct 2024 16:52:42 -0700 Subject: [PATCH 1/6] [clang][modules] De-duplicate some logic in `HeaderFileI

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113984 >From c11ea47908e93fedf83021377f904d296802e627 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 30 Oct 2024 16:52:42 -0700 Subject: [PATCH 1/6] [clang][modules] De-duplicate some logic in `HeaderFileI

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

2024-10-31 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] De-duplicate some logic in `HeaderFileInfoTrait` (PR #114330)

2024-10-30 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114330 None >From c11ea47908e93fedf83021377f904d296802e627 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 30 Oct 2024 16:52:42 -0700 Subject: [PATCH] [clang][modules] De-duplicate some logic in `HeaderFil

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

2024-10-30 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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] [llvm] [clang] NFC: Remove `{File, Directory}Entry::getName()` (PR #74910)

2024-10-30 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: How about something like this? ```c++ auto FE = CI.getFileManager().getOptionalFileEntryRef("foo.h"); bool IsFooIncluded = FE && CI.getPreprocessor().getIncludedFiles().contains(*FE); ``` https://github.com/llvm/llvm-project/pull/74910 __

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

2024-10-30 Thread Jan Svoboda 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 Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113984 >From 709cc1c8c41603c4d9eb637cb0453521029af201 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 28 Oct 2024 16:59:13 -0700 Subject: [PATCH 1/3] [clang][modules] Avoid allocations when reading blob pat

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

2024-10-29 Thread Jan Svoboda 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 Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113984 >From 709cc1c8c41603c4d9eb637cb0453521029af201 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 28 Oct 2024 16:59:13 -0700 Subject: [PATCH 1/2] [clang][modules] Avoid allocations when reading blob pat

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

2024-10-29 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-29 Thread Jan Svoboda 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 relying on name of inferred module maps (PR #114085)

2024-10-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114085 What the special case for `"__inferred_module.map"` was getting at is that in general we cannot report overridden files as dependencies: neither the build system nor Clang itself won't know what to do with

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

2024-10-29 Thread Jan Svoboda 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 Jan Svoboda 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] Stop sorting file dependencies (PR #114079)

2024-10-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114079 The dependency scanner collects file dependencies of modules into a `llvm::StringSet`. However, we don't need the deduplication it performs, since that's already guaranteed by the PCM we read the paths fro

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

2024-10-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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-29 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-28 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-28 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-28 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-28 Thread Jan Svoboda 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][modules] Avoid allocations when reading blob paths (PR #113984)

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/113984 When reading a path from a bitstream blob, `ASTReader` performs up to three allocations: 1. Conversion of the `StringRef` blob into `std::string` to conform to the `ASTReader::ResolveImportedPath()` API t

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

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][deps] Improve timing output (PR #113726)

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited 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] Optimize construction and usage of the submodule index (PR #113391)

2024-10-28 Thread Jan Svoboda via cfe-commits
@@ -541,11 +541,14 @@ 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] 19131c7 - [clang][modules][lldb] Fix build after #113391

2024-10-28 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2024-10-28T12:50:53-07:00 New Revision: 19131c7f36e047898ea954ee5a187ac62f2ab09b URL: https://github.com/llvm/llvm-project/commit/19131c7f36e047898ea954ee5a187ac62f2ab09b DIFF: https://github.com/llvm/llvm-project/commit/19131c7f36e047898ea954ee5a187ac62f2ab09b.diff L

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

2024-10-28 Thread Jan Svoboda via cfe-commits
@@ -541,11 +541,14 @@ 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][deps] Improve timing output (PR #113726)

2024-10-28 Thread Jan Svoboda 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][deps] Improve timing output (PR #113726)

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113726 >From 58056a40734ee2a64dca37f7669f77f2447f492c Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 25 Oct 2024 11:42:58 -0700 Subject: [PATCH 1/2] [clang][deps] Improve timing output This patch adds the

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

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] Optimize construction and usage of the submodule index (PR #113391)

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113391 >From c6ff124355209de31c86096eb2ede14d598aa5cd Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 15:46:07 -0700 Subject: [PATCH 1/2] [clang][modules] Optimize construction and usage of the

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

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113391 >From c795bab6ec59676daaa3ef67077b9a738dd93839 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 15:46:07 -0700 Subject: [PATCH 1/2] [clang][modules] Optimize construction and usage of the

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

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][modules] Preserve the module map that allowed inferring (PR #113389)

2024-10-28 Thread Jan Svoboda 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] Preserve the module map that allowed inferring (PR #113389)

2024-10-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113389 >From efcd62d35fe296b2bd4fe5cdbec9ab96493a885f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 14:01:45 -0700 Subject: [PATCH 1/2] [clang][modules] Preserve the module map that allowed in

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

2024-10-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] [llvm] [AMDGPU] Add a type for the named barrier (PR #113614)

2024-10-25 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: This PR did bump `NUM_PREDEF_TYPE_IDS`, but after the pre-merge tests succeeded, #97277 that also bumps `NUM_PREDEF_TYPE_IDS ` landed in `main`. https://github.com/llvm/llvm-project/pull/113614 ___ cfe-commits mailing list cfe-comm

[clang] [CLANG] bump NUM_PREDEF_TYPE_IDS (PR #113728)

2024-10-25 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Already fixed in 75252e29ea6a0959f3c1670e641a03fc18fc65fa. https://github.com/llvm/llvm-project/pull/113728 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [AMDGPU] Add a type for the named barrier (PR #113614)

2024-10-25 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I just pushed a fix in 75252e2. https://github.com/llvm/llvm-project/pull/113614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 75252e2 - [clang][serialization] Bump `NUM_PREDEF_TYPE_IDS`

2024-10-25 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2024-10-25T12:40:59-07:00 New Revision: 75252e29ea6a0959f3c1670e641a03fc18fc65fa URL: https://github.com/llvm/llvm-project/commit/75252e29ea6a0959f3c1670e641a03fc18fc65fa DIFF: https://github.com/llvm/llvm-project/commit/75252e29ea6a0959f3c1670e641a03fc18fc65fa.diff L

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

2024-10-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/113726 This patch adds the number of executed instructions into the timing output, which provides more stable results compared to wall or process time. The format itself is also tweaked so that it's more amenable

[clang] [clang-tools-extra] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-25 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/113395 ___ 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] Shrink the size of `Module::Headers` (PR #113395)

2024-10-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/113395 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-10-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/113718 I noticed that some PCM files contain `HeaderFileInfo` for headers only included in a dependent PCM file, which is wasteful. This patch changes the logic to only write headers that are included locally. T

[clang] [clang-tools-extra] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-25 Thread Jan Svoboda via cfe-commits
@@ -263,17 +261,36 @@ class alignas(8) Module { FileEntryRef Entry; }; - /// Information about a directory name as found in the module map - /// file. +private: + static const int NumHeaderKinds = HK_Excluded + 1; + // The begin index for a HeaderKind also acts the e

[clang] [clang-tools-extra] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113395 >From 09246d11c8663c0b2b31317eddc297c1d29fcd60 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 16:07:27 -0700 Subject: [PATCH 1/4] [clang][modules] Shrink the size of `Module::Headers` Th

[clang] [clang-tools-extra] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/113395 >From 09246d11c8663c0b2b31317eddc297c1d29fcd60 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 22 Oct 2024 16:07:27 -0700 Subject: [PATCH 1/3] [clang][modules] Shrink the size of `Module::Headers` Th

[clang] [clang-tools-extra] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-24 Thread Jan Svoboda via cfe-commits
@@ -271,8 +271,22 @@ class alignas(8) Module { DirectoryEntryRef Entry; }; - /// The headers that are part of this module. - SmallVector Headers[5]; +private: + unsigned HeaderKindBeginIndex[6] = {}; jansvoboda11 wrote: I used `NumHeaderKinds`, but e

[clang] [clang][modules] Shrink the size of `Module::Headers` (PR #113395)

2024-10-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/113395 This patch shrinks the size of the `Module` class from 2112B to 1624B. I wasn't able to get a good data on the actual impact on memory usage, but given my `clang-scan-deps` workload at hand (with tens of t

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

2024-10-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/113391 This patch avoids eagerly populating the submodule index on `Module` construction. The `StringMap` allocation shows up in my profiles of `clang-scan-deps`, while the index is not necessary most of the time

  1   2   3   4   5   6   7   8   9   10   >