[PATCH] D105493: [clang] Change set type used for SourceLocation.

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 19 05:37:06 PDT 2021


This revision was automatically updated to reflect the committed changes.
simon_tatham marked an inline comment as done.
Closed by commit rGcef56d58dbbb: [clang] Change set type used for SourceLocation. (authored by simon_tatham).

Changed prior to commit:
  https://reviews.llvm.org/D105493?vs=356758&id=359756#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105493/new/

https://reviews.llvm.org/D105493

Files:
  clang/include/clang/Basic/SourceLocation.h
  clang/include/clang/Lex/Preprocessor.h


Index: clang/include/clang/Lex/Preprocessor.h
===================================================================
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -783,8 +783,7 @@
   /// deserializing from PCH, we don't need to deserialize identifier & macros
   /// just so that we can report that they are unused, we just warn using
   /// the SourceLocations of this set (that will be filled by the ASTReader).
-  /// We are using SmallPtrSet instead of a vector for faster removal.
-  using WarnUnusedMacroLocsTy = llvm::SmallPtrSet<SourceLocation, 32>;
+  using WarnUnusedMacroLocsTy = llvm::SmallDenseSet<SourceLocation, 32>;
   WarnUnusedMacroLocsTy WarnUnusedMacroLocs;
 
   /// A "freelist" of MacroArg objects that can be
Index: clang/include/clang/Basic/SourceLocation.h
===================================================================
--- clang/include/clang/Basic/SourceLocation.h
+++ clang/include/clang/Basic/SourceLocation.h
@@ -16,7 +16,6 @@
 
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/PointerLikeTypeTraits.h"
 #include <cassert>
 #include <cstdint>
 #include <string>
@@ -510,20 +509,6 @@
     static void Profile(const clang::SourceLocation &X, FoldingSetNodeID &ID);
   };
 
-  // Teach SmallPtrSet how to handle SourceLocation.
-  template<>
-  struct PointerLikeTypeTraits<clang::SourceLocation> {
-    static constexpr int NumLowBitsAvailable = 0;
-
-    static void *getAsVoidPointer(clang::SourceLocation L) {
-      return L.getPtrEncoding();
-    }
-
-    static clang::SourceLocation getFromVoidPointer(void *P) {
-      return clang::SourceLocation::getFromRawEncoding((unsigned)(uintptr_t)P);
-    }
-  };
-
 } // namespace llvm
 
 #endif // LLVM_CLANG_BASIC_SOURCELOCATION_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105493.359756.patch
Type: text/x-patch
Size: 1796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210719/37016455/attachment.bin>


More information about the cfe-commits mailing list