[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 03:12:42 PDT 2018


lebedev.ri added inline comments.


================
Comment at: clang-doc/BitcodeWriter.cpp:382
+  emitRecord(R.USR, REFERENCE_USR);
+  emitRecord(R.Name, REFERENCE_NAME);
+  emitRecord((unsigned)R.RefType, REFERENCE_TYPE);
----------------
>>! 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?


https://reviews.llvm.org/D46281





More information about the cfe-commits mailing list