[clang] Llvm modules on demand bmi (PR #71773)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 8 21:40:43 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 21861991e760e7e845dc1be5b804c950543d699a 6fa533ecaef0f75c87554fb646b0e5dca8ea7255 -- clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h clang/include/clang/Sema/Sema.h clang/include/clang/Serialization/ASTWriter.h clang/include/clang/Serialization/PCHContainerOperations.h clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp clang/lib/Frontend/FrontendAction.cpp clang/lib/Serialization/GeneratePCH.cpp clang/lib/Serialization/PCHContainerOperations.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index bfe112ff1..f6794a4f4 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -197,15 +197,16 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
// to consider the case in which a BMI is explicitly the main output of the
// compilation.
InputKind IK = getCurrentFileKind();
- bool EmitBMI = CI.getLangOpts().CPlusPlusModules &&
- IK.getFormat() == InputKind::Format::Source &&
- !this->usesPreprocessorOnly() &&
- (CI.getFrontendOpts().ProgramAction == frontend::EmitObj ||
- CI.getFrontendOpts().ProgramAction == frontend::EmitAssembly ||
- CI.getFrontendOpts().ProgramAction == frontend::EmitBC ||
- CI.getFrontendOpts().ProgramAction == frontend::EmitLLVM ||
- CI.getFrontendOpts().ProgramAction == frontend::EmitLLVMOnly ||
- CI.getFrontendOpts().ProgramAction == frontend::EmitCodeGenOnly);
+ bool EmitBMI =
+ CI.getLangOpts().CPlusPlusModules &&
+ IK.getFormat() == InputKind::Format::Source &&
+ !this->usesPreprocessorOnly() &&
+ (CI.getFrontendOpts().ProgramAction == frontend::EmitObj ||
+ CI.getFrontendOpts().ProgramAction == frontend::EmitAssembly ||
+ CI.getFrontendOpts().ProgramAction == frontend::EmitBC ||
+ CI.getFrontendOpts().ProgramAction == frontend::EmitLLVM ||
+ CI.getFrontendOpts().ProgramAction == frontend::EmitLLVMOnly ||
+ CI.getFrontendOpts().ProgramAction == frontend::EmitCodeGenOnly);
// If there are no registered plugins and we do not need to emit a BMI, we
// do not need to wrap the consumer in a MultiplexConsumer.
@@ -225,8 +226,8 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
// statement). We do not open this on the output stream, but provide it
// as a fallback.
// The default here is to output the pcm alongside the main output.
- std::string XOut
- = llvm::sys::path::parent_path(CI.getFrontendOpts().OutputFile).str();
+ std::string XOut =
+ llvm::sys::path::parent_path(CI.getFrontendOpts().OutputFile).str();
std::string XIn = llvm::sys::path::filename(InFile).str();
if (!XOut.empty()) {
XOut += llvm::sys::path::get_separator();
@@ -245,19 +246,19 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
// Add a job to build the CMI from the AST.
// ??? : change the CTOR flags to note that this is a CXX20 module?
Consumers.push_back(std::make_unique<PCHGenerator>(
- CI.getPreprocessor(), CI.getModuleCache(), XOut, Sysroot, Buffer,
- CI.getFrontendOpts().ModuleFileExtensions,
- /*AllowASTWithErrors=*/false,
- /*IncludeTimestamps=*/false,
- /*BuildingImplicitModule=*/false,
- /*ShouldCacheASTInMemory=*/false,
- /*IsForBMI=*/true));
+ CI.getPreprocessor(), CI.getModuleCache(), XOut, Sysroot, Buffer,
+ CI.getFrontendOpts().ModuleFileExtensions,
+ /*AllowASTWithErrors=*/false,
+ /*IncludeTimestamps=*/false,
+ /*BuildingImplicitModule=*/false,
+ /*ShouldCacheASTInMemory=*/false,
+ /*IsForBMI=*/true));
// This writes the CMI (if one is needed), but does not open the output
// file unless/until it is required.
- Consumers.push_back(CI.getPCHContainerWriter()
- .CreatePCHDeferredContainerGenerator(
- CI, std::string(InFile), XOut, std::move(OS), Buffer));
+ Consumers.push_back(
+ CI.getPCHContainerWriter().CreatePCHDeferredContainerGenerator(
+ CI, std::string(InFile), XOut, std::move(OS), Buffer));
}
// Collect the list of plugins that go before the main action (in Consumers)
``````````
</details>
https://github.com/llvm/llvm-project/pull/71773
More information about the cfe-commits
mailing list