[PATCH] D75665: [analyzer] On-demand parsing capability for CTU

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 12 02:39:18 PDT 2020


balazske added inline comments.


================
Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:362
 
-  return ASTUnit::LoadFromASTFile(
-      std::string(ASTFilePath), CI.getPCHContainerOperations()->getRawReader(),
-      ASTUnit::LoadEverything, Diags, CI.getFileSystemOpts());
+  auto LoadFromFile = [this](StringRef Path) {
+    IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
----------------
Is here a lambda necessary? I think it must not be over-used. In this case we can construct the file path as the first step and then use it to load the file, without using lambda call.


================
Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:583
+                 CommandLineArgs.begin(),
+                 [](auto &&CmdPart) { return CmdPart.c_str(); });
+
----------------
Is here a special reason to use `auto &&` type (and not `auto &` or `std::string &`)? Probably this code is faulty: The `CmdPart` is moved out and then destructed, before the content of it (where the `c_str` points to) is used?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75665





More information about the cfe-commits mailing list