aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-doc
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-doc')
-rw-r--r--clang-tools-extra/clang-doc/BitcodeReader.cpp6
-rw-r--r--clang-tools-extra/clang-doc/BitcodeWriter.cpp12
-rw-r--r--clang-tools-extra/clang-doc/HTMLGenerator.cpp11
-rw-r--r--clang-tools-extra/clang-doc/MDGenerator.cpp6
-rw-r--r--clang-tools-extra/clang-doc/Mapper.cpp17
-rw-r--r--clang-tools-extra/clang-doc/Mapper.h3
-rw-r--r--clang-tools-extra/clang-doc/Representation.h24
-rw-r--r--clang-tools-extra/clang-doc/Serialize.cpp67
-rw-r--r--clang-tools-extra/clang-doc/Serialize.h28
-rw-r--r--clang-tools-extra/clang-doc/YAMLGenerator.cpp2
10 files changed, 93 insertions, 83 deletions
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index 92674c5..f8e338eb7 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -79,7 +79,8 @@ static llvm::Error decodeRecord(const Record &R, std::optional<Location> &Field,
if (R[0] > INT_MAX)
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"integer too large to parse");
- Field.emplace(static_cast<int>(R[0]), Blob, static_cast<bool>(R[1]));
+ Field.emplace(static_cast<int>(R[0]), static_cast<int>(R[1]), Blob,
+ static_cast<bool>(R[2]));
return llvm::Error::success();
}
@@ -130,7 +131,8 @@ static llvm::Error decodeRecord(const Record &R,
if (R[0] > INT_MAX)
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"integer too large to parse");
- Field.emplace_back(static_cast<int>(R[0]), Blob, static_cast<bool>(R[1]));
+ Field.emplace_back(static_cast<int>(R[0]), static_cast<int>(R[1]), Blob,
+ static_cast<bool>(R[2]));
return llvm::Error::success();
}
diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
index 6545629..f0a445e 100644
--- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp
@@ -78,13 +78,16 @@ static void genLocationAbbrev(std::shared_ptr<llvm::BitCodeAbbrev> &Abbrev) {
{// 0. Fixed-size integer (line number)
llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
BitCodeConstants::LineNumberSize),
- // 1. Boolean (IsFileInRootDir)
+ // 1. Fixed-size integer (start line number)
+ llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
+ BitCodeConstants::LineNumberSize),
+ // 2. Boolean (IsFileInRootDir)
llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
BitCodeConstants::BoolSize),
- // 2. Fixed-size integer (length of the following string (filename))
+ // 3. Fixed-size integer (length of the following string (filename))
llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed,
BitCodeConstants::StringLengthSize),
- // 3. The string blob
+ // 4. The string blob
llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob)});
}
@@ -357,7 +360,8 @@ void ClangDocBitcodeWriter::emitRecord(const Location &Loc, RecordId ID) {
if (!prepRecordData(ID, true))
return;
// FIXME: Assert that the line number is of the appropriate size.
- Record.push_back(Loc.LineNumber);
+ Record.push_back(Loc.StartLineNumber);
+ Record.push_back(Loc.EndLineNumber);
assert(Loc.Filename.size() < (1U << BitCodeConstants::StringLengthSize));
Record.push_back(Loc.IsFileInRootDir);
Record.push_back(Loc.Filename.size());
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 6d061b3..4ad5ba2 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -455,7 +455,7 @@ static std::unique_ptr<TagNode> writeSourceFileRef(const ClangDocContext &CDCtx,
if (!L.IsFileInRootDir && !CDCtx.RepositoryUrl)
return std::make_unique<TagNode>(
- HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
+ HTMLTag::TAG_P, "Defined at line " + std::to_string(L.StartLineNumber) +
" of file " + L.Filename);
SmallString<128> FileURL(CDCtx.RepositoryUrl.value_or(""));
@@ -472,13 +472,14 @@ static std::unique_ptr<TagNode> writeSourceFileRef(const ClangDocContext &CDCtx,
llvm::sys::path::Style::windows));
auto Node = std::make_unique<TagNode>(HTMLTag::TAG_P);
Node->Children.emplace_back(std::make_unique<TextNode>("Defined at line "));
- auto LocNumberNode =
- std::make_unique<TagNode>(HTMLTag::TAG_A, std::to_string(L.LineNumber));
+ auto LocNumberNode = std::make_unique<TagNode>(
+ HTMLTag::TAG_A, std::to_string(L.StartLineNumber));
// The links to a specific line in the source code use the github /
// googlesource notation so it won't work for all hosting pages.
LocNumberNode->Attributes.emplace_back(
- "href", formatv("{0}#{1}{2}", FileURL,
- CDCtx.RepositoryLinePrefix.value_or(""), L.LineNumber));
+ "href",
+ formatv("{0}#{1}{2}", FileURL, CDCtx.RepositoryLinePrefix.value_or(""),
+ L.StartLineNumber));
Node->Children.emplace_back(std::move(LocNumberNode));
Node->Children.emplace_back(std::make_unique<TextNode>(" of file "));
auto LocFileNode = std::make_unique<TagNode>(
diff --git a/clang-tools-extra/clang-doc/MDGenerator.cpp b/clang-tools-extra/clang-doc/MDGenerator.cpp
index 43f1d7b..ccd6175 100644
--- a/clang-tools-extra/clang-doc/MDGenerator.cpp
+++ b/clang-tools-extra/clang-doc/MDGenerator.cpp
@@ -56,12 +56,12 @@ static void writeSourceFileRef(const ClangDocContext &CDCtx, const Location &L,
raw_ostream &OS) {
if (!CDCtx.RepositoryUrl) {
- OS << "*Defined at " << L.Filename << "#" << std::to_string(L.LineNumber)
- << "*";
+ OS << "*Defined at " << L.Filename << "#"
+ << std::to_string(L.StartLineNumber) << "*";
} else {
OS << formatv("*Defined at [#{0}{1}{2}](#{0}{1}{3})*",
- CDCtx.RepositoryLinePrefix.value_or(""), L.LineNumber,
+ CDCtx.RepositoryLinePrefix.value_or(""), L.StartLineNumber,
L.Filename, *CDCtx.RepositoryUrl);
}
OS << "\n\n";
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp
index 3ccf026..a17645c 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -28,6 +28,17 @@ template <typename T> static bool isTypedefAnonRecord(const T *D) {
return false;
}
+Location MapASTVisitor::getDeclLocation(const NamedDecl *D) const {
+ bool IsFileInRootDir;
+ llvm::SmallString<128> File =
+ getFile(D, D->getASTContext(), CDCtx.SourceRoot, IsFileInRootDir);
+ SourceManager &SM = D->getASTContext().getSourceManager();
+ int Start = SM.getPresumedLoc(D->getBeginLoc()).getLine();
+ int End = SM.getPresumedLoc(D->getEndLoc()).getLine();
+
+ return Location(Start, End, File, IsFileInRootDir);
+}
+
void MapASTVisitor::HandleTranslationUnit(ASTContext &Context) {
TraverseDecl(Context.getTranslationUnitDecl());
}
@@ -59,9 +70,9 @@ bool MapASTVisitor::mapDecl(const T *D, bool IsDefinition) {
bool IsFileInRootDir;
llvm::SmallString<128> File =
getFile(D, D->getASTContext(), CDCtx.SourceRoot, IsFileInRootDir);
- auto [Child, Parent] = serialize::emitInfo(
- D, getComment(D, D->getASTContext()), getLine(D, D->getASTContext()),
- File, IsFileInRootDir, CDCtx.PublicOnly);
+ auto [Child, Parent] =
+ serialize::emitInfo(D, getComment(D, D->getASTContext()),
+ getDeclLocation(D), CDCtx.PublicOnly);
// A null in place of a valid Info indicates that the serializer is skipping
// this decl for some reason (e.g. we're only reporting public decls).
diff --git a/clang-tools-extra/clang-doc/Mapper.h b/clang-tools-extra/clang-doc/Mapper.h
index 75c8e94..36322ea 100644
--- a/clang-tools-extra/clang-doc/Mapper.h
+++ b/clang-tools-extra/clang-doc/Mapper.h
@@ -46,6 +46,9 @@ private:
template <typename T> bool mapDecl(const T *D, bool IsDefinition);
int getLine(const NamedDecl *D, const ASTContext &Context) const;
+
+ Location getDeclLocation(const NamedDecl *D) const;
+
llvm::SmallString<128> getFile(const NamedDecl *D, const ASTContext &Context,
StringRef RootDir,
bool &IsFileInRootDir) const;
diff --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index d7f2453..b0b34fc 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -241,31 +241,29 @@ struct MemberTypeInfo : public FieldTypeInfo {
};
struct Location {
- Location(int LineNumber = 0, StringRef Filename = StringRef(),
- bool IsFileInRootDir = false)
- : LineNumber(LineNumber), Filename(Filename),
- IsFileInRootDir(IsFileInRootDir) {}
+ Location(int StartLineNumber = 0, int EndLineNumber = 0,
+ StringRef Filename = StringRef(), bool IsFileInRootDir = false)
+ : StartLineNumber(StartLineNumber), EndLineNumber(EndLineNumber),
+ Filename(Filename), IsFileInRootDir(IsFileInRootDir) {}
bool operator==(const Location &Other) const {
- return std::tie(LineNumber, Filename) ==
- std::tie(Other.LineNumber, Other.Filename);
+ return std::tie(StartLineNumber, EndLineNumber, Filename) ==
+ std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
}
- bool operator!=(const Location &Other) const {
- return std::tie(LineNumber, Filename) !=
- std::tie(Other.LineNumber, Other.Filename);
- }
+ bool operator!=(const Location &Other) const { return !(*this == Other); }
// This operator is used to sort a vector of Locations.
// No specific order (attributes more important than others) is required. Any
// sort is enough, the order is only needed to call std::unique after sorting
// the vector.
bool operator<(const Location &Other) const {
- return std::tie(LineNumber, Filename) <
- std::tie(Other.LineNumber, Other.Filename);
+ return std::tie(StartLineNumber, EndLineNumber, Filename) <
+ std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
}
- int LineNumber = 0; // Line number of this Location.
+ int StartLineNumber = 0; // Line number of this Location.
+ int EndLineNumber = 0;
SmallString<32> Filename; // File for this Location.
bool IsFileInRootDir = false; // Indicates if file is inside root directory
};
diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp
index 8ddc34b..18db427 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -535,22 +535,18 @@ static void populateInfo(Info &I, const T *D, const FullComment *C,
template <typename T>
static void populateSymbolInfo(SymbolInfo &I, const T *D, const FullComment *C,
- int LineNumber, StringRef Filename,
- bool IsFileInRootDir,
- bool &IsInAnonymousNamespace) {
+ Location Loc, bool &IsInAnonymousNamespace) {
populateInfo(I, D, C, IsInAnonymousNamespace);
if (D->isThisDeclarationADefinition())
- I.DefLoc.emplace(LineNumber, Filename, IsFileInRootDir);
+ I.DefLoc = Loc;
else
- I.Loc.emplace_back(LineNumber, Filename, IsFileInRootDir);
+ I.Loc.emplace_back(Loc);
}
static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
- const FullComment *FC, int LineNumber,
- StringRef Filename, bool IsFileInRootDir,
+ const FullComment *FC, Location Loc,
bool &IsInAnonymousNamespace) {
- populateSymbolInfo(I, D, FC, LineNumber, Filename, IsFileInRootDir,
- IsInAnonymousNamespace);
+ populateSymbolInfo(I, D, FC, Loc, IsInAnonymousNamespace);
auto &LO = D->getLangOpts();
I.ReturnType = getTypeInfoForType(D->getReturnType(), LO);
parseParameters(I, D);
@@ -579,7 +575,7 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
static void populateMemberTypeInfo(MemberTypeInfo &I, const Decl *D) {
assert(D && "Expect non-null FieldDecl in populateMemberTypeInfo");
- ASTContext& Context = D->getASTContext();
+ ASTContext &Context = D->getASTContext();
// TODO investigate whether we can use ASTContext::getCommentForDecl instead
// of this logic. See also similar code in Mapper.cpp.
RawComment *Comment = Context.getRawCommentForDeclNoCache(D);
@@ -643,8 +639,7 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
// reference, its value is not relevant in here so it's not used
// anywhere besides the function call.
bool IsInAnonymousNamespace;
- populateFunctionInfo(FI, MD, /*FullComment=*/{}, /*LineNumber=*/{},
- /*FileName=*/{}, IsFileInRootDir,
+ populateFunctionInfo(FI, MD, /*FullComment=*/{}, /*Location=*/{},
IsInAnonymousNamespace);
FI.Access =
getFinalAccessSpecifier(BI.Access, MD->getAccessUnsafe());
@@ -662,8 +657,8 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const NamespaceDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
auto NSI = std::make_unique<NamespaceInfo>();
bool IsInAnonymousNamespace = false;
populateInfo(*NSI, D, FC, IsInAnonymousNamespace);
@@ -683,12 +678,11 @@ emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const RecordDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
auto RI = std::make_unique<RecordInfo>();
bool IsInAnonymousNamespace = false;
- populateSymbolInfo(*RI, D, FC, LineNumber, File, IsFileInRootDir,
- IsInAnonymousNamespace);
+ populateSymbolInfo(*RI, D, FC, Loc, IsInAnonymousNamespace);
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
@@ -701,7 +695,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
}
// TODO: remove first call to parseBases, that function should be deleted
parseBases(*RI, C);
- parseBases(*RI, C, IsFileInRootDir, PublicOnly, true);
+ parseBases(*RI, C, /*IsFileInRootDir=*/true, PublicOnly, /*IsParent=*/true);
}
RI->Path = getInfoRelativePath(RI->Namespace);
@@ -750,12 +744,11 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const FunctionDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
FunctionInfo Func;
bool IsInAnonymousNamespace = false;
- populateFunctionInfo(Func, D, FC, LineNumber, File, IsFileInRootDir,
- IsInAnonymousNamespace);
+ populateFunctionInfo(Func, D, FC, Loc, IsInAnonymousNamespace);
Func.Access = clang::AccessSpecifier::AS_none;
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
@@ -765,12 +758,11 @@ emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const CXXMethodDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
FunctionInfo Func;
bool IsInAnonymousNamespace = false;
- populateFunctionInfo(Func, D, FC, LineNumber, File, IsFileInRootDir,
- IsInAnonymousNamespace);
+ populateFunctionInfo(Func, D, FC, Loc, IsInAnonymousNamespace);
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
@@ -795,16 +787,15 @@ emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const TypedefDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
TypedefInfo Info;
-
bool IsInAnonymousNamespace = false;
populateInfo(Info, D, FC, IsInAnonymousNamespace);
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
- Info.DefLoc.emplace(LineNumber, File, IsFileInRootDir);
+ Info.DefLoc = Loc;
auto &LO = D->getLangOpts();
Info.Underlying = getTypeInfoForType(D->getUnderlyingType(), LO);
if (Info.Underlying.Type.Name.empty()) {
@@ -822,8 +813,8 @@ emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
// A type alias is a C++ "using" declaration for a type. It gets mapped to a
// TypedefInfo with the IsUsing flag set.
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const TypeAliasDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
TypedefInfo Info;
bool IsInAnonymousNamespace = false;
@@ -831,7 +822,7 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
- Info.DefLoc.emplace(LineNumber, File, IsFileInRootDir);
+ Info.DefLoc = Loc;
auto &LO = D->getLangOpts();
Info.Underlying = getTypeInfoForType(D->getUnderlyingType(), LO);
Info.IsUsing = true;
@@ -841,12 +832,12 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
}
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
+emitInfo(const EnumDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly) {
EnumInfo Enum;
bool IsInAnonymousNamespace = false;
- populateSymbolInfo(Enum, D, FC, LineNumber, File, IsFileInRootDir,
- IsInAnonymousNamespace);
+ populateSymbolInfo(Enum, D, FC, Loc, IsInAnonymousNamespace);
+
if (!shouldSerializeInfo(PublicOnly, IsInAnonymousNamespace, D))
return {};
diff --git a/clang-tools-extra/clang-doc/Serialize.h b/clang-tools-extra/clang-doc/Serialize.h
index 4194679..7e6cbb7 100644
--- a/clang-tools-extra/clang-doc/Serialize.h
+++ b/clang-tools-extra/clang-doc/Serialize.h
@@ -37,36 +37,36 @@ namespace serialize {
// its parent scope. For NamespaceDecl and RecordDecl both elements are not
// nullptr.
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const NamespaceDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const RecordDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const EnumDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const FunctionDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
emitInfo(const VarDecl *D, const FullComment *FC, int LineNumber,
StringRef File, bool IsFileInRootDir, bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const CXXMethodDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const TypedefDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
-emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
- StringRef File, bool IsFileInRootDir, bool PublicOnly);
+emitInfo(const TypeAliasDecl *D, const FullComment *FC, Location Loc,
+ bool PublicOnly);
// Function to hash a given USR value for storage.
// As USRs (Unified Symbol Resolution) could be large, especially for functions
diff --git a/clang-tools-extra/clang-doc/YAMLGenerator.cpp b/clang-tools-extra/clang-doc/YAMLGenerator.cpp
index 1b741f5..8c110b3 100644
--- a/clang-tools-extra/clang-doc/YAMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/YAMLGenerator.cpp
@@ -169,7 +169,7 @@ static void commentInfoMapping(IO &IO, CommentInfo &I) {
template <> struct MappingTraits<Location> {
static void mapping(IO &IO, Location &Loc) {
- IO.mapOptional("LineNumber", Loc.LineNumber, 0);
+ IO.mapOptional("LineNumber", Loc.StartLineNumber, 0);
IO.mapOptional("Filename", Loc.Filename, SmallString<32>());
}
};