[PATCH] D40409: [Tooling] Acknowledge that many CompilationDatabases don't support enumeration.

Noel Grandin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 02:32:11 PST 2017


grandinj added inline comments.


================
Comment at: include/clang/Tooling/CompilationDatabase.h:122
+  /// can enumerate their source files.
+  virtual std::vector<std::string> getAllFiles() const { return {}; }
 
----------------
I know very little about LLVM's standards, so ignore me if I'm wrong, but shouldn't this be returning a pair of (begin,end) iterators rather than potentially a copy of a very large array of strings?

And shouldn't it be returning an iteration over StringRef rather then std::string, which will require copying the actual data?


================
Comment at: include/clang/Tooling/CompilationDatabase.h:133
+  /// getCompileCommands(). Subclasses may override this for efficiency.
+  virtual std::vector<CompileCommand> getAllCompileCommands() const;
 };
----------------
similarly here


https://reviews.llvm.org/D40409





More information about the cfe-commits mailing list