Author: oToToT Date: 2021-04-07T20:58:48+08:00 New Revision: fc1117df5b875b922ec4d4417404b26abaceaf7b
URL: https://github.com/llvm/llvm-project/commit/fc1117df5b875b922ec4d4417404b26abaceaf7b DIFF: https://github.com/llvm/llvm-project/commit/fc1117df5b875b922ec4d4417404b26abaceaf7b.diff LOG: [clang] Check AuxTarget exists when creating target in CompilerInstance D97493 separate target creation out to a single function `CompilerInstance::createTarget`. However, it would overwrite AuxTarget even if it has been set. As @kadircet recommended in D98128, this patch check the existence of AuxTarget and not overwrite it when it has been set. Reviewed By: kadircet Differential Revision: https://reviews.llvm.org/D100024 Added: Modified: clang/lib/Frontend/CompilerInstance.cpp Removed: ################################################################################ diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index b2ec18d122fb..b76baae2e013 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -104,8 +104,10 @@ bool CompilerInstance::createTarget() { if (!hasTarget()) return false; - // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation. - if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice || + // Check whether AuxTarget exists, if not, then create TargetInfo for the + // other side of CUDA/OpenMP/SYCL compilation. + if (!getAuxTarget() && + (getLangOpts().CUDA || getLangOpts().OpenMPIsDevice || getLangOpts().SYCLIsDevice) && !getFrontendOpts().AuxTriple.empty()) { auto TO = std::make_shared<TargetOptions>(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits