[clang] 73dba2f - [clang][deps] Fix modulemap file path for implementation of module

2023-01-27 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2023-01-27T11:37:35-08:00 New Revision: 73dba2f649a8e8c01e9c8b8df3bdc89cdf0fd7ee URL: https://github.com/llvm/llvm-project/commit/73dba2f649a8e8c01e9c8b8df3bdc89cdf0fd7ee DIFF: https://github.com/llvm/llvm-project/commit/73dba2f649a8e8c01e9c8b8df3bdc89cdf0fd7ee.diff

[clang] 223e99f - [clang][deps] Fix module context hash for constant strings

2023-02-03 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2023-02-03T15:10:19-08:00 New Revision: 223e99fb698dd63b5bb9266e11c2582261e05ad9 URL: https://github.com/llvm/llvm-project/commit/223e99fb698dd63b5bb9266e11c2582261e05ad9 DIFF: https://github.com/llvm/llvm-project/commit/223e99fb698dd63b5bb9266e11c2582261e05ad9.diff

[clang] 509223d - [clang][deps] Further canonicalize implicit modules options in dep scan

2022-06-15 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2022-06-15T13:29:47-07:00 New Revision: 509223da61145c3eb982751cba9ab6ddf0f48e9d URL: https://github.com/llvm/llvm-project/commit/509223da61145c3eb982751cba9ab6ddf0f48e9d DIFF: https://github.com/llvm/llvm-project/commit/509223da61145c3eb982751cba9ab6ddf0f48e9d.diff

[clang] 4a3a9a5 - [clang][deps] Sort submodules when calculating dependencies

2022-06-17 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2022-06-17T07:55:27-07:00 New Revision: 4a3a9a5fa0b2fd0e70672c35010fe2f00740f098 URL: https://github.com/llvm/llvm-project/commit/4a3a9a5fa0b2fd0e70672c35010fe2f00740f098 DIFF: https://github.com/llvm/llvm-project/commit/4a3a9a5fa0b2fd0e70672c35010fe2f00740f098.diff

[clang] 7a72dca - [clang][deps] Set -disable-free for module compilations

2022-06-08 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2022-06-08T11:09:17-07:00 New Revision: 7a72dca74a27f1f6198cfabb064dc43274ee005d URL: https://github.com/llvm/llvm-project/commit/7a72dca74a27f1f6198cfabb064dc43274ee005d DIFF: https://github.com/llvm/llvm-project/commit/7a72dca74a27f1f6198cfabb064dc43274ee005d.diff

[clang] 835fcf2 - [clang][deps] Make order of module dependencies deterministic

