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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2024-10-29 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. Looks better than https://github.com/llvm/llvm-project/pull/113984 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2024-10-28 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-modules Author: Jan Svoboda (jansvoboda11) Changes When reading a path from a bitstream blob, `ASTReader` performs up to three allocations: 1. Conversion of the `StringRef` blob into `std::string` to conform to the `ASTReader::ResolveImportedPat

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

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