Skip to content

Commit 8503c49

Browse files
committed
Rename variables
1 parent d1b9c55 commit 8503c49

File tree

1 file changed

+41
-50
lines changed

1 file changed

+41
-50
lines changed

clang/lib/CIR/FrontendAction/CIRGenAction.cpp

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "clang/Frontend/FrontendDiagnostic.h"
3636
#include "clang/Frontend/MultiplexConsumer.h"
3737
#include "clang/Lex/Preprocessor.h"
38+
#include "llvm/ADT/SmallString.h"
3839
#include "llvm/Bitcode/BitcodeReader.h"
3940
#include "llvm/IR/DebugInfo.h"
4041
#include "llvm/IR/DiagnosticInfo.h"
@@ -47,11 +48,10 @@
4748
#include "llvm/LTO/LTOBackend.h"
4849
#include "llvm/Linker/Linker.h"
4950
#include "llvm/Pass.h"
50-
#include "llvm/ADT/SmallString.h"
5151
#include "llvm/Support/MemoryBuffer.h"
52+
#include "llvm/Support/Path.h"
5253
#include "llvm/Support/Signals.h"
5354
#include "llvm/Support/SourceMgr.h"
54-
#include "llvm/Support/Path.h"
5555
#include "llvm/Support/TimeProfiler.h"
5656
#include "llvm/Support/Timer.h"
5757
#include "llvm/Support/ToolOutputFile.h"
@@ -112,12 +112,12 @@ class CIRGenConsumer : public clang::ASTConsumer {
112112

113113
CIRGenAction::OutputType Action;
114114

115-
CompilerInstance &CompilerInstance;
116-
DiagnosticsEngine &DiagnosticsEngine;
117-
[[maybe_unused]] const HeaderSearchOptions &HeaderSearchOptions;
118-
CodeGenOptions &CodeGenOptions;
119-
[[maybe_unused]] const TargetOptions &TargetOptions;
120-
[[maybe_unused]] const LangOptions &LangOptions;
115+
CompilerInstance &CI;
116+
DiagnosticsEngine &Diags;
117+
[[maybe_unused]] const HeaderSearchOptions &HeaderSearchOpts;
118+
CodeGenOptions &CodeGenOpts;
119+
[[maybe_unused]] const TargetOptions &TargetOpts;
120+
[[maybe_unused]] const LangOptions &LangOpts;
121121
const FrontendOptions &FeOptions;
122122

123123
std::string InputFileName;
@@ -128,25 +128,21 @@ class CIRGenConsumer : public clang::ASTConsumer {
128128
std::unique_ptr<CIRGenerator> Gen;
129129

130130
public:
131-
CIRGenConsumer(CIRGenAction::OutputType Action,
132-
class CompilerInstance &CompilerInstance,
133-
class DiagnosticsEngine &DiagnosticsEngine,
131+
CIRGenConsumer(CIRGenAction::OutputType Action, class CompilerInstance &CI,
132+
class DiagnosticsEngine &Diags,
134133
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
135-
const class HeaderSearchOptions &HeaderSearchOptions,
136-
class CodeGenOptions &CodeGenOptions,
137-
const class TargetOptions &TargetOptions,
138-
const class LangOptions &LangOptions,
134+
const class HeaderSearchOptions &HeaderSearchOpts,
135+
class CodeGenOptions &CodeGenOpts,
136+
const class TargetOptions &TargetOpts,
137+
const class LangOptions &LangOpts,
139138
const FrontendOptions &FeOptions, StringRef InputFile,
140139
std::unique_ptr<raw_pwrite_stream> Os)
141-
: Action(Action), CompilerInstance(CompilerInstance),
142-
DiagnosticsEngine(DiagnosticsEngine),
143-
HeaderSearchOptions(HeaderSearchOptions),
144-
CodeGenOptions(CodeGenOptions), TargetOptions(TargetOptions),
145-
LangOptions(LangOptions), FeOptions(FeOptions),
146-
InputFileName(InputFile.str()),
147-
OutputStream(std::move(Os)), FS(VFS),
148-
Gen(std::make_unique<CIRGenerator>(DiagnosticsEngine, std::move(VFS),
149-
CodeGenOptions)) {}
140+
: Action(Action), CI(CI), Diags(Diags),
141+
HeaderSearchOpts(HeaderSearchOpts), CodeGenOpts(CodeGenOpts),
142+
TargetOpts(TargetOpts), LangOpts(LangOpts), FeOptions(FeOptions),
143+
InputFileName(InputFile.str()), OutputStream(std::move(Os)), FS(VFS),
144+
Gen(std::make_unique<CIRGenerator>(Diags, std::move(VFS),
145+
CodeGenOpts)) {}
150146

151147
void Initialize(ASTContext &Ctx) override {
152148
assert(!AstContext && "initialized multiple times");
@@ -221,12 +217,12 @@ class CIRGenConsumer : public clang::ASTConsumer {
221217
FeOptions.ClangIRLifetimeCheck, LifetimeOpts,
222218
FeOptions.ClangIRIdiomRecognizer, IdiomRecognizerOpts,
223219
FeOptions.ClangIRLibOpt, LibOptOpts, PassOptParsingFailure,
224-
CodeGenOptions.OptimizationLevel > 0, FlattenCir,
220+
CodeGenOpts.OptimizationLevel > 0, FlattenCir,
225221
!FeOptions.ClangIRDirectLowering, EnableCcLowering,
226222
FeOptions.ClangIREnableMem2Reg)
227223
.failed()) {
228224
if (!PassOptParsingFailure.empty()) {
229-
auto D = DiagnosticsEngine.Report(diag::err_drv_cir_pass_opt_parsing);
225+
auto D = Diags.Report(diag::err_drv_cir_pass_opt_parsing);
230226
D << PassOptParsingFailure;
231227
} else
232228
llvm::report_fatal_error("CIR codegen: MLIR pass manager fails "
@@ -269,24 +265,21 @@ class CIRGenConsumer : public clang::ASTConsumer {
269265
}
270266
}
271267

272-
bool EmitCIR = LangOptions.EmitCIRToFile || FeOptions.EmitClangIRFile ||
273-
!LangOptions.CIRFile.empty() ||
274-
!FeOptions.ClangIRFile.empty();
268+
bool EmitCIR = LangOpts.EmitCIRToFile || FeOptions.EmitClangIRFile ||
269+
!LangOpts.CIRFile.empty() || !FeOptions.ClangIRFile.empty();
275270
if (EmitCIR) {
276271
std::unique_ptr<raw_pwrite_stream> CIRStream;
277272
llvm::SmallString<128> DefaultPath;
278273
if (!FeOptions.ClangIRFile.empty()) {
279-
CIRStream = CompilerInstance.createOutputFile(
280-
FeOptions.ClangIRFile,
281-
/*Binary=*/false,
282-
/*RemoveFileOnSignal=*/true,
283-
/*UseTemporary=*/true);
284-
} else if (!LangOptions.CIRFile.empty()) {
285-
CIRStream = CompilerInstance.createOutputFile(
286-
LangOptions.CIRFile,
287-
/*Binary=*/false,
288-
/*RemoveFileOnSignal=*/true,
289-
/*UseTemporary=*/true);
274+
CIRStream = CI.createOutputFile(FeOptions.ClangIRFile,
275+
/*Binary=*/false,
276+
/*RemoveFileOnSignal=*/true,
277+
/*UseTemporary=*/true);
278+
} else if (!LangOpts.CIRFile.empty()) {
279+
CIRStream = CI.createOutputFile(LangOpts.CIRFile,
280+
/*Binary=*/false,
281+
/*RemoveFileOnSignal=*/true,
282+
/*UseTemporary=*/true);
290283
} else {
291284
if (!FeOptions.OutputFile.empty() && FeOptions.OutputFile != "-") {
292285
DefaultPath = FeOptions.OutputFile;
@@ -299,11 +292,10 @@ class CIRGenConsumer : public clang::ASTConsumer {
299292
DefaultPath = "clangir-output";
300293
}
301294
llvm::sys::path::replace_extension(DefaultPath, "cir");
302-
CIRStream = CompilerInstance.createOutputFile(
303-
DefaultPath,
304-
/*Binary=*/false,
305-
/*RemoveFileOnSignal=*/true,
306-
/*UseTemporary=*/true);
295+
CIRStream = CI.createOutputFile(DefaultPath,
296+
/*Binary=*/false,
297+
/*RemoveFileOnSignal=*/true,
298+
/*UseTemporary=*/true);
307299
}
308300

309301
if (CIRStream) {
@@ -354,18 +346,17 @@ class CIRGenConsumer : public clang::ASTConsumer {
354346
case CIRGenAction::OutputType::EmitAssembly: {
355347
llvm::LLVMContext LlvmCtx;
356348
bool DisableDebugInfo =
357-
CodeGenOptions.getDebugInfo() == llvm::codegenoptions::NoDebugInfo;
349+
CodeGenOpts.getDebugInfo() == llvm::codegenoptions::NoDebugInfo;
358350
auto LlvmModule = lowerFromCIRToLLVMIR(
359351
FeOptions, MlirMod, std::move(MlirCtx), LlvmCtx,
360352
FeOptions.ClangIRDisableCIRVerifier,
361353
!FeOptions.ClangIRCallConvLowering, DisableDebugInfo);
362354

363355
BackendAction BackendAction = getBackendActionFromOutputType(Action);
364356

365-
emitBackendOutput(CompilerInstance, CodeGenOptions,
366-
C.getTargetInfo().getDataLayoutString(),
367-
LlvmModule.get(), BackendAction, FS,
368-
std::move(OutputStream));
357+
emitBackendOutput(
358+
CI, CodeGenOpts, C.getTargetInfo().getDataLayoutString(),
359+
LlvmModule.get(), BackendAction, FS, std::move(OutputStream));
369360
break;
370361
}
371362
case CIRGenAction::OutputType::None:

0 commit comments

Comments
 (0)