[clang] [clang][modules][deps] Add mutex as an alternative to file lock (PR #129751)

2025-03-14 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I rebased this on top of the other PRs I've recently landed. This is ready for another round of reviews. https://github.com/llvm/llvm-project/pull/129751 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.or

[clang] [clang][modules] Fix filesystem races in `ModuleManager` (PR #131354)

2025-03-17 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/131354 >From 7945795843a81eb13b0febd752928bfcc3715eba Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 17 Mar 2025 08:11:52 -0700 Subject: [PATCH] [clang][modules] Fix filesystem races in `ModuleManager` The

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-08 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/134887 This PR extracts the creation of `CompilerInstance` for compiling an implicitly-discovered module out of `compileModuleImpl()` into its own separate function and passes it into `compileModuleImpl()` from t

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-08 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: The only non-NFC change I'm aware of is that the `err_module_rebuild_finalized` diagnostic is now only emitted by `compileModule()` and not by `CompilerInstance::createModuleFromSource()`. I believe that's fine, since that's only used from `#pragma clang module build/endbui

[clang] [clang][modules] Name the module map files on PCM file conflict (PR #134475)

2025-04-08 Thread Jan Svoboda via cfe-commits
@@ -6067,14 +6062,21 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F, if (OptionalFileEntryRef CurFile = CurrentModule->getASTFile()) { // Don't emit module relocation error if we have -fno-validate-pch if (!bool(PP.getPreprocessorOpts().D

[clang] [clang][DependencyScanning] Track dependencies from prebuilt modules to determine IsInStableDir (PR #132237)

2025-04-08 Thread Jan Svoboda via cfe-commits
@@ -237,6 +237,17 @@ class ASTReaderListener { return true; } + /// Overloaded member function of \c visitInputFile that should + /// be defined when the input file contains both the virtual and external + /// paths, for example when deserializing input files from AST

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/134887 >From a41ba702f42671f7e9c51c29a846a6c7c7324378 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 7 Apr 2025 13:30:28 -0700 Subject: [PATCH 1/7] [clang] Extract `CompilerInstance` creation out of `compi

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/134887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/135405 This PR exposes `cloneForModuleCompile()` as a public `CompilerInstance` member function. This will be eventually used in the dependency scanner to customize implicit module builds. >From 4b0c9ddf692da1d1

[clang] [clang][modules] Name the module map files on PCM file conflict (PR #134475)

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/134475 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-17 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/136178 >From 51449e05b19f3b0f237305159ae150bc92588fd9 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 11 Apr 2025 14:11:36 -0700 Subject: [PATCH 1/2] [clang][deps] Make dependency directives getter thread-s

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM once the extra `std::string` constructor gets removed & the test passes. https://github.com/llvm/llvm-project/pull/135703 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,33 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +std::vector +DependencyScanningFilesystemSharedCache::getInvalidNegativeStatCachedPaths( +llvm::vfs::FileSystem &UnderlyingFS) const { + // Iterate thr

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited https://github.com/llvm/llvm-project/pull/135703 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache:: +diagnoseInvalidNegativeStatCachedPaths( +std::vector &InvalidPaths, +llvm::vfs::FileSyst

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache:: +diagnoseInvalidNegativeStatCachedPaths( +std::vector &InvalidPaths, +llvm::vfs::FileSyst

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache:: +diagnoseInvalidNegativeStatCachedPaths( jansvoboda11 wrote: This function no longer di

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache:: +diagnoseInvalidNegativeStatCachedPaths( +std::vector &InvalidPaths, jansvoboda1

[clang] cdad39b - [llvm][docs] Replace `Optional` with `std::optional`

2025-04-17 Thread Jan Svoboda via cfe-commits
Author: Jan Svoboda Date: 2025-04-17T13:18:11-07:00 New Revision: cdad39b7e007aa2a597f6fbeda28a6b269406916 URL: https://github.com/llvm/llvm-project/commit/cdad39b7e007aa2a597f6fbeda28a6b269406916 DIFF: https://github.com/llvm/llvm-project/commit/cdad39b7e007aa2a597f6fbeda28a6b269406916.diff L

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache:: +diagnoseInvalidNegativeStatCachedPaths( +std::vector &InvalidPaths, jansvoboda1

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-17 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/136178 This PR fixes two issues in one go: 1. The dependency directives getter (a `std::function`) was being stored in `PreprocessorOptions`. The goes against the principle where the options classes are supposed

[clang] [clang-tools-extra] [clang] Hide the `TargetOptions` pointer from `CompilerInvocation` (PR #106271)

2025-04-17 Thread Jan Svoboda via cfe-commits
@@ -216,7 +216,7 @@ enum OpenCLTypeKind : uint8_t { /// class TargetInfo : public TransferrableTargetInfo, public RefCountedBase { - std::shared_ptr TargetOpts; + TargetOptions *TargetOpts; jansvoboda11 wrote: Ping @kadircet. Let me know i

[clang] [Clang] Fix crash when building a module with CC_PRINT_HEADERS_FORMAT=json (PR #136227)

2025-04-17 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Since this is trying to make `CC_PRINT_HEADERS_FORMAT` work for modules, I have to ask: should it report module map files too? https://github.com/llvm/llvm-project/pull/136227 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-18 Thread Jan Svoboda via cfe-commits
@@ -92,16 +92,10 @@ bool Preprocessor::EnterSourceFile(FileID FID, ConstSearchDirIterator CurDir, } Lexer *TheLexer = new Lexer(FID, *InputFile, *this, IsFirstIncludeOfFile); - if (getPreprocessorOpts().DependencyDirectivesForFile && - FID != PredefinesFileID) { -

[clang] [Clang] Fix crash when building a module with CC_PRINT_HEADERS_FORMAT=json (PR #136227)

2025-04-18 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. Ok, LGTM as a targeted fix. https://github.com/llvm/llvm-project/pull/136227 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when building a module with CC_PRINT_HEADERS_FORMAT=json (PR #136227)

2025-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/136227 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when -header-include-filtering is not specified (PR #136232)

2025-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. Looks great, thank you! https://github.com/llvm/llvm-project/pull/136232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Hide the `LangOptions` pointer from `CompilerInvocation` (PR #137675)

2025-04-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137675 This PR makes `CompilerInvocation` the sole owner of the `LangOptions` instance. >From 14469a8726fc1d038f41c7e3e29a84ec8f52d013 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 22 Aug 2024 08:45:08 -0

[clang] [clang] Enable making the module build stack thread-safe (PR #137059)

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137059 This PR makes another piece of the `CompilerInstance::cloneForModuleCompile()` result thread-safe: the module build stack. This data structure is used to detect cyclic dependencies between modules. The pro

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

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/132984 >From 8599450e27f0d866db8785f1840372583fc545a2 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 28 Mar 2025 09:02:12 -0700 Subject: [PATCH] [clang] Do not share ownership of `HeaderSearchOptions` ---

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -116,6 +117,13 @@ CXStringSet *createSet(const std::vector &Strings) { return Set; } +CXStringSet *createSet(const std::vector &Strings) { + return createSetImpl(Strings); +} + +CXStringSet *createSet(const std::vector &Strings) { + return createSetImpl(Strings); -

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited https://github.com/llvm/llvm-project/pull/136178 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F, .getModuleCache() .getInMemoryModuleCache() .isPCMFinal(F.FileName); - if (isDiagnosedResult

[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F, .getModuleCache() .getInMemoryModuleCache() .isPCMFinal(F.FileName); - if (isDiagnosedResult

[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F, .getModuleCache() .getInMemoryModuleCache() .isPCMFinal(F.FileName); - if (isDiagnosedResult

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/136178 >From 51449e05b19f3b0f237305159ae150bc92588fd9 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 11 Apr 2025 14:11:36 -0700 Subject: [PATCH 1/3] [clang][deps] Make dependency directives getter thread-s

[clang] [clang][deps] Make dependency directives getter thread-safe (PR #136178)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -92,16 +92,10 @@ bool Preprocessor::EnterSourceFile(FileID FID, ConstSearchDirIterator CurDir, } Lexer *TheLexer = new Lexer(FID, *InputFile, *this, IsFirstIncludeOfFile); - if (getPreprocessorOpts().DependencyDirectivesForFile && - FID != PredefinesFileID) { -

[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F, .getModuleCache() .getInMemoryModuleCache() .isPCMFinal(F.FileName); - if (isDiagnosedResult

[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F, .getModuleCache() .getInMemoryModuleCache() .isPCMFinal(F.FileName); - if (isDiagnosedResult

[clang] [clang] Enable making `CompilerInstance` diagnostics thread-safe (PR #136601)

2025-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/136601 ___ 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-23 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: CC @AaronBallman as a last resort. The reason for `CompilerInvocation` not sharing ownership of its sub-objects is given here: https://github.com/llvm/llvm-project/pull/133467#issuecomment-2762065443 https://github.com/llvm/llvm-project/pull/132984 _

[clang] [clang][Modules] Diagnose mismatching pcm dependencies in explicit buiilds (PR #137068)

2025-04-23 Thread Jan Svoboda via cfe-commits
@@ -3311,11 +3312,22 @@ ASTReader::ReadControlBlock(ModuleFile &F, SignatureBytes.end()); Blob = Blob.substr(ASTFileSignature::size); +// Use BaseDirectoryAsWritten to ensure we use the same path in the +

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-23 Thread Jan Svoboda via cfe-commits
@@ -107,15 +107,28 @@ CXString createCXString(CXStringBuf *buf) { return Str; } -CXStringSet *createSet(const std::vector &Strings) { +template +static CXStringSet *createSetImpl(ArrayRef Strings) { jansvoboda11 wrote: Nit: If you switched the order of tem

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-23 Thread Jan Svoboda via cfe-commits
@@ -107,15 +107,28 @@ CXString createCXString(CXStringBuf *buf) { return Str; } -CXStringSet *createSet(const std::vector &Strings) { +template +static CXStringSet *createSetImpl(ArrayRef Strings) { CXStringSet *Set = new CXStringSet; Set->Count = Strings.size(); S

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited https://github.com/llvm/llvm-project/pull/136773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][index] Skip over `#include UNDEF_IDENT` in single-file-parse mode (PR #135218)

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

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-10 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/134887 >From a41ba702f42671f7e9c51c29a846a6c7c7324378 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 7 Apr 2025 13:30:28 -0700 Subject: [PATCH 1/6] [clang] Extract `CompilerInstance` creation out of `compi

[clang] [Modules] Fix an identifier hiding a function-like macro definition. (PR #135471)

2025-04-14 Thread Jan Svoboda via cfe-commits
@@ -3871,7 +3874,8 @@ class ASTIdentifierTableTrait { if (isInterestingIdentifier(II, MacroOffset)) { DataLen += 2; // 2 bytes for builtin ID DataLen += 2; // 2 bytes for flags - if (MacroOffset) + if (MacroOffset || (II->hasMacroDefinition() && +

[clang] [clang][frontend] Make `CompilerInstance::FailedModules` thread-safe (PR #135473)

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/135473 This PR makes some progress towards making it possible to create clones of `CompilerInstance` that are independent of each other and can be used in a multi-threaded setting. This PR tackles `CompilerInstan

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

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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] [Modules] Fix the inconsistency of which `Decl` should be serialized for an identifier. (PR #135887)

2025-04-16 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. https://github.com/llvm/llvm-project/pull/135887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-16 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 commented: On a second thought, what's the current intent for build system integration? I'm curious why we're emitting a diagnostic here rather than just passing the list of paths back to the build system and letting it decide how to report these. https://githu

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-16 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I don't think workers need to be involved at all - we just need to pass the same VFS to this function that we use to instantiate all workers. For example, downstream `clang_experimental_DependencyScannerWorker_create_v0()` always uses `llvm::vfs::createPhysicalFileSystem()`

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-16 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: (To be frank, I think it would be better to enforce the consistency of VFSs by having the service own one and the workers just applying overlays as needed, but that's definitely out of scope for this patch.) https://github.com/llvm/llvm-project/pull/135703 _

[clang] [clang-tools-extra] [lldb] [clang][frontend] Require invocation to construct `CompilerInstance` (PR #137668)

2025-05-01 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/137668 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules][deps] Optimize in-process timestamping of PCMs (PR #137363)

2025-05-01 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/137363 >From f5b5bc95209c2c44c30481754870d319df20f78f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 24 Apr 2025 14:35:59 -0700 Subject: [PATCH 1/5] [clang][deps] Optimize in-process timestamping of PCMs -

[clang] [clang] Provide to `PPCallbacks` full expression range even in single file parse mode. (PR #138358)

2025-05-05 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. https://github.com/llvm/llvm-project/pull/138358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Modules] Diagnose mismatching pcm dependencies in explicit buiilds (PR #137068)

2025-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, but I'd try to align the spelling of the diagnostic (`"-Wlazy-pcm-mismatch"`) with how we talk about the `-fmodule-file=X=X.pcm` option (`"mapping of module name to precompiled module file"`). Maybe `"-Wmodule-file-mapping-misma

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

2025-04-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed 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][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/136612 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash when -header-include-filtering is not specified (PR #136232)

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/136232 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-23 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: How about `clang/unittests/libclang/LibclangTest.cpp`? https://github.com/llvm/llvm-project/pull/136773 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Adding an API to create a `CXStringSet` from a Vector of `StringRef`s (PR #136773)

2025-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, thanks! I left a couple of comments for your consideration, but don't feel obligated to incorporate them. https://github.com/llvm/llvm-project/pull/136773 ___ cfe-commits mailing list c

[clang] [clang] Enable making the `CompilerInstance` module dependency collector thread-safe (PR #137227)

2025-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137227 The same principle as #135473, #135737, #136178, #136601 & #137059. >From 30fb74c3ff1197a6e1d7cdc8ff52fa2d2c0d9c33 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 24 Apr 2025 11:26:17 -0700 Subject:

[clang] [clang] Enable making the module build stack thread-safe (PR #137059)

2025-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/137059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules][deps] Optimize in-process timestamping of PCMs (PR #137363)

2025-04-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137363 In the past, timestamps used for `-fmodules-validate-once-per-build-session` were found to be a source of contention in the dependency scanner ([D149802](https://reviews.llvm.org/D149802), https://github

[clang] [clang][modules][deps] Optimize in-process timestamping of PCMs (PR #137363)

2025-04-25 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: CC @artemcm https://github.com/llvm/llvm-project/pull/137363 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [lldb] [clang] Hide the `TargetOptions` pointer from `CompilerInvocation` (PR #106271)

2025-04-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/106271 >From 4431265f6be2b989b63e4562fa8def4448d336ab Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 27 Aug 2024 09:34:01 -0700 Subject: [PATCH 1/7] [clang] `TargetInfo` does not own `TargetOptions` --- c

[clang] [clang-tools-extra] [lldb] [clang] Hide the `TargetOptions` pointer from `CompilerInvocation` (PR #106271)

2025-04-25 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 edited https://github.com/llvm/llvm-project/pull/106271 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Enable making `CompilerInstance` diagnostics thread-safe (PR #136601)

2025-04-22 Thread Jan Svoboda via cfe-commits
@@ -861,9 +864,13 @@ class CompilerInstance : public ModuleLoader { /// /// Explicitly-specified \c VFS takes precedence over the VFS of this instance /// when creating the clone and also prevents \c FileManager sharing. - std::unique_ptr cloneForModuleCompile( - S

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( +llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const { + /

[clang] [clang][frontend] Make `CompilerInstance::FailedModules` thread-safe (PR #135473)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -1206,82 +1198,70 @@ createCompilerInstanceForModuleCompileImpl(CompilerInstance &ImportingInstance, DiagnosticOptions &DiagOpts = Invocation->getDiagnosticOpts(); DiagOpts.VerifyDiagnostics = 0; - assert(ImportingInstance.getInvocation().getModuleHash() == -

[clang] [clang-tools-extra] [lldb] [clang][modules] Lazily load by name lookups in module maps (PR #132853)

2025-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, thank you! https://github.com/llvm/llvm-project/pull/132853 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( jansvoboda11 wrote: Shouldn't this be taking locks? If ther

[clang] [clang][lex] Introduce new single-module-parse mode (PR #135813)

2025-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/135813 This PR introduces new single-module preprocessing mode. It is very similar to single-file-parse mode, but has the following differences: * Single-file mode skips over all inclusion directives, while the si

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( +llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const { + /

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,31 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( +llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const { + /

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-10 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > Can you not just move the `err_module_rebuild_finalized` diagnostic into > `compileModuleImpl`? It has access to everything it needs there. I didn't want to do it there to avoid unnecessarily creating the `CompilerInstance` when we're about to hit the error. But I tried m

[clang] [clang] Extract `CompilerInstance` creation out of `compileModuleImpl()` (PR #134887)

2025-04-10 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/134887 >From a41ba702f42671f7e9c51c29a846a6c7c7324378 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 7 Apr 2025 13:30:28 -0700 Subject: [PATCH 1/5] [clang] Extract `CompilerInstance` creation out of `compi

[clang] [clang][DependencyScanning] Track dependencies from prebuilt modules to determine IsInStableDir (PR #132237)

2025-04-10 Thread Jan Svoboda via cfe-commits
@@ -90,63 +90,132 @@ static bool checkHeaderSearchPaths(const HeaderSearchOptions &HSOpts, using PrebuiltModuleFilesT = decltype(HeaderSearchOptions::PrebuiltModuleFiles); -/// A listener that collects the imported modules and optionally the input -/// files. +/// A listene

[clang] [Modules] Fix an identifier hiding a function-like macro definition. (PR #135471)

2025-04-14 Thread Jan Svoboda via cfe-commits
@@ -3871,7 +3874,8 @@ class ASTIdentifierTableTrait { if (isInterestingIdentifier(II, MacroOffset)) { DataLen += 2; // 2 bytes for builtin ID DataLen += 2; // 2 bytes for flags - if (MacroOffset) + if (MacroOffset || (II->hasMacroDefinition() && +

[clang] [Modules] Fix an identifier hiding a function-like macro definition. (PR #135471)

2025-04-14 Thread Jan Svoboda via cfe-commits
@@ -2419,6 +2422,9 @@ namespace { // declarations it needs. ++NumIdentifierLookupHits; Found = *Pos; + if (Trait.hasMoreInformationInDependencies()) +// Look for the identifier in extra modules as they contain more info. +return false; ---

[clang] [clang][frontend] Make `CompilerInstance::FailedModules` thread-safe (PR #135473)

2025-04-14 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/135473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Enable making `CompilerInstance` VFS thread-safe (PR #135737)

2025-04-14 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/135737 The `llvm::vfs::FileSystem` interface makes no promises around thread-safety. To enable making `CompilerInstance` thread-safe, this PR allows passing an explicit VFS to `cloneForModuleCompile()`. This will

[clang] [Modules] Fix an identifier hiding a function-like macro definition. (PR #135471)

2025-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM. The behavior is a bit subtle (always was), but it's good to have this edge-case fixed. https://github.com/llvm/llvm-project/pull/135471 ___ cfe-commits mailing list cfe-commits@lists.ll

[clang] [clang][frontend] Make `CompilerInstance::FailedModules` thread-safe (PR #135473)

2025-04-11 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/135473 >From b58c683e4bd51558e72d1cb6ced88cb6fc372048 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 11 Apr 2025 10:13:49 -0700 Subject: [PATCH 1/4] [clang][frontend] Promote `cloneForModuleCompileImpl` to

[clang] [clang][scan-deps] Centralize logic for populating StableDirs, NFC (PR #135704)

2025-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. https://github.com/llvm/llvm-project/pull/135704 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( +llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const { + /

[clang] [clang][Dependency Scanning] Adding an API to Diagnose Invalid Negative Stat Cache Entries (PR #135703)

2025-04-15 Thread Jan Svoboda via cfe-commits
@@ -108,6 +108,32 @@ DependencyScanningFilesystemSharedCache::getShardForUID( return CacheShards[Hash % NumShards]; } +void DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths( +llvm::raw_ostream &OS, llvm::vfs::FileSystem &UnderlyingFS) const { + /

[clang] [clang-tools-extra] [lldb] [clang] Hide the `TargetOptions` pointer from `CompilerInvocation` (PR #106271)

2025-04-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/106271 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [lldb] [clang][frontend] Require invocation to construct `CompilerInstance` (PR #137668)

2025-04-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137668 This PR makes it so that `CompilerInvocation` needs to be provided to `CompilerInstance` on construction. There are a couple of benefits in my view: * Making it impossible to mis-use some `CompilerInstance`

[clang] [clang] Make the `AnalyzerOptions` reference count non-intrusive (PR #137680)

2025-04-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/137680 This PR makes `CompilerInvocation` the sole owner of the `AnalyzerOptions` instance. Clients can no longer become co-owners by doing something like this: ```c++ void shareOwnership(CompilerInvocation &CI)

[clang] [clang] Make the `AnalyzerOptions` reference count non-intrusive (PR #137680)

2025-04-28 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/137680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [lldb] [clang][frontend] Require invocation to construct `CompilerInstance` (PR #137668)

2025-04-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/137668 >From 692779413664a17287a1f34d4e3225ae8bc96ae0 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 21 Apr 2025 11:55:43 -0700 Subject: [PATCH 1/2] [clang][frontend] Require invocation for `CompilerInstan

[clang] [clang] Hide the `LangOptions` pointer from `CompilerInvocation` (PR #137675)

2025-04-29 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > > The `unique_ptr` in `ASTUnit` always stores a **copy** of the `shared_ptr` > > in `CompilerInvocation`. > > And we need `unique_ptr` in `ASTUnit` instead of a direct value so we can > change LangOpts in `ASTUnit::Parse`? Not really, using `LangOptions` directly instead

[clang] [clang] Hide the `LangOptions` pointer from `CompilerInvocation` (PR #137675)

2025-04-29 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > Also looks like [this > assert](https://github.com/llvm/llvm-project/blob/14469a8726fc1d038f41c7e3e29a84ec8f52d013/clang/include/clang/Frontend/ASTUnit.h#L472) > doesn't serve its value anymore > > ```c++ > const LangOptions &getLangOpts() const { > assert(LangOpts

[clang] [clang] Enable making the `CompilerInstance` module dependency collector thread-safe (PR #137227)

2025-04-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/137227 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Hide the `LangOptions` pointer from `CompilerInvocation` (PR #137675)

2025-04-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/137675 >From 14469a8726fc1d038f41c7e3e29a84ec8f52d013 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 22 Aug 2024 08:45:08 -0700 Subject: [PATCH 1/2] [clang] Hide the `LangOptions` pointer from `CompilerInv

[clang] [clang] Hide the `LangOptions` pointer from `CompilerInvocation` (PR #137675)

2025-04-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/137675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules][deps] Optimize in-process timestamping of PCMs (PR #137363)

2025-04-29 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/137363 >From 5b72c421030761d432af4e7d1d87120192ffa475 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 24 Apr 2025 14:35:59 -0700 Subject: [PATCH 1/5] [clang][deps] Optimize in-process timestamping of PCMs -

<    9   10   11   12   13   14   15   16   >