================
@@ -492,6 +493,18 @@ void Flang::addOffloadOptions(Compilation &C, const 
InputInfoList &Inputs,
     if (Args.hasArg(options::OPT_nogpulib))
       CmdArgs.push_back("-nogpulib");
   }
+
+  // For all the host OpenMP offloading compile jobs we need to pass the 
targets
+  // information using -fopenmp-targets= option.
+  if (JA.isHostOffloading(Action::OFK_OpenMP)) {
+    SmallString<128> Targets("-fopenmp-targets=");
----------------
skatrak wrote:

> For now, I would grudgingly accept the code as-is if this was done for the 
> rest of the file, but hope that we can avoid all this code duplication in the 
> future.
> 
> Did you consider to just extract the lines from `Clang.cpp` into another 
> function to some location this is accessible to both?

I agree that we should try to avoid duplicating code like this as much as 
possible. In this case, I just followed what's been done for other similar 
options and just copied it from clang.

After a quick look, I don't see an obvious place to add this shared code, but 
it looks like one way to get there would be to create a `Driver` or similar 
class deriving from `Tool` and make that the shared parent for the `Clang` and 
`Flang` classes, putting in it common option processing code used by both. 
Something like this would probably be best done on its own patch after some 
discussion, though. In any case, I think @banach-space is the expert on this 
area, so maybe he knows of any plans already in place to improve this situation 
or can give us some pointers on how to better deal with this in the short term.

https://github.com/llvm/llvm-project/pull/100152
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to