[PATCH] D71018: [ASTImporter] Improved import of TypeSourceInfo (TypeLoc)

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 08:16:31 PST 2020


martong marked 3 inline comments as done.
martong added inline comments.


================
Comment at: clang/lib/AST/ASTImporter.cpp:8043
+
+  Error VisitFunctionTypeLoc(FunctionTypeLoc From) {
+    auto To = ToL.castAs<FunctionTypeLoc>();
----------------
balazske wrote:
> martong wrote:
> > a_sidorin wrote:
> > > Does this import interacts well with type loc import partially done at L3258 (VisitFunctionDecl)? Should we merge them?
> > I think we should check here whether the given ParmVarDecl had been imported previously and if yes then set that with `setParam`, otherwise it could be set to a nullptr. @balazske what do you think?
> Probably we could get the `FunctionTypeLoc` from `TInfo` (this is the first TypeLoc there?) and set the parameters (that are set to nullptr at line 8055), at this loop in `VisitFunctionDecl`:
> ```
>   // Set the parameters.
>   for (auto *Param : Parameters) {
>     Param->setOwningFunction(ToFunction);
>     ToFunction->addDeclInternal(Param);
>   }
>   ToFunction->setParams(Parameters);
> ```
Guys, I moved the TypeLoc import part of VisitFunctionDecl to here. But, this is possible only if first we import the parameters and only then we import the TypeLoc (TypeSourceInfo) in VisitFunctionDecl, so I made that reorganization too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71018





More information about the cfe-commits mailing list