aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-05-03 23:07:45 +0000
committerDouglas Gregor <dgregor@apple.com>2013-05-03 23:07:45 +0000
commitcc2b653c319599f502425d2c3de29865d47bb9e4 (patch)
treef48754b8a62d6358871a82346a66bd228fd108cc
parenta4a90cabfa15c900016a7cfaea51a6d4e8ebf4db (diff)
Remove DiagnosticConsumer::clone(), a bad idea that is now unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181070 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Diagnostic.h9
-rw-r--r--include/clang/Frontend/ChainedDiagnosticConsumer.h6
-rw-r--r--include/clang/Frontend/CompilerInstance.h7
-rw-r--r--include/clang/Frontend/LogDiagnosticPrinter.h2
-rw-r--r--include/clang/Frontend/TextDiagnosticBuffer.h2
-rw-r--r--include/clang/Frontend/TextDiagnosticPrinter.h1
-rw-r--r--include/clang/Frontend/VerifyDiagnosticConsumer.h2
-rw-r--r--include/clang/Rewrite/Frontend/FixItRewriter.h2
-rw-r--r--lib/ARCMigrate/ARCMT.cpp6
-rw-r--r--lib/Basic/Diagnostic.cpp5
-rw-r--r--lib/Frontend/ASTUnit.cpp12
-rw-r--r--lib/Frontend/CompilerInstance.cpp15
-rw-r--r--lib/Frontend/LogDiagnosticPrinter.cpp5
-rw-r--r--lib/Frontend/SerializedDiagnosticPrinter.cpp4
-rw-r--r--lib/Frontend/TextDiagnosticBuffer.cpp3
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp5
-rw-r--r--lib/Frontend/VerifyDiagnosticConsumer.cpp8
-rw-r--r--lib/Rewrite/Frontend/FixItRewriter.cpp5
-rw-r--r--tools/libclang/Indexing.cpp7
19 files changed, 7 insertions, 99 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 2d9d288964..900964b68a 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -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.
diff --git a/include/clang/Frontend/ChainedDiagnosticConsumer.h b/include/clang/Frontend/ChainedDiagnosticConsumer.h
index ce2b242296..b7dc7c7b52 100644
--- a/include/clang/Frontend/ChainedDiagnosticConsumer.h
+++ b/include/clang/Frontend/ChainedDiagnosticConsumer.h
@@ -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
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index d73a428018..dbd76066b9 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -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.
diff --git a/include/clang/Frontend/LogDiagnosticPrinter.h b/include/clang/Frontend/LogDiagnosticPrinter.h
index 0c700a7671..e8a6bb357c 100644
--- a/include/clang/Frontend/LogDiagnosticPrinter.h
+++ b/include/clang/Frontend/LogDiagnosticPrinter.h
@@ -70,8 +70,6 @@ public:
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info);
-
- DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namespace clang
diff --git a/include/clang/Frontend/TextDiagnosticBuffer.h b/include/clang/Frontend/TextDiagnosticBuffer.h
index 6f1c0e8aea..93ac299da3 100644
--- a/include/clang/Frontend/TextDiagnosticBuffer.h
+++ b/include/clang/Frontend/TextDiagnosticBuffer.h
@@ -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
diff --git a/include/clang/Frontend/TextDiagnosticPrinter.h b/include/clang/Frontend/TextDiagnosticPrinter.h
index 470438e7bd..dc8047066c 100644
--- a/include/clang/Frontend/TextDiagnosticPrinter.h
+++ b/include/clang/Frontend/TextDiagnosticPrinter.h
@@ -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
diff --git a/include/clang/Frontend/VerifyDiagnosticConsumer.h b/include/clang/Frontend/VerifyDiagnosticConsumer.h
index 9cd73ba961..95d7752517 100644
--- a/include/clang/Frontend/VerifyDiagnosticConsumer.h
+++ b/include/clang/Frontend/VerifyDiagnosticConsumer.h
@@ -266,8 +266,6 @@ public:
virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const Diagnostic &Info);
-
- virtual DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
};
} // end namspace clang
diff --git a/include/clang/Rewrite/Frontend/FixItRewriter.h b/include/clang/Rewrite/Frontend/FixItRewriter.h
index 04c04a25f5..423f0667cd 100644
--- a/include/clang/Rewrite/Frontend/FixItRewriter.h
+++ b/include/clang/Rewrite/Frontend/FixItRewriter.h
@@ -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;
};
}
diff --git a/lib/ARCMigrate/ARCMT.cpp b/lib/ARCMigrate/ARCMT.cpp
index fb452cdc73..a6d48762fe 100644
--- a/lib/ARCMigrate/ARCMT.cpp
+++ b/lib/ARCMigrate/ARCMT.cpp
@@ -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
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 5eff86c2b8..c5b277a9a8 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -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;
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 1b4e5a0b39..8fe4baa5e3 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -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));
}
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 027e99a29d..cf856fc2ab 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -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.
diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp
index 0a22481cb6..2189b8658e 100644
--- a/lib/Frontend/LogDiagnosticPrinter.cpp
+++ b/lib/Frontend/LogDiagnosticPrinter.cpp
@@ -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);
-}
-
diff --git a/lib/Frontend/SerializedDiagnosticPrinter.cpp b/lib/Frontend/SerializedDiagnosticPrinter.cpp
index 4bb662bb26..6514321f22 100644
--- a/lib/Frontend/SerializedDiagnosticPrinter.cpp
+++ b/lib/Frontend/SerializedDiagnosticPrinter.cpp
@@ -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();
diff --git a/lib/Frontend/TextDiagnosticBuffer.cpp b/lib/Frontend/TextDiagnosticBuffer.cpp
index 039475a2e0..5821436a30 100644
--- a/lib/Frontend/TextDiagnosticBuffer.cpp
+++ b/lib/Frontend/TextDiagnosticBuffer.cpp
@@ -75,6 +75,3 @@ void TextDiagnosticBuffer::FlushDiagnostics(DiagnosticsEngine &Diags) const {
escapeDiag(it->second, Buf)));
}
-DiagnosticConsumer *TextDiagnosticBuffer::clone(DiagnosticsEngine &) const {
- return new TextDiagnosticBuffer();
-}
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 010f649e6b..c22798af60 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -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);
-}
diff --git a/lib/Frontend/VerifyDiagnosticConsumer.cpp b/lib/Frontend/VerifyDiagnosticConsumer.cpp
index 91aa52b771..46745b6b9a 100644
--- a/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ b/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -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) {
diff --git a/lib/Rewrite/Frontend/FixItRewriter.cpp b/lib/Rewrite/Frontend/FixItRewriter.cpp
index a3bbdcf6eb..166c607d02 100644
--- a/lib/Rewrite/Frontend/FixItRewriter.cpp
+++ b/lib/Rewrite/Frontend/FixItRewriter.cpp
@@ -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() {}
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index 27d8b8327f..15786acb8b 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -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,