[PATCH] D67907: [clangd] Implement a smart version of HeaderSource switch.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 01:00:05 PDT 2019


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/HeaderSourceSwitch.cpp:113
+  auto Best = Candidates.begin();
+  for (auto It = Candidates.begin(); It != Candidates.end(); ++It) {
+    if (It->second > Best->second)
----------------
kadircet wrote:
> nit: `for(auto &It : Candidates)`
for-range doesn't work here, the type is `StringMapEntry` which is a non-copy structure, we need to copy an iterator for recording the `Best`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67907





More information about the cfe-commits mailing list