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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 26 08:20:41 PST 2019

martong added inline comments.

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();
a_sidorin wrote:
> 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()"?
Ok, I changed that to `getTemplateDefinition`.

Comment at: lib/AST/ASTImporter.cpp:5563
+          // TODO: handle conflicting names
+        } // linkage
+      }   // template
a_sidorin wrote:
> 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).
Ok, I removed these comments and added a FIXME.

  rC Clang



More information about the cfe-commits mailing list