[PATCH] D95202: ADT: Use 'using' to inherit assign and append in SmallString

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 21 21:17:43 PST 2021


dexonsmith created this revision.
dexonsmith added a reviewer: dblaikie.
Herald added subscribers: ributzka, hiraditya.
dexonsmith requested review of this revision.
Herald added projects: clang, LLVM.
Herald added a subscriber: cfe-commits.

Rather than reimplement, use a `using` declaration to bring in
`SmallVectorImpl<char>`'s assign and append implementations in
`SmallString`.

The `SmallString` versions were missing reference invalidation
assertions from `SmallVector`. This patch also fixes a bug in
`llvm::FileCollector::addFileImpl`, which was a copy/paste from
`clang::ModuleDependencyCollector::copyToRoot`, both caught by the
no-longer-skipped assertions.

As a drive-by, this also sinks the `const SmallVectorImpl&` versions of
these methods down into `SmallVectorImpl`, since I imagine they'd be
useful elsewhere.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95202

Files:
  clang/lib/Frontend/ModuleDependencyCollector.cpp
  llvm/include/llvm/ADT/SmallString.h
  llvm/include/llvm/ADT/SmallVector.h
  llvm/lib/Support/FileCollector.cpp
  llvm/unittests/ADT/SmallVectorTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95202.318413.patch
Type: text/x-patch
Size: 5574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210122/03cd1b2c/attachment.bin>


More information about the cfe-commits mailing list