[clang] [lldb] [AST] Add OriginalDC argument to ExternalASTSource::FindExternalVisibleDeclsByName (PR #123152)

2025-01-15 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: @nikic hi, could you test if this patch may trigger the compilation time regression? https://github.com/llvm/llvm-project/pull/123152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [lldb] [AST] Add OriginalDC argument to ExternalASTSource::FindExternalVisibleDeclsByName (PR #123152)

2025-01-15 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/123152 >From 3b3a9575f47c786db93fc0524d019fad5ef7cd61 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 16 Jan 2025 11:30:30 +0800 Subject: [PATCH] [AST] Add OriginalDC argument to ExternalASTSource::FindExterna

[clang] 731db2a - Revert "[C++20] [Modules] Support module level lookup (#122887)"

2025-01-15 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-01-16T10:23:11+08:00 New Revision: 731db2a03e096fe42196f0ae6531179b998b0bf8 URL: https://github.com/llvm/llvm-project/commit/731db2a03e096fe42196f0ae6531179b998b0bf8 DIFF: https://github.com/llvm/llvm-project/commit/731db2a03e096fe42196f0ae6531179b998b0bf8.diff LO

[clang] [lldb] [C++20] [Modules] Support module level lookup (PR #122887)

2025-01-15 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Looks like this change has some compile-time impact even if modules are not > used: > https://llvm-compile-time-tracker.com/compare.php?from=edc02351dd11cc4a39b7c541b26b71c6f36c8e55&to=7201cae106260aeb3e97d5291ff30f05076a&stat=instructions:u > It seems to add about 0.5%

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -3240,6 +3244,7 @@ def PreferredName : InheritableAttr { let InheritEvenIfAlreadyPresent = 1; let MeaningfulToClassTemplateDefinition = 1; let TemplateDependent = 1; + let DeferDeserialization = 1; ChuanqiXu9 wrote: Maybe it is better to add comment

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -3159,13 +3164,36 @@ Attr *ASTRecordReader::readAttr() { return New; } -/// Reads attributes from the current stream position. -void ASTRecordReader::readAttributes(AttrVec &Attrs) { +/// Reads attributes from the current stream position, advancing Idx. +/// For some attr

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/122726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: LGTM basically. https://github.com/llvm/llvm-project/pull/122726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -713,6 +713,10 @@ class Attr { // attribute may be documented under multiple categories, more than one // Documentation entry may be listed. list Documentation; + // Set to true if deserialization of this attribute must be deferred until + // the parent Decl is full

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -10079,6 +10079,11 @@ void ASTReader::finishPendingActions() { } PendingDeducedVarTypes.clear(); +// Load the delayed preferred name attributes. +for (unsigned I = 0; I != PendingDeferredAttributes.size(); ++I) + loadDeferredAttribute(PendingDeferredAtt

[clang] [clang-cl] Accept `cl`-style output arguments (`/Fo`, `-Fo`) for `--fmodule-output` (PR #121046)

2025-01-16 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > @ChuanqiXu9 are you able to have a look? Sorry, I can't test and take a deeper look on windows. From https://discourse.llvm.org/t/driver-volunteer-wanted-for-modules-support-in-driver-for-mac-ubuntu-and-windows/83768/13, I think you can CC people there or calling again ther

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -83,6 +83,9 @@ class ASTRecordReader /// Returns the current value in this record, without advancing. uint64_t peekInt() { return Record[Idx]; } + /// Returns the next value in this record, without advancing. + uint64_t peekNextInt() { return Record[Idx + 1]; } --

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. LGTM with nits. https://github.com/llvm/llvm-project/pull/122726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
@@ -3118,18 +3120,27 @@ class AttrReader { return Reader.readVersionTuple(); } + void skipInts(unsigned N) { Reader.skipInts(N); } + + unsigned getCurrentIdx() { return Reader.getIdx(); } + OMPTraitInfo *readOMPTraitInfo() { return Reader.readOMPTraitInfo(); }

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

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/122726 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [C++20] [Modules] Support module level lookup (PR #122887)

2025-01-16 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > Looks like this change has some compile-time impact even if modules are not > > used: > > https://llvm-compile-time-tracker.com/compare.php?from=edc02351dd11cc4a39b7c541b26b71c6f36c8e55&to=7201cae106260aeb3e97d5291ff30f05076a&stat=instructions:u > > It seems to add ab

[clang] [C++20] [Modules] Support module level lookup (#122887) (PR #123281)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 created https://github.com/llvm/llvm-project/pull/123281 Close https://github.com/llvm/llvm-project/issues/90154 This patch is also an optimization to the lookup process to utilize the information provided by `export` keyword. Previously, in the lookup process, t

[clang] [C++20] [Modules] Support module level lookup (#122887) (PR #123281)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/123281 >From 0eb519b80b9923b5bd9e4697b4ccd92f6b9f2e8e Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Wed, 15 Jan 2025 15:15:35 +0800 Subject: [PATCH] [C++20] [Modules] Support module level lookup (#122887) Close h

[clang] [C++20] [Modules] Support module level lookup (#122887) (PR #123281)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/123281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [AST] Add OriginalDC argument to ExternalASTSource::FindExternalVisibleDeclsByName (PR #123152)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/123152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] [Modules] Makes sure internal declaration won't be found by other TU (PR #123059)

2025-01-17 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/123059 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] baa5b76 - [C++20] [Modules] Make module local decls visible to language linkage in the same module

2025-01-17 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-01-17T22:17:50+08:00 New Revision: baa5b769f2f76baa0ce1ebfe28236dee2c761f0d URL: https://github.com/llvm/llvm-project/commit/baa5b769f2f76baa0ce1ebfe28236dee2c761f0d DIFF: https://github.com/llvm/llvm-project/commit/baa5b769f2f76baa0ce1ebfe28236dee2c761f0d.diff LO

[clang] [C++20] [Modules] Support module level lookup (#122887) (PR #123281)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/123281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lldb] [AST] Add OriginalDC argument to ExternalASTSource::FindExternalVisibleDeclsByName (PR #123152)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/123152 >From ea3eb4454319ce703bf689dac000f0ed382c2ee5 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 16 Jan 2025 11:30:30 +0800 Subject: [PATCH] [AST] Add OriginalDC argument to ExternalASTSource::FindExterna

[clang] [C++20] [Modules] Makes sure internal declaration won't be found by other TU (PR #123059)

2025-01-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/123059 >From d0decfc63c2fef8ae659bc2133c6aee849ec19ae Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Wed, 15 Jan 2025 11:33:54 +0800 Subject: [PATCH] [C++20] [Modules] Makes sure internal declaration won't be foun

[clang] [lldb] [AST] Add OriginalDC argument to ExternalASTSource::FindExternalVisibleDeclsByName (PR #123152)

2025-01-16 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Compile-time looks fine on this one: > https://llvm-compile-time-tracker.com/compare.php?from=8fb29ba287d72392bd7900c33d2a8d2149126dbe&to=fd734a392a094a573ee7fe587b9fc5f616f92a9a&stat=instructions:u Thanks. I'll land this after CI gets green. https://github.com/llvm/llvm-pr

[clang] [C++20][Modules][Serialization] Delay marking pending incomplete decl chains until the end of `finishPendingActions`. (PR #121245)

2025-02-13 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: @zixu-w @mpark given the original patch get backported to the release branch and the patch get reverted, I think we should revert the patch in the release branch too. https://github.com/llvm/llvm-project/pull/121245 ___ cfe-commits

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/125988 >From 42eb3826ed79de5aabb7f0197cfda2ad62d9735d Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Tue, 11 Feb 2025 11:21:34 +0800 Subject: [PATCH 1/2] [clangd] [C++20] [Modules] Introduce cache for scanning mod

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
@@ -380,30 +381,114 @@ llvm::SmallVector getAllRequiredModules(ProjectModules &MDB, return ModuleNames; } +class CachingProjectModules : public ProjectModules { +public: + CachingProjectModules(const GlobalCompilationDatabase &CDB) : CDB(CDB) {} + + std::vector getRequire

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
@@ -449,21 +534,17 @@ llvm::Error ModulesBuilder::ModulesBuilderImpl::getOrBuildModuleFile( std::unique_ptr ModulesBuilder::buildPrerequisiteModulesFor(PathRef File, const ThreadsafeFS &TFS) { - std::unique_ptr MDB = Impl->getCDB().

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
@@ -380,30 +381,114 @@ llvm::SmallVector getAllRequiredModules(ProjectModules &MDB, return ModuleNames; } +class CachingProjectModules : public ProjectModules { +public: + CachingProjectModules(const GlobalCompilationDatabase &CDB) : CDB(CDB) {} + + std::vector getRequire

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/125988 >From 42eb3826ed79de5aabb7f0197cfda2ad62d9735d Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Tue, 11 Feb 2025 11:21:34 +0800 Subject: [PATCH 1/3] [clangd] [C++20] [Modules] Introduce cache for scanning mod

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: Update: I asked the Scanner to not run again after global scanned. I felt this was an simple over sight. It doesn't make sense to ask a scanner to scan globally multiple times. https://github.com/llvm/llvm-project/pull/125988 ___ cf

[clang] [C++20][Modules][Serialization] Delay marking pending incomplete decl chains until the end of `finishPendingActions`. (PR #121245)

2025-02-14 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > @zixu-w and @ChuanqiXu9 Just want to clarify policies about changes > reversion. As far as I understand it was one example in some private codebase > with no reproducer publicly available. I can understand and completely agree > if it breaks any existing test or llvm-build

[clang] [C++20] [Modules] Instantiate pending instantiations when GMF ends (PR #126842)

2025-02-12 Thread Chuanqi Xu via cfe-commits
@@ -1104,9 +1104,13 @@ void Sema::ActOnStartOfTranslationUnit() { } void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) { - // No explicit actions are required at the end of the global module fragment. - if (Kind == TUFragmentKind::Global) + if (Kind == TUFrag

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > * Now the ScanningProjectModules are owned by different calls to > > `ModulesBuilder::buildPrerequisiteModulesFor`. So we don't need to care > > about thread safety in ScanningProjectModules. And if we make it the > > underlying ProjectModules, we need to care about the t

[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

2025-02-13 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/125988 >From 42eb3826ed79de5aabb7f0197cfda2ad62d9735d Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Tue, 11 Feb 2025 11:21:34 +0800 Subject: [PATCH] [clangd] [C++20] [Modules] Introduce cache for scanning modules

[clang] [Serialization] Remove getMacroID (PR #127413)

2025-02-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/127413 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (PR #127161)

2025-02-16 Thread Chuanqi Xu via cfe-commits
@@ -2633,7 +2646,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings( SourceLocation()) || (!Diags.isIgnored(diag::warn_unsafe_buffer_libc_call, SourceLocation()) && S.getLangOpts().CPlusPlus /* only warn about libc calls in C++ */))

[clang] [Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (PR #127161)

2025-02-16 Thread Chuanqi Xu via cfe-commits
@@ -2633,7 +2646,7 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings( SourceLocation()) || (!Diags.isIgnored(diag::warn_unsafe_buffer_libc_call, SourceLocation()) && S.getLangOpts().CPlusPlus /* only warn about libc calls in C++ */))

[clang] [Fix] Speedup -Wunsafe-buffer-usage when using clang modules. (PR #127161)

2025-02-16 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/127161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [C++20] [Modules] Instantiate pending instantiations when GMF ends (PR #126842)

2025-02-11 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/126842 >From a25871dd97fded43484f7b690f6ff58664be0b99 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Wed, 12 Feb 2025 11:35:37 +0800 Subject: [PATCH] [C++20] [Modules] Instantiate pending instantiations when GMF e

[clang-tools-extra] [clangd] [C++20] [Modules] Add modules suffix for 'Header' Source Switch (PR #131591)

2025-03-17 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 created https://github.com/llvm/llvm-project/pull/131591 Support the trivial "header"/source switch for module interfaces. I initially thought the naming are bad and we should rename it. But later I feel it is better to split patches as much as possible. >From t

[clang] [PATCH] [clang][modules] Fix serialization and de-serialization of PCH module file refs (#105994) (PR #132802)

2025-03-24 Thread Chuanqi Xu via cfe-commits
@@ -9615,7 +9615,7 @@ ModuleFile *ASTReader::getLocalModuleFile(ModuleFile &M, unsigned ID) const { // It's a prefix (preamble, PCH, ...). Look it up by index. unsigned IndexFromEnd = ID >> 1; assert(IndexFromEnd && "got reference to unknown module file"); -ret

[clang] [PATCH] [clang][modules] Fix serialization and de-serialization of PCH module file refs (#105994) (PR #132802)

2025-03-24 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/132802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [PATCH] [clang][modules] Fix serialization and de-serialization of PCH module file refs (#105994) (PR #132802)

2025-03-24 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/132802 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add a missing space to the -Weager-load-cxx-named-modules diagnostic message. (PR #131987)

2025-03-19 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/131987 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Guard against bad -fmodule-file mappings (#132059) (PR #133462)

2025-04-05 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: I received a mail but not see it in the web page. Is something going wrong. https://github.com/llvm/llvm-project/pull/133462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Serialization] Fix lazy template loading (PR #133057)

2025-03-26 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > While I may not able to look into them in detail recently, it may be > > helpful to split this into seperate patches to review and to land. > > I initially considered this, but @vgvassilev said in [root-project/root#17722 > (comment)](https://github.com/root-project/root/

[clang] [Serialization] Fix lazy template loading (PR #133057)

2025-03-26 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Complete only needed partial specializations: It is unclear (to me) why this > needs to be done "for safety", but this change significantly improves the > effectiveness of lazy loading. This comes from the logic: if we have a partial template specialization `A` and we need

[clang] c419260 - [Serialization] Avoid iterating Dense{Map,Set} to break determinism

2025-03-26 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-03-26T16:01:08+08:00 New Revision: c41926013fd8b23c3d1eca51804a2de36c88433a URL: https://github.com/llvm/llvm-project/commit/c41926013fd8b23c3d1eca51804a2de36c88433a DIFF: https://github.com/llvm/llvm-project/commit/c41926013fd8b23c3d1eca51804a2de36c88433a.diff LO

[clang] [RFC][clang] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)

2025-03-28 Thread Chuanqi Xu via cfe-commits
@@ -1390,7 +1390,19 @@ class ASTReader /// predefines buffer may contain additional definitions. std::string SuggestedPredefines; - llvm::DenseMap DefinitionSource; + struct DefinitionSourceFlags { ChuanqiXu9 wrote: ```suggestion struct DefinitionSour

[clang] [RFC][clang] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)

2025-03-28 Thread Chuanqi Xu via cfe-commits
@@ -1390,7 +1390,19 @@ class ASTReader /// predefines buffer may contain additional definitions. std::string SuggestedPredefines; - llvm::DenseMap DefinitionSource; + struct DefinitionSourceFlags { +ExtKind HasExternalDefinitions : 2; + +/// Indicates if given fu

[clang] [Serialization] Fix lazy template loading (PR #133057)

2025-03-28 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > > > While I may not able to look into them in detail recently, it may be > > > > helpful to split this into seperate patches to review and to land. > > > > > > > > > I initially considered this, but @vgvassilev said in > > > [root-project/root#17722 > > > (comment)](htt

[clang] [RFC][clang] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)

2025-03-28 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: LGTM generally. Some other personal suggestion to the title, it might be better to add `[modules]` to the title. Since my mail filter will highlight these mails with the tag : ) This might be why I missed you last ping. https://github.com/llvm/llvm-project/pull/132214 __

[clang] Support '-fmodule-file-home-is-cwd' for C++ header units. (PR #135147)

2025-04-10 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > BTW, I think `-fmodule-file=` is not a suggested way to introduce BMIs. It > > will load the BMIs eagerly. And for named modules, we will load them lazily > > according to their name. For header units, may be we can do something with > > FID. It matters for cases like: >

[clang] Support '-fmodule-file-home-is-cwd' for C++ modules. (PR #135147)

2025-04-10 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: Didn't take a close look. But I don't feel we shall do it behind a flag. I think we should make BMI of C++20 modules (at least C++20 named modules) relocatable. In our downstream, IIUC, we make it by always enabling "-fmodules-embed-all-files " . See d

[clang] Support '-fmodule-file-home-is-cwd' for C++ header units. (PR #135147)

2025-04-10 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > If you did `-fmodule-file==` for header units, I think it is > > better to upstream that first. I think it is more fundamental. > > We don't do anything special downstream. As far as I know it already works > today. If `-fmodule-file==` already works for header units, it

[clang] [modules] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)

2025-03-31 Thread Chuanqi Xu via cfe-commits
@@ -1390,7 +1390,19 @@ class ASTReader /// predefines buffer may contain additional definitions. std::string SuggestedPredefines; - llvm::DenseMap DefinitionSource; + struct DefinitionSourceFlags { +ExtKind HasExternalDefinitions : 2; + +/// Indicates if given fu

[clang] Mark CXX module initializer with PACBTI attributes (PR #133716)

2025-03-31 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: LGTM. I'll leave the formal approval to @efriedma-quic https://github.com/llvm/llvm-project/pull/133716 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang][Modules] Fix the Size of `RecordDecl`'s `BitCodeAbbrevOp` (PR #133500)

2025-03-31 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. LGTM. Thanks. https://github.com/llvm/llvm-project/pull/133500 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [modules] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)

2025-04-01 Thread Chuanqi Xu via cfe-commits
@@ -1392,6 +1392,20 @@ class ASTReader llvm::DenseMap DefinitionSource; + /// The set of extra flags about declarations that we have read from + /// the module file. + struct ExternalDeclarationBits { +/// Indicates if given function declaration was a definition but

[clang] [clang][modules] Guard against bad -fmodule-file mappings (#132059) (PR #133462)

2025-04-01 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: Thanks. What I feel not good is passing `ExpectedName` and `ModuleMismatch` all around. I am wondering if we can check it by inserting a check in `ASTReader::ReadControlBlock` in `case IMPORT:` where we can check the `ImportedName` and the name stored i

[clang] [docs] Fix the use of word "dependent" and other typos in the C++ Modules Doc (PR #136719)

2025-04-23 Thread Chuanqi Xu via cfe-commits
@@ -477,21 +476,21 @@ When the ``-fmodules-embed-all-files`` flag are enabled, Clang explicitly emits code into the BMI file, the contents of the BMI file contain a sufficiently verbose representation to reproduce the original source file. -:sup:`1`` Input files: The source

[clang] [docs] Fix the use of word "dependent" and other typos in the C++ Modules Doc (PR #136719)

2025-04-22 Thread Chuanqi Xu via cfe-commits
@@ -477,21 +476,21 @@ When the ``-fmodules-embed-all-files`` flag are enabled, Clang explicitly emits code into the BMI file, the contents of the BMI file contain a sufficiently verbose representation to reproduce the original source file. -:sup:`1`` Input files: The source

[clang] [docs] Fix the use of word "dependent" and other typos in the C++ Modules Doc (PR #136719)

2025-04-22 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/136719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [docs] Fix the use of word "dependent" and other typos in the C++ Modules Doc (PR #136719)

2025-04-22 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. I am not a native speaker. So LGTM generally. https://github.com/llvm/llvm-project/pull/136719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] Support '-fmodule-file-home-is-cwd' for C++ modules. (PR #135147)

2025-04-10 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Separately, even with named modules, with or without > `-fmodules-embed-all-files`, the `INPUT_FILE` paths in the PCM are still > absolute. I guess with `-fmodules-embed-all-files` those paths are not used > since the source files are embedded, which I suppose is how it avo

[clang] Support '-fmodule-file-home-is-cwd' for C++ modules. (PR #135147)

2025-04-10 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Going back to the idea of not writing the paths of imported PCMs at all; > currently the condition to not write the paths is if the imported PCM is a > named module. Perhaps this condition can be extended to omit the paths if the > PCM was found through `-fmodule-file==`?

[clang] Support '-fmodule-file-home-is-cwd' for C++ modules. (PR #135147)

2025-04-13 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. Yeah, I have some concern about the interface. But I am in the camp that we'd better to get best practice from practice instead of pure imagination. And given Meta is doing the experiments in practice, I think it is fine to let it go.

[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-05 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: I feel `.clear()` should have a similar semantic with `= {};`. It will be confusing for people to understand this. It will be helpful if you can provide a test to show the difference. https://github.com/llvm/llvm-project/pull/138256 ___

[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-05 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: Could you elaborate? Why `= {}` is better than `.clear()` ? https://github.com/llvm/llvm-project/pull/138256 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

2025-05-06 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: hmmm for `test case`, I mean a test case in clang, either a unit test or a lit test, so we can understand the effect on users more clearly. And if you're talking about the general code policy, I'll suggest you to https://discourse.llvm.org/ to make it more verbose. https://

[clang] [Modules] Fix the inconsistency of which `Decl` should be serialized for an identifier. (PR #135887)

2025-04-15 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. LGTM 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] [Serialization] Fix lazy template loading (PR #133057)

2025-04-27 Thread Chuanqi Xu via cfe-commits
@@ -21,17 +21,6 @@ using namespace clang; namespace { class TemplateArgumentHasher { - // If we bail out during the process of calculating hash values for - // template arguments for any reason. We're allowed to do it since - // TemplateArgumentHasher are only required to g

[clang] [Serialization] Fix lazy template loading (PR #133057)

2025-04-28 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: LGTM. Let's land this in individual commits after the large test in google finish. https://github.com/llvm/llvm-project/pull/133057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang] [C++20] [Modules] Instantiate pending instantiations when GMF ends (PR #126842)

2025-02-18 Thread Chuanqi Xu via cfe-commits
@@ -1104,9 +1104,13 @@ void Sema::ActOnStartOfTranslationUnit() { } void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) { - // No explicit actions are required at the end of the global module fragment. - if (Kind == TUFragmentKind::Global) + if (Kind == TUFrag

[clang] [C++20] [Modules] Instantiate pending instantiations when GMF ends (PR #126842)

2025-02-19 Thread Chuanqi Xu via cfe-commits
@@ -1104,9 +1104,13 @@ void Sema::ActOnStartOfTranslationUnit() { } void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind) { - // No explicit actions are required at the end of the global module fragment. - if (Kind == TUFragmentKind::Global) + if (Kind == TUFrag

[clang] 170b573 - [Driver] [C++20] [Modules] Warning for the surprising useless case for reduced BMI

2025-02-27 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-02-28T13:36:29+08:00 New Revision: 170b5736824bd4f70a7bf9dd0028b997d85ba76f URL: https://github.com/llvm/llvm-project/commit/170b5736824bd4f70a7bf9dd0028b997d85ba76f DIFF: https://github.com/llvm/llvm-project/commit/170b5736824bd4f70a7bf9dd0028b997d85ba76f.diff LO

[clang] [C++20] [Modules] Support generating in-class defined function with try-catch body (PR #129212)

2025-02-28 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 created https://github.com/llvm/llvm-project/pull/129212 See the example: ``` export module func; class C { public: void member() try { } catch (...) { } }; ``` We woudln't generate the definition for `C::member` but we should. Since the function i

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-27 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. Abstractly the current one looks good to stop the bleeding first. But for the issue itself, I still feel we can fix it in the middle end. Since the case a coroutine without a suspend point is relatively rare case to me. https://github.c

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-27 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > Even for a real suspend, though, isn't it still possible for the coroutine to > be resumed on a different thread, completed, and the frame deleted, all > before the coroutine ramp finishes executing on the current thread? Technically possible, you got me. https://github.co

[clang] 15c49b9 - [Coroutines] [CodeGen] Don't change AST in CodeGen/Coroutines

2025-02-28 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-02-28T16:03:50+08:00 New Revision: 15c49b9db3f60bdbd320271d5e97f118c00b95dd URL: https://github.com/llvm/llvm-project/commit/15c49b9db3f60bdbd320271d5e97f118c00b95dd DIFF: https://github.com/llvm/llvm-project/commit/15c49b9db3f60bdbd320271d5e97f118c00b95dd.diff LO

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-07 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-05 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-06 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-05 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-05 Thread Chuanqi Xu via cfe-commits
@@ -10178,12 +10178,12 @@ void ASTReader::visitTopLevelModuleMaps( } void ASTReader::finishPendingActions() { - while ( - !PendingIdentifierInfos.empty() || !PendingDeducedFunctionTypes.empty() || - !PendingDeducedVarTypes.empty() || !PendingIncompleteDeclChains.em

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-05 Thread Chuanqi Xu via cfe-commits
@@ -10178,12 +10178,12 @@ void ASTReader::visitTopLevelModuleMaps( } void ASTReader::finishPendingActions() { - while ( - !PendingIdentifierInfos.empty() || !PendingDeducedFunctionTypes.empty() || - !PendingDeducedVarTypes.empty() || !PendingIncompleteDeclChains.em

[clang] [C++20][Modules] Fix incomplete decl chains (PR #129982)

2025-03-05 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Do not update the declaration generation number if the redeclaration chain completion was delayed. (PR #129982)

2025-03-09 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [C++20][Modules] Do not update the declaration generation number if the redeclaration chain completion was delayed. (PR #129982)

2025-03-09 Thread Chuanqi Xu via cfe-commits
@@ -9180,6 +9180,12 @@ bool Sema::hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, if (!getLangOpts().Modules && !getLangOpts().ModulesLocalVisibility) return true; + // The external source may have additional definitions of this entity that are + // visi

[clang] [llvm] [Coroutines] Replace coro.outside.frame metadata with an intrinsic (PR #129255)

2025-03-10 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: I am still concerning about the potential performance loss on using the intrinsic on parameters. Did you have any insight? https://github.com/llvm/llvm-project/pull/129255 ___ cfe-commits mailing list cfe-commi

[clang] [clang] Fix a segfault when M is a nullptr (PR #130712)

2025-03-11 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: The patch itself seems not bad. But we prefer to ask for a test for such changes. https://github.com/llvm/llvm-project/pull/130712 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-28 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > Since the case a coroutine without a suspend point is relatively rare case > > to me. > > For what it's worth, this issue isn't limited to coroutines without any > suspend point. It can also occur: > > * If the coroutine conditionally doesn't await (e.g., `if (condition)

[clang] 4d8070e - [C++20] [Modules] Don't add decls from other units to undefinedButUsed set

2025-03-12 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-03-13T11:02:57+08:00 New Revision: 4d8070e9560269494654bd21a2b0c342f4bdae48 URL: https://github.com/llvm/llvm-project/commit/4d8070e9560269494654bd21a2b0c342f4bdae48 DIFF: https://github.com/llvm/llvm-project/commit/4d8070e9560269494654bd21a2b0c342f4bdae48.diff LO

[clang] ea15e8b - [C++20] [Modules] Avoid use-but-not-defined error

2025-03-05 Thread Chuanqi Xu via cfe-commits
Author: Chuanqi Xu Date: 2025-03-05T19:05:49+08:00 New Revision: ea15e8b16eacdf2fb3a9715c5fc753b62fdfd516 URL: https://github.com/llvm/llvm-project/commit/ea15e8b16eacdf2fb3a9715c5fc753b62fdfd516 DIFF: https://github.com/llvm/llvm-project/commit/ea15e8b16eacdf2fb3a9715c5fc753b62fdfd516.diff LO

[clang] [C++20] [Modules] Support generating in-class defined function with try-catch body (PR #129212)

2025-03-04 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 updated https://github.com/llvm/llvm-project/pull/129212 >From 8876ef70a08f8547d49b89275a3b1b455221abd0 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Fri, 28 Feb 2025 17:03:49 +0800 Subject: [PATCH 1/3] [C++20] [Modules] Support generating in-class defined funct

[clang] [C++20] [Modules] Support generating in-class defined function with try-catch body (PR #129212)

2025-03-04 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > > Thanks, LGTM. > > > With just a little more effort you could add the EOF stuff in there too. > > > > > > What do you mean by EOF stuff? > > It seems you can deduplicate by moving this block into the scope guard: > > ```c++ > while (Tok.isNot(tok::eof)) >

[clang] [C++20] [Modules] Support generating in-class defined function with try-catch body (PR #129212)

2025-03-04 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/129212 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    17   18   19   20   21   22   23   24   >