HomePhabricator

[clang][Basic] Make SourceLocation usable as key in hash maps, NFCI

Authored by miyuki on Oct 20 2020, 7:52 AM.

Description

[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 DenseMaps containing raw representation of
SourceLocations 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