mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-30 19:37:08 +00:00
Work around relative --sysroot=
This commit is contained in:
parent
58c701d98a
commit
94d2b5821e
@ -269,7 +269,9 @@ void Initialize(MessageHandler *m, InitializeParam ¶m, ReplyOnce &reply) {
|
|||||||
LOG_S(INFO) << "initializationOptions: " << output.GetString();
|
LOG_S(INFO) << "initializationOptions: " << output.GetString();
|
||||||
|
|
||||||
if (g_config->cacheDirectory.size()) {
|
if (g_config->cacheDirectory.size()) {
|
||||||
g_config->cacheDirectory = NormalizePath(g_config->cacheDirectory);
|
SmallString<256> Path(g_config->cacheDirectory);
|
||||||
|
sys::fs::make_absolute(Path);
|
||||||
|
g_config->cacheDirectory = Path.str();
|
||||||
EnsureEndsInSlash(g_config->cacheDirectory);
|
EnsureEndsInSlash(g_config->cacheDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "project.hh"
|
#include "project.hh"
|
||||||
|
|
||||||
|
#include "clang_tu.hh" // llvm::vfs
|
||||||
#include "filesystem.hh"
|
#include "filesystem.hh"
|
||||||
#include "log.hh"
|
#include "log.hh"
|
||||||
#include "match.hh"
|
#include "match.hh"
|
||||||
@ -328,6 +329,7 @@ LoadEntriesFromDirectory(ProjectConfig *project,
|
|||||||
std::vector<Project::Entry> result;
|
std::vector<Project::Entry> result;
|
||||||
ProjectProcessor proc(project);
|
ProjectProcessor proc(project);
|
||||||
for (tooling::CompileCommand &Cmd : CDB->getAllCompileCommands()) {
|
for (tooling::CompileCommand &Cmd : CDB->getAllCompileCommands()) {
|
||||||
|
static bool once;
|
||||||
Project::Entry entry;
|
Project::Entry entry;
|
||||||
entry.root = project->root;
|
entry.root = project->root;
|
||||||
DoPathMapping(entry.root);
|
DoPathMapping(entry.root);
|
||||||
@ -342,7 +344,18 @@ LoadEntriesFromDirectory(ProjectConfig *project,
|
|||||||
DoPathMapping(arg);
|
DoPathMapping(arg);
|
||||||
entry.args.push_back(Intern(arg));
|
entry.args.push_back(Intern(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Work around relative --sysroot= as it isn't affected by
|
||||||
|
// -working-directory=. chdir is thread hostile but this function runs
|
||||||
|
// before indexers do actual work and it works when there is only one
|
||||||
|
// workspace folder.
|
||||||
|
if (!once) {
|
||||||
|
once = true;
|
||||||
|
llvm::vfs::getRealFileSystem()->setCurrentWorkingDirectory(
|
||||||
|
entry.directory);
|
||||||
|
}
|
||||||
proc.Process(entry);
|
proc.Process(entry);
|
||||||
|
|
||||||
if (Seen.insert(entry.filename).second)
|
if (Seen.insert(entry.filename).second)
|
||||||
result.push_back(entry);
|
result.push_back(entry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user