[PATCH] D45815: [libclang] Allow skipping function bodies in preamble only

Nikolai Kosjar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 27 07:30:55 PDT 2018


nik added a comment.

OK, to skip all function bodies in the preamble except for template functions and functions within a template class, I've amended the previous diff with:

- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -102,9 +102,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, }

  if (SkipFunctionBodies != SkipFunctionBodiesKind::None && +      TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate && +      !isa<ClassTemplateDecl>(getCurrentClass().TagOrTemplate) && +      !isa<ClassTemplateSpecializationDecl>(getCurrentClass().TagOrTemplate) && +      !isa<ClassTemplatePartialSpecializationDecl>( +          getCurrentClass().TagOrTemplate) && (!FnD || Actions.canSkipFunctionBody(FnD)) && trySkippingFunctionBody()) { Actions.ActOnSkippedFunctionBody(FnD);

I'm not sure whether this covers all cases, but here are the timing in relation to others:

Reparse for skipping all function bodies: 0.2s
Reparse for skipping all function bodies except template functions (previous patch set, not handling function bodies within template classes): 0.27s
Reparse for skipping all function bodies with the diff above (fixing another case + ignoring function bodies in templates): 0.44s
Reparse without skipping any function bodies in the preamble: 0.51s

As I said, I'm not sure whether this diff covered all cases, but it can get only more worse than 0.44s :) That's enough for me to stop here.


Repository:
  rC Clang

https://reviews.llvm.org/D45815





More information about the cfe-commits mailing list