[all-commits] [llvm/llvm-project] 46c921: [clangd] Always retrieve ProjectInfo from Base in ...
kadir çetinkaya via All-commits
all-commits at lists.llvm.org
Thu Jul 16 03:38:30 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 46c921003c2ce5f1cdc4de9ef613eb001980780c
https://github.com/llvm/llvm-project/commit/46c921003c2ce5f1cdc4de9ef613eb001980780c
Author: Kadir Cetinkaya <kadircet at google.com>
Date: 2020-07-16 (Thu, 16 Jul 2020)
Changed paths:
M clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
M clang-tools-extra/clangd/GlobalCompilationDatabase.h
M clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
Log Message:
-----------
[clangd] Always retrieve ProjectInfo from Base in OverlayCDB
Summary:
Clangd is returning current working directory for overriden commands.
This can cause inconsistencies between:
- header and the main files, as OverlayCDB only contains entries for the main
files it direct any queries for the headers to the base, creating a
discrepancy between the two.
- different clangd instances, as the results will be different depending on the
timing of execution of the query and override of the command. hence clangd
might see two different project infos for the same file between different
invocations.
- editors and the way user has invoked it, as current working directory of
clangd will depend on those, hence even when there's no underlying base CWD
might change depending on the editor, or the directory user has started the
editor in.
This patch gets rid of that discrepency by always directing queries to base or
returning llvm::None in absence of it.
For a sample bug see https://reviews.llvm.org/D83099#2154185.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83934
More information about the All-commits
mailing list