From af141b27f512ce0639f76858a49fced1379225b0 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Sun, 14 Sep 2014 13:47:41 +0200 Subject: [PATCH] Implement debug wrappers to diagnose cases without LLVMDEV. --- core/meta/src/TCling.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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; -- 1.8.2