From: Axel Naumann Date: Sun, 14 Sep 2014 11:47:41 +0000 (+0200) Subject: Implement debug wrappers to diagnose cases without LLVMDEV. X-Git-Tag: v6-02-00-rc1~127 X-Git-Url: https://root.cern.ch/gitweb?p=root.git;a=commitdiff_plain;h=af141b27f512ce0639f76858a49fced1379225b0 Implement debug wrappers to diagnose cases without LLVMDEV. --- diff --git a/core/meta/src/TCling.cxx b/core/meta/src/TCling.cxx index 501b865..4576967 100644 --- a/core/meta/src/TCling.cxx +++ b/core/meta/src/TCling.cxx @@ -182,6 +182,36 @@ char *dlerror() { #endif #endif +//______________________________________________________________________________ +// These functions are helpers for debugging issues with non-LLVMDEV builds. +// +clang::DeclContext* TCling__DEBUG__getDeclContext(clang::Decl* D) { + return D->getDeclContext(); +} +clang::NamespaceDecl* TCling__DEBUG__DCtoNamespace(clang::DeclContext* DC) { + return llvm::dyn_cast(DC); +} +clang::RecordDecl* TCling__DEBUG__DCtoRecordDecl(clang::DeclContext* DC) { + return llvm::dyn_cast(DC); +} +void TCling__DEBUG__dump(clang::DeclContext* DC) { + return DC->dump(); +} +void TCling__DEBUG__dump(clang::Decl* D) { + return D->dump(); +} +void TCling__DEBUG__printName(clang::Decl* D) { + if (clang::NamedDecl* ND = dyn_cast(D)) { + std::string name; + { + llvm::raw_string_ostream OS; + ND->getNameForDiagnostic(name, D->getASTContext()->getPrintingPolicy(), + true /*Qualified*/); + } + printf("%s\n", name.c_str()); + } +} + using namespace std; using namespace clang;