[PATCH] D58494: [ASTImporter] Handle redecl chain of FunctionTemplateDecls

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 24 15:32:36 PST 2019


a_sidorin added a comment.

Hi Gabor,
The patch looks OK overall but I have some comments inline.



================
Comment at: lib/AST/ASTImporter.cpp:4966
 // it has any definition in the redecl chain.
-static ClassTemplateDecl *getDefinition(ClassTemplateDecl *D) {
-  CXXRecordDecl *ToTemplatedDef = D->getTemplatedDecl()->getDefinition();
+template <typename T> static auto getDefinition(T *D) -> T * {
+  auto *ToTemplatedDef = D->getTemplatedDecl()->getDefinition();
----------------
We should point that this function is for TemplateDecls only somehow. But we can't just pass TemplateDecl as the parameter due to loss of the actual return type. Maybewe should rename this function into "getTemplateDefinition()"?


================
Comment at: lib/AST/ASTImporter.cpp:5563
+          // TODO: handle conflicting names
+        } // linkage
+      }   // template
----------------
We don't usually put such comments after control flow statements. If they are really needed, it is a good sign that a function must be split, and it's better to leave a FIXME for this (or do the split).


Repository:
  rC Clang

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

https://reviews.llvm.org/D58494





More information about the cfe-commits mailing list