]> granicus.if.org Git - clang/commitdiff
Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
authorDouglas Gregor <dgregor@apple.com>
Fri, 3 May 2013 23:07:45 +0000 (23:07 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 3 May 2013 23:07:45 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181070 91177308-0d34-0410-b5e6-96231b3b80d8

19 files changed:
include/clang/Basic/Diagnostic.h
include/clang/Frontend/ChainedDiagnosticConsumer.h
include/clang/Frontend/CompilerInstance.h
include/clang/Frontend/LogDiagnosticPrinter.h
include/clang/Frontend/TextDiagnosticBuffer.h
include/clang/Frontend/TextDiagnosticPrinter.h
include/clang/Frontend/VerifyDiagnosticConsumer.h
include/clang/Rewrite/Frontend/FixItRewriter.h
lib/ARCMigrate/ARCMT.cpp
lib/Basic/Diagnostic.cpp
lib/Frontend/ASTUnit.cpp
lib/Frontend/CompilerInstance.cpp
lib/Frontend/LogDiagnosticPrinter.cpp
lib/Frontend/SerializedDiagnosticPrinter.cpp
lib/Frontend/TextDiagnosticBuffer.cpp
lib/Frontend/TextDiagnosticPrinter.cpp
lib/Frontend/VerifyDiagnosticConsumer.cpp
lib/Rewrite/Frontend/FixItRewriter.cpp
tools/libclang/Indexing.cpp

index 2d9d288964d85af042fca659b21224adcb6bd680..900964b68adbe4edf38c0ba53badd29c1591be72 100644 (file)
@@ -1301,10 +1301,6 @@ public:
   /// warnings and errors.
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
-  
-  /// \brief Clone the diagnostic consumer, producing an equivalent consumer
-  /// that can be used in a different context.
-  virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const = 0;
 };
 
 /// \brief A diagnostic client that ignores all diagnostics.
@@ -1314,9 +1310,6 @@ class IgnoringDiagConsumer : public DiagnosticConsumer {
                         const Diagnostic &Info) {
     // Just ignore it.
   }
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    return new IgnoringDiagConsumer();
-  }
 };
 
 /// \brief Diagnostic consumer that forwards diagnostics along to an
@@ -1335,8 +1328,6 @@ public:
   virtual void clear();
 
   virtual bool IncludeInDiagnosticCounts() const;
-
-  virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 // Struct used for sending info about how a type should be printed.
index ce2b242296ed3a360dde9ac4010f2f1ad9fcb7a4..b7dc7c7b529113e7d6a70aa624f5f62fab98c093 100644 (file)
@@ -60,12 +60,6 @@ public:
     Primary->HandleDiagnostic(DiagLevel, Info);
     Secondary->HandleDiagnostic(DiagLevel, Info);
   }
-  
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    return new ChainedDiagnosticConsumer(Primary->clone(Diags), 
-                                         Secondary->clone(Diags));
-  }
-
 };
 
 } // end namspace clang
index d73a4280187319c9576f9326ab3b3c105c4ffec4..dbd76066b94e0bf477bff9503a117e6cd3e33a50 100644 (file)
@@ -493,12 +493,8 @@ public:
   ///
   /// \param ShouldOwnClient If Client is non-NULL, specifies whether 
   /// the diagnostic object should take ownership of the client.
-  ///
-  /// \param ShouldCloneClient If Client is non-NULL, specifies whether that
-  /// client should be cloned.
   void createDiagnostics(DiagnosticConsumer *Client = 0,
-                         bool ShouldOwnClient = true,
-                         bool ShouldCloneClient = true);
+                         bool ShouldOwnClient = true);
 
   /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
   ///
@@ -522,7 +518,6 @@ public:
   createDiagnostics(DiagnosticOptions *Opts,
                     DiagnosticConsumer *Client = 0,
                     bool ShouldOwnClient = true,
-                    bool ShouldCloneClient = true,
                     const CodeGenOptions *CodeGenOpts = 0);
 
   /// Create the file manager and replace any existing one with it.
index 0c700a7671b6121d7640017ca8c39393299171da..e8a6bb357cab370b0c4be39743133b895bd96dfd 100644 (file)
@@ -70,8 +70,6 @@ public:
 
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
-  
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 } // end namespace clang
index 6f1c0e8aeaf7ec8c5ad8540ee58e83e952bc29e7..93ac299da30e475f324cd4ec64b673822811ecec 100644 (file)
@@ -45,8 +45,6 @@ public:
   /// FlushDiagnostics - Flush the buffered diagnostics to an given
   /// diagnostic engine.
   void FlushDiagnostics(DiagnosticsEngine &Diags) const;
