[PATCH] D46281: [clang-doc] Attaching a name to reference data

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 1 10:33:18 PDT 2018


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

I can't really comment on the BC change since i don't think anything
here makes use of that yet, but the code changes look ok to me.

LGTM.



================
Comment at: clang-doc/BitcodeWriter.cpp:382
+  emitRecord(R.USR, REFERENCE_USR);
+  emitRecord(R.Name, REFERENCE_NAME);
+  emitRecord((unsigned)R.RefType, REFERENCE_TYPE);
----------------
juliehockett wrote:
> lebedev.ri wrote:
> > >>! In D46281#1083806, @lebedev.ri wrote:
> > > Global question: you are using `NamedDecl::getNameAsString()`, and passing it as `StringRef`.
> > > You have looked at this with ASAN, and it's ok?
> > > 
> > > Also, have you considered using the `NamedDecl::getName()`, which already returns `StringRef`.?
> > 
> > Hm, looking at those two functions, not sure `NamedDecl::getName()` will work here.
> > Alternatively, have you considered just making this `Name` field store `DeclarationName`,
> > and call `getNameAsString()` only here?
> The field stores it as a string? So the name string is copied into the info data structure itself -- this is so that the backend need have no knowledge of the AST to do its job.
Oh i see, forgot about that.


================
Comment at: clang-doc/BitcodeWriter.h:146
   class AbbreviationMap {
     llvm::DenseMap<unsigned, unsigned> Abbrevs;
 
----------------
There is `llvm::SmallDenseMap`, apparently. Not sure if it helps here.


https://reviews.llvm.org/D46281





More information about the cfe-commits mailing list