Skip to content
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 1 commit into from
Dec 15, 2023

Conversation

banach-space
Copy link
Contributor

The new name better reflects what the variable represents.

The new name better reflects what the variable represents.
@llvmbot llvmbot added flang:driver flang Flang issues not falling into any other category labels Dec 14, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 14, 2023

@llvm/pr-subscribers-flang-driver

Author: Andrzej Warzyński (banach-space)

Changes

The new name better reflects what the variable represents.


Full diff: https://github.com/llvm/llvm-project/pull/75535.diff

1 Files Affected:

  • (modified) flang/lib/Frontend/CompilerInvocation.cpp (+27-26)
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;
 }

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@banach-space banach-space merged commit 48e96e9 into llvm:main Dec 15, 2023
6 checks passed
@banach-space banach-space deleted the andrzej/rename_res branch March 16, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants