[PATCH] D25425: [AST] Convert Marshallers to use unique_ptr.

Tim Shen via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 02:12:24 PDT 2016


timshen added inline comments.


================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:514
+      MutableArrayRef<std::unique_ptr<MatcherDescriptor>> Callbacks)
+      : Overloads(std::make_move_iterator(Callbacks.begin()),
+                  std::make_move_iterator(Callbacks.end())) {}
----------------
Notice that this is 2x slower, because move on unique_ptr resets the move-from side. But it is less likely to have an issue.


================
Comment at: clang/lib/ASTMatchers/Dynamic/Registry.cpp:501
   for (const auto &M : RegistryData->constructors()) {
-    const auto *Matcher = M.getValue();
+    const std::unique_ptr<const MatcherDescriptor>& Matcher = M.getValue();
     StringRef Name = M.getKey();
----------------
const MatcherDescriptor &Matcher = *M.getValue()?


https://reviews.llvm.org/D25425





More information about the cfe-commits mailing list