aboutsummaryrefslogtreecommitdiff
path: root/clang-doc/Mapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-doc/Mapper.cpp')
-rw-r--r--clang-doc/Mapper.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/clang-doc/Mapper.cpp b/clang-doc/Mapper.cpp
index f3ef99e6..71e94047 100644
--- a/clang-doc/Mapper.cpp
+++ b/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,10 +34,15 @@ template <typename T> bool MapASTVisitor::mapDecl(const T *D) {
if (index::generateUSRForDecl(D, USR))
return true;
- ECtx->reportResult(llvm::toHex(llvm::toStringRef(serialize::hashUSR(USR))),
- serialize::emitInfo(D, getComment(D, D->getASTContext()),
- getLine(D, D->getASTContext()),
- getFile(D, D->getASTContext())));
+ auto I = serialize::emitInfo(
+ D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()),
+ getFile(D, D->getASTContext()), CDCtx.PublicOnly);
+
+ // 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;
}
@@ -72,13 +78,13 @@ MapASTVisitor::getComment(const NamedDecl *D, const ASTContext &Context) const {
int MapASTVisitor::getLine(const NamedDecl *D,
const ASTContext &Context) const {
- return Context.getSourceManager().getPresumedLoc(D->getLocStart()).getLine();
+ return Context.getSourceManager().getPresumedLoc(D->getBeginLoc()).getLine();
}
llvm::StringRef MapASTVisitor::getFile(const NamedDecl *D,
const ASTContext &Context) const {
return Context.getSourceManager()
- .getPresumedLoc(D->getLocStart())
+ .getPresumedLoc(D->getBeginLoc())
.getFilename();
}