<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 3:20 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Index: lib/AST/RecordLayoutBuilder.cpp<br>
===================================================================<br>
--- lib/AST/RecordLayoutBuilder.cpp<br>
+++ lib/AST/RecordLayoutBuilder.cpp<br>
@@ -1996,6 +1996,16 @@<br>
bool allowInlineFunctions =<br>
Context.getTargetInfo().getCXXABI().canKeyFunctionBeInline();<br>
<br>
+ if (Context.getLangOpts().CUDA) {<br>
+ const bool IsDevice = Context.getLangOpts().CUDAIsDevice;<br></blockquote><div><br></div></div></div><div>Guess you intended to use this local variable, but didn't? ^</div><span class=""><div> </div></span></div></div></div></blockquote><div>Yup. Leftover from reshuffling the code. Nuked.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ for (const CXXMethodDecl *MD : RD->methods())<br>
+ if (Context.getLangOpts().CUDAIsDevice && !MD->hasAttr<CUDADeviceAttr>())<br>
+ return nullptr;<br>
+ else if (!Context.getLangOpts().CUDAIsDevice &&<br></blockquote><div><br></div></span><div>Drop the else after return (just "if/return/if/return")<br>(and/or you could roll both conditions into one if test - potentially even using "std::any_of" (or llvm::any_of))</div><div> </div></div></div></div></blockquote><div><br></div><div>Nice. It might be just the function to do the job.</div><div><br></div><div>--Artem</div><div><br></div></div>
</div></div>