-  
-  virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 } // end namspace clang
index 470438e7bd9a2adcd0c24f4cb61b03e88e8b596b..dc8047066c1d315d056855b2ef141d02375f662a 100644 (file)
@@ -50,7 +50,6 @@ public:
   void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP);
   void EndSourceFile();
   void HandleDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 } // end namespace clang
index 9cd73ba9614390db947900ebcd9c83b046728b6b..95d7752517d8eed6aa51ab83e5bb9e5d61114b4a 100644 (file)
@@ -266,8 +266,6 @@ public:
 
   virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                                 const Diagnostic &Info);
-  
-  virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 } // end namspace clang
index 04c04a25f549492499270629ddabbce68debd4e7..423f0667cde0bd1947f0f3c85640171e7b0dfe66 100644 (file)
@@ -121,8 +121,6 @@ public:
 
   /// \brief Emit a diagnostic via the adapted diagnostic client.
   void Diag(SourceLocation Loc, unsigned DiagID);
-  
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
 };
 
 }
index fb452cdc73f70204ee26b845f020eb490355b9d3..a6d48762fe558a6af5c77fbb69c2eac48f6fad71 100644 (file)
@@ -140,12 +140,6 @@ public:
     // Non-ARC warnings are ignored.
     Diags.setLastDiagnosticIgnored();
   }
-  
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    // Just drop any diagnostics that come from cloned consumers; they'll
-    // have different source managers anyway.
-    return new IgnoringDiagConsumer();
-  }
 };
 
 } // end anonymous namespace
index 5eff86c2b8841576478618d6214b51c3ec935ae9..c5b277a9a88c1a1018e5bd0222e401c85a61762a 100644 (file)
@@ -989,11 +989,6 @@ bool ForwardingDiagnosticConsumer::IncludeInDiagnosticCounts() const {
   return Target.IncludeInDiagnosticCounts();
 }
 
-DiagnosticConsumer *
-ForwardingDiagnosticConsumer::clone(DiagnosticsEngine &Diags) const {
-  return new ForwardingDiagnosticConsumer(Target);
-}
-
 PartialDiagnostic::StorageAllocator::StorageAllocator() {
   for (unsigned I = 0; I != NumCached; ++I)
     FreeList[I] = Cached + I;
index 1b4e5a0b39af8fd3f452264989be8b3136a65258..8fe4baa5e301eeb5c98a13203f07a7e9c04faedd 100644 (file)
@@ -604,15 +604,6 @@ public:
 
   virtual void HandleDiagnostic(DiagnosticsEngine::Level Level,
                                 const Diagnostic &Info);
-  
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    // Just drop any diagnostics that come from cloned consumers; they'll
-    // have different source managers anyway.
-    // FIXME: We'd like to be able to capture these somehow, even if it's just
-    // file/line/column, because they could occur when parsing module maps or
-    // building modules on-demand.
-    return new IgnoringDiagConsumer();
-  }
 };
 
 /// \brief RAII object that optionally captures diagnostics, if
@@ -679,8 +670,7 @@ void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> &Diags,
       Client = new StoredDiagnosticConsumer(AST.StoredDiagnostics);
     Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions(),
                                                 Client,
-                                                /*ShouldOwnClient=*/true,
-                                                /*ShouldCloneClient=*/false);
+                                                /*ShouldOwnClient=*/true);
   } else if (CaptureDiagnostics) {
     Diags->setClient(new StoredDiagnosticConsumer(AST.StoredDiagnostics));
   }
index 027e99a29d4bc654133092aeb688d92d675100e9..cf856fc2ab6525ad53d87505ce36e4ec54cb7e10 100644 (file)
@@ -155,18 +155,15 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
 }
 
 void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
-                                         bool ShouldOwnClient,
-                                         bool ShouldCloneClient) {
+                                         bool ShouldOwnClient) {
   Diagnostics = createDiagnostics(&getDiagnosticOpts(), Client,
-                                  ShouldOwnClient, ShouldCloneClient,
-                                  &getCodeGenOpts());
+                                  ShouldOwnClient, &getCodeGenOpts());
 }
 
 IntrusiveRefCntPtr<DiagnosticsEngine>
 CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
                                     DiagnosticConsumer *Client,
                                     bool ShouldOwnClient,
