This is an archive of the discontinued LLVM Phabricator instance.

Add ability to load a FixedCompilationDatabase from a buffer.
ClosedPublic

Authored by sammccall on Dec 4 2020, 12:59 AM.

Details

Summary

Previously, loading one from a file meant allowing the library to do the IO.
Clangd would prefer to do such IO itself (e.g. to allow caching).

Diff Detail

Event Timeline

sammccall created this revision.Dec 4 2020, 12:59 AM
sammccall requested review of this revision.Dec 4 2020, 12:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 4 2020, 12:59 AM
usaxena95 added inline comments.Dec 4 2020, 8:19 AM
clang/include/clang/Tooling/CompilationDatabase.h
194

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.

194

Do you intend to use it apart from testing ?

clang/unittests/Tooling/CompilationDatabaseTest.cpp
555

nit: change to something like /path/to/cdb/dir

sammccall updated this revision to Diff 309630.Dec 4 2020, 1:04 PM
sammccall marked an inline comment as done.

Address review comments

sammccall marked an inline comment as done.Dec 4 2020, 1:09 PM
sammccall added inline comments.
clang/include/clang/Tooling/CompilationDatabase.h
194

Yes. See D92663

usaxena95 accepted this revision.Dec 5 2020, 1:18 AM

Thanks.

This revision is now accepted and ready to land.Dec 5 2020, 1:18 AM