2022-06-08 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2022-06-08T11:09:17-07:00 New Revision: 835fcf2aa5127bf99a1e6397c72153f00a0497b2 URL: https://github.com/llvm/llvm-project/commit/835fcf2aa5127bf99a1e6397c72153f00a0497b2 DIFF: https://github.com/llvm/llvm-project/commit/835fcf2aa5127bf99a1e6397c72153f00a0497b2.diff

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-18 Thread Ben Langmuir via cfe-commits
@@ -330,3 +359,24 @@ DependencyScanningWorkerFilesystem::openFileForRead(const Twine &Path) { return Result.getError(); return DepScanFile::create(Result.get()); } + +std::error_code DependencyScanningWorkerFilesystem::setCurrentWorkingDirectory( +const Twine &Path)

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-18 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/66122 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-21 Thread Ben Langmuir via cfe-commits
@@ -524,13 +524,7 @@ enum ASTRecordTypes { /// of source-location information. SOURCE_LOCATION_OFFSETS = 14, - /// Record code for the set of source location entries - /// that need to be preloaded by the AST reader. - /// - /// This set contains the source location en

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-21 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: > in my experience, it's not actually referenced in most modules Can you clarify what you looked at here? I assume you checked non-scanner modules as well? https://github.com/llvm/llvm-project/pull/66962 ___

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-21 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/66962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-21 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM other than my nit about the comment https://github.com/llvm/llvm-project/pull/66962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang][modules] Adopt `FileEntryRef` in the `HeaderFileInfo` block in PCM files (PR #67383)

2023-09-26 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/67383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Adopt `FileEntryRef` in the `HeaderFileInfo` block in PCM files (PR #67383)

2023-09-26 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/67383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Adopt `FileEntryRef` in the `HeaderFileInfo` block in PCM files (PR #67383)

2023-09-26 Thread Ben Langmuir via cfe-commits
@@ -612,24 +612,21 @@ FileManager::getNoncachedStatValue(StringRef Path, } void FileManager::GetUniqueIDMapping( -SmallVectorImpl &UIDToFiles) const { +SmallVectorImpl &UIDToFiles) const { UIDToFiles.clear(); UIDToFiles.resize(NextFileUID); - // Map file entri

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-27 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > I changed SourceManager::isInTheSameTranslationUnit() to check for that case > explicitly instead of relying on the fact/bug that built-ins buffers happened > to be assigned an untranslated include SourceLocation. What is the translated location you get here? It's hard fo

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-09-27 Thread Ben Langmuir via cfe-commits
@@ -864,74 +864,7 @@ FileID SourceManager::getFileIDLocal(SourceLocation::UIntTy SLocOffset) const { /// This function knows that the SourceLocation is in a loaded buffer, not a /// local one. FileID SourceManager::getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const { -

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-09-27 Thread Ben Langmuir via cfe-commits
@@ -50,6 +50,7 @@ int y = a2; // CHECK: In module 'a': // CHECK-NEXT: a.h:1:45: error: +int z = b; // MISSING-B: could not find file '{{.*}}b.h' // MISSING-B-NOT: please delete the module cache benlangmuir wrote: Can we use this approach to test the current

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-09-27 Thread Ben Langmuir via cfe-commits
@@ -288,10 +288,12 @@ class ModuleFile { /// for the entry is SLocEntryOffsetsBase + SLocEntryOffsets[i]. uint64_t SLocEntryOffsetsBase = 0; - /// Offsets for all of the source location entries in the - /// AST file. + /// Stream bit offsets for all of the source locati

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-09-27 Thread Ben Langmuir via cfe-commits
@@ -2261,43 +2261,68 @@ template struct enumerator_result { mutable range_reference_tuple Storage; }; -/// Infinite stream of increasing 0-based `size_t` indices. -struct index_stream { - struct iterator : iterator_facade_base { -iterator &operator++() { - assert

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-09-27 Thread Ben Langmuir via cfe-commits
@@ -1444,6 +1444,77 @@ llvm::Error ASTReader::ReadSourceManagerBlock(ModuleFile &F) { } } +std::optional +ASTReader::readSLocOffset(ModuleFile *F, unsigned Index) { benlangmuir wrote: Does every path that returns `std::nullopt` report an error? If so I wou

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-09-28 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Thanks for laying it out. I also find this easier to understand in your latest changes because the comments in `isBeforeInTranslationUnit` lay out the intended ordering without relying on `isInTheSameTranslationUnit` returning `false` for builtin buffers, which is the part t

[clang] [clang] NFCI: Use `FileEntryRef` in `SourceManager::FileInfos` (PR #67742)

2023-09-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: I'm skeptical that treating `FileEntryRef` as `FileEntry *` for the purposes of equality and hashing is a good idea. To me, the obvious interpretation of `FileEntryRef ==` is that the path must be equal, and having it based on the dev/inode is surpris

[clang] [clang] NFCI: Use `FileEntryRef` in `SourceManager::FileInfos` (PR #67742)

2023-09-28 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: For what it's worth, until recently there was almost no **use** of the implicit unique file semantics for FileEntryRef even though the DenseMapInfo had been available for a long time. But okay, I see there are more uses now so this is not the right place to push back on tha

[clang] [clang] NFCI: Use `FileEntryRef` in `SourceManager::FileInfos` (PR #67742)

2023-09-28 Thread Ben Langmuir via cfe-commits
@@ -179,6 +179,46 @@ TEST(FileEntryTest, DenseMapInfo) { EXPECT_TRUE(Set.find(R1)->isSameRef(R1)); EXPECT_TRUE(Set.find(R2)->isSameRef(R2)); } + + // Insert R1Also second and confirm R1 "wins" when looked up as FileEntry. benlangmuir wrote: This com

[clang] [clang] NFCI: Use `FileEntryRef` in `SourceManager::FileInfos` (PR #67742)

2023-09-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Comment in the test needs a fix, but otherwise LGTM https://github.com/llvm/llvm-project/pull/67742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [clang] NFCI: Use `FileEntryRef` in `SourceManager::FileInfos` (PR #67742)

2023-09-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/67742 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: I thin https://github.com/llvm/llvm-project/pull/67838 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/67838 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
@@ -843,7 +843,7 @@ void ClangMoveTool::moveDeclsToNewFiles() { // Move all contents from OldFile to NewFile. void ClangMoveTool::moveAll(SourceManager &SM, StringRef OldFile, StringRef NewFile) { - auto FE = SM.getFileManager().getFile(makeAbsolute

[clang-tools-extra] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
@@ -228,7 +228,7 @@ int main(int argc, const char **argv) { Tool.applyAllReplacements(Rewrite); for (const auto &File : Files) { - auto Entry = FileMgr.getFile(File); + auto Entry = FileMgr.getOptionalFileRef(File); benlangmuir wrote: Anothe

[clang] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
@@ -152,7 +152,7 @@ int main(int argc, const char **argv) { for (auto I = ChangedFiles.begin(), E = ChangedFiles.end(); I != E; ++I) { OS << " {\n"; OS << "\"FilePath\": \"" << *I << "\",\n"; -const auto Entry = FileMgr.getFile(*I); +

[clang] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

2023-09-29 Thread Ben Langmuir via cfe-commits
@@ -527,17 +527,6 @@ FileID SourceManager::getNextFileID(FileID FID) const { /// Create a new FileID that represents the specified file /// being \#included from the specified IncludePosition. -/// -/// This translates NULL into standard input. -FileID SourceManager::createFil

[clang] [clang] use absolute path for builtin headers during module compilation (PR #68023)

2023-10-02 Thread Ben Langmuir via cfe-commits
@@ -348,6 +348,10 @@ bool ModuleMap::resolveAsBuiltinHeader( if (!File) return false; + // Ensure the path to the module directory is absolute, otherwise + // builtin headers will fail to resolve when using relative resource + // directory paths without a -I. + llvm:

[clang-tools-extra] [clang] NFCI: Use `FileEntryRef` for `FileID` creation (PR #67838)

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

[clang] [clang] NFC: Remove unused `FileEntry::getLastRef()` (PR #68156)

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

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -2082,6 +2082,11 @@ std::pair SourceManager::isInTheSameTranslationUnit( if (LOffs.first == ROffs.first) return std::make_pair(true, LOffs.second < ROffs.second); + // Built-ins are not considered part of any TU. benlangmuir wrote: Does this have t

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -701,6 +701,10 @@ class SourceManager : public RefCountedBase { /// use (-ID - 2). SmallVector LoadedSLocEntryTable; + /// For each allocation in LoadedSLocEntryTable, we keep the new size. This + /// can be used to determine whether two FileIDs come from the same AS

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -458,11 +458,14 @@ SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, CurrentLoadedOffset - TotalSize < NextLocalOffset) { return std::make_pair(0, 0); } - LoadedSLocEntryTable.resize(LoadedSLocEntryTable.size() + NumSLocEntries); - SLocEntryLoa

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -458,11 +458,14 @@ SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, CurrentLoadedOffset - TotalSize < NextLocalOffset) { return std::make_pair(0, 0); } - LoadedSLocEntryTable.resize(LoadedSLocEntryTable.size() + NumSLocEntries); - SLocEntryLoa

[clang] [clang] NFC: Deprecate `FileEntry::getName()` (PR #68157)

2023-10-03 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/68157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] NFC: Deprecate `FileEntry::getName()` (PR #68157)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -284,7 +284,6 @@ TEST_F(FileManagerTest, getFileRefReturnsCorrectNameForDifferentStatPath) { ASSERT_FALSE(!F1Alias); ASSERT_FALSE(!F1Alias2); EXPECT_EQ("dir/f1.cpp", F1->getName()); - EXPECT_EQ("dir/f1.cpp", F1->getFileEntry().getName()); benlangmuir

[clang] [clang] NFC: Deprecate `FileEntry::getName()` (PR #68157)

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

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-03 Thread Ben Langmuir via cfe-commits
@@ -2082,6 +2082,11 @@ std::pair SourceManager::isInTheSameTranslationUnit( if (LOffs.first == ROffs.first) return std::make_pair(true, LOffs.second < ROffs.second); + // Built-ins are not considered part of any TU. benlangmuir wrote: Yes, this commen

[clang] [clang] use absolute path for builtin headers during module compilation (PR #68023)

2023-10-03 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. This seems reasonable to me, but I would like @jansvoboda11 to also look at it. https://github.com/llvm/llvm-project/pull/68023 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -701,6 +701,10 @@ class SourceManager : public RefCountedBase { /// use (-ID - 2). SmallVector LoadedSLocEntryTable; + /// For each allocation in LoadedSLocEntryTable, we keep the new size. This + /// can be used to determine whether two FileIDs come from the same AS

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -458,14 +458,12 @@ SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, CurrentLoadedOffset - TotalSize < NextLocalOffset) { return std::make_pair(0, 0); } - - unsigned NewTableSize = LoadedSLocEntryTable.size() + NumSLocEntries; - LoadedSLocEntry

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -1986,13 +1984,15 @@ bool SourceManager::isInTheSameTranslationUnitImpl( if (isLoadedFileID(LOffs.first) != isLoadedFileID(ROffs.first)) return false; - // If both are loaded from different AST files. if (isLoadedFileID(LOffs.first) && isLoadedFileID(ROffs.first))

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/66962 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -458,14 +458,12 @@ SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries, CurrentLoadedOffset - TotalSize < NextLocalOffset) { return std::make_pair(0, 0); } - - unsigned NewTableSize = LoadedSLocEntryTable.size() + NumSLocEntries; - LoadedSLocEntry

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Thanks for iterating! I find the current implementation much clearer. The only thing I might quibble about is the "child" vs. "parent" terminology you changed: I think it's fairly ambiguous either way, because the node is the "child" f

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/66966 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Remove preloaded SLocEntries from PCM files (PR #66962)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Thanks for iterating! I find the current implementation much clearer. The only thing I might quibble about is the "child" vs. "parent" terminology you changed: I think it's fairly ambiguous either way, because the node is the "child" f

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/66966 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -1444,6 +1444,74 @@ llvm::Error ASTReader::ReadSourceManagerBlock(ModuleFile &F) { } } +llvm::Expected +ASTReader::readSLocOffset(ModuleFile *F, unsigned Index) { + BitstreamCursor &Cursor = F->SLocEntryCursor; + SavedStreamPosition SavedPosition(Cursor); + if (llvm::

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM; you might need a `std::move` in `readSLocOffset` to appease an older compiler. https://github.com/llvm/llvm-project/pull/66966 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
@@ -288,10 +288,12 @@ class ModuleFile { /// for the entry is SLocEntryOffsetsBase + SLocEntryOffsets[i]. uint64_t SLocEntryOffsetsBase = 0; - /// Offsets for all of the source location entries in the - /// AST file. + /// Stream bit offsets for all of the source locati

[clang] [clang][modules] Move `SLocEntry` search into `ASTReader` (PR #66966)

2023-10-04 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Latest change to shrink memory use LGTM. https://github.com/llvm/llvm-project/pull/66966 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [clang][modules] Use file name as requested (PR #68957)

2023-10-13 Thread Ben Langmuir via cfe-commits
@@ -1384,10 +1384,10 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, SmallVector ModMaps(AdditionalModMaps->begin(), AdditionalModMaps->end()); llvm::sort(ModMaps, [](FileEntryRef A, FileEntryRe

[clang] [clang][modules] Use file name as requested (PR #68957)

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

[clang] dc5cbba - [clang][modules] Add -Wsystem-headers-in-module=

2023-08-09 Thread Ben Langmuir via cfe-commits
Author: Ben Langmuir Date: 2023-08-09T10:40:53-07:00 New Revision: dc5cbba3196db61d57b7d84118732a6c96d8ee64 URL: https://github.com/llvm/llvm-project/commit/dc5cbba3196db61d57b7d84118732a6c96d8ee64 DIFF: https://github.com/llvm/llvm-project/commit/dc5cbba3196db61d57b7d84118732a6c96d8ee64.diff

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -66,16 +66,18 @@ bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args, DiagnosticsEngine *Diags = nullptr, bool DefaultDiagColor = true); +namespace CompilerInvocationDetail { /// The base class of Co

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -94,47 +96,37 @@ class CompilerInvocationRefBase { /// Options controlling the static analyzer. AnalyzerOptionsRef AnalyzerOpts; - CompilerInvocationRefBase(); - CompilerInvocationRefBase(const CompilerInvocationRefBase &X); - CompilerInvocationRefBase(CompilerInvoca

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -154,46 +146,158 @@ class CompilerInvocationValueBase { PreprocessorOutputOptions PreprocessorOutputOpts; public: - MigratorOptions &getMigratorOpts() { return MigratorOpts; } + // clang-format off const MigratorOptions &getMigratorOpts() const { return MigratorOpts;

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -123,49 +123,101 @@ static Expected> parseToleranceOption(StringRef Arg) { } //===--===// -// Initialization. +// Storage details. //===--

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -94,47 +96,37 @@ class CompilerInvocationRefBase { /// Options controlling the static analyzer. AnalyzerOptionsRef AnalyzerOpts; - CompilerInvocationRefBase(); - CompilerInvocationRefBase(const CompilerInvocationRefBase &X); - CompilerInvocationRefBase(CompilerInvoca

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -123,49 +123,101 @@ static Expected> parseToleranceOption(StringRef Arg) { } //===--===// -// Initialization. +// Storage details. //===--

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -94,47 +96,37 @@ class CompilerInvocationRefBase { /// Options controlling the static analyzer. AnalyzerOptionsRef AnalyzerOpts; - CompilerInvocationRefBase(); - CompilerInvocationRefBase(const CompilerInvocationRefBase &X); - CompilerInvocationRefBase(CompilerInvoca

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -123,49 +123,101 @@ static Expected> parseToleranceOption(StringRef Arg) { } //===--===// -// Initialization. +// Storage details. //===--

[clang] [clang] Make the entire `CompilerInvocation` ref-counted (PR #65647)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/65647 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: This basically LGTM, but could we add some unit tests for the new type? https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir unresolved https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Introduce copy-on-write `CompilerInvocation` (PR #65412)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/65412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Store common, partially-formed invocation (PR #65677)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -279,13 +281,16 @@ class ModuleDepCollector final : public DependencyCollector { /// Add module files (pcm) to the invocation, if needed. void addModuleFiles(CompilerInvocation &CI, ArrayRef ClangModuleDeps) const; + void addModuleFiles(CowCompile

[clang] [clang][deps] Store common, partially-formed invocation (PR #65677)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -117,14 +112,37 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs( CI.getFrontendOpts().ARCMTAction = FrontendOptions::ARCMT_None; CI.getFrontendOpts().ObjCMTAction = FrontendOptions::ObjCMT_None; CI.getFrontendOpts().MTMigrateDir.clear(); - CI.getLan

[clang] [clang][deps] Store common, partially-formed invocation (PR #65677)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -117,14 +112,37 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs( CI.getFrontendOpts().ARCMTAction = FrontendOptions::ARCMT_None; CI.getFrontendOpts().ObjCMTAction = FrontendOptions::ObjCMT_None; CI.getFrontendOpts().MTMigrateDir.clear(); - CI.getLan

[clang] [clang][deps] Store common, partially-formed invocation (PR #65677)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir resolved https://github.com/llvm/llvm-project/pull/65677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Store common, partially-formed invocation (PR #65677)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/65677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Generate command lines lazily (PR #65691)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -532,7 +539,8 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) { // Finish the compiler invocation. Requires dependencies and the context hash. MDC.addOutputPaths(CI, MD); - MD.BuildArguments = CI.getCC1CommandLine(); + MD.BuildInvocationOrArguments =

[clang] [clang][deps] Generate command lines lazily (PR #65691)

2023-09-07 Thread Ben Langmuir via cfe-commits
@@ -136,9 +138,15 @@ struct ModuleDeps { /// determined that the differences are benign for this compilation. std::vector ClangModuleDeps; - /// Compiler invocation that can be used to build this module. Does not - /// include argv[0]. - std::vector BuildArguments; + /

[clang] [clang][deps] Generate command lines lazily (PR #65691)

2023-09-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/65691 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-12 Thread Ben Langmuir via cfe-commits
@@ -215,44 +225,57 @@ DependencyScanningWorkerFilesystem::findEntryByFilenameWithWriteThrough( } llvm::ErrorOr -DependencyScanningWorkerFilesystem::computeAndStoreResult(StringRef Filename) { - llvm::ErrorOr Stat = getUnderlyingFS().status(Filename); +DependencyScanningWorke

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-12 Thread Ben Langmuir via cfe-commits
@@ -215,44 +225,57 @@ DependencyScanningWorkerFilesystem::findEntryByFilenameWithWriteThrough( } llvm::ErrorOr -DependencyScanningWorkerFilesystem::computeAndStoreResult(StringRef Filename) { - llvm::ErrorOr Stat = getUnderlyingFS().status(Filename); +DependencyScanningWorke

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-14 Thread Ben Langmuir via cfe-commits
@@ -482,16 +482,9 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) { MD.ID.ModuleName = M->getFullModuleName(); MD.IsSystem = M->IsSystem; - ModuleMap &ModMapInfo = - MDC.ScanInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap(); - - Optiona

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-14 Thread Ben Langmuir via cfe-commits
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, std::error_code ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl &Path) { + FileManager &FM = SourceMgr.getFileManager(); + FM.makeAbsolutePath(Path); benlangmuir wrote: I'm not

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-14 Thread Ben Langmuir via cfe-commits
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, std::error_code ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl &Path) { + FileManager &FM = SourceMgr.getFileManager(); + FM.makeAbsolutePath(Path); benlangmuir wrote: This wo

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, std::error_code ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl &Path) { + FileManager &FM = SourceMgr.getFileManager(); + FM.makeAbsolutePath(Path); benlangmuir wrote: Is the

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -330,3 +353,20 @@ DependencyScanningWorkerFilesystem::openFileForRead(const Twine &Path) { return Result.getError(); return DepScanFile::create(Result.get()); } + +std::error_code DependencyScanningWorkerFilesystem::setCurrentWorkingDirectory( +const Twine &Path)

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, std::error_code ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl &Path) { + FileManager &FM = SourceMgr.getFileManager(); + FM.makeAbsolutePath(Path); benlangmuir wrote: > The c

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -330,3 +353,20 @@ DependencyScanningWorkerFilesystem::openFileForRead(const Twine &Path) { return Result.getError(); return DepScanFile::create(Result.get()); } + +std::error_code DependencyScanningWorkerFilesystem::setCurrentWorkingDirectory( +const Twine &Path)

[clang] [DependencyScanningFilesystem] Make sure the local/shared cache filename lookups use only absolute paths (PR #66122)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -330,3 +353,20 @@ DependencyScanningWorkerFilesystem::openFileForRead(const Twine &Path) { return Result.getError(); return DepScanFile::create(Result.get()); } + +std::error_code DependencyScanningWorkerFilesystem::setCurrentWorkingDirectory( +const Twine &Path)

[clang] [clang][deps] Load module map file from PCM (PR #66389)

2023-09-15 Thread Ben Langmuir via cfe-commits
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M, std::error_code ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl &Path) { + FileManager &FM = SourceMgr.getFileManager(); + FM.makeAbsolutePath(Path); benlangmuir wrote: > This

<    1   2   3   4   5   >