diff options
author | Brett Wilson <brettw@gmail.com> | 2022-10-24 13:48:55 -0700 |
---|---|---|
committer | Brett Wilson <brettw@gmail.com> | 2022-10-25 13:47:24 -0700 |
commit | 7231c9966e523a6fa20aa63b9a9245aff49cf881 (patch) | |
tree | 9c52baac41534579092f8fd06d0112c951784bcf /clang-tools-extra/clang-doc/BitcodeReader.cpp | |
parent | 39917b5e0174e0e4206df31da0e32b984c96c404 (diff) | |
download | llvm-7231c9966e523a6fa20aa63b9a9245aff49cf881.zip llvm-7231c9966e523a6fa20aa63b9a9245aff49cf881.tar.gz llvm-7231c9966e523a6fa20aa63b9a9245aff49cf881.tar.bz2 |
[clang-doc] Fix typedef/using output.
Provides an initializer for the TypedefInfo.IsUsing member. Previously
this member was uninitialized and would produce random output.
Adds the Description (code comments) to the bitcode reader/writer.
Previously the typedef/using descriptions were lost during the bitcode
round-trip. Adds a test for this.
Differential Revision: https://reviews.llvm.org/D136638
Diffstat (limited to 'clang-tools-extra/clang-doc/BitcodeReader.cpp')
-rw-r--r-- | clang-tools-extra/clang-doc/BitcodeReader.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp index 8e1db35..524b82d 100644 --- a/clang-tools-extra/clang-doc/BitcodeReader.cpp +++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp @@ -368,28 +368,27 @@ template <typename T> llvm::Expected<CommentInfo *> getCommentInfo(T I) { } template <> llvm::Expected<CommentInfo *> getCommentInfo(FunctionInfo *I) { - I->Description.emplace_back(); - return &I->Description.back(); + return &I->Description.emplace_back(); } template <> llvm::Expected<CommentInfo *> getCommentInfo(NamespaceInfo *I) { - I->Description.emplace_back(); - return &I->Description.back(); + return &I->Description.emplace_back(); } template <> llvm::Expected<CommentInfo *> getCommentInfo(RecordInfo *I) { - I->Description.emplace_back(); - return &I->Description.back(); + return &I->Description.emplace_back(); } template <> llvm::Expected<CommentInfo *> getCommentInfo(MemberTypeInfo *I) { - I->Description.emplace_back(); - return &I->Description.back(); + return &I->Description.emplace_back(); } template <> llvm::Expected<CommentInfo *> getCommentInfo(EnumInfo *I) { - I->Description.emplace_back(); - return &I->Description.back(); + return &I->Description.emplace_back(); +} + +template <> llvm::Expected<CommentInfo *> getCommentInfo(TypedefInfo *I) { + return &I->Description.emplace_back(); } template <> llvm::Expected<CommentInfo *> getCommentInfo(CommentInfo *I) { |