[all-commits] [llvm/llvm-project] 6a043e: [clang-tidy] Fix ODR violation in unittests.

NoQ via All-commits all-commits at lists.llvm.org
Thu Jul 30 08:53:45 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a043ecc0cf4d257d06c4fe0c3d5e1d9a8c7ea94
      https://github.com/llvm/llvm-project/commit/6a043ecc0cf4d257d06c4fe0c3d5e1d9a8c7ea94
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2020-07-30 (Thu, 30 Jul 2020)

  Changed paths:
    M clang-tools-extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp
    M clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

  Log Message:
  -----------
  [clang-tidy] Fix ODR violation in unittests.

Both tests define clang::tidy::test::TestCheck::registerMatchers().
This is UB and causes linker to sometimes choose the wrong overload.

Put classes into anonymous namespaces to avoid the problem.

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




More information about the All-commits mailing list