forked from OSchip/llvm-project
[clangd] Remove big PreambleData constructor. NFC
This commit is contained in:
parent
44c9adb414
commit
91670f5f20
|
@ -312,18 +312,6 @@ bool isMainFile(llvm::StringRef FileName, const SourceManager &SM) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
PreambleData::PreambleData(const ParseInputs &Inputs,
|
|
||||||
PrecompiledPreamble Preamble,
|
|
||||||
std::vector<Diag> Diags, IncludeStructure Includes,
|
|
||||||
MainFileMacros Macros,
|
|
||||||
std::unique_ptr<PreambleFileStatusCache> StatCache,
|
|
||||||
CanonicalIncludes CanonIncludes)
|
|
||||||
: Version(Inputs.Version), CompileCommand(Inputs.CompileCommand),
|
|
||||||
Preamble(std::move(Preamble)), Diags(std::move(Diags)),
|
|
||||||
Includes(std::move(Includes)), Macros(std::move(Macros)),
|
|
||||||
StatCache(std::move(StatCache)), CanonIncludes(std::move(CanonIncludes)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<const PreambleData>
|
std::shared_ptr<const PreambleData>
|
||||||
buildPreamble(PathRef FileName, CompilerInvocation CI,
|
buildPreamble(PathRef FileName, CompilerInvocation CI,
|
||||||
const ParseInputs &Inputs, bool StoreInMemory,
|
const ParseInputs &Inputs, bool StoreInMemory,
|
||||||
|
@ -393,10 +381,14 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
|
||||||
vlog("Built preamble of size {0} for file {1} version {2}",
|
vlog("Built preamble of size {0} for file {1} version {2}",
|
||||||
BuiltPreamble->getSize(), FileName, Inputs.Version);
|
BuiltPreamble->getSize(), FileName, Inputs.Version);
|
||||||
std::vector<Diag> Diags = PreambleDiagnostics.take();
|
std::vector<Diag> Diags = PreambleDiagnostics.take();
|
||||||
auto Result = std::make_shared<PreambleData>(
|
auto Result = std::make_shared<PreambleData>(std::move(*BuiltPreamble));
|
||||||
Inputs, std::move(*BuiltPreamble), std::move(Diags),
|
Result->Version = Inputs.Version;
|
||||||
CapturedInfo.takeIncludes(), CapturedInfo.takeMacros(),
|
Result->CompileCommand = Inputs.CompileCommand;
|
||||||
std::move(StatCache), CapturedInfo.takeCanonicalIncludes());
|
Result->Diags = std::move(Diags);
|
||||||
|
Result->Includes = CapturedInfo.takeIncludes();
|
||||||
|
Result->Macros = CapturedInfo.takeMacros();
|
||||||
|
Result->CanonIncludes = CapturedInfo.takeCanonicalIncludes();
|
||||||
|
Result->StatCache = std::move(StatCache);
|
||||||
Result->MainIsIncludeGuarded = CapturedInfo.isMainFileIncludeGuarded();
|
Result->MainIsIncludeGuarded = CapturedInfo.isMainFileIncludeGuarded();
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,7 @@ namespace clangd {
|
||||||
/// As we must avoid re-parsing the preamble, any information that can only
|
/// As we must avoid re-parsing the preamble, any information that can only
|
||||||
/// be obtained during parsing must be eagerly captured and stored here.
|
/// be obtained during parsing must be eagerly captured and stored here.
|
||||||
struct PreambleData {
|
struct PreambleData {
|
||||||
PreambleData(const ParseInputs &Inputs, PrecompiledPreamble Preamble,
|
PreambleData(PrecompiledPreamble Preamble) : Preamble(std::move(Preamble)) {}
|
||||||
std::vector<Diag> Diags, IncludeStructure Includes,
|
|
||||||
MainFileMacros Macros,
|
|
||||||
std::unique_ptr<PreambleFileStatusCache> StatCache,
|
|
||||||
CanonicalIncludes CanonIncludes);
|
|
||||||
|
|
||||||
// Version of the ParseInputs this preamble was built from.
|
// Version of the ParseInputs this preamble was built from.
|
||||||
std::string Version;
|
std::string Version;
|
||||||
|
|
Loading…
Reference in New Issue