beanz created this revision. beanz added reviewers: steven_wu, arphaman. beanz requested review of this revision. Herald added a project: clang.
Prior to this patch when you used `clang -module-file-info` clang would delete the module on completion because the module was treated as an output file. This fixes the issue so you don't need to invoke cc1 directly to get module file information. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D103547 Files: clang/lib/Driver/Driver.cpp clang/test/Modules/module_file_info.m Index: clang/test/Modules/module_file_info.m =================================================================== --- clang/test/Modules/module_file_info.m +++ clang/test/Modules/module_file_info.m @@ -7,8 +7,8 @@ // RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s --check-prefix=RAW // RUN: %clang_cc1 -w -Wunused -fmodules -fmodule-format=obj -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-obj -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s -// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s -// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s --check-prefix=OBJ +// RUN: %clang -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s +// RUN: %clang -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s --check-prefix=OBJ // RAW: Module format: raw // OBJ: Module format: obj Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -4883,6 +4883,11 @@ return "-"; } + if (JA.getType() == types::TY_ModuleFile && + C.getArgs().getLastArg(options::OPT_module_file_info)) { + return "-"; + } + // Is this the assembly listing for /FA? if (JA.getType() == types::TY_PP_Asm && (C.getArgs().hasArg(options::OPT__SLASH_FA) ||
Index: clang/test/Modules/module_file_info.m =================================================================== --- clang/test/Modules/module_file_info.m +++ clang/test/Modules/module_file_info.m @@ -7,8 +7,8 @@ // RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s --check-prefix=RAW // RUN: %clang_cc1 -w -Wunused -fmodules -fmodule-format=obj -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-obj -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s -// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s -// RUN: %clang_cc1 -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s --check-prefix=OBJ +// RUN: %clang -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s +// RUN: %clang -module-file-info %t-obj/DependsOnModule.pcm | FileCheck %s --check-prefix=OBJ // RAW: Module format: raw // OBJ: Module format: obj Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -4883,6 +4883,11 @@ return "-"; } + if (JA.getType() == types::TY_ModuleFile && + C.getArgs().getLastArg(options::OPT_module_file_info)) { + return "-"; + } + // Is this the assembly listing for /FA? if (JA.getType() == types::TY_PP_Asm && (C.getArgs().hasArg(options::OPT__SLASH_FA) ||
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits