[PATCH] D137995: [Flang][Driver] Handle target CPU and features

Kiran Chandramohan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 16 08:23:31 PST 2022


kiranchandramohan added a comment.

Thanks @mnadeem for this patch. A few minor comments first. Try to replace auto in all places except where the type is on the RHS.

We might need `-fc1` tests as well.



================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:85
+                             ArgStringList &CmdArgs) const {
+  // return;
+  const auto &TC = getToolChain();
----------------
Nit: leftover code?


================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:86
+  // return;
+  const auto &TC = getToolChain();
+  const llvm::Triple &Triple = TC.getEffectiveTriple();
----------------
Nit: replace auto.


================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:99
+  default:
+    // Untested for other targets but should work generally.
+    break;
----------------
I get a segfault in ` Fortran::frontend::CodeGenAction::setUpTargetMachine()` currently when using `./bin/flang-new --target=x86_64-linux-gnu  file.f90`


================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:179
+
+  for (const auto *currentArg :
+       args.filtered(clang::driver::options::OPT_target_feature))
----------------
Nit: Can you remove the auto here?


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:594
 
-  const std::string &theTriple = ci.getInvocation().getTargetOpts().triple;
+  const auto &targetOpts = ci.getInvocation().getTargetOpts();
+  const std::string &theTriple = targetOpts.triple;
----------------
Nit: Can you remove the auto here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137995/new/

https://reviews.llvm.org/D137995



More information about the cfe-commits mailing list