Skip to content

Commit

Permalink
[clangd][NFC] Small tweak to combined provider
Browse files Browse the repository at this point in the history
This should address the FIXME about clang3.9 dervied to base unique_ptr constructor not working.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D91925
  • Loading branch information
njames93 committed Dec 8, 2020
1 parent 877170f commit 4a0528e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions clang-tools-extra/clangd/ConfigProvider.cpp
Expand Up @@ -144,7 +144,7 @@ Provider::fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath,

std::unique_ptr<Provider>
Provider::combine(std::vector<const Provider *> Providers) {
struct CombinedProvider : Provider {
class CombinedProvider : public Provider {
std::vector<const Provider *> Providers;

std::vector<CompiledFragment>
Expand All @@ -156,14 +156,13 @@ Provider::combine(std::vector<const Provider *> Providers) {
}
return Result;
}

public:
CombinedProvider(std::vector<const Provider *> Providers)
: Providers(std::move(Providers)) {}
};
auto Result = std::make_unique<CombinedProvider>();
Result->Providers = std::move(Providers);
// FIXME: This is a workaround for a bug in older versions of clang (< 3.9)
// The constructor that is supposed to allow for Derived to Base
// conversion does not work. Remove this if we drop support for such
// configurations.
return std::unique_ptr<Provider>(Result.release());

return std::make_unique<CombinedProvider>(std::move(Providers));
}

Config Provider::getConfig(const Params &P, DiagnosticCallback DC) const {
Expand Down

0 comments on commit 4a0528e

Please sign in to comment.