ToolChain::TranslateArgs() returns nullptr if no changes are performed.
This would currently mean that OpenMPArgs are lost. Patch fixes this
by falling back to simply using OpenMPArgs in that case.
Differential Revision: https://reviews.llvm.org/D38259
llvm-svn: 314330
*TranslatedArgs, DeviceOffloadKind, AllocatedArgs);
if (!OpenMPArgs) {
Entry = TC->TranslateArgs(*TranslatedArgs, BoundArch, DeviceOffloadKind);
+ if (!Entry)
+ Entry = TranslatedArgs;
} else {
Entry = TC->TranslateArgs(*OpenMPArgs, BoundArch, DeviceOffloadKind);
- delete OpenMPArgs;
+ if (!Entry)
+ Entry = OpenMPArgs;
+ else
+ delete OpenMPArgs;
}
- if (!Entry)
- Entry = TranslatedArgs;
-
// Add allocated arguments to the final DAL.
for (auto ArgPtr : AllocatedArgs) {
Entry->AddSynthesizedArg(ArgPtr);