[PATCH] D85923: [clangd] Fix crash-bug in preamble indexing when using modules.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 05:48:13 PDT 2020


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/TestTU.cpp:77
+  CI.getHeaderSearchOpts().ModuleCachePath = ModuleCachePath.c_str();
+  llvm::errs() << "MC: " << ModuleCachePath << "\n";
+  llvm::errs().flush();
----------------
errs should probably go away


================
Comment at: clang-tools-extra/clangd/unittests/TestTU.cpp:96
+  auto ModuleCacheDeleter = llvm::make_scope_exit(
+      std::bind(deleteModuleCache, CI->getHeaderSearchOpts().ModuleCachePath));
   return clang::clangd::buildPreamble(testPath(Filename), *CI, Inputs,
----------------
or just `[&]{ deleteModuleCache(...); }` - bind isn't unreadable here, but we use it so rarely that it almost feels obscure :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85923



More information about the cfe-commits mailing list