[PATCH] D42301: [ASTImporter] Support LambdaExprs and improve template support

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 00:22:29 PST 2018


xazax.hun added a comment.

I do not see a test for the following changes:

- ASTImporter: don't add templated declarations into DeclContext
- ASTImporter: proper set ParmVarDecls for imported FunctionProtoTypeLoc



================
Comment at: lib/AST/ASTImporter.cpp:2085
+  case FunctionDecl::TK_MemberSpecialization: {
+    FunctionDecl *InstFD = cast_or_null<FunctionDecl>(
+          Importer.Import(FromFD->getInstantiatedFromMemberFunction()));
----------------
Use `auto` to avoid repeating type.


================
Comment at: lib/AST/ASTImporter.cpp:2100
+    auto *FTSInfo = FromFD->getTemplateSpecializationInfo();
+    FunctionTemplateDecl *Template = cast_or_null<FunctionTemplateDecl>(
+        Importer.Import(FTSInfo->getTemplate()));
----------------
Use `auto` to avoid repeating type.


================
Comment at: lib/AST/ASTImporter.cpp:2160
+
+  return false;
+}
----------------
Is the switch above meant to be exhaustive? If so, adding `LLVM_UNREACHABLE` here might be beneficial.


================
Comment at: lib/AST/ASTImporter.cpp:6138
+  CXXRecordDecl *FromClass = LE->getLambdaClass();
+  CXXRecordDecl *ToClass = dyn_cast_or_null<CXXRecordDecl>(
+        Importer.Import(FromClass));
----------------
Use `auto` to avoid repeting type.


================
Comment at: lib/AST/ASTStructuralEquivalence.cpp:1267
 
+static bool IsTemplateDeclStructurallyEquivalent(
+    StructuralEquivalenceContext &Ctx, TemplateDecl *D1, TemplateDecl *D2) {
----------------
The name if this function might be misleading. Only looking at the name I would assume that it is also checking for the templated decl itself not just the identifier and the template parameters. I think it would be nice to either change the functionality or the name.


Repository:
  rC Clang

https://reviews.llvm.org/D42301





More information about the cfe-commits mailing list