[PATCH] D112013: [clang][ASTImporter] Fix for importing functions with EST_Unevaluated prototype.

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 19 10:03:06 PDT 2021


shafik added inline comments.


================
Comment at: clang/unittests/AST/ASTImporterTest.cpp:6180
+  ASSERT_FALSE(FromCtor->getTypeSourceInfo());
+  // Set a TypeSourceInfo for the function, this state may occur in reality.
+  TypeSourceInfo *FromTSI = FromTU->getASTContext().getTrivialTypeSourceInfo(
----------------
balazske wrote:
> shafik wrote:
> > steakhal wrote:
> > > Perhaps, put here a `FIXME` to replace this with a real-world scenario.
> > I think it is useful to have cases that we run into in practice as a regression test but it would be nice to see a more general test as well.
> What means a "more general test"? Code where the `setTypeSourceInfo` is not needed? I just could not find out why there is no TypeSourceInfo set. The involved code part looks like this (comes from Bitcoin):
> ```
> void RegisterSharedValidationInterface(std::shared_ptr<CValidationInterface> pwalletIn) {
>     // Each connection captures pwalletIn to ensure that each callback is
>     // executed before pwalletIn is destroyed. For more details see #18338.
>     g_signals.m_internals->Register(std::move(pwalletIn));
> }
> 
> void RegisterValidationInterface(CValidationInterface* callbacks)
> {
>     // Create a shared_ptr with a no-op deleter - CValidationInterface lifecycle
>     // is managed by the caller.
>     RegisterSharedValidationInterface({callbacks, [](CValidationInterface*){}});
>     //                                            ^ This is the lambda to be imported.
> }
> ```
> If the same code is used in the test and a simple `CValidationInterface` and `std::shared_ptr` with appropriate constructor is added there is still no `TypeSourceInfo` in the needed place.
Yeah, that is what I meant, a test that did not require the `setTypeSourceInfo` hand crafting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112013/new/

https://reviews.llvm.org/D112013



More information about the cfe-commits mailing list