[all-commits] [llvm/llvm-project] 234c47: [clang][Basic] Make SourceLocation usable as key i...

Mikhail Maltsev via All-commits all-commits at lists.llvm.org
Tue Oct 20 07:53:45 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 234c47ae2a8e1877de8c661d5bb862ba952eabf9
      https://github.com/llvm/llvm-project/commit/234c47ae2a8e1877de8c661d5bb862ba952eabf9
  Author: Mikhail Maltsev <mikhail.maltsev at arm.com>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
    M clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.h
    M clang/include/clang/Basic/SourceLocation.h
    M clang/lib/Basic/SourceLocation.cpp

  Log Message:
  -----------
  [clang][Basic] Make SourceLocation usable as key in hash maps, NFCI

This change creates a `DenseMapInfo` trait specialization for the
SourceLocation class. The empty key, the tombstone key, and the hash
function are identical to `DenseMapInfo<unsigned>`, because we already
have hash maps that use raw the representation of `SourceLocation` as
a key.

The update of existing `DenseMap`s containing raw representation of
`SourceLocation`s will be done in a follow-up patch. As an example
the patch makes use of the new trait in one instance:
clang-tidy/google/UpgradeGoogletestCaseCheck.{h,cpp}

Reviewed By: dexonsmith

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




More information about the All-commits mailing list