[PATCH] D128207: [clang-doc][NFC] Fix reference invalidation assertion failure.

liushuai wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 04:48:01 PDT 2022


MTC added a comment.

Sorry for the delayed response. Adding the regression test is not as simple as I thought, **first of all clang-tools-extra does not enable the //assert//**, see https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/lit.site.cfg.py.in . And add the clang-doc when enable `--format=html` is little bit of tricky.

> Also, I wonder if assign could/should add logic to be resilient to this.

Eventhough `destroy_range()` does nothing for now, there are indeed potential risks.

  void assign(in_iter in_start, in_iter in_end) {
    this->assertSafeToReferenceAfterClear(in_start, in_end);
    clear();
    append(in_start, in_end);
  }
  void clear() {
    this->destroy_range(this->begin(), this->end());
    this->Size = 0;
  }


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D128207



More information about the cfe-commits mailing list