[cfe-dev] index library

Andrew Sutton andrew.n.sutton at gmail.com
Thu Jan 14 11:05:34 PST 2010


> Please continue sending these to cfe-dev rather than only me.  I will
> definitely look at them in either case, but it's good to be open.
>

Sorry about that. I wasn't paying attention to the "Reply-To". I'm
responding to the list and can re-post the patches later.


> Looking at the PCH patch, your general approach seems good, but I'm not
> sure why you've introduced PCHReader/Writer::VisitFunctionBase rather than
> just calling VisitFunctionDecl from all the subclass methods.  Is there some
> reason I'm not recalling that the param references have to come last in the
> record?
>

I wasn't sure if ordering of records mattered or not. I was trying to
preserve the same basic ordering of records for Method and kin, and not set
the Code member twice. In the end, it probably won't matter too much.

I'll experiment a little and roll back that change if it's not a big deal.

+void PCHDeclWriter::visitFunctionTemplateDecl(FunctionTemplateDecl *D) {
> +  VisitTemplateDecl(D);
> +  FunctionDecl* Func = D->getTemplatedDecl();
> +  if (CXXConstructorDecl* Ctor = dyn_cast<CXXConstructorDecl>(Func)) {
> +    VisitCXXConstructorDecl(Ctor);
> +  } else {
> +    VisitFunctionDecl(Func);
> +  }
> +  Code = pch::DECL_FUNCTION_TEMPLATE;
> +}
>
> The easier and faster way to do this is to call
> Visit(D->getTemplatedDecl()).
>

Good point :) I actually forgot that I'd written it that way.


> Eventually it'll need to support anything you can get in C, ObjC, C++, or
> ObjC++.  That is, it will need to support everything that clang can produce.
>
Everything which is a DeclContext needs a cursor, but not necessarily its
> own cursor type.  CXXRecordDecls need their own cursor type because of the
> base clauses;  CXXConstructorDecls need their own cursor type because of the
> initializers;  everything else should be able to use Function.  But I'm not
> totally sure;  I've done relatively little work in here.
>

I'll have to spend some time digesting that information.

Andrew Sutton
andrew.n.sutton at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100114/c90e53fd/attachment.html>


More information about the cfe-dev mailing list