The diagnostic printer expects the LangOptions to still be alive. Give it one that lives at least as long as all the uses of it. This is still wrong though, we should be passing in the correct LangOpts for a given source file.

llvm-svn: 200952
This commit is contained in:
Nick Lewycky 2014-02-06 22:57:16 +00:00
parent 7c435a5ede
commit ccf8e29060
1 changed files with 3 additions and 2 deletions

View File

@ -322,15 +322,16 @@ static void reportDiagnostic(const ClangTidyMessage &Message,
void handleErrors(SmallVectorImpl<ClangTidyError> &Errors, bool Fix) {
FileManager Files((FileSystemOptions()));
LangOptions LangOpts; // FIXME: use langopts from each original file
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
DiagOpts->ShowColors = llvm::sys::Process::StandardErrHasColors();
DiagnosticConsumer *DiagPrinter =
new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts);
DiagnosticsEngine Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs),
&*DiagOpts, DiagPrinter);
DiagPrinter->BeginSourceFile(LangOptions());
DiagPrinter->BeginSourceFile(LangOpts);
SourceManager SourceMgr(Diags, Files);
Rewriter Rewrite(SourceMgr, LangOptions());
Rewriter Rewrite(SourceMgr, LangOpts);
for (SmallVectorImpl<ClangTidyError>::iterator I = Errors.begin(),
E = Errors.end();
I != E; ++I) {