-                                    bool ShouldCloneClient,
                                     const CodeGenOptions *CodeGenOpts) {
   IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr<DiagnosticsEngine>
@@ -175,10 +172,7 @@ CompilerInstance::createDiagnostics(DiagnosticOptions *Opts,
   // Create the diagnostic client for reporting errors or for
   // implementing -verify.
   if (Client) {
-    if (ShouldCloneClient)
-      Diags->setClient(Client->clone(*Diags), ShouldOwnClient);
-    else
-      Diags->setClient(Client, ShouldOwnClient);
+    Diags->setClient(Client, ShouldOwnClient);
   } else
     Diags->setClient(new TextDiagnosticPrinter(llvm::errs(), Opts));
 
@@ -871,8 +865,7 @@ static void compileModule(CompilerInstance &ImportingInstance,
 
   Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
                                    ImportingInstance.getDiagnosticClient()),
-                             /*ShouldOwnClient=*/true,
-                             /*ShouldCloneClient=*/false);
+                             /*ShouldOwnClient=*/true);
 
   // Note that this module is part of the module build stack, so that we
   // can detect cycles in the module graph.
index 0a22481cb6342a9c2af885798e6c06d2febd3ba6..2189b8658ed2aa2051ada6807425e8a6227d71cf 100644 (file)
@@ -171,8 +171,3 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
   Entries.push_back(DE);
 }
 
-DiagnosticConsumer *
-LogDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
-  return new LogDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
-}
-
index 4bb662bb2650c81b173faf82c44affa7695d345e..6514321f228dce1f122dbbd76ffc7620bd770dcf 100644 (file)
@@ -114,10 +114,6 @@ public:
 
   virtual void finish();
 
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    return new SDiagsWriter(State);
-  }
-
 private:
   /// \brief Emit the preamble for the serialized diagnostics.
   void EmitPreamble();
index 039475a2e04fe3349e5ccc8519042f8b8fede151..5821436a306fe7398ed440d9b7430903ac20bc98 100644 (file)
@@ -75,6 +75,3 @@ void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
                                        escapeDiag(it->second, Buf)));
 }
 
-DiagnosticConsumer *TextDiagnosticBuffer::clone(DiagnosticsEngine &) const {
-  return new TextDiagnosticBuffer();
-}
index 010f649e6b7375fd7d1e6df07c708c3967cae3e6..c22798af60ac21d1c8064b18b80d6a77bdc05d6c 100644 (file)
@@ -155,8 +155,3 @@ void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
 
   OS.flush();
 }
-
-DiagnosticConsumer *
-TextDiagnosticPrinter::clone(DiagnosticsEngine &Diags) const {
-  return new TextDiagnosticPrinter(OS, &*DiagOpts, /*OwnsOutputStream=*/false);
-}
index 91aa52b771b220e6f0b6253df376309bb06a88e1..46745b6b9a4fe32ba3f2b4246a05c2ac9ccd34df 100644 (file)
@@ -820,14 +820,6 @@ void VerifyDiagnosticConsumer::CheckDiagnostics() {
   ED.Notes.clear();
 }
 
-DiagnosticConsumer *
-VerifyDiagnosticConsumer::clone(DiagnosticsEngine &Diags) const {
-  if (!Diags.getClient())
-    Diags.setClient(PrimaryClient->clone(Diags));
-  
-  return new VerifyDiagnosticConsumer(Diags);
-}
-
 Directive *Directive::create(bool RegexKind, SourceLocation DirectiveLoc,
                              SourceLocation DiagnosticLoc, StringRef Text,
                              unsigned Min, unsigned Max) {
index a3bbdcf6ebda885a3e4822d62ddf4799c16810c1..166c607d020e0f5a8da78eb1e4bb84071176ac7f 100644 (file)
@@ -197,9 +197,4 @@ void FixItRewriter::Diag(SourceLocation Loc, unsigned DiagID) {
   Diags.setClient(this);
 }
 
-DiagnosticConsumer *FixItRewriter::clone(DiagnosticsEngine &Diags) const {
-  return new FixItRewriter(Diags, Diags.getSourceManager(), 
-                           Rewrite.getLangOpts(), FixItOpts);
-}
-
 FixItOptions::~FixItOptions() {}
index 27d8b8327f67c5074f54209580bd1a500a4e2264..15786acb8b3bed16f79bc5597d723351970dee24 100644 (file)
@@ -398,10 +398,6 @@ public:
     if (level >= DiagnosticsEngine::Error)
       Errors.push_back(StoredDiagnostic(level, Info));
   }
-
-  DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
-    return new IgnoringDiagConsumer();
-  }
 };
 
 //===----------------------------------------------------------------------===//
@@ -549,8 +545,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
   IntrusiveRefCntPtr<DiagnosticsEngine>
     Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions,
                                               CaptureDiag,
-                                              /*ShouldOwnClient=*/true,
-                                              /*ShouldCloneClient=*/false));
+                                              /*ShouldOwnClient=*/true));
 
   // Recover resources if we crash before exiting this function.
   llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,