aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ASTContext.cpp6
-rw-r--r--test/Index/annotate-comments-typedef.m6
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 7ba64e32f3..9107307700 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -431,9 +431,9 @@ comments::FullComment *ASTContext::getCommentForDecl(
// Attach enum's documentation to its typedef if latter
// does not have one of its own.
QualType QT = TD->getUnderlyingType();
- if (const EnumType *ET = QT->getAs<EnumType>())
- if (const EnumDecl *ED = ET->getDecl())
- if (comments::FullComment *FC = getCommentForDecl(ED, PP))
+ if (const TagType *TT = QT->getAs<TagType>())
+ if (const Decl *TD = TT->getDecl())
+ if (comments::FullComment *FC = getCommentForDecl(TD, PP))
return cloneFullComment(FC, D);
}
return NULL;
diff --git a/test/Index/annotate-comments-typedef.m b/test/Index/annotate-comments-typedef.m
index 6e5fb73520..784c51ec8c 100644
--- a/test/Index/annotate-comments-typedef.m
+++ b/test/Index/annotate-comments-typedef.m
@@ -28,3 +28,9 @@ enum E {
};
typedef enum E E_T;
// CHECK: TypedefDecl=E_T:[[@LINE-1]]:16 (Definition) FullCommentAsHTML=[<p class="para-brief"> Documentation for E </p>] FullCommentAsXML=[<Typedef file="{{[^"]+}}annotate-comments-typedef.m" line="[[@LINE-1]]" column="16"><Name>E</Name><USR>c:@E@E</USR><Declaration>typedef enum E E_T</Declaration><Abstract><Para> Documentation for E </Para></Abstract></Typedef>]
+
+/** Comment about Foo */
+typedef struct {
+ int iii;
+ } Foo;
+// CHECK: TypedefDecl=Foo:[[@LINE-1]]:11 (Definition) FullCommentAsHTML=[<p class="para-brief"> Comment about Foo </p>] FullCommentAsXML=[<Typedef file="{{[^"]+}}annotate-comments-typedef.m" line="[[@LINE-1]]" column="11"><Name>&lt;anonymous&gt;</Name><USR>c:@SA@Foo</USR><Declaration>typedef struct Foo Foo</Declaration><Abstract><Para> Comment about Foo </Para></Abstract></Typedef>]