r314330 - [OpenMP] Fix translation of target args

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 11:12:36 PDT 2017


Author: hahnfeld
Date: Wed Sep 27 11:12:36 2017
New Revision: 314330

URL: http://llvm.org/viewvc/llvm-project?rev=314330&view=rev
Log:
[OpenMP] Fix translation of target args

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

Modified:
    cfe/trunk/lib/Driver/Compilation.cpp

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=314330&r1=314329&r2=314330&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Wed Sep 27 11:12:36 2017
@@ -57,14 +57,16 @@ Compilation::getArgsForToolChain(const T
         *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);




More information about the cfe-commits mailing list