[PATCH] D119479: [clang][extract-api] Add global record support

Zixu Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 14:07:23 PDT 2022


zixuw updated this revision to Diff 415974.
zixuw added a comment.

Using `SmallString`/`SmallVectorImpl<char>` to pass `USR` into the `add*` APIs
still feel weird and unintuitive. And it's still not clear to the caller that
`Name` won't be copied but `USR` will.
Trying out another approach: still pass both `Name` and `USR` using `StringRef`
and so that the caller will be responsible to keep the string alive. In the
meanwhile expose a `recordUSR` method in `API` that wraps the USR generation,
and puts the USR string in persistent allocator memory. This way it is clear to
the caller that it needs to either use `recordUSR` to get the `StringRef USR`
needed for the `add*` calls, or to be responsible for keeping the string alive
if the caller generates USRs on its own.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119479/new/

https://reviews.llvm.org/D119479

Files:
  clang/include/clang/AST/RawCommentList.h
  clang/include/clang/Frontend/FrontendActions.h
  clang/include/clang/SymbolGraph/API.h
  clang/include/clang/SymbolGraph/AvailabilityInfo.h
  clang/include/clang/SymbolGraph/DeclarationFragments.h
  clang/include/clang/SymbolGraph/FrontendActions.h
  clang/include/clang/SymbolGraph/Serialization.h
  clang/lib/AST/RawCommentList.cpp
  clang/lib/CMakeLists.txt
  clang/lib/Frontend/CMakeLists.txt
  clang/lib/Frontend/ExtractAPIConsumer.cpp
  clang/lib/FrontendTool/CMakeLists.txt
  clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  clang/lib/SymbolGraph/API.cpp
  clang/lib/SymbolGraph/CMakeLists.txt
  clang/lib/SymbolGraph/DeclarationFragments.cpp
  clang/lib/SymbolGraph/ExtractAPIConsumer.cpp
  clang/lib/SymbolGraph/Serialization.cpp
  clang/test/Driver/extract-api.c
  clang/test/SymbolGraph/global_record.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119479.415974.patch
Type: text/x-patch
Size: 72696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220316/a5716831/attachment-0001.bin>


More information about the cfe-commits mailing list