http://llvm.org/bugs/show_bug.cgi?id=13634
Bug #: 13634
Summary: -Wdocumentation assertion when dealing with implicit
instantiations of functions
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
terfin:clang dgregor$ cat t.cpp
template<typename T>
struct X {
/// \brief Blarg
X(T) {}
};
void bar() {
X<int> xi(5);
}
/// unattached
terfin:clang dgregor$ clang -Wdocumentation t.cpp
Assertion failed: (DeclOrParsedComment.isNull()), function setDecl, file
/Users/dgregor/Projects/llvm/tools/clang/include/clang/AST/RawCommentList.h,
line 66.
The issue is, essentially, that the implicit instantiation picks up a comment
that is already associated with the member function from which it was
instantiated.
This little hack:
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp (revision 161762)
+++ lib/AST/ASTContext.cpp (working copy)
@@ -195,6 +195,12 @@
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
if (const FunctionTemplateDecl *FTD = FD->getDescribedFunctionTemplate())
D = FTD;
+ else if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
{
+ if (FD->isFunctionTemplateSpecialization())
+ D = FD->getPrimaryTemplate();
+ else if (FunctionDecl *MemFD = FD->getInstantiatedFromMemberFunction())
+ D = MemFD;
+ }
} else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
if (const ClassTemplateDecl *CTD = RD->getDescribedClassTemplate())
D = CTD;
Seems to fix the immediate problem, but there will likely also be issues with
class template specializations and instantiations, as well as enums and static
data members, so we need a more comprehensive approach.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs