-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][driver][nfc] Rename one variable (res -> invoc) #75535
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The new name better reflects what the variable represents.
llvmbot
added
flang:driver
flang
Flang issues not falling into any other category
labels
Dec 14, 2023
@llvm/pr-subscribers-flang-driver Author: Andrzej Warzyński (banach-space) ChangesThe new name better reflects what the variable represents. Full diff: https://github.com/llvm/llvm-project/pull/75535.diff 1 Files Affected:
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index b3f32bb241d068..4ce6171801d2c9 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1085,7 +1085,7 @@ static bool parseLinkerOptionsArgs(CompilerInvocation &invoc,
}
bool CompilerInvocation::createFromArgs(
- CompilerInvocation &res, llvm::ArrayRef<const char *> commandLineArgs,
+ CompilerInvocation &invoc, llvm::ArrayRef<const char *> commandLineArgs,
clang::DiagnosticsEngine &diags, const char *argv0) {
bool success = true;
@@ -1096,7 +1096,7 @@ bool CompilerInvocation::createFromArgs(
// NOTE: Like in Clang, it would be nice to use option marshalling
// for this so that the entire logic for setting-up the triple is in one
// place.
- res.getTargetOpts().triple =
+ invoc.getTargetOpts().triple =
llvm::Triple::normalize(llvm::sys::getDefaultTargetTriple());
// Parse the arguments
@@ -1128,7 +1128,7 @@ bool CompilerInvocation::createFromArgs(
// -flang-experimental-hlfir
if (args.hasArg(clang::driver::options::OPT_flang_experimental_hlfir) ||
args.hasArg(clang::driver::options::OPT_emit_hlfir)) {
- res.loweringOpts.setLowerToHighLevelFIR(true);
+ invoc.loweringOpts.setLowerToHighLevelFIR(true);
}
// -flang-deprecated-no-hlfir
@@ -1141,16 +1141,17 @@ bool CompilerInvocation::createFromArgs(
"'-flang-deprecated-no-hlfir' cannot be both specified");
diags.Report(diagID);
}
- res.loweringOpts.setLowerToHighLevelFIR(false);
+ invoc.loweringOpts.setLowerToHighLevelFIR(false);
}
- if (args.hasArg(clang::driver::options::OPT_flang_experimental_polymorphism)) {
- res.loweringOpts.setPolymorphicTypeImpl(true);
+ if (args.hasArg(
+ clang::driver::options::OPT_flang_experimental_polymorphism)) {
+ invoc.loweringOpts.setPolymorphicTypeImpl(true);
}
// -fno-ppc-native-vector-element-order
if (args.hasArg(clang::driver::options::OPT_fno_ppc_native_vec_elem_order)) {
- res.loweringOpts.setNoPPCNativeVecElemOrder(true);
+ invoc.loweringOpts.setNoPPCNativeVecElemOrder(true);
}
// Preserve all the remark options requested, i.e. -Rpass, -Rpass-missed or
@@ -1161,46 +1162,46 @@ bool CompilerInvocation::createFromArgs(
// This is -Rfoo=, where foo is the name of the diagnostic
// group. Add only the remark option name to the diagnostics. e.g. for
// -Rpass= we will add the string "pass".
- res.getDiagnosticOpts().Remarks.push_back(
+ invoc.getDiagnosticOpts().Remarks.push_back(
std::string(a->getOption().getName().drop_front(1).rtrim("=-")));
else
// If no regex was provided, add the provided value, e.g. for -Rpass add
// the string "pass".
- res.getDiagnosticOpts().Remarks.push_back(a->getValue());
+ invoc.getDiagnosticOpts().Remarks.push_back(a->getValue());
}
- success &= parseFrontendArgs(res.getFrontendOpts(), args, diags);
- parseTargetArgs(res.getTargetOpts(), args);
- parsePreprocessorArgs(res.getPreprocessorOpts(), args);
- parseCodeGenArgs(res.getCodeGenOpts(), args, diags);
- success &= parseDebugArgs(res.getCodeGenOpts(), args, diags);
- success &= parseVectorLibArg(res.getCodeGenOpts(), args, diags);
- success &= parseSemaArgs(res, args, diags);
- success &= parseDialectArgs(res, args, diags);
- success &= parseDiagArgs(res, args, diags);
+ success &= parseFrontendArgs(invoc.getFrontendOpts(), args, diags);
+ parseTargetArgs(invoc.getTargetOpts(), args);
+ parsePreprocessorArgs(invoc.getPreprocessorOpts(), args);
+ parseCodeGenArgs(invoc.getCodeGenOpts(), args, diags);
+ success &= parseDebugArgs(invoc.getCodeGenOpts(), args, diags);
+ success &= parseVectorLibArg(invoc.getCodeGenOpts(), args, diags);
+ success &= parseSemaArgs(invoc, args, diags);
+ success &= parseDialectArgs(invoc, args, diags);
+ success &= parseDiagArgs(invoc, args, diags);
// Collect LLVM (-mllvm) and MLIR (-mmlir) options.
// NOTE: Try to avoid adding any options directly to `llvmArgs` or
// `mlirArgs`. Instead, you can use
// * `-mllvm <your-llvm-option>`, or
// * `-mmlir <your-mlir-option>`.
- res.frontendOpts.llvmArgs =
+ invoc.frontendOpts.llvmArgs =
args.getAllArgValues(clang::driver::options::OPT_mllvm);
- res.frontendOpts.mlirArgs =
+ invoc.frontendOpts.mlirArgs =
args.getAllArgValues(clang::driver::options::OPT_mmlir);
- success &= parseFloatingPointArgs(res, args, diags);
+ success &= parseFloatingPointArgs(invoc, args, diags);
- success &= parseVScaleArgs(res, args, diags);
+ success &= parseVScaleArgs(invoc, args, diags);
- success &= parseLinkerOptionsArgs(res, args, diags);
+ success &= parseLinkerOptionsArgs(invoc, args, diags);
// Set the string to be used as the return value of the COMPILER_OPTIONS
// intrinsic of iso_fortran_env. This is either passed in from the parent
// compiler driver invocation with an environment variable, or failing that
// set to the command line arguments of the frontend driver invocation.
- res.allCompilerInvocOpts = std::string();
- llvm::raw_string_ostream os(res.allCompilerInvocOpts);
+ invoc.allCompilerInvocOpts = std::string();
+ llvm::raw_string_ostream os(invoc.allCompilerInvocOpts);
char *compilerOptsEnv = std::getenv("FLANG_COMPILER_OPTIONS_STRING");
if (compilerOptsEnv != nullptr) {
os << compilerOptsEnv;
@@ -1212,7 +1213,7 @@ bool CompilerInvocation::createFromArgs(
}
}
- res.setArgv0(argv0);
+ invoc.setArgv0(argv0);
return success;
}
|
tblah
approved these changes
Dec 15, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new name better reflects what the variable represents.