eandrews updated this revision to Diff 553534. eandrews added a comment. Thanks for the reviews! Requested changes have been made in latest patch
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158671/new/ https://reviews.llvm.org/D158671 Files: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h clang/lib/ExtractAPI/DeclarationFragments.cpp clang/lib/Sema/SemaTemplateInstantiateDecl.cpp Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -5062,6 +5062,7 @@ } IR{*this, PatternRec, NewRec}; TypeSourceInfo *NewSI = IR.TransformType(Function->getTypeSourceInfo()); + assert(NewSI && "Type Transform failed?"); Function->setType(NewSI->getType()); Function->setTypeSourceInfo(NewSI); Index: clang/lib/ExtractAPI/DeclarationFragments.cpp =================================================================== --- clang/lib/ExtractAPI/DeclarationFragments.cpp +++ clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -688,9 +688,9 @@ const CXXMethodDecl *Method) { DeclarationFragments Fragments; std::string Name; - if (isa<CXXConstructorDecl>(Method)) { + if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(Method)) { Name = Method->getNameAsString(); - if (dyn_cast<CXXConstructorDecl>(Method)->isExplicit()) + if (Constructor->isExplicit()) Fragments.append("explicit", DeclarationFragments::FragmentKind::Keyword) .appendSpace(); } else if (isa<CXXDestructorDecl>(Method)) Index: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h =================================================================== --- clang/include/clang/ExtractAPI/ExtractAPIVisitor.h +++ clang/include/clang/ExtractAPI/ExtractAPIVisitor.h @@ -266,7 +266,9 @@ if (Decl->isStaticDataMember()) { SymbolReference Context; - auto Record = dyn_cast<RecordDecl>(Decl->getDeclContext()); + // getDeclContext() should return a RecordDecl since we + // are currently handling a static data member. + auto *Record = cast<RecordDecl>(Decl->getDeclContext()); Context.Name = Record->getName(); Context.USR = API.recordUSR(Record); auto Access = DeclarationFragmentsBuilder::getAccessControl(Decl);
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -5062,6 +5062,7 @@ } IR{*this, PatternRec, NewRec}; TypeSourceInfo *NewSI = IR.TransformType(Function->getTypeSourceInfo()); + assert(NewSI && "Type Transform failed?"); Function->setType(NewSI->getType()); Function->setTypeSourceInfo(NewSI); Index: clang/lib/ExtractAPI/DeclarationFragments.cpp =================================================================== --- clang/lib/ExtractAPI/DeclarationFragments.cpp +++ clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -688,9 +688,9 @@ const CXXMethodDecl *Method) { DeclarationFragments Fragments; std::string Name; - if (isa<CXXConstructorDecl>(Method)) { + if (const auto *Constructor = dyn_cast<CXXConstructorDecl>(Method)) { Name = Method->getNameAsString(); - if (dyn_cast<CXXConstructorDecl>(Method)->isExplicit()) + if (Constructor->isExplicit()) Fragments.append("explicit", DeclarationFragments::FragmentKind::Keyword) .appendSpace(); } else if (isa<CXXDestructorDecl>(Method)) Index: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h =================================================================== --- clang/include/clang/ExtractAPI/ExtractAPIVisitor.h +++ clang/include/clang/ExtractAPI/ExtractAPIVisitor.h @@ -266,7 +266,9 @@ if (Decl->isStaticDataMember()) { SymbolReference Context; - auto Record = dyn_cast<RecordDecl>(Decl->getDeclContext()); + // getDeclContext() should return a RecordDecl since we + // are currently handling a static data member. + auto *Record = cast<RecordDecl>(Decl->getDeclContext()); Context.Name = Record->getName(); Context.USR = API.recordUSR(Record); auto Access = DeclarationFragmentsBuilder::getAccessControl(Decl);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits