[all-commits] [llvm/llvm-project] ba5628: ADT: Use 'using' to inherit assign and append in S...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Jan 22 16:18:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba5628f2c2a9de049b80b3e276f7e05f481c49e7
      https://github.com/llvm/llvm-project/commit/ba5628f2c2a9de049b80b3e276f7e05f481c49e7
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

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

  Log Message:
  -----------
  ADT: Use 'using' to inherit assign and append in SmallString

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.

Differential Revision: https://reviews.llvm.org/D95202




More information about the All-commits mailing list