///
/// \param DeviceOffloadKind - The device offload kind used for the
/// translation.
- virtual llvm::opt::DerivedArgList *
- TranslateOpenMPTargetArgs(const llvm::opt::DerivedArgList &Args,
- Action::OffloadKind DeviceOffloadKind) const;
+ virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
+ const llvm::opt::DerivedArgList &Args,
+ Action::OffloadKind DeviceOffloadKind,
+ SmallVector<llvm::opt::Arg *, 4> &AllocatedArgs) const;
/// Choose a tool to use to handle the action \p JA.
///
DerivedArgList *&Entry = TCArgs[{TC, BoundArch, DeviceOffloadKind}];
if (!Entry) {
+ SmallVector<Arg *, 4> AllocatedArgs;
// Translate OpenMP toolchain arguments provided via the -Xopenmp-target flags.
- DerivedArgList *OpenMPArgs = TC->TranslateOpenMPTargetArgs(*TranslatedArgs,
- DeviceOffloadKind);
+ DerivedArgList *OpenMPArgs = TC->TranslateOpenMPTargetArgs(
+ *TranslatedArgs, DeviceOffloadKind, AllocatedArgs);
if (!OpenMPArgs) {
Entry = TC->TranslateArgs(*TranslatedArgs, BoundArch, DeviceOffloadKind);
} else {
if (!Entry)
Entry = TranslatedArgs;
+
+ // Add allocated arguments to the final DAL.
+ for (auto ArgPtr : AllocatedArgs) {
+ Entry->AddSynthesizedArg(ArgPtr);
+ }
}
return *Entry;
return VersionTuple();
}
-llvm::opt::DerivedArgList *
-ToolChain::TranslateOpenMPTargetArgs(const llvm::opt::DerivedArgList &Args,
- Action::OffloadKind DeviceOffloadKind) const {
+llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
+ const llvm::opt::DerivedArgList &Args,
+ Action::OffloadKind DeviceOffloadKind,
+ SmallVector<llvm::opt::Arg *, 4> &AllocatedArgs) const {
if (DeviceOffloadKind == Action::OFK_OpenMP) {
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
const OptTable &Opts = getDriver().getOpts();
}
XOpenMPTargetArg->setBaseArg(A);
A = XOpenMPTargetArg.release();
+ AllocatedArgs.push_back(A);
DAL->append(A);
NewArgAdded = true;
}
/// Perform several driver tests for OpenMP offloading
///
-// Until this test is stabilized on all local configurations.
-// UNSUPPORTED: linux
-
// REQUIRES: clang-driver
// REQUIRES: x86-registered-target
// REQUIRES: powerpc-registered-target