[clang] [clang] Processing real directories added as virtual ones (PR #91645)

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

[clang] [llvm] [modules] Accept equivalent module caches from different symlink (PR #90925)

2024-05-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/90925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [modules] Accept equivalent module caches from different symlink (PR #90925)

2024-05-07 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM if we rename the checkHeaderSearchOptions function. https://github.com/llvm/llvm-project/pull/90925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [modules] Accept equivalent module caches from different symlink (PR #90925)

2024-05-07 Thread Ben Langmuir via cfe-commits
@@ -833,32 +833,33 @@ bool SimpleASTReaderListener::ReadPreprocessorOptions( /// against the header search options in an existing preprocessor. /// /// \param Diags If non-null, produce diagnostics for any mismatches incurred. -static bool checkHeaderSearchOptions(const

[clang] [llvm] [modules] Accept equivalent module caches from different symlink (PR #90925)

2024-05-03 Thread Ben Langmuir via cfe-commits
@@ -839,17 +839,15 @@ static bool checkHeaderSearchOptions(const HeaderSearchOptions , DiagnosticsEngine *Diags, const LangOptions , const PreprocessorOptions ) { -

[clang] [modules] Accept equivalent module caches from different symlink (PR #90925)

2024-05-03 Thread Ben Langmuir via cfe-commits
@@ -839,17 +839,15 @@ static bool checkHeaderSearchOptions(const HeaderSearchOptions , DiagnosticsEngine *Diags, const LangOptions , const PreprocessorOptions ) { -

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

2024-05-01 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. 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] [Modules] Process include files changes with -fmodules-validate-input-files-content and -fno-pch-timestamp options (PR #90319)

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

[clang] [Modules] Process include files changes with -fmodules-validate-input-files-content and -fno-pch-timestamp options (PR #90319)

2024-04-30 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,34 @@ +// UNSUPPORTED: system-windows +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: cp a1.h a.h +// RUN: %clang -fmodules -fmodules-validate-input-files-content -Xclang -fno-pch-timestamp -fimplicit-modules -fmodule-map-file=module.modulemap

[clang] [Modules] Process include files changes with -fmodules-validate-input-files-content and -fno-pch-timestamp options (PR #90319)

2024-04-30 Thread Ben Langmuir via cfe-commits
@@ -0,0 +1,34 @@ +// UNSUPPORTED: system-windows +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t +// +// RUN: cp a1.h a.h +// RUN: %clang -fmodules -fmodules-validate-input-files-content -Xclang -fno-pch-timestamp -fimplicit-modules -fmodule-map-file=module.modulemap

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

2024-04-26 Thread Ben Langmuir 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 Ben Langmuir 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][deps] Support single-file mode for all formats (PR #88764)

2024-04-16 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. 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][deps] Support single-file mode for all formats (PR #88764)

2024-04-15 Thread Ben Langmuir 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 Ben Langmuir 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] Add `-o` flag to specify output path (PR #88767)

2024-04-15 Thread Ben Langmuir via cfe-commits
@@ -864,8 +873,24 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { }); SharedStream Errs(llvm::errs()); - // Print out the dependency results to STDOUT by default. - SharedStream DependencyOS(llvm::outs()); + + std::optional FileOS;

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

2024-04-15 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited 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] Add `-o` flag to specify output path (PR #88767)

2024-04-15 Thread Ben Langmuir via cfe-commits
@@ -864,8 +873,24 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) { }); SharedStream Errs(llvm::errs()); - // Print out the dependency results to STDOUT by default. - SharedStream DependencyOS(llvm::outs()); + + std::optional FileOS;

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

2024-04-15 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM with a couple minor comments https://github.com/llvm/llvm-project/pull/88767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

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

[clang] [clang-tools-extra] [clang][modules] Do not resolve `HeaderFileInfo` externally in `ASTWriter` (PR #87848)

2024-04-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. LGTM (with the `Not to be committed, just here as a demonstration` test removed, of course). https://github.com/llvm/llvm-project/pull/87848 ___ cfe-commits mailing list

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2024-04-11 Thread Ben Langmuir via cfe-commits
@@ -194,6 +201,17 @@ class DependencyScanningFilesystemSharedCache { const CachedFileSystemEntry & getOrInsertEntryForFilename(StringRef Filename, const CachedFileSystemEntry ); + +/// Returns real path associated with the filename

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2024-04-11 Thread Ben Langmuir via cfe-commits
@@ -230,6 +251,26 @@ class DependencyScanningFilesystemLocalCache { assert(InsertedEntry == && "entry already present"); return *InsertedEntry; } + + /// Returns real path associated with the filename or nullptr if none is + /// found. + const CachedRealPath

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2024-04-11 Thread Ben Langmuir via cfe-commits
@@ -159,7 +159,37 @@ DependencyScanningFilesystemSharedCache::CacheShard:: getOrInsertEntryForFilename(StringRef Filename, const CachedFileSystemEntry ) { std::lock_guard LockGuard(CacheLock); - return *EntriesByFilename.insert({Filename,

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2024-04-11 Thread Ben Langmuir via cfe-commits
@@ -130,11 +130,11 @@ DependencyScanningFilesystemSharedCache::CacheShard:: getOrEmplaceEntryForFilename(StringRef Filename, llvm::ErrorOr Stat) { std::lock_guard LockGuard(CacheLock); - auto Insertion =

[clang] [llvm] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2024-04-11 Thread Ben Langmuir via cfe-commits
@@ -226,9 +247,28 @@ class DependencyScanningFilesystemLocalCache { insertEntryForFilename(StringRef Filename, const CachedFileSystemEntry ) { assert(llvm::sys::path::is_absolute_gnu(Filename)); -const auto *InsertedEntry =

[clang] [clang-tools-extra] [clang][modules] Do not resolve `HeaderFileInfo` externally in `ASTWriter` (PR #87848)

2024-04-09 Thread Ben Langmuir via cfe-commits
@@ -409,7 +409,7 @@ class SymbolCollector::HeaderFileURICache { // Framework headers are spelled as , not // "path/FrameworkName.framework/Headers/Foo.h". auto = PP->getHeaderSearchInfo(); -if (const auto *HFI = HS.getExistingFileInfo(*FE, /*WantExternal*/

[clang] [clang-tools-extra] [clang][modules] Do not resolve `HeaderFileInfo` externally in `ASTWriter` (PR #87848)

2024-04-09 Thread Ben Langmuir via cfe-commits
@@ -409,7 +409,7 @@ class SymbolCollector::HeaderFileURICache { // Framework headers are spelled as , not // "path/FrameworkName.framework/Headers/Foo.h". auto = PP->getHeaderSearchInfo(); -if (const auto *HFI = HS.getExistingFileInfo(*FE, /*WantExternal*/

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

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

[clang] [clang] Move state out of `PreprocessorOptions` (2/n) (PR #87099)

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

[clang] [clang] Move state out of `PreprocessorOptions` (1/n) (PR #86358)

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

[clang] [clang] Move state out of `PreprocessorOptions` (1/n) (PR #86358)

2024-03-28 Thread Ben Langmuir via cfe-commits
@@ -34,12 +34,17 @@ class InitOnlyAction : public FrontendAction { /// Preprocessor-based frontend action that also loads PCH files. class ReadPCHAndPreprocessAction : public FrontendAction { + llvm::function_ref OnCI; benlangmuir wrote: My concern is that

[clang] [clang] Move state out of `PreprocessorOptions` (1/n) (PR #86358)

2024-03-28 Thread Ben Langmuir via cfe-commits
@@ -736,6 +736,19 @@ class Preprocessor { State ConditionalStackState = Off; } PreambleConditionalStack; + /// Function for getting the dependency preprocessor directives of a file. + /// + /// These are directives derived from a special form of lexing where the +

[clang] [clang] Move state out of `PreprocessorOptions` (1/n) (PR #86358)

2024-03-28 Thread Ben Langmuir via cfe-commits
@@ -34,12 +34,17 @@ class InitOnlyAction : public FrontendAction { /// Preprocessor-based frontend action that also loads PCH files. class ReadPCHAndPreprocessAction : public FrontendAction { + llvm::function_ref OnCI; benlangmuir wrote: What does `OnCI`

[clang] [clang][modules] Avoid calling expensive `SourceManager::translateFile()` (PR #86216)

2024-03-28 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Thanks for explaining; LGTM https://github.com/llvm/llvm-project/pull/86216 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][modules] Avoid calling expensive `SourceManager::translateFile()` (PR #86216)

2024-03-25 Thread Ben Langmuir via cfe-commits
@@ -71,6 +71,7 @@ // CHECK-NEXT: "context-hash": "{{.*}}", // CHECK-NEXT: "file-deps": [ // CHECK-NEXT: "[[PREFIX]]/first/module.modulemap", +// CHECK-NEXT: "[[PREFIX]]/second/module.modulemap", benlangmuir wrote: Why did this

[clang] [clang][modules] Avoid calling expensive `SourceManager::translateFile()` (PR #86216)

2024-03-25 Thread Ben Langmuir via cfe-commits
@@ -1337,9 +1337,24 @@ static bool compileModule(CompilerInstance , // Get or create the module map that we'll use to build this module. ModuleMap = ImportingInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap(); + SourceManager =

[clang] [clang][deps] Lazy dependency directives (PR #86347)

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

[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

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

[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

2024-03-13 Thread Ben Langmuir via cfe-commits
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) { if (Requested->isSubModuleOf(Use)) return true; - // Anyone is allowed to use our builtin stdarg.h and stddef.h and their - // accompanying modules. - if (Requested->getTopLevelModuleName()

[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

2024-03-13 Thread Ben Langmuir via cfe-commits
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) { if (Requested->isSubModuleOf(Use)) return true; - // Anyone is allowed to use our builtin stdarg.h and stddef.h and their - // accompanying modules. - if (Requested->getTopLevelModuleName()

[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

2024-03-13 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: >> I'm not excited by the complexity we are moving toward with the builtin >> headers. But I don't have any alternatives. > When -fbuiltin-headers-in-system-modules goes away, things become simpler > than they were since modules were introduced. Even for the case with

[clang] [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (PR #84127)

2024-03-13 Thread Ben Langmuir via cfe-commits
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) { if (Requested->isSubModuleOf(Use)) return true; - // Anyone is allowed to use our builtin stdarg.h and stddef.h and their - // accompanying modules. - if (Requested->getTopLevelModuleName()

[clang] [NFC] [C++20] [Modules] [P1689] [Scanner] Don't use thread pool in P1689 per file mode (PR #84285)

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

[clang] [clang][deps] Fix dependency scanning with -working-directory (PR #84525)

2024-03-12 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir closed https://github.com/llvm/llvm-project/pull/84525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][deps] Fix dependency scanning with -working-directory (PR #84525)

2024-03-11 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir updated https://github.com/llvm/llvm-project/pull/84525 >From 24e2454b90c2aaabb999e84240d5b2263ff01719 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Fri, 8 Mar 2024 09:53:42 -0800 Subject: [PATCH] [clang][deps] Fix dependency scanning with -working-directory

[clang] [clang][deps] Fix dependency scanning with -working-directory (PR #84525)

2024-03-11 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: I don't think there's a difference we can test for here -- the VFS WD shouldn't be modified after the driver sets it and before the FM is used here, so it would be identical to `-working-directory` during the critical window. But I agree recreating the FileManager is

[clang] [clang][deps] Fix dependency scanning with -working-directory (PR #84525)

2024-03-11 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: > I can see a situation where we ask FileManager about the same relative path > before and after setting the parsed FileSystemOptions. The second call would > blindly return the cached result, effectively ignoring -working-directory for > that file. The driver calls

[clang] [clang][deps] Fix dependency scanning with -working-directory (PR #84525)

2024-03-08 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir created https://github.com/llvm/llvm-project/pull/84525 Stop overriding -working-directory to CWD during argument parsing, which should no longer necessary after we set the VFS working directory, and set FSOpts correctly after parsing arguments so that

[clang] [llvm] [clang][ScanDeps] Allow PCHs to have different VFS overlays (PR #82294)

2024-02-28 Thread Ben Langmuir via cfe-commits
@@ -175,8 +192,19 @@ static void sanitizeDiagOpts(DiagnosticOptions ) { DiagOpts.ShowCarets = false; // Don't write out diagnostic file. DiagOpts.DiagnosticSerializationFile.clear(); - // Don't emit warnings as errors (and all other warnings too). -

[clang] [llvm] [clang][ScanDeps] Allow PCHs to have different VFS overlays (PR #82294)

2024-02-28 Thread Ben Langmuir via cfe-commits
@@ -175,8 +192,19 @@ static void sanitizeDiagOpts(DiagnosticOptions ) { DiagOpts.ShowCarets = false; // Don't write out diagnostic file. DiagOpts.DiagnosticSerializationFile.clear(); - // Don't emit warnings as errors (and all other warnings too). -

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

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

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
@@ -127,8 +127,12 @@ class PPCallbacks { /// \param RelativePath The path relative to SearchPath, at which the include /// file was found. This is equal to FileName except for framework includes. /// - /// \param Imported The module, whenever an inclusion directive was

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir deleted https://github.com/llvm/llvm-project/pull/81061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
@@ -127,8 +127,12 @@ class PPCallbacks { /// \param RelativePath The path relative to SearchPath, at which the include /// file was found. This is equal to FileName except for framework includes. /// - /// \param Imported The module, whenever an inclusion directive was

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: It would be good to update your commit message to talk about the benefits of this change: the callback now provides more information about the included header and models the associated module accurately regardless of whether it is translated to an

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
@@ -127,8 +127,12 @@ class PPCallbacks { /// \param RelativePath The path relative to SearchPath, at which the include /// file was found. This is equal to FileName except for framework includes. /// - /// \param Imported The module, whenever an inclusion directive was

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
@@ -2265,7 +2265,6 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( UsableHeaderUnit = true; else if (!IsImportDecl) { // This is a Header Unit that we do not include-translate - SuggestedModule = ModuleMap::KnownHeader();

[clang] [clang-tools-extra] [clang][lex] Always pass suggested module to `InclusionDirective()` callback (PR #81061)

2024-02-08 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/81061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang] NFC: Remove `{File, Directory}Entry::getName()` (PR #74910)

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

[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)

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

[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)

2023-12-08 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. Nice simplification https://github.com/llvm/llvm-project/pull/74900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)

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

[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)

2023-12-08 Thread Ben Langmuir via cfe-commits
@@ -441,22 +434,19 @@ void ModuleManager::visit(llvm::function_ref Visitor, bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, OptionalFileEntryRef ) {

[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)

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

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

2023-12-06 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

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

2023-12-06 Thread Ben Langmuir via cfe-commits
@@ -157,6 +157,25 @@ #define LLVM_DEPRECATED(MSG, FIX) [[deprecated(MSG)]] #endif +// clang-format off +#if defined(__clang__) || defined(__GNUC__) +#define LLVM_IGNORE_DEPRECATIONS_OF_DECLARATIONS_BEGIN \ benlangmuir wrote: I'm not

[clang] [clang][DependencyScanner] Include the working directory in the context hash (PR #73719)

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

[clang] [llvm] [clang][DependencyScanner] Remove unused -ivfsoverlay files (PR #73734)

2023-11-29 Thread Ben Langmuir via cfe-commits
@@ -498,11 +518,18 @@ class NamedNodeOrError { } // namespace detail /// An in-memory file system. -class InMemoryFileSystem : public FileSystem { +class InMemoryFileSystem : public RTTIExtends { std::unique_ptr Root; std::string WorkingDirectory; bool

[clang] [llvm] [clang][DependencyScanner] Remove unused -ivfsoverlay files (PR #73734)

2023-11-29 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: It's odd to me that tracking is enabled by default. I would have expected tracking be off by default and enabled explicitly for scanning. Similarly, in the modulemap case it could save-and-restore rather than enable the tracking if it was previously

[clang] [llvm] [clang][DependencyScanner] Remove unused -ivfsoverlay files (PR #73734)

2023-11-29 Thread Ben Langmuir via cfe-commits
@@ -4997,6 +4997,19 @@ ASTReader::ASTReadResult ASTReader::readUnhashedControlBlockImpl( F->SearchPathUsage[I] = true; break; } +case VFS_USAGE: { + if (!F) +break; + unsigned Count = Record[0]; + const char *Byte =

[clang] [llvm] [clang][DependencyScanner] Remove unused -ivfsoverlay files (PR #73734)

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

[clang] [clang] Fix sorting header paths (PR #73323)

2023-11-28 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: You could try using `clang -cc1 -E -x c-module-map` which calls `Module::print`. To trigger this code path you can follow the pattern in `darwin_specific_modulemap_hacks.m`, ie create a module like ``` $ touch Tcl/x1.h $ touch Tcl/x2.h $ cat Tcl/module.modulemap module Tcl

[clang] [clang][DependencyScanner] Remove all warning flags when suppressing warnings (PR #71612)

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

[clang] [clang][deps] Skip writing `DIAG_PRAGMA_MAPPINGS` record (PR #70874)

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

[clang] Revert "Reland [clang] Canonicalize system headers in dependency file when -canonical-prefixes" (PR #71697)

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

[llvm] [clang] [clang][DepScan] Make OptimizeArgs a bit mask enum and enable by default (PR #71588)

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

[clang] [clang][modules] Avoid modules diagnostics for `__has_include()` (PR #71450)

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

[clang] [clang][modules] Don't prevent translation of FW_Private includes when explicitly building FW (PR #70714)

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

[clang] [clang][deps] Skip slow `UNHASHED_CONTROL_BLOCK` records (PR #69975)

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

[clang] [clang-scan-deps] [P1689] Keep consistent behavior for make dependencies with clang (PR #69551)

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

[clang] [clang-scan-deps] [P1689] Keep consistent behavior for make dependencies with clang (PR #69551)

2023-10-30 Thread Ben Langmuir via cfe-commits
@@ -666,13 +666,19 @@ static StringRef makeAbsoluteAndPreferred(CompilerInstance , StringRef Path, } void ModuleDepCollector::addFileDep(StringRef Path) { - llvm::SmallString<256> Storage; - Path = makeAbsoluteAndPreferred(ScanInstance, Path, Storage); + // Within P1689

[clang] [clang-scan-deps] [P1689] Keep consistent behavior for make dependencies with clang (PR #69551)

2023-10-27 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Thanks for the ping, I had missed your question > How do you think about the idea to add a flag to the MDC about whether or not > calling makeAbsoluteAndPreferred? SGTM; this seems like a good compromise since we can't easily extract this into the consumer.

[clang] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2023-10-26 Thread Ben Langmuir via cfe-commits
@@ -168,6 +170,12 @@ class DependencyScanningFilesystemSharedCache { /// The backing storage for cached contents. llvm::SpecificBumpPtrAllocator ContentsStorage; +/// Map from filenames to cached real paths. +llvm::StringMap RealPathsByFilename;

[clang] [clang][deps] Cache `VFS::getRealPath()` (PR #68645)

2023-10-26 Thread Ben Langmuir via cfe-commits
@@ -230,6 +251,26 @@ class DependencyScanningFilesystemLocalCache { assert(InsertedEntry == && "entry already present"); return *InsertedEntry; } + + /// Returns real path associated with the filename or nullptr if none is + /// found. + const CachedRealPath

[clang] [clang][deps] Fix `__has_include` behavior with umbrella headers (PR #70144)

2023-10-25 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir approved this pull request. > Yeah. I did try to fix up all calls to LookupFile to perform module map > lookup, but a bunch of tests started failing (mostly standard C++ modules > tests IIRC), so there's probably more nuance required there. Okay, I do think this

[clang] [clang] use relative paths for builtin headers during module compilation (PR #68023)

2023-10-25 Thread Ben Langmuir via cfe-commits
benlangmuir wrote: Thanks for your patience, I should have looked at this sooner. The change to our downstream test looks expected; the `` buffer changed ```diff -#import "/^tc/lib/clang/18/include/stdbool.h" +#import "stdbool.h" ``` But the actual resolution of which header is used is

[clang] [clang][deps] Fix `__has_include` behavior with umbrella headers (PR #70144)

2023-10-24 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: Can you clarify how this bug occurs in terms of what information about the header is stored that causes us to get the wrong module? It seems bad that passing `nullptr` to `LookupFile` could cause incorrect behaviour and makes me wonder if we need to

[clang] [clang][deps] Skip slow `UNHASHED_CONTROL_BLOCK` records (PR #69975)

2023-10-23 Thread Ben Langmuir via cfe-commits
@@ -2944,6 +2944,10 @@ def fno_modules_validate_textual_header_includes : MarshallingInfoNegativeFlag>, HelpText<"Do not enforce -fmodules-decluse and private header restrictions for textual headers. " "This flag will be removed in a future Clang release.">;

[clang] [clang][deps] Skip slow `UNHASHED_CONTROL_BLOCK` records (PR #69975)

2023-10-23 Thread Ben Langmuir via cfe-commits
@@ -1212,9 +1212,12 @@ void ASTWriter::writeUnhashedControlBlock(Preprocessor , Record.clear(); } + const auto = PP.getHeaderSearchInfo().getHeaderSearchOpts(); + // Diagnostic options. const auto = Context.getDiagnostics(); const DiagnosticOptions =

[clang] [clang][deps] Skip slow `UNHASHED_CONTROL_BLOCK` records (PR #69975)

2023-10-23 Thread Ben Langmuir via cfe-commits
@@ -2944,6 +2944,10 @@ def fno_modules_validate_textual_header_includes : MarshallingInfoNegativeFlag>, HelpText<"Do not enforce -fmodules-decluse and private header restrictions for textual headers. " "This flag will be removed in a future Clang release.">;

[clang] [clang-scan-deps] [P1689] Keep consistent behavior for make dependencies with clang (PR #69551)

2023-10-19 Thread Ben Langmuir via cfe-commits
https://github.com/benlangmuir commented: Is the issue with MDC's FileDeps that we are calling `makeAbsoluteAndPreferred` on the paths? Maybe we could instead move that call into `FullDependencyConsumer`. Or are there other issues? The fact we need to add additional

[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] [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 , ASTContext , SmallVector ModMaps(AdditionalModMaps->begin(), AdditionalModMaps->end()); llvm::sort(ModMaps, [](FileEntryRef A, FileEntryRef B) { -

[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

[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

[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

[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 ) { } } +llvm::Expected +ASTReader::readSLocOffset(ModuleFile *F, unsigned Index) { + BitstreamCursor = F->SLocEntryCursor; + SavedStreamPosition SavedPosition(Cursor); + if (llvm::Error

[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"

  1   2   3   4   >