[PATCH] D100024: [clang] Check AuxTarget exists when creating target in CompilerInstance.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 7 04:11:59 PDT 2021


kadircet added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInstance.cpp:109
+  // other side of CUDA/OpenMP/SYCL compilation.
+  if (!hasAuxTarget() &&
+      (getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
----------------
oToToT wrote:
> kadircet wrote:
> > can we just do `!getAuxTarget()` and not introduce `hasAuxTarget()` ? i don't think the new api in the interface provides much value.
> After some thinking, I’m wondering might it be more flexible if we add an option to let the user determine whether overwrite AuxTarget by themselves?
> 
> Like changing the prototype to
> `bool CompilerInstance::createTarget(bool OverwriteAuxTarget = true);`
> and simply check `if (OverwriteAuxTarget && ...` here.
i think it is better to let the clients clear the target before hand via `setAuxTarget(nullptr)` (or not set it at all), then confuse them with (defaulted) extra options when calling some function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100024



More information about the cfe-commits mailing list