diff options
Diffstat (limited to 'clang-tools-extra/clang-doc/Mapper.cpp')
| -rw-r--r-- | clang-tools-extra/clang-doc/Mapper.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index fb0b42af3ee..4456c1ed9b8 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -13,6 +13,7 @@ #include "clang/AST/Comment.h" #include "clang/Index/USRGeneration.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/Error.h" using clang::comments::FullComment; @@ -33,14 +34,15 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D) { if (index::generateUSRForDecl(D, USR)) return true; - std::string info = serialize::emitInfo( + auto I = serialize::emitInfo( D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()), getFile(D, D->getASTContext()), CDCtx.PublicOnly); - if (info != "") - CDCtx.ECtx->reportResult( - llvm::toHex(llvm::toStringRef(serialize::hashUSR(USR))), info); - + // A null in place of I indicates that the serializer is skipping this decl + // for some reason (e.g. we're only reporting public decls). + if (I) + CDCtx.ECtx->reportResult(llvm::toHex(llvm::toStringRef(I->USR)), + serialize::serialize(I)); return true; } |

