[clangd][NFC] Small tweak to combined provider

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
This commit is contained in:
Nathan James 2020-12-08 17:12:55 +00:00
parent 877170f3eb
commit 4a0528e4a0
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 7 additions and 8 deletions

View File

@ -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>
@ -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 {