Re: [lldb-dev] [cfe-dev] [RFC] Improving import failure checking strategy inside ASTImporter

2018-05-18 Thread Gábor Márton via lldb-dev
An other idea, couldn't we just pass the cast operation as a template
template parameter?
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] [cfe-dev] [RFC] Improving import failure checking strategy inside ASTImporter

2018-05-18 Thread Gábor Márton via lldb-dev
Hi Aleksei,

I think it is a very good idea to exploit [[nodiscard]] .
On the other hand I find a bit misleading some of the names of these
functions. `importCastedNonNull` does a simple `cast<>` inside, thus
perhaps a name `importAndCast` would better explain what happens.
Similarly, instead of `importCasted`, `importAndCastOrNull`
(import_and_cast_or_null ?) sounds better for me, what do you think?

Gabor
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev


Re: [lldb-dev] [cfe-dev] [RFC] Improving import failure checking strategy inside ASTImporter

2018-05-18 Thread Gábor Márton via lldb-dev
Of course, I think there is no need to have different functions which
differ only in the cast operation. We can use a template template parameter
for the cast operation:

template  class CastOp, typename DeclTy>
LLVM_NODISCARD bool import(DeclTy *&ToD, DeclTy *FromD) {
  if (auto Res = Importer.Import(FromD)) {
ToD = CastOp(*Res);
return false;
  }
  return true;
}

And then the usage:
  if (import(ToEPI.ExceptionSpec.SourceDecl,
 FromEPI.ExceptionSpec.SourceDecl))
return {};

Gabor

On Fri, May 18, 2018 at 8:52 PM Aleksei Sidorin 
wrote:
>
> Sorry, I didn't got the idea. Could please you explain a bit more?
>
> 18.05.2018 13:09, Gábor Márton via cfe-dev пишет:
> > An other idea, couldn't we just pass the cast operation as a template
> > template parameter?
> > ___
> > cfe-dev mailing list
> > cfe-...@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
> --
> Best regards,
> Aleksei Sidorin,
> SRR, Samsung Electronics
>
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev