@@ -1085,7 +1085,7 @@ static bool parseLinkerOptionsArgs(CompilerInvocation &invoc,
1085
1085
}
1086
1086
1087
1087
bool CompilerInvocation::createFromArgs (
1088
- CompilerInvocation &res , llvm::ArrayRef<const char *> commandLineArgs,
1088
+ CompilerInvocation &invoc , llvm::ArrayRef<const char *> commandLineArgs,
1089
1089
clang::DiagnosticsEngine &diags, const char *argv0) {
1090
1090
1091
1091
bool success = true ;
@@ -1096,7 +1096,7 @@ bool CompilerInvocation::createFromArgs(
1096
1096
// NOTE: Like in Clang, it would be nice to use option marshalling
1097
1097
// for this so that the entire logic for setting-up the triple is in one
1098
1098
// place.
1099
- res .getTargetOpts ().triple =
1099
+ invoc .getTargetOpts ().triple =
1100
1100
llvm::Triple::normalize (llvm::sys::getDefaultTargetTriple ());
1101
1101
1102
1102
// Parse the arguments
@@ -1128,7 +1128,7 @@ bool CompilerInvocation::createFromArgs(
1128
1128
// -flang-experimental-hlfir
1129
1129
if (args.hasArg (clang::driver::options::OPT_flang_experimental_hlfir) ||
1130
1130
args.hasArg (clang::driver::options::OPT_emit_hlfir)) {
1131
- res .loweringOpts .setLowerToHighLevelFIR (true );
1131
+ invoc .loweringOpts .setLowerToHighLevelFIR (true );
1132
1132
}
1133
1133
1134
1134
// -flang-deprecated-no-hlfir
@@ -1141,16 +1141,17 @@ bool CompilerInvocation::createFromArgs(
1141
1141
" '-flang-deprecated-no-hlfir' cannot be both specified" );
1142
1142
diags.Report (diagID);
1143
1143
}
1144
- res .loweringOpts .setLowerToHighLevelFIR (false );
1144
+ invoc .loweringOpts .setLowerToHighLevelFIR (false );
1145
1145
}
1146
1146
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 );
1149
1150
}
1150
1151
1151
1152
// -fno-ppc-native-vector-element-order
1152
1153
if (args.hasArg (clang::driver::options::OPT_fno_ppc_native_vec_elem_order)) {
1153
- res .loweringOpts .setNoPPCNativeVecElemOrder (true );
1154
+ invoc .loweringOpts .setNoPPCNativeVecElemOrder (true );
1154
1155
}
1155
1156
1156
1157
// Preserve all the remark options requested, i.e. -Rpass, -Rpass-missed or
@@ -1161,46 +1162,46 @@ bool CompilerInvocation::createFromArgs(
1161
1162
// This is -Rfoo=, where foo is the name of the diagnostic
1162
1163
// group. Add only the remark option name to the diagnostics. e.g. for
1163
1164
// -Rpass= we will add the string "pass".
1164
- res .getDiagnosticOpts ().Remarks .push_back (
1165
+ invoc .getDiagnosticOpts ().Remarks .push_back (
1165
1166
std::string (a->getOption ().getName ().drop_front (1 ).rtrim (" =-" )));
1166
1167
else
1167
1168
// If no regex was provided, add the provided value, e.g. for -Rpass add
1168
1169
// the string "pass".
1169
- res .getDiagnosticOpts ().Remarks .push_back (a->getValue ());
1170
+ invoc .getDiagnosticOpts ().Remarks .push_back (a->getValue ());
1170
1171
}
1171
1172
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);
1181
1182
1182
1183
// Collect LLVM (-mllvm) and MLIR (-mmlir) options.
1183
1184
// NOTE: Try to avoid adding any options directly to `llvmArgs` or
1184
1185
// `mlirArgs`. Instead, you can use
1185
1186
// * `-mllvm <your-llvm-option>`, or
1186
1187
// * `-mmlir <your-mlir-option>`.
1187
- res .frontendOpts .llvmArgs =
1188
+ invoc .frontendOpts .llvmArgs =
1188
1189
args.getAllArgValues (clang::driver::options::OPT_mllvm);
1189
- res .frontendOpts .mlirArgs =
1190
+ invoc .frontendOpts .mlirArgs =
1190
1191
args.getAllArgValues (clang::driver::options::OPT_mmlir);
1191
1192
1192
- success &= parseFloatingPointArgs (res , args, diags);
1193
+ success &= parseFloatingPointArgs (invoc , args, diags);
1193
1194
1194
- success &= parseVScaleArgs (res , args, diags);
1195
+ success &= parseVScaleArgs (invoc , args, diags);
1195
1196
1196
- success &= parseLinkerOptionsArgs (res , args, diags);
1197
+ success &= parseLinkerOptionsArgs (invoc , args, diags);
1197
1198
1198
1199
// Set the string to be used as the return value of the COMPILER_OPTIONS
1199
1200
// intrinsic of iso_fortran_env. This is either passed in from the parent
1200
1201
// compiler driver invocation with an environment variable, or failing that
1201
1202
// 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 );
1204
1205
char *compilerOptsEnv = std::getenv (" FLANG_COMPILER_OPTIONS_STRING" );
1205
1206
if (compilerOptsEnv != nullptr ) {
1206
1207
os << compilerOptsEnv;
@@ -1212,7 +1213,7 @@ bool CompilerInvocation::createFromArgs(
1212
1213
}
1213
1214
}
1214
1215
1215
- res .setArgv0 (argv0);
1216
+ invoc .setArgv0 (argv0);
1216
1217
1217
1218
return success;
1218
1219
}
0 commit comments