Skip to content

Commit 48e96e9

Browse files
authored
[flang][driver][nfc] Rename one variable (res -> invoc) (#75535)
The new name better reflects what the variable represents.
1 parent 71bbfab commit 48e96e9

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ static bool parseLinkerOptionsArgs(CompilerInvocation &invoc,
10851085
}
10861086

10871087
bool CompilerInvocation::createFromArgs(
1088-
CompilerInvocation &res, llvm::ArrayRef<const char *> commandLineArgs,
1088+
CompilerInvocation &invoc, llvm::ArrayRef<const char *> commandLineArgs,
10891089
clang::DiagnosticsEngine &diags, const char *argv0) {
10901090

10911091
bool success = true;
@@ -1096,7 +1096,7 @@ bool CompilerInvocation::createFromArgs(
10961096
// NOTE: Like in Clang, it would be nice to use option marshalling
10971097
// for this so that the entire logic for setting-up the triple is in one
10981098
// place.
1099-
res.getTargetOpts().triple =
1099+
invoc.getTargetOpts().triple =
11001100
llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple());
11011101

11021102
// Parse the arguments
@@ -1128,7 +1128,7 @@ bool CompilerInvocation::createFromArgs(
11281128
// -flang-experimental-hlfir
11291129
if (args.hasArg(clang::driver::options::OPT_flang_experimental_hlfir) ||
11301130
args.hasArg(clang::driver::options::OPT_emit_hlfir)) {
1131-
res.loweringOpts.setLowerToHighLevelFIR(true);
1131+
invoc.loweringOpts.setLowerToHighLevelFIR(true);
11321132
}
11331133

11341134
// -flang-deprecated-no-hlfir
@@ -1141,16 +1141,17 @@ bool CompilerInvocation::createFromArgs(
11411141
"'-flang-deprecated-no-hlfir' cannot be both specified");
11421142
diags.Report(diagID);
11431143
}
1144-
res.loweringOpts.setLowerToHighLevelFIR(false);
1144+
invoc.loweringOpts.setLowerToHighLevelFIR(false);
11451145
}
11461146

1147-
if (args.hasArg(clang::driver::options::OPT_flang_experimental_polymorphism)) {
1148-
res.loweringOpts.setPolymorphicTypeImpl(true);
1147+
if (args.hasArg(
1148+
clang::driver::options::OPT_flang_experimental_polymorphism)) {
1149+
invoc.loweringOpts.setPolymorphicTypeImpl(true);
11491150
}
11501151

11511152
// -fno-ppc-native-vector-element-order
11521153
if (args.hasArg(clang::driver::options::OPT_fno_ppc_native_vec_elem_order)) {
1153-
res.loweringOpts.setNoPPCNativeVecElemOrder(true);
1154+
invoc.loweringOpts.setNoPPCNativeVecElemOrder(true);
11541155
}
11551156

11561157
// Preserve all the remark options requested, i.e. -Rpass, -Rpass-missed or
@@ -1161,46 +1162,46 @@ bool CompilerInvocation::createFromArgs(
11611162
// This is -Rfoo=, where foo is the name of the diagnostic
11621163
// group. Add only the remark option name to the diagnostics. e.g. for
11631164
// -Rpass= we will add the string "pass".
1164-
res.getDiagnosticOpts().Remarks.push_back(
1165+
invoc.getDiagnosticOpts().Remarks.push_back(
11651166
std::string(a->getOption().getName().drop_front(1).rtrim("=-")));
11661167
else
11671168
// If no regex was provided, add the provided value, e.g. for -Rpass add
11681169
// the string "pass".
1169-
res.getDiagnosticOpts().Remarks.push_back(a->getValue());
1170+
invoc.getDiagnosticOpts().Remarks.push_back(a->getValue());
11701171
}
11711172

1172-
success &= parseFrontendArgs(res.getFrontendOpts(), args, diags);
1173-
parseTargetArgs(res.getTargetOpts(), args);
1174-
parsePreprocessorArgs(res.getPreprocessorOpts(), args);
1175-
parseCodeGenArgs(res.getCodeGenOpts(), args, diags);
1176-
success &= parseDebugArgs(res.getCodeGenOpts(), args, diags);
1177-
success &= parseVectorLibArg(res.getCodeGenOpts(), args, diags);
1178-
success &= parseSemaArgs(res, args, diags);
1179-
success &= parseDialectArgs(res, args, diags);
1180-
success &= parseDiagArgs(res, args, diags);
1173+
success &= parseFrontendArgs(invoc.getFrontendOpts(), args, diags);
1174+
parseTargetArgs(invoc.getTargetOpts(), args);
1175+
parsePreprocessorArgs(invoc.getPreprocessorOpts(), args);
1176+
parseCodeGenArgs(invoc.getCodeGenOpts(), args, diags);
1177+
success &= parseDebugArgs(invoc.getCodeGenOpts(), args, diags);
1178+
success &= parseVectorLibArg(invoc.getCodeGenOpts(), args, diags);
1179+
success &= parseSemaArgs(invoc, args, diags);
1180+
success &= parseDialectArgs(invoc, args, diags);
1181+
success &= parseDiagArgs(invoc, args, diags);
11811182

11821183
// Collect LLVM (-mllvm) and MLIR (-mmlir) options.
11831184
// NOTE: Try to avoid adding any options directly to `llvmArgs` or
11841185
// `mlirArgs`. Instead, you can use
11851186
// * `-mllvm <your-llvm-option>`, or
11861187
// * `-mmlir <your-mlir-option>`.
1187-
res.frontendOpts.llvmArgs =
1188+
invoc.frontendOpts.llvmArgs =
11881189
args.getAllArgValues(clang::driver::options::OPT_mllvm);
1189-
res.frontendOpts.mlirArgs =
1190+
invoc.frontendOpts.mlirArgs =
11901191
args.getAllArgValues(clang::driver::options::OPT_mmlir);
11911192

1192-
success &= parseFloatingPointArgs(res, args, diags);
1193+
success &= parseFloatingPointArgs(invoc, args, diags);
11931194

1194-
success &= parseVScaleArgs(res, args, diags);
1195+
success &= parseVScaleArgs(invoc, args, diags);
11951196

1196-
success &= parseLinkerOptionsArgs(res, args, diags);
1197+
success &= parseLinkerOptionsArgs(invoc, args, diags);
11971198

11981199
// Set the string to be used as the return value of the COMPILER_OPTIONS
11991200
// intrinsic of iso_fortran_env. This is either passed in from the parent
12001201
// compiler driver invocation with an environment variable, or failing that
12011202
// set to the command line arguments of the frontend driver invocation.
1202-
res.allCompilerInvocOpts = std::string();
1203-
llvm::raw_string_ostream os(res.allCompilerInvocOpts);
1203+
invoc.allCompilerInvocOpts = std::string();
1204+
llvm::raw_string_ostream os(invoc.allCompilerInvocOpts);
12041205
char *compilerOptsEnv = std::getenv("FLANG_COMPILER_OPTIONS_STRING");
12051206
if (compilerOptsEnv != nullptr) {
12061207
os << compilerOptsEnv;
@@ -1212,7 +1213,7 @@ bool CompilerInvocation::createFromArgs(
12121213
}
12131214
}
12141215

1215-
res.setArgv0(argv0);
1216+
invoc.setArgv0(argv0);
12161217

12171218
return success;
12181219
}

0 commit comments

Comments
 (0)