[clang-tools-extra] r200952 - 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.

Nick Lewycky nicholas at mxc.ca
Thu Feb 6 14:57:16 PST 2014


Author: nicholas
Date: Thu Feb  6 16:57:16 2014
New Revision: 200952

URL: http://llvm.org/viewvc/llvm-project?rev=200952&view=rev
Log:
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.

Modified:
    clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=200952&r1=200951&r2=200952&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Thu Feb  6 16:57:16 2014
@@ -322,15 +322,16 @@ static void reportDiagnostic(const Clang
 
 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) {





More information about the cfe-commits mailing list