[PATCH] D66151: [clang-doc] Fix bitcode writer

Diego Astiazarán via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 10:26:44 PDT 2019


DiegoAstiazaran created this revision.
DiegoAstiazaran added reviewers: jakehehrlich, juliehockett.
DiegoAstiazaran added a project: clang-tools-extra.

Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo.
This is added and corresponding test is included.


https://reviews.llvm.org/D66151

Files:
  clang-tools-extra/clang-doc/BitcodeWriter.cpp
  clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp


Index: clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp
===================================================================
--- clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp
+++ clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp
@@ -126,8 +126,7 @@
   I.IsMethod = true;
   I.Parent = Reference(EmptySID, "Parent", InfoType::IT_record);
 
-  // TODO: fix access
-  // I.Access = AccessSpecifier::AS_private;
+  I.Access = AccessSpecifier::AS_private;
 
   std::string WriteResult = writeInfo(&I);
   EXPECT_TRUE(WriteResult.size() > 0);
Index: clang-tools-extra/clang-doc/BitcodeWriter.cpp
===================================================================
--- clang-tools-extra/clang-doc/BitcodeWriter.cpp
+++ clang-tools-extra/clang-doc/BitcodeWriter.cpp
@@ -510,6 +510,7 @@
     emitBlock(N, FieldId::F_namespace);
   for (const auto &CI : I.Description)
     emitBlock(CI);
+  emitRecord(I.Access, FUNCTION_ACCESS);
   emitRecord(I.IsMethod, FUNCTION_IS_METHOD);
   if (I.DefLoc)
     emitRecord(I.DefLoc.getValue(), FUNCTION_DEFLOCATION);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66151.214871.patch
Type: text/x-patch
Size: 1061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190813/430ace37/attachment.bin>


More information about the cfe-commits mailing list