[PATCH] D15309: [CUDA] emit vtables only for classes with methods usable on this side of compilation.
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 7 15:55:59 PST 2015
On Mon, Dec 7, 2015 at 3:20 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Index: lib/AST/RecordLayoutBuilder.cpp
>> ===================================================================
>> --- lib/AST/RecordLayoutBuilder.cpp
>> +++ lib/AST/RecordLayoutBuilder.cpp
>> @@ -1996,6 +1996,16 @@
>> bool allowInlineFunctions =
>> Context.getTargetInfo().getCXXABI().canKeyFunctionBeInline();
>>
>> + if (Context.getLangOpts().CUDA) {
>> + const bool IsDevice = Context.getLangOpts().CUDAIsDevice;
>>
>
> Guess you intended to use this local variable, but didn't? ^
>
>
Yup. Leftover from reshuffling the code. Nuked.
> + for (const CXXMethodDecl *MD : RD->methods())
>> + if (Context.getLangOpts().CUDAIsDevice &&
>> !MD->hasAttr<CUDADeviceAttr>())
>> + return nullptr;
>> + else if (!Context.getLangOpts().CUDAIsDevice &&
>>
>
> Drop the else after return (just "if/return/if/return")
> (and/or you could roll both conditions into one if test - potentially even
> using "std::any_of" (or llvm::any_of))
>
>
Nice. It might be just the function to do the job.
--Artem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151207/9284e461/attachment.html>
More information about the cfe-commits
mailing list