]> granicus.if.org Git - clang/commitdiff
Remove leftover code and use the text path diagnostic client even without a specified...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 3 Dec 2010 01:17:19 +0000 (01:17 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 3 Dec 2010 01:17:19 +0000 (01:17 +0000)
it just uses diagnostic notes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120773 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/AnalysisConsumer.cpp
lib/Checker/TextPathDiagnostics.cpp

index 47dd7fa186dc69218606b65f4fd8cd5532cc149a..52dd06803468f5044584dbf809a41c9a0c09f020 100644 (file)
@@ -108,6 +108,10 @@ public:
         case PD_##NAME: PD = CREATEFN(OutDir, PP); break;
 #include "clang/Frontend/Analyses.def"
       }
+    } else if (Opts.AnalysisDiagOpt == PD_TEXT) {
+      // Create the text client even without a specified output file since
+      // it just uses diagnostic notes.
+      PD = createTextPathDiagnosticClient("", PP);
     }
 
     // Create the analyzer component creators.
index 03c6088027a2d593c023ca73ec1b46a8c5fb6e60..83ff7a4409b151a72a6f8a27e81710a258812c3a 100644 (file)
@@ -20,7 +20,7 @@ using namespace llvm;
 
 namespace {
 
-/// \brief Simple path diagnostic client used for outputting as text
+/// \brief Simple path diagnostic client used for outputting as diagnostic notes
 /// the sequence of events.
 class TextPathDiagnostics : public PathDiagnosticClient {
   const std::string OutputFile;
@@ -61,14 +61,6 @@ void TextPathDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) {
     return;
   }
 
-  // Open the file.
-  std::string ErrMsg;
-  llvm::raw_fd_ostream o(OutputFile.c_str(), ErrMsg);
-  if (!ErrMsg.empty()) {
-    llvm::errs() << "warning: could not create file: " << OutputFile << '\n';
-    return;
-  }
-
   for (PathDiagnostic::const_iterator I=D->begin(), E=D->end(); I != E; ++I) {
     if (isa<PathDiagnosticEventPiece>(*I)) {
       PathDiagnosticEventPiece &event = cast<PathDiagnosticEventPiece>(*I);