[PATCH] D69840: [Basic] Make SourceLocation usable as key in hash maps, NFCI

Mikhail Maltsev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 04:14:41 PST 2019


miyuki created this revision.
miyuki added reviewers: aprantl, rsmith, faisalv.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
miyuki edited reviewers, added: JDevlieghere; removed: jdoerfert.
Herald added a reviewer: jdoerfert.

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 patch also converts the existing llvm::DenseMap<unsigned, T>,
llvm::DenseSet<unsigned> and std::map<unsigned, T> objects that store
source location as 'unsigned' to using SourceLocation directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69840

Files:
  clang/include/clang/Basic/SourceLocation.h
  clang/include/clang/Edit/EditedSource.h
  clang/include/clang/Tooling/Syntax/Tokens.h
  clang/lib/ARCMigrate/TransGCAttrs.cpp
  clang/lib/ARCMigrate/TransProperties.cpp
  clang/lib/ARCMigrate/Transforms.h
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/Edit/EditedSource.cpp
  clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
  clang/lib/Tooling/Syntax/Tokens.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69840.227843.patch
Type: text/x-patch
Size: 16795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191105/2949cfd9/attachment-0001.bin>


More information about the cfe-commits mailing list