[Basic] Move DiagnosticsEngine::dump from .h to .cpp

The two LLVM_DUMP_METHOD methods have a undefined reference on clang::DiagnosticsEngine::DiagStateMap::dump.

tools/clang/tools/extra/clangd/benchmarks/IndexBenchmark links in
clangDaemon but does not link in clangBasic explicitly, which causes a
linker error "undefined symbol" in !NDEBUG + -DBUILD_SHARED_LIBS=on builds.

Move LLVM_DUMP_METHOD methods to .cpp to fix IndexBenchmark. They should
be unconditionally defined as they are also used by non-dump-method #pragma clang __debug diag_mapping

llvm-svn: 348065
This commit is contained in:
Fangrui Song 2018-12-01 01:43:05 +00:00
parent fbb925462e
commit 2f55320741
2 changed files with 10 additions and 4 deletions

View File

@ -486,10 +486,8 @@ public:
DiagnosticsEngine &operator=(const DiagnosticsEngine &) = delete;
~DiagnosticsEngine();
LLVM_DUMP_METHOD void dump() const { DiagStatesByLoc.dump(*SourceMgr); }
LLVM_DUMP_METHOD void dump(StringRef DiagName) const {
DiagStatesByLoc.dump(*SourceMgr, DiagName);
}
LLVM_DUMP_METHOD void dump() const;
LLVM_DUMP_METHOD void dump(StringRef DiagName) const;
const IntrusiveRefCntPtr<DiagnosticIDs> &getDiagnosticIDs() const {
return Diags;

View File

@ -89,6 +89,14 @@ DiagnosticsEngine::~DiagnosticsEngine() {
setClient(nullptr);
}
void DiagnosticsEngine::dump() const {
DiagStatesByLoc.dump(*SourceMgr);
}
void DiagnosticsEngine::dump(StringRef DiagName) const {
DiagStatesByLoc.dump(*SourceMgr, DiagName);
}
void DiagnosticsEngine::setClient(DiagnosticConsumer *client,
bool ShouldOwnClient) {
Owner.reset(ShouldOwnClient ? client : nullptr);