[PATCH] D92640: Add ability to load a FixedCompilationDatabase from a buffer.
    Utkarsh Saxena via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Dec  4 08:19:38 PST 2020
    
    
  
usaxena95 added inline comments.
================
Comment at: clang/include/clang/Tooling/CompilationDatabase.h:194
+  static std::unique_ptr<FixedCompilationDatabase>
+  loadFromBuffer(StringRef Path, StringRef Data, std::string &ErrorMsg);
+
----------------
`Path` is not meaningful for load from buffer. May be change name to `Directory` and call loadFromBuffer(**llvm::sys::path::parent_path(Path)**, (*File)->getBuffer(), ErrorMsg); instead.
================
Comment at: clang/include/clang/Tooling/CompilationDatabase.h:194
+  static std::unique_ptr<FixedCompilationDatabase>
+  loadFromBuffer(StringRef Path, StringRef Data, std::string &ErrorMsg);
+
----------------
usaxena95 wrote:
> `Path` is not meaningful for load from buffer. May be change name to `Directory` and call loadFromBuffer(**llvm::sys::path::parent_path(Path)**, (*File)->getBuffer(), ErrorMsg); instead.
Do you intend to use it apart from testing ?
================
Comment at: clang/unittests/Tooling/CompilationDatabaseTest.cpp:553
+  std::string ErrorMsg;
+  auto CDB = FixedCompilationDatabase::loadFromBuffer("/path/compile_flags.txt",
+                                                      Data, ErrorMsg);
----------------
nit: change to something like `/path/to/cdb/dir`
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92640/new/
https://reviews.llvm.org/D92640
    
    
More information about the cfe-commits
mailing list