[PATCH] D11194: Instantiate function declarations in instantiated functions.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 13:57:09 PDT 2015


rsmith added inline comments.

================
Comment at: lib/AST/DeclBase.cpp:273
@@ +272,3 @@
+    return true;
+  if (const CXXRecordDecl *ClassD = dyn_cast<CXXRecordDecl>(LDC))
+    return ClassD->isLocalClass() && !ClassD->isLambda();;
----------------
It's not necessary for this change, but to match its documentation this function should handle other kinds of `TagDecl` too (enums, C structs). Something like:

  do {
    if (LDC->isFunctionOrMethod())
      return true;
    if (!isa<TagDecl>(LDC))
      return false;
    LDC = LDC->getLexicalParent();
  } while (LDC);
  return false;

... maybe?

================
Comment at: lib/AST/DeclBase.cpp:274
@@ +273,3 @@
+  if (const CXXRecordDecl *ClassD = dyn_cast<CXXRecordDecl>(LDC))
+    return ClassD->isLocalClass() && !ClassD->isLambda();;
+  return false;
----------------
You have a double-semicolon here.

================
Comment at: lib/AST/DeclBase.cpp:274
@@ +273,3 @@
+  if (const CXXRecordDecl *ClassD = dyn_cast<CXXRecordDecl>(LDC))
+    return ClassD->isLocalClass() && !ClassD->isLambda();;
+  return false;
----------------
rsmith wrote:
> You have a double-semicolon here.
Why are you discounting lambdas here?


http://reviews.llvm.org/D11194





More information about the cfe-commits mailing list