[PATCH] D73951: [Clang] [Driver]Add logic to search for flang frontend

David Truby via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 07:00:12 PST 2020


DavidTruby requested changes to this revision.
DavidTruby added a comment.
This revision now requires changes to proceed.

If what I've suggested above doesn't work then the patch lgtm as is



================
Comment at: clang/lib/Driver/Driver.cpp:131
       CCLogDiagnostics(false), CCGenDiagnostics(false),
-      TargetTriple(TargetTriple), CCCGenericGCCName(""), Saver(Alloc),
-      CheckInputsExist(true), GenReproducer(false),
+      TargetTriple(TargetTriple), CCCGenericGCCName(""), FFCGenericFortranName(""),
+      Saver(Alloc), CheckInputsExist(true), GenReproducer(false),
----------------
I think you can default this to "flang" here instead of "", and then you don't need to check if it is empty later (see my later comment)


================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:13-14
 
 #include "clang/Driver/Options.h"
-
 #include <cassert>
 
----------------
Nit: stray space here


================
Comment at: clang/lib/Driver/ToolChains/Flang.cpp:71-77
+  const std::string &customFortranName = D.getFFCGenericFortranName();
+  const char *FortranName;
+  if (!customFortranName.empty())
+    FortranName = customFortranName.c_str();
+  else FortranName = "flang";
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(FortranName));
----------------
I think here you can just do `FortranName = D.getFFCGenericFortranName();`
and then 
`getToolChain().GetProgramPath(FortranName.c_str())`
as long as you have defaulted to "flang" earlier.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73951





More information about the cfe-commits mailing list