forked from OSchip/llvm-project
[clangd] Use function pointer instead of function_ref to avoid GCC 5 bug
With GCC <6 constructing a function_ref from a free function reference leads to it referencing a temporary function pointer. If the lifetime of that temporary is insufficient it can crash. Fixes https://github.com/clangd/clangd/issues/800
This commit is contained in:
parent
76f3ffb2b2
commit
ec1fb95333
|
@ -279,11 +279,10 @@ bool DirectoryBasedGlobalCompilationDatabase::DirectoryCache::load(
|
|||
struct CDBFile {
|
||||
CachedFile *File;
|
||||
// Wrapper for {Fixed,JSON}CompilationDatabase::loadFromBuffer.
|
||||
llvm::function_ref<std::unique_ptr<tooling::CompilationDatabase>(
|
||||
std::unique_ptr<tooling::CompilationDatabase> (*Parser)(
|
||||
PathRef,
|
||||
/*Data*/ llvm::StringRef,
|
||||
/*ErrorMsg*/ std::string &)>
|
||||
Parser;
|
||||
/*ErrorMsg*/ std::string &);
|
||||
};
|
||||
for (const auto &Entry : {CDBFile{&CompileCommandsJson, parseJSON},
|
||||
CDBFile{&BuildCompileCommandsJson, parseJSON},
|
||||
|
|
Loading…
Reference in New Issue