[all-commits] [llvm/llvm-project] c547c2: [NFC] ASSERT_EQ before accessing items in containers

Kirill Bobyrev via All-commits all-commits at lists.llvm.org
Tue Nov 26 04:46:25 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c547c22f18973dceaf5b40dae1b4ad7d3dd4eab7
      https://github.com/llvm/llvm-project/commit/c547c22f18973dceaf5b40dae1b4ad7d3dd4eab7
  Author: Kirill Bobyrev <kbobyrev at google.com>
  Date:   2019-11-26 (Tue, 26 Nov 2019)

  Changed paths:
    M clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
    M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

  Log Message:
  -----------
  [NFC] ASSERT_EQ before accessing items in containers

As discussed offline, something different from `EXPECT_EQ` should be
used to check if the container contains enough items before accessing
them so that other tests can still be run even if the assertion fails as
opposed to having `EXPECT_EQ` failing and then aborting the run due to
the errors caused by out-of-bounds memory access.

Reviewed by: ilya-biryukov

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




More information about the All-commits mailing list