tra added inline comments.

================
Comment at: lib/Driver/Action.cpp:191-202
@@ +190,14 @@
+    const OffloadActionWorkTy &Work) const {
+  auto I = getInputs().begin();
+  auto E = getInputs().end();
+  if (I == E)
+    return;
+
+  // Skip host action
+  if (HostTC)
+    ++I;
+
+  auto TI = DevToolChains.begin();
+  for (; I != E; ++I, ++TI)
+    Work(*I, *TI, (*I)->getOffloadingArch());
+}
----------------
sfantao wrote:
> tra wrote:
> > You may want to add an assert that I and TI are both valid within the loop.
> I added an assertion for `TI`. I didn't do that for `I` though, as it is the 
> exit condition of the loop, so it will be always valid. Let me know if you 
> still want me to add that.
I don't see any changes in this function in your latest patch. Did you add that 
assert somewhere else?

I'm not worried about validity of `I` which is indeed ensured by the loop, but 
rather want to verify that number of inputs we process and number of elements 
in DevToolChains match. While running out of TI elements eary would be 
obviously wrong, I assume that exiting the loop with some remaining TI elements 
would also be unexpected and that we should assert() that it does not happen.


http://reviews.llvm.org/D18171



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to