Author: maskray Date: Fri Nov 30 17:43:05 2018 New Revision: 348065 URL: http://llvm.org/viewvc/llvm-project?rev=348065&view=rev Log: [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 Modified: cfe/trunk/include/clang/Basic/Diagnostic.h cfe/trunk/lib/Basic/Diagnostic.cpp Modified: cfe/trunk/include/clang/Basic/Diagnostic.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=348065&r1=348064&r2=348065&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/Diagnostic.h (original) +++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Nov 30 17:43:05 2018 @@ -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; Modified: cfe/trunk/lib/Basic/Diagnostic.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=348065&r1=348064&r2=348065&view=diff ============================================================================== --- cfe/trunk/lib/Basic/Diagnostic.cpp (original) +++ cfe/trunk/lib/Basic/Diagnostic.cpp Fri Nov 30 17:43:05 2018 @@ -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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits