[clang] [serialization] no transitive decl change (PR #92083)

2024-05-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 commented: This looks good conceptually, I left a couple of minor notes. https://github.com/llvm/llvm-project/pull/92083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [serialization] no transitive decl change (PR #92083)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -7802,20 +7800,31 @@ Decl *ASTReader::GetDecl(GlobalDeclID ID) { LocalDeclID ASTReader::mapGlobalIDToModuleFileGlobalID(ModuleFile , GlobalDeclID GlobalID) { - DeclID ID = GlobalID.get(); - if (ID <

[clang] [serialization] no transitive decl change (PR #92083)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -111,6 +109,28 @@ void *Decl::operator new(std::size_t Size, const ASTContext , return ::operator new(Size + Extra, Ctx); } +GlobalDeclID Decl::getGlobalID() const { + if (!isFromASTFile()) +return GlobalDeclID(); + uint64_t ID = *((const uint64_t *)this - 1);

[clang] [serialization] no transitive decl change (PR #92083)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -255,6 +255,12 @@ class DeclOffset { } }; +// The unaligned decl ID used in the Blobs of bistreams. +using unalighed_decl_id_t = jansvoboda11 wrote: I know this typo isn't introduced by your PR, but since your PR is touching it, please fix it in a prep

[clang] [serialization] no transitive decl change (PR #92083)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -124,6 +130,15 @@ class DeclIDBase { bool isInvalid() const { return ID == PREDEF_DECL_NULL_ID; } + unsigned getModuleFileIndex() const { return ID >> 32; } + + unsigned getLocalDeclIndex() const { +// Implement it directly instead of calling

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-05-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/89950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-05-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 deleted https://github.com/llvm/llvm-project/pull/89950 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,36 @@ +// Check that the scanner can adjust arguments by reading .rsp files in advance. + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json jansvoboda11 wrote: Ok, that makes sense, thanks!

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-05-24 Thread Jan Svoboda via cfe-commits
@@ -86,6 +86,8 @@ static bool DeprecatedDriverCommand; static ResourceDirRecipeKind ResourceDirRecipe; static bool Verbose; static bool PrintTiming; +static llvm::BumpPtrAllocator Alloc; +static llvm::StringSaver Saver{Alloc}; jansvoboda11 wrote: Why do these

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

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

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-05-06 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,36 @@ +// Check that the scanner can adjust arguments by reading .rsp files in advance. + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json +// RUN: echo /Fo%t/tu.obj >> %t/args_nested.rsp

[clang] [clang][deps] Only bypass scanning VFS for the module cache (PR #88800)

2024-05-06 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I don't think I'll have time to work on this PR in the short-term. https://github.com/llvm/llvm-project/pull/88800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-06 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: This sounds good in principle, but some tests are failing in CI, so this might need more refinement. https://github.com/llvm/llvm-project/pull/91140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] cc1: Report an error for multiple actions unless separated by -main-file-name (PR #91140)

2024-05-05 Thread Jan Svoboda via cfe-commits
@@ -2841,6 +2841,30 @@ static bool ParseFrontendArgs(FrontendOptions , ArgList , } Opts.ProgramAction = *ProgramAction; + +// Catch common mistakes when multiple actions are specified for cc1 (e.g. +// -S -emit-llvm means -emit-llvm while -emit-llvm -S means

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

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

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

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

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

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

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
@@ -249,9 +245,27 @@ GetAffectingModuleMaps(const Preprocessor , Module *RootModule) { for (const auto : HS.findResolvedModulesForHeader(*File)) if (const Module *M = KH.getModule()) -CollectIncludingMapsFromAncestors(M); +

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
@@ -249,9 +245,27 @@ GetAffectingModuleMaps(const Preprocessor , Module *RootModule) { for (const auto : HS.findResolvedModulesForHeader(*File)) if (const Module *M = KH.getModule()) -CollectIncludingMapsFromAncestors(M); +

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 ready_for_review https://github.com/llvm/llvm-project/pull/89992 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89992 >From 8c2989ffe7b6e61b32facf831aa7eeabbf0001d2 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH 1/3] [clang][modules] Allow including module maps to be

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89992 >From 8c2989ffe7b6e61b32facf831aa7eeabbf0001d2 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH 1/3] [clang][modules] Allow including module maps to be

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89992 >From 8c2989ffe7b6e61b32facf831aa7eeabbf0001d2 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH 1/2] [clang][modules] Allow including module maps to be

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-26 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89992 >From 6e77e37977bbecc8053d12b4db3f790042b8f34d Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH 1/2] [clang][modules] Allow including module maps to be

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

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

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-25 Thread Jan Svoboda via cfe-commits
@@ -792,10 +792,15 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { llvm::cl::PrintOptionValues(); + // Expand response files in advance, so that we can "see" all the arguments + // when adjusting below. + auto ResponseExpander =

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-25 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,36 @@ +// Check that the scanner can adjust arguments by reading .rsp files in advance. + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json +// RUN: echo /Fo%t/tu.obj >> %t/args_nested.rsp

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

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

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-25 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,36 @@ +// Check that the scanner can adjust arguments by reading .rsp files in advance. + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json jansvoboda11 wrote: You can now do this:

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-25 Thread Jan Svoboda via cfe-commits
@@ -1069,7 +1069,7 @@ void Clang::AddPreprocessingOptions(Compilation , const JobAction , // If user provided -o, that is the dependency target, except // when we are only generating a dependency file. - Arg *OutputOpt = Args.getLastArg(options::OPT_o); +

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89992 >From 6e77e37977bbecc8053d12b4db3f790042b8f34d Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH] [clang][modules] Allow including module maps to be

[clang] [clang][modules] Allow including module maps to be non-affecting (PR #89992)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/89992 None >From e16becb9357fd560a1c9c673389e6dbba02e024c Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 24 Apr 2024 11:12:28 -0700 Subject: [PATCH] [clang][modules] Allow including module maps to be

[clang] [libclang] Compute the right spelling location (PR #72400)

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

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-24 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Hmm, that driver code is only executed if the dependency file was requested on the Clang command line, though. `clang-scan-deps` should be able to generate the dependency file even if the original command line doesn't have `-MD` and friends. That's why we call

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-24 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > Maybe the issue is that the DependencyOptions we pass have no target set, > since the original command line doesn't have -MD (or something like that)? No, even then we should deduce the output path:

[clang] [clang-scan-deps] Expand response files before the argument adjuster (PR #89950)

2024-04-24 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: This change makes sense to me, but I forget what's the purpose of the whole output path deducing code. Even for `clang-cl` command lines we should go through the driver and get a `CompilerInvocation` that will have the output file set (if the action does produce an output

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: (Out of interest, what machine are you seeing the contention with?) https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/88427 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 approved this pull request. The changes LGTM, don't want to block this on my remaining nits. I believe @Bigcheese wanted to test test impact on PCM size on our side before this lands. https://github.com/llvm/llvm-project/pull/86912

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-24 Thread Jan Svoboda via cfe-commits
@@ -2220,33 +2221,40 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-24 Thread Jan Svoboda via cfe-commits
@@ -2221,33 +,45 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-24 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/8] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-24 Thread Jan Svoboda via cfe-commits
@@ -1574,6 +1574,7 @@ bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor , } } + FileInfo.IsLocallyIncluded = true; jansvoboda11 wrote: I agree, I wanted to colocate this with call to `Preprocessor::markIncluded()`. If we find a better way of

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,20 @@ +// This test checks that a module map with a textual header can be marked as jansvoboda11 wrote: (And thanks for the extended test case!) https://github.com/llvm/llvm-project/pull/89441 ___

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,20 @@ +// This test checks that a module map with a textual header can be marked as jansvoboda11 wrote: Should work with [b03c34f](https://github.com/llvm/llvm-project/pull/89441/commits/b03c34f99bd90398f0599b5703cbf82d8b881981).

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/6] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/5] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/5] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
@@ -0,0 +1,20 @@ +// This test checks that a module map with a textual header can be marked as jansvoboda11 wrote: This patch unfortunately doesn't pass that test (on line 44) due to [this](https://github.com/llvm/llvm-project/pull/89441/files#r1576422103):

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/4] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
@@ -187,7 +187,8 @@ GetAffectingModuleMaps(const Preprocessor , Module *RootModule) { continue; const HeaderFileInfo *HFI = HS.getExistingLocalFileInfo(*File); -if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader)) +if (!HFI ||

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > I've sent a version of this as #89729, based on your first commit here. I left a comment there. > > I think one option we have here is to consider all module maps describing a > > textual header that got included as affecting. I'm concerned that a long > > chain of

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-23 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/3] [clang][modules] Allow module map files with textual

[clang] [clang][modules] Only modulemaps of included textual headers are affecting (PR #89729)

2024-04-23 Thread Jan Svoboda via cfe-commits
@@ -1441,6 +1441,10 @@ void HeaderSearch::MarkFileModuleHeader(FileEntryRef FE, HFI.isCompilingModuleHeader |= isCompilingModuleHeader; } +void HeaderSearch::EnteredTextualFile(FileEntryRef File) { + getFileInfo(File).isCompilingModuleHeader = true;

[clang] [clang][modules] Stop eagerly reading files with diagnostic pragmas (PR #87442)

2024-04-22 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: No worries, happy to get to the bottom of it. https://github.com/llvm/llvm-project/pull/87442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-22 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: @sam-mccall That makes sense. I think one option we have here is to consider all module maps describing a textual header that got included as affecting. I'm concerned that a long chain of textual header includes might again be problematic. For this particular test, we

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-22 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH 1/2] [clang][modules] Allow module map files with textual

[clang] [Clang] Diagnose apply AST consume actions on LLVM IR (PR #88602)

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

[clang] [clang][modules] Stop eagerly reading files with diagnostic pragmas (PR #87442)

2024-04-22 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: @alexfh Can you check it doesn't boil down to the same thing as the issue you reported in https://reviews.llvm.org/D137213? https://github.com/llvm/llvm-project/pull/87442 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [libclang] Compute the right spelling location (PR #72400)

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

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > Is this a pre-existing issue, or did my patch change to make "each textual > header gets a `HFI`"? I'm not sure yet, I think we'll need to investigate [Sam's reproducer](https://github.com/llvm/llvm-project/pull/89005#issuecomment-2067300965) and consider [Richard's

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: I updated the description of this PR, hopefully it makes more sense now. I still need to investigate what goes wrong in "Modules/preprocess-decluse.cpp". It seems that it assumes `%t/b.pcm` embeds the information from "a.modulemap".

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Just so you're aware, it's possible that https://github.com/llvm/llvm-project/pull/87848 introduced some unexpected behavior change. It would be good to check if your issues are caused just by one patch in isolation or by a combination of more patches that landed recently.

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Hmm, this will probably only work if you compile `A` into a PCM and then pass it to `B`. This is not how "Modules/preprocess-decluse.cpp" is set up. https://github.com/llvm/llvm-project/pull/89441 ___ cfe-commits mailing list

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89441 >From 9165d6086e2570198fba1c333d0c9cb9c09037c7 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 12:13:06 -0700 Subject: [PATCH] [clang][modules] Allow module map files with textual header

[clang] [clang][modules] Only avoid pruning module maps when asked to (PR #89428)

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

[clang] [clang][modules] Allow module maps with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] Allow module map files with textual headers to be non-affecting (PR #89441)

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

[clang] [clang][modules] Allow module map files with textual headers be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: (Only commit c68b6468347e0a6141ff312139a82a3a8be9ce2e is relevant here, the other one is from #89428.) https://github.com/llvm/llvm-project/pull/89441 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

2024-04-19 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: https://github.com/llvm/llvm-project/pull/89441 might be of interest too. https://github.com/llvm/llvm-project/pull/89005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][modules] Allow module map files with textual headers be non-affecting (PR #89441)

2024-04-19 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/89441 Depends on #89428. >From baa15bb0f35e3f9845407c6b843b82c3a466369f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 10:28:33 -0700 Subject: [PATCH 1/2] [clang][modules] Only avoid pruning

[clang] [clang][modules] Only avoid pruning module maps when asked to (PR #89428)

2024-04-19 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89428 >From baa15bb0f35e3f9845407c6b843b82c3a466369f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 10:28:33 -0700 Subject: [PATCH] [clang][modules] Only avoid pruning module maps when asked to

[clang] [clang][modules] Only avoid pruning module maps when asked to (PR #89428)

2024-04-19 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/89428 >From baa15bb0f35e3f9845407c6b843b82c3a466369f Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 19 Apr 2024 10:28:33 -0700 Subject: [PATCH 1/2] [clang][modules] Only avoid pruning module maps when

[clang] [clang][modules] Only avoid pruning module maps when asked to (PR #89428)

2024-04-19 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/89428 Pruning non-affecting module maps is useful even when passing module maps explicitly via `-fmodule-map-file=`. For this situation, this patch reinstates the behavior we had prior to #87849. For the

[clang] [libclang] Compute the right spelling location (PR #72400)

2024-04-19 Thread Jan Svoboda via cfe-commits
@@ -1292,6 +1292,31 @@ void func() {} EXPECT_EQ(attrCount, 1); } +TEST_F(LibclangParseTest, clang_getSpellingLocation) { + std::string fileName = "main.c"; + WriteFile(fileName, "#define X(value) int x = value;\nX(42)\n"); + + ClangTU = clang_parseTranslationUnit(Index,

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -2220,33 +2221,40 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

[clang] [clang-scan-deps] Fix contention when updating `TrackingStatistic`s in hot code paths in `FileManager`. (PR #88427)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -1293,6 +1293,10 @@ compileModuleImpl(CompilerInstance , SourceLocation ImportLoc, diag::remark_module_build_done) << ModuleName; + // Propagate the statistics to the parent FileManager. + if

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -5574,10 +5577,34 @@ void ASTWriter::AddFileID(FileID FID, RecordDataImpl ) { Record.push_back(getAdjustedFileID(FID).getOpaqueValue()); } +SourceLocationEncoding::RawLocEncoding +ASTWriter::getRawSourceLocationEncoding(SourceLocation Loc, LocSeq *Seq) { + unsigned

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -4082,14 +4069,14 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile ) const { : ModuleMgr.lookupByFileName(Name)); if (!OM) { std::string Msg = - "SourceLocation remap refers to unknown module, cannot find "; + "cannot

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-18 Thread Jan Svoboda via cfe-commits
@@ -2221,33 +,45 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

[clang] [Rewrite] Fix offset computation in RemoveText (PR #73827)

2024-04-18 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Sorry, I'm not familiar with the rewriter. Maybe @PiotrZSL would be able to take look? https://github.com/llvm/llvm-project/pull/73827 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [libclang] Compute the right spelling location (PR #72400)

2024-04-18 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: The change itself looks good, but I think we should have a test and an entry in release notes. https://github.com/llvm/llvm-project/pull/72400 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

2024-04-17 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: Also note that `ASTWriter` uses this logic in couple of places to avoid serializing unrelated headers: ```c++ if (!HFI || (HFI->isModuleHeader && !HFI->isCompilingModuleHeader)) continue; ``` Since textual headers from other modules have `isModuleHeader=false` and

[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

2024-04-17 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: > getExistingFileInfo(, /*WantExternal=*/false) Until [recently](https://github.com/llvm/llvm-project/pull/87848) that function still consulted `ExternalSource` for `HeaderFileInfo` that `IsValid && !External && !Resolved`. Maybe you want to try the new

[clang] [clang][deps] Add `-o` flag to specify output path (PR #88767)

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

[clang] [clang][deps] Support single-file mode for all formats (PR #88764)

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

[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

2024-04-16 Thread Jan Svoboda via cfe-commits
jansvoboda11 wrote: As a test, maybe you could probe the resulting PCM with `-module-file-info`. https://github.com/llvm/llvm-project/pull/89005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][modules] Only compute affecting module maps with implicit search (PR #87849)

2024-04-16 Thread Jan Svoboda via cfe-commits
@@ -161,8 +161,13 @@ static TypeCode getTypeCodeForTypeClass(Type::TypeClass id) { namespace { -std::set GetAffectingModuleMaps(const Preprocessor , - Module *RootModule) { +std::optional> +GetAffectingModuleMaps(const

[clang] [clang][deps] Only bypass scanning VFS for the module cache (PR #88800)

2024-04-16 Thread Jan Svoboda via cfe-commits
@@ -201,11 +201,8 @@ const CachedRealPath ::CacheShard:: return *StoredRealPath; } -static bool shouldCacheStatFailures(StringRef Filename) { - StringRef Ext = llvm::sys::path::extension(Filename); - if (Ext.empty()) -return false; // This may be the module cache

[clang] [clang][deps] Only bypass scanning VFS for the module cache (PR #88800)

2024-04-16 Thread Jan Svoboda via cfe-commits
@@ -362,7 +357,7 @@ DependencyScanningWorkerFilesystem::openFileForRead(const Twine ) { SmallString<256> OwnedFilename; StringRef Filename = Path.toStringRef(OwnedFilename); - if (Filename.ends_with(".pcm")) + if (shouldBypass(Filename)) jansvoboda11

[clang] [clang][deps] Only bypass scanning VFS for the module cache (PR #88800)

2024-04-16 Thread Jan Svoboda via cfe-commits
@@ -201,11 +201,8 @@ const CachedRealPath ::CacheShard:: return *StoredRealPath; } -static bool shouldCacheStatFailures(StringRef Filename) { - StringRef Ext = llvm::sys::path::extension(Filename); - if (Ext.empty()) -return false; // This may be the module cache

[clang] [clang][deps] Only bypass scanning VFS for the module cache (PR #88800)

2024-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/88800 The scanning VFS doesn't cache stat failures of paths with no extension. This was originally implemented to avoid caching the non-existence of the modules cache directory that the modular scanner will

[clang] [clang][deps] Support single-file mode for all formats (PR #88764)

2024-04-15 Thread Jan Svoboda via cfe-commits
@@ -1,23 +1,10 @@ // RUN: rm -rf %t // RUN: split-file %s %t -//--- missing_tu.json.in -[{ - "directory": "DIR", - "command": "clang -fsyntax-only DIR/missing_tu.c", - "file": "DIR/missing_tu.c" -}] -//--- missing_header.json.in -[{ - "directory": "DIR", - "command":

[clang] [clang][deps] Support single-file mode for all formats (PR #88764)

2024-04-15 Thread Jan Svoboda via cfe-commits
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/88764 >From 0c6f6a7794b5bd3264632f54bc3bf56f1dfa118e Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Mon, 15 Apr 2024 10:27:44 -0700 Subject: [PATCH 1/2] [clang][deps] Support single-file mode for all formats

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-15 Thread Jan Svoboda via cfe-commits
@@ -2220,33 +2221,40 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

[clang] [Modules] No transitive source location change (PR #86912)

2024-04-15 Thread Jan Svoboda via cfe-commits
@@ -2220,33 +2221,40 @@ class ASTReader return Sema::AlignPackInfo::getFromRawEncoding(Raw); } + using RawLocEncoding = SourceLocationEncoding::RawLocEncoding; + /// Read a source location from raw form and return it in its /// originating module file's source

  1   2   3   4   5   6   7   8   9   10   >