unsigned MaxLines, bool &CreatedBuffer);
llvm::MemoryBuffer *getMainBufferWithPrecompiledPreamble(
- CompilerInvocation PreambleInvocation,
+ const CompilerInvocation &PreambleInvocationIn,
bool AllowRebuild = true,
unsigned MaxLines = 0);
void RealizeTopLevelDeclsFromPreamble();
/// buffer that should be used in place of the main file when doing so.
/// Otherwise, returns a NULL pointer.
llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble(
- CompilerInvocation PreambleInvocation,
+ const CompilerInvocation &PreambleInvocationIn,
bool AllowRebuild,
unsigned MaxLines) {
- FrontendOptions &FrontendOpts = PreambleInvocation.getFrontendOpts();
+
+ llvm::IntrusiveRefCntPtr<CompilerInvocation>
+ PreambleInvocation(new CompilerInvocation(PreambleInvocationIn));
+ FrontendOptions &FrontendOpts = PreambleInvocation->getFrontendOpts();
PreprocessorOptions &PreprocessorOpts
- = PreambleInvocation.getPreprocessorOpts();
+ = PreambleInvocation->getPreprocessorOpts();
bool CreatedPreambleBuffer = false;
std::pair<llvm::MemoryBuffer *, std::pair<unsigned, bool> > NewPreamble
- = ComputePreamble(PreambleInvocation, MaxLines, CreatedPreambleBuffer);
+ = ComputePreamble(*PreambleInvocation, MaxLines, CreatedPreambleBuffer);
// If ComputePreamble() Take ownership of the
llvm::OwningPtr<llvm::MemoryBuffer> OwnedPreambleBuffer;
// have occurred in the preamble.
getDiagnostics().Reset();
ProcessWarningOptions(getDiagnostics(),
- PreambleInvocation.getDiagnosticOpts());
+ PreambleInvocation->getDiagnosticOpts());
getDiagnostics().setNumWarnings(NumWarningsInPreamble);
if (StoredDiagnostics.size() > NumStoredDiagnosticsInPreamble)
StoredDiagnostics.erase(
llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance>
CICleanup(Clang.get());
- Clang->setInvocation(&PreambleInvocation);
+ Clang->setInvocation(&*PreambleInvocation);
OriginalSourceFile = Clang->getFrontendOpts().Inputs[0].second;
// Set up diagnostics, capturing all of the diagnostics produced.