[cfe-commits] r162238 - /cfe/trunk/lib/AST/ASTContext.cpp

Dmitri Gribenko gribozavr at gmail.com
Mon Aug 20 15:36:31 PDT 2012


Author: gribozavr
Date: Mon Aug 20 17:36:31 2012
New Revision: 162238

URL: http://llvm.org/viewvc/llvm-project?rev=162238&view=rev
Log:
Attaching comments to declarations: ignore implicit decls.  Decl::isImplicit()
does not return true for all implicit decls currently.

This should fix PR13634 for now, but Decl::isImplicit() should be fixed, too.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=162238&r1=162237&r2=162238&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Aug 20 17:36:31 2012
@@ -67,11 +67,29 @@
     return NULL;
 
   // User can not attach documentation to implicit instantiations.
+  // FIXME: all these implicit instantiations shoud be marked as implicit
+  // declarations and get caught by condition above.
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
       return NULL;
   }
 
+  if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
+    if (VD->isStaticDataMember() &&
+        VD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
+      return NULL;
+  }
+
+  if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(D)) {
+    if (CRD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
+      return NULL;
+  }
+
+  if (const EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
+    if (ED->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
+      return NULL;
+  }
+
   // TODO: handle comments for function parameters properly.
   if (isa<ParmVarDecl>(D))
     return NULL;





More information about the cfe-commits mailing list