[PATCH] D92012: [clangd][query-driver] Extract target

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 00:58:05 PST 2020


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:344
+    }
+    return Cmd;
   }
----------------
kadircet wrote:
> ofc we don't need it. but the thing is we are returning an `Optional<tooling::Command>` hence the return statement needs to invoke a constructor for `Optional` and without `std::move` it would invoke a copy constructor rather than a move-based one.
> 
> And even though rest of the calculations are cached per driver&language name, this copy is going to happen for every translation unit. So in theory it would be nice to prevent that.
oh actually never mind, `Cmd` itself is also an `Optional<tooling::Command>`, i thought it was a naked `tooling::Command`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92012



More information about the cfe-commits mailing list