[PATCH] D53381: [clang-doc] Bringing bitcode tests in line
Julie Hockett via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 17 13:18:23 PDT 2018
This revision was automatically updated to reflect the committed changes.
juliehockett marked an inline comment as done.
Closed by commit rL344707: [clang-doc] Bringing bitcode tests in line (authored by juliehockett, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D53381?vs=170024&id=170033#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53381
Files:
clang-tools-extra/trunk/unittests/clang-doc/BitcodeTest.cpp
clang-tools-extra/trunk/unittests/clang-doc/ClangDocTest.h
Index: clang-tools-extra/trunk/unittests/clang-doc/ClangDocTest.h
===================================================================
--- clang-tools-extra/trunk/unittests/clang-doc/ClangDocTest.h
+++ clang-tools-extra/trunk/unittests/clang-doc/ClangDocTest.h
@@ -22,7 +22,7 @@
static const SymbolID EmptySID = SymbolID();
static const SymbolID NonEmptySID =
- SymbolID{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ SymbolID{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
NamespaceInfo *InfoAsNamespace(Info *I);
RecordInfo *InfoAsRecord(Info *I);
Index: clang-tools-extra/trunk/unittests/clang-doc/BitcodeTest.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clang-doc/BitcodeTest.cpp
+++ clang-tools-extra/trunk/unittests/clang-doc/BitcodeTest.cpp
@@ -18,15 +18,29 @@
namespace clang {
namespace doc {
-std::string writeInfo(Info *I) {
+template <typename T> static std::string writeInfo(T &I) {
SmallString<2048> Buffer;
llvm::BitstreamWriter Stream(Buffer);
ClangDocBitcodeWriter Writer(Stream);
- // Check that there was no error in the write.
- assert(Writer.dispatchInfoForWrite(I) == false);
+ Writer.emitBlock(I);
return Buffer.str().str();
}
+std::string writeInfo(Info *I) {
+ switch (I->IT) {
+ case InfoType::IT_namespace:
+ return writeInfo(*static_cast<NamespaceInfo *>(I));
+ case InfoType::IT_record:
+ return writeInfo(*static_cast<RecordInfo *>(I));
+ case InfoType::IT_enum:
+ return writeInfo(*static_cast<EnumInfo *>(I));
+ case InfoType::IT_function:
+ return writeInfo(*static_cast<FunctionInfo *>(I));
+ default:
+ return "";
+ }
+}
+
std::vector<std::unique_ptr<Info>> readInfo(StringRef Bitcode,
size_t NumInfos) {
llvm::BitstreamCursor Stream(Bitcode);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53381.170033.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181017/1a2fd1c3/attachment.bin>
More information about the cfe-commits
mailing list