summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r--clang/lib/Driver/ToolChain.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index e131ffea5cb..d6d84e4719c 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -807,16 +807,19 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
if (DeviceOffloadKind == Action::OFK_OpenMP) {
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
const OptTable &Opts = getDriver().getOpts();
- bool NewArgAdded = false;
+ bool Modified = false;
// Handle -Xopenmp-target flags
for (Arg *A : Args) {
// Exclude flags which may only apply to the host toolchain.
- // Do not exclude flags when the host triple (AuxTriple),
- // matches the current toolchain triple.
+ // Do not exclude flags when the host triple (AuxTriple)
+ // matches the current toolchain triple. If it is not present
+ // at all, target and host share a toolchain.
if (A->getOption().matches(options::OPT_m_Group)) {
- if (getAuxTriple() && getAuxTriple()->str() == getTriple().str())
+ if (!getAuxTriple() || getAuxTriple()->str() == getTriple().str())
DAL->append(A);
+ else
+ Modified = true;
continue;
}
@@ -857,10 +860,10 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
A = XOpenMPTargetArg.release();
AllocatedArgs.push_back(A);
DAL->append(A);
- NewArgAdded = true;
+ Modified = true;
}
- if (NewArgAdded) {
+ if (Modified) {
return DAL;
} else {
delete DAL;
OpenPOWER on IntegriCloud