[PATCH] D63367: [clang-doc] Add basic support for templates and typedef
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 14 17:48:48 PDT 2019
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-doc/Serialize.cpp:182
static RecordDecl *getDeclForType(const QualType &T) {
- auto *Ty = T->getAs<RecordType>();
- if (!Ty)
- return nullptr;
- return Ty->getDecl()->getDefinition();
+ if (const auto *D = T->getAsRecordDecl())
+ return D->getDefinition();
----------------
Please don't use auto because type is not spelled in same statement.
================
Comment at: clang-tools-extra/clang-doc/Serialize.cpp:252
+ if (const auto *Ty = B.getType()->getAs<TemplateSpecializationType>()) {
+ const auto *D = Ty->getTemplateName().getAsTemplateDecl();
+ I.Parents.emplace_back(getUSRForDecl(D), B.getType().getAsString(),
----------------
Please don't use auto because type is not spelled in same statement.
================
Comment at: clang-tools-extra/clang-doc/Serialize.cpp:255
+ InfoType::IT_record);
+ } else if (const auto *P = getDeclForType(B.getType()))
I.Parents.emplace_back(getUSRForDecl(P), P->getNameAsString(),
----------------
Please don't use auto because type is not spelled in same statement.
================
Comment at: clang-tools-extra/clang-doc/Serialize.cpp:350
+ if (const auto *C = dyn_cast<CXXRecordDecl>(D)) {
+ if (const auto *TD = C->getTypedefNameForAnonDecl()) {
+ I->Name = TD->getNameAsString();
----------------
Please don't use auto because type is not spelled in same statement.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63367/new/
https://reviews.llvm.org/D63367
More information about the cfe-commits
mailing list