[PATCH] D147561: [clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd
This revision was automatically updated to reflect the committed changes. Closed by commit rG8ee5029b225b: [clang] dont serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd (authored by rmaz). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147561/new/ https://reviews.llvm.org/D147561 Files: clang/lib/Serialization/ASTWriter.cpp clang/test/Modules/module-file-home-is-cwd.m Index: clang/test/Modules/module-file-home-is-cwd.m === --- clang/test/Modules/module-file-home-is-cwd.m +++ clang/test/Modules/module-file-home-is-cwd.m @@ -5,11 +5,12 @@ // RUN: -fmodules-embed-all-files %S/Inputs/normal-module-map/module.map \ // RUN: -o %t/mod.pcm // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s --check-prefix=INPUT -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' // CHECK-NOT: MODULE_DIRECTORY +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' @import libA; Index: clang/lib/Serialization/ASTWriter.cpp === --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -1288,11 +1288,11 @@ // If the home of the module is the current working directory, then we // want to pick up the cwd of the build process loading the module, not // our cwd, when we load this module. -if (!(PP.getHeaderSearchInfo() +if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd && +(!PP.getHeaderSearchInfo() .getHeaderSearchOpts() .ModuleMapFileHomeIsCwd || - PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) || -WritingModule->Directory->getName() != StringRef(".")) { + WritingModule->Directory->getName() != StringRef("."))) { // Module directory. auto Abbrev = std::make_shared(); Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY)); Index: clang/test/Modules/module-file-home-is-cwd.m === --- clang/test/Modules/module-file-home-is-cwd.m +++ clang/test/Modules/module-file-home-is-cwd.m @@ -5,11 +5,12 @@ // RUN: -fmodules-embed-all-files %S/Inputs/normal-module-map/module.map \ // RUN: -o %t/mod.pcm // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s --check-prefix=INPUT -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' // CHECK-NOT: MODULE_DIRECTORY +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' @import libA; Index: clang/lib/Serialization/ASTWriter.cpp === --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -1288,11 +1288,11 @@ // If the home of the module is the current working directory, then we // want to pick up the cwd of the build process loading the module, not // our cwd, when we load this module. -if (!(PP.getHeaderSearchInfo() +if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd && +(!PP.getHeaderSearchInfo() .getHeaderSearchOpts() .ModuleMapFileHomeIsCwd || - PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) || -WritingModule->Directory->getName() != StringRef(".")) { + WritingModule->Directory->getName() != StringRef("."))) { // Module directory. auto Abbrev = std::make_shared(); Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D147561: [clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd
keith accepted this revision. keith added inline comments. This revision is now accepted and ready to land. Comment at: clang/test/Modules/module-file-home-is-cwd.m:7-8 // RUN: -o %t/mod.pcm // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s --check-prefix=INPUT Instead of doing 2 invocations you can do `--check-prefixes=CHECK,INPUT` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147561/new/ https://reviews.llvm.org/D147561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D147561: [clang] don't serialize MODULE_DIRECTORY with ModuleFileHomeIsCwd
rmaz created this revision. Herald added a project: All. rmaz requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fix a bug in the MODULE_DIRECTORY serialization logic that would cause MODULE_DIRECTORY to be serialized when `-fmodule-file-home-is-cwd` is specified. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D147561 Files: clang/lib/Serialization/ASTWriter.cpp clang/test/Modules/module-file-home-is-cwd.m Index: clang/test/Modules/module-file-home-is-cwd.m === --- clang/test/Modules/module-file-home-is-cwd.m +++ clang/test/Modules/module-file-home-is-cwd.m @@ -5,11 +5,12 @@ // RUN: -fmodules-embed-all-files %S/Inputs/normal-module-map/module.map \ // RUN: -o %t/mod.pcm // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s --check-prefix=INPUT -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' // CHECK-NOT: MODULE_DIRECTORY +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' @import libA; Index: clang/lib/Serialization/ASTWriter.cpp === --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -1288,11 +1288,11 @@ // If the home of the module is the current working directory, then we // want to pick up the cwd of the build process loading the module, not // our cwd, when we load this module. -if (!(PP.getHeaderSearchInfo() +if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd && +(!PP.getHeaderSearchInfo() .getHeaderSearchOpts() .ModuleMapFileHomeIsCwd || - PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) || -WritingModule->Directory->getName() != StringRef(".")) { + WritingModule->Directory->getName() != StringRef("."))) { // Module directory. auto Abbrev = std::make_shared(); Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY)); Index: clang/test/Modules/module-file-home-is-cwd.m === --- clang/test/Modules/module-file-home-is-cwd.m +++ clang/test/Modules/module-file-home-is-cwd.m @@ -5,11 +5,12 @@ // RUN: -fmodules-embed-all-files %S/Inputs/normal-module-map/module.map \ // RUN: -o %t/mod.pcm // RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t/mod.pcm | FileCheck %s --check-prefix=INPUT -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' -// CHECK: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' // CHECK-NOT: MODULE_DIRECTORY +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}module.map' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a2.h' +// INPUT: blob data = 'Inputs{{/|\\}}normal-module-map{{/|\\}}a1.h' @import libA; Index: clang/lib/Serialization/ASTWriter.cpp === --- clang/lib/Serialization/ASTWriter.cpp +++ clang/lib/Serialization/ASTWriter.cpp @@ -1288,11 +1288,11 @@ // If the home of the module is the current working directory, then we // want to pick up the cwd of the build process loading the module, not // our cwd, when we load this module. -if (!(PP.getHeaderSearchInfo() +if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd && +(!PP.getHeaderSearchInfo() .getHeaderSearchOpts() .ModuleMapFileHomeIsCwd || - PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) || -WritingModule->Directory->getName() != StringRef(".")) { + WritingModule->Directory->getName() != StringRef("."))) { // Module directory. auto Abbrev = std::make_shared(); Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits