diff options
| author | Julie Hockett <juliehockett@google.com> | 2019-07-12 18:32:00 +0000 |
|---|---|---|
| committer | Julie Hockett <juliehockett@google.com> | 2019-07-12 18:32:00 +0000 |
| commit | 2c1c9a240776e5ccfb29b8a22bb32bb7e87ac2dd (patch) | |
| tree | 01de292be1b791cca0047d25e1bed39d62e13011 /clang-tools-extra/clang-doc/BitcodeWriter.cpp | |
| parent | 13f7ddff17ba1f4c5a51c83af1c83cb501ad0653 (diff) | |
[clang-doc] Add html links to references
<a> tags are added for the parents and members of records and return type and
params of functions. The link redirects to the reference's info file.
The directory path where each info file will be saved is now generated in the
serialization phase and stored as an attribute in each Info.
Bitcode writer and reader were modified to handle the new attributes.
Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com).
Differential Revision: https://reviews.llvm.org/D63663
llvm-svn: 365937
Diffstat (limited to 'clang-tools-extra/clang-doc/BitcodeWriter.cpp')
| -rw-r--r-- | clang-tools-extra/clang-doc/BitcodeWriter.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp b/clang-tools-extra/clang-doc/BitcodeWriter.cpp index 46ae5af99f8a..2adb93609f47 100644 --- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp +++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp @@ -148,6 +148,7 @@ static const llvm::IndexedMap<RecordIdDsc, RecordIdToIndexFunctor> {MEMBER_TYPE_ACCESS, {"Access", &IntAbbrev}}, {NAMESPACE_USR, {"USR", &SymbolIDAbbrev}}, {NAMESPACE_NAME, {"Name", &StringAbbrev}}, + {NAMESPACE_PATH, {"Path", &StringAbbrev}}, {ENUM_USR, {"USR", &SymbolIDAbbrev}}, {ENUM_NAME, {"Name", &StringAbbrev}}, {ENUM_DEFLOCATION, {"DefLocation", &LocationAbbrev}}, @@ -156,6 +157,7 @@ static const llvm::IndexedMap<RecordIdDsc, RecordIdToIndexFunctor> {ENUM_SCOPED, {"Scoped", &BoolAbbrev}}, {RECORD_USR, {"USR", &SymbolIDAbbrev}}, {RECORD_NAME, {"Name", &StringAbbrev}}, + {RECORD_PATH, {"Path", &StringAbbrev}}, {RECORD_DEFLOCATION, {"DefLocation", &LocationAbbrev}}, {RECORD_LOCATION, {"Location", &LocationAbbrev}}, {RECORD_TAG_TYPE, {"TagType", &IntAbbrev}}, @@ -169,6 +171,7 @@ static const llvm::IndexedMap<RecordIdDsc, RecordIdToIndexFunctor> {REFERENCE_USR, {"USR", &SymbolIDAbbrev}}, {REFERENCE_NAME, {"Name", &StringAbbrev}}, {REFERENCE_TYPE, {"RefType", &IntAbbrev}}, + {REFERENCE_PATH, {"Path", &StringAbbrev}}, {REFERENCE_FIELD, {"Field", &IntAbbrev}}}; assert(Inits.size() == RecordIdCount); for (const auto &Init : Inits) { @@ -199,18 +202,20 @@ static const std::vector<std::pair<BlockId, std::vector<RecordId>>> {ENUM_USR, ENUM_NAME, ENUM_DEFLOCATION, ENUM_LOCATION, ENUM_MEMBER, ENUM_SCOPED}}, // Namespace Block - {BI_NAMESPACE_BLOCK_ID, {NAMESPACE_USR, NAMESPACE_NAME}}, + {BI_NAMESPACE_BLOCK_ID, + {NAMESPACE_USR, NAMESPACE_NAME, NAMESPACE_PATH}}, // Record Block {BI_RECORD_BLOCK_ID, - {RECORD_USR, RECORD_NAME, RECORD_DEFLOCATION, RECORD_LOCATION, - RECORD_TAG_TYPE, RECORD_IS_TYPE_DEF}}, + {RECORD_USR, RECORD_NAME, RECORD_PATH, RECORD_DEFLOCATION, + RECORD_LOCATION, RECORD_TAG_TYPE, RECORD_IS_TYPE_DEF}}, // Function Block {BI_FUNCTION_BLOCK_ID, {FUNCTION_USR, FUNCTION_NAME, FUNCTION_DEFLOCATION, FUNCTION_LOCATION, FUNCTION_ACCESS, FUNCTION_IS_METHOD}}, // Reference Block {BI_REFERENCE_BLOCK_ID, - {REFERENCE_USR, REFERENCE_NAME, REFERENCE_TYPE, REFERENCE_FIELD}}}; + {REFERENCE_USR, REFERENCE_NAME, REFERENCE_TYPE, REFERENCE_PATH, + REFERENCE_FIELD}}}; // AbbreviationMap @@ -381,6 +386,7 @@ void ClangDocBitcodeWriter::emitBlock(const Reference &R, FieldId Field) { emitRecord(R.USR, REFERENCE_USR); emitRecord(R.Name, REFERENCE_NAME); emitRecord((unsigned)R.RefType, REFERENCE_TYPE); + emitRecord(R.Path, REFERENCE_PATH); emitRecord((unsigned)Field, REFERENCE_FIELD); } @@ -428,6 +434,7 @@ void ClangDocBitcodeWriter::emitBlock(const NamespaceInfo &I) { StreamSubBlockGuard Block(Stream, BI_NAMESPACE_BLOCK_ID); emitRecord(I.USR, NAMESPACE_USR); emitRecord(I.Name, NAMESPACE_NAME); + emitRecord(I.Path, NAMESPACE_PATH); for (const auto &N : I.Namespace) emitBlock(N, FieldId::F_namespace); for (const auto &CI : I.Description) @@ -463,6 +470,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo &I) { StreamSubBlockGuard Block(Stream, BI_RECORD_BLOCK_ID); emitRecord(I.USR, RECORD_USR); emitRecord(I.Name, RECORD_NAME); + emitRecord(I.Path, RECORD_PATH); for (const auto &N : I.Namespace) emitBlock(N, FieldId::F_namespace); for (const auto &CI : I.Description